aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-01-17 10:29:06 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-17 10:29:06 -0500
commitea9b395fe20ac74be788f415af2622ac8f0c35c7 (patch)
treed1653e1a4cbe360aa7132ea4e29ab92a02038224 /include/linux
parent61420e147a706ee7c7a902008045547fb2a2a330 (diff)
parent1bc4ccfff8675adc3d96f91245eb7e2dc0043ca9 (diff)
Merge branch 'upstream'
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/aio.h12
-rw-r--r--include/linux/amba/bus.h55
-rw-r--r--include/linux/amba/clcd.h271
-rw-r--r--include/linux/amba/kmi.h92
-rw-r--r--include/linux/amba/serial.h161
-rw-r--r--include/linux/ata.h10
-rw-r--r--include/linux/atalk.h18
-rw-r--r--include/linux/auxvec.h2
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/bitops.h9
-rw-r--r--include/linux/blkdev.h118
-rw-r--r--include/linux/bootmem.h46
-rw-r--r--include/linux/buffer_head.h3
-rw-r--r--include/linux/byteorder/generic.h2
-rw-r--r--include/linux/byteorder/swab.h2
-rw-r--r--include/linux/byteorder/swabb.h2
-rw-r--r--include/linux/cache.h19
-rw-r--r--include/linux/calc64.h49
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/clk.h124
-rw-r--r--include/linux/compat_ioctl.h34
-rw-r--r--include/linux/compiler-gcc.h17
-rw-r--r--include/linux/compiler-gcc2.h29
-rw-r--r--include/linux/compiler-gcc3.h18
-rw-r--r--include/linux/compiler-gcc4.h18
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/configfs.h205
-rw-r--r--include/linux/cpufreq.h10
-rw-r--r--include/linux/cpuset.h46
-rw-r--r--include/linux/crypto.h5
-rw-r--r--include/linux/cycx_x25.h66
-rw-r--r--include/linux/dcache.h9
-rw-r--r--include/linux/dccp.h7
-rw-r--r--include/linux/device.h17
-rw-r--r--include/linux/dm-ioctl.h11
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/dvb/frontend.h10
-rw-r--r--include/linux/elevator.h5
-rw-r--r--include/linux/elf.h2
-rw-r--r--include/linux/etherdevice.h3
-rw-r--r--include/linux/ext3_fs_i.h2
-rw-r--r--include/linux/fb.h10
-rw-r--r--include/linux/filter.h2
-rw-r--r--include/linux/firmware.h2
-rw-r--r--include/linux/fs.h89
-rw-r--r--include/linux/fsl_devices.h6
-rw-r--r--include/linux/fuse.h24
-rw-r--r--include/linux/gfp.h5
-rw-r--r--include/linux/hardirq.h4
-rw-r--r--include/linux/hrtimer.h139
-rw-r--r--include/linux/hugetlb.h4
-rw-r--r--include/linux/hwmon-vid.h6
-rw-r--r--include/linux/i2c-id.h25
-rw-r--r--include/linux/i2c.h41
-rw-r--r--include/linux/i2o.h976
-rw-r--r--include/linux/ide.h12
-rw-r--r--include/linux/if_frad.h12
-rw-r--r--include/linux/if_pppox.h3
-rw-r--r--include/linux/inet.h2
-rw-r--r--include/linux/init.h12
-rw-r--r--include/linux/input.h79
-rw-r--r--include/linux/interrupt.h4
-rw-r--r--include/linux/ioc3.h93
-rw-r--r--include/linux/ip.h131
-rw-r--r--include/linux/ipv6.h83
-rw-r--r--include/linux/irq.h13
-rw-r--r--include/linux/isdnif.h70
-rw-r--r--include/linux/isicom.h59
-rw-r--r--include/linux/jbd.h8
-rw-r--r--include/linux/jffs2_fs_i.h4
-rw-r--r--include/linux/jiffies.h18
-rw-r--r--include/linux/kbd_kern.h2
-rw-r--r--include/linux/kernel.h17
-rw-r--r--include/linux/kexec.h5
-rw-r--r--include/linux/key.h20
-rw-r--r--include/linux/keyctl.h3
-rw-r--r--include/linux/kobject.h54
-rw-r--r--include/linux/kobject_uevent.h57
-rw-r--r--include/linux/kprobes.h6
-rw-r--r--include/linux/ktime.h284
-rw-r--r--include/linux/libata.h13
-rw-r--r--include/linux/list.h14
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/loop.h4
-rw-r--r--include/linux/memory.h8
-rw-r--r--include/linux/mempolicy.h95
-rw-r--r--include/linux/mm.h112
-rw-r--r--include/linux/mm_inline.h22
-rw-r--r--include/linux/mmc/card.h5
-rw-r--r--include/linux/mmc/mmc.h6
-rw-r--r--include/linux/mmzone.h52
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--include/linux/mount.h9
-rw-r--r--include/linux/msdos_fs.h3
-rw-r--r--include/linux/mutex-debug.h23
-rw-r--r--include/linux/mutex.h120
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/nbd.h8
-rw-r--r--include/linux/ncp.h126
-rw-r--r--include/linux/ncp_fs.h28
-rw-r--r--include/linux/net.h4
-rw-r--r--include/linux/netdevice.h11
-rw-r--r--include/linux/netfilter.h92
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h3
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h5
-rw-r--r--include/linux/netfilter/x_tables.h224
-rw-r--r--include/linux/netfilter/xt_CLASSIFY.h8
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h25
-rw-r--r--include/linux/netfilter/xt_MARK.h21
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h16
-rw-r--r--include/linux/netfilter/xt_comment.h10
-rw-r--r--include/linux/netfilter/xt_connbytes.h25
-rw-r--r--include/linux/netfilter/xt_connmark.h18
-rw-r--r--include/linux/netfilter/xt_conntrack.h63
-rw-r--r--include/linux/netfilter/xt_dccp.h23
-rw-r--r--include/linux/netfilter/xt_helper.h8
-rw-r--r--include/linux/netfilter/xt_length.h9
-rw-r--r--include/linux/netfilter/xt_limit.h21
-rw-r--r--include/linux/netfilter/xt_mac.h8
-rw-r--r--include/linux/netfilter/xt_mark.h9
-rw-r--r--include/linux/netfilter/xt_physdev.h24
-rw-r--r--include/linux/netfilter/xt_pkttype.h8
-rw-r--r--include/linux/netfilter/xt_realm.h10
-rw-r--r--include/linux/netfilter/xt_sctp.h107
-rw-r--r--include/linux/netfilter/xt_state.h13
-rw-r--r--include/linux/netfilter/xt_string.h18
-rw-r--r--include/linux/netfilter/xt_tcpmss.h9
-rw-r--r--include/linux/netfilter/xt_tcpudp.h36
-rw-r--r--include/linux/netfilter_arp/arp_tables.h123
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h7
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h217
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLASSIFY.h5
-rw-r--r--include/linux/netfilter_ipv4/ipt_CONNMARK.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_MARK.h22
-rw-r--r--include/linux/netfilter_ipv4/ipt_NFQUEUE.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_comment.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_connbytes.h31
-rw-r--r--include/linux/netfilter_ipv4/ipt_connmark.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_conntrack.h66
-rw-r--r--include/linux/netfilter_ipv4/ipt_dccp.h22
-rw-r--r--include/linux/netfilter_ipv4/ipt_helper.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_length.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_limit.h19
-rw-r--r--include/linux/netfilter_ipv4/ipt_mac.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_mark.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_physdev.h27
-rw-r--r--include/linux/netfilter_ipv4/ipt_pkttype.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h52
-rw-r--r--include/linux/netfilter_ipv4/ipt_realm.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_state.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_string.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_tcpmss.h6
-rw-r--r--include/linux/netfilter_ipv6.h5
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h214
-rw-r--r--include/linux/netfilter_ipv6/ip6t_MARK.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_length.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_limit.h21
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mac.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mark.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_physdev.h27
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h52
-rw-r--r--include/linux/nfs_fs.h65
-rw-r--r--include/linux/nfs_idmap.h2
-rw-r--r--include/linux/nfs_page.h12
-rw-r--r--include/linux/nfs_xdr.h89
-rw-r--r--include/linux/nfsd/nfsfh.h6
-rw-r--r--include/linux/nfsd/xdr.h3
-rw-r--r--include/linux/nfsd/xdr3.h1
-rw-r--r--include/linux/page-flags.h91
-rw-r--r--include/linux/pagevec.h5
-rw-r--r--include/linux/parport.h3
-rw-r--r--include/linux/parport_pc.h4
-rw-r--r--include/linux/pci.h69
-rw-r--r--include/linux/pci_ids.h51
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/percpu.h8
-rw-r--r--include/linux/pfkeyv2.h15
-rw-r--r--include/linux/phy.h3
-rw-r--r--include/linux/pipe_fs_i.h2
-rw-r--r--include/linux/pkt_sched.h7
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pmu.h8
-rw-r--r--include/linux/pnp.h9
-rw-r--r--include/linux/posix-timers.h90
-rw-r--r--include/linux/proc_fs.h5
-rw-r--r--include/linux/ptrace.h4
-rw-r--r--include/linux/radix-tree.h1
-rw-r--r--include/linux/raid/md.h4
-rw-r--r--include/linux/raid/md_k.h80
-rw-r--r--include/linux/raid/raid1.h14
-rw-r--r--include/linux/raid/raid10.h22
-rw-r--r--include/linux/raid/raid5.h7
-rw-r--r--include/linux/raid_class.h2
-rw-r--r--include/linux/ramfs.h10
-rw-r--r--include/linux/random.h6
-rw-r--r--include/linux/rcupdate.h37
-rw-r--r--include/linux/rcuref.h220
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/relayfs_fs.h65
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rmap.h1
-rw-r--r--include/linux/rtc.h3
-rw-r--r--include/linux/sched.h98
-rw-r--r--include/linux/screen_info.h76
-rw-r--r--include/linux/sdla.h64
-rw-r--r--include/linux/seccomp.h6
-rw-r--r--include/linux/security.h132
-rw-r--r--include/linux/serial_core.h6
-rw-r--r--include/linux/shmem_fs.h2
-rw-r--r--include/linux/signal.h30
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--include/linux/slab.h35
-rw-r--r--include/linux/smb_fs.h47
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/spi/ads7846.h18
-rw-r--r--include/linux/spi/flash.h31
-rw-r--r--include/linux/spi/spi.h668
-rw-r--r--include/linux/spi/spi_bitbang.h135
-rw-r--r--include/linux/spinlock.h3
-rw-r--r--include/linux/spinlock_types_up.h14
-rw-r--r--include/linux/sunrpc/clnt.h5
-rw-r--r--include/linux/sunrpc/gss_spkm3.h2
-rw-r--r--include/linux/sunrpc/sched.h48
-rw-r--r--include/linux/sunrpc/xdr.h6
-rw-r--r--include/linux/sunrpc/xprt.h12
-rw-r--r--include/linux/suspend.h8
-rw-r--r--include/linux/swap.h16
-rw-r--r--include/linux/synclink.h9
-rw-r--r--include/linux/syscalls.h7
-rw-r--r--include/linux/sysctl.h5
-rw-r--r--include/linux/tcp.h21
-rw-r--r--include/linux/time.h186
-rw-r--r--include/linux/timer.h2
-rw-r--r--include/linux/tipc.h212
-rw-r--r--include/linux/tipc_config.h407
-rw-r--r--include/linux/topology.h2
-rw-r--r--include/linux/tty.h97
-rw-r--r--include/linux/tty_flip.h20
-rw-r--r--include/linux/tty_ldisc.h9
-rw-r--r--include/linux/udf_fs.h5
-rw-r--r--include/linux/udf_fs_i.h5
-rw-r--r--include/linux/udf_fs_sb.h5
-rw-r--r--include/linux/udp.h6
-rw-r--r--include/linux/usb.h35
-rw-r--r--include/linux/usb_usual.h126
-rw-r--r--include/linux/video_decoder.h2
-rw-r--r--include/linux/videodev2.h16
-rw-r--r--include/linux/wavefront.h36
-rw-r--r--include/linux/workqueue.h1
-rw-r--r--include/linux/writeback.h19
-rw-r--r--include/linux/xattr.h19
-rw-r--r--include/linux/xfrm.h29
-rw-r--r--include/linux/zlib.h11
254 files changed, 7206 insertions, 3051 deletions
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 49fd37629ee4..00c8efa95cc3 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -94,26 +94,27 @@ struct kiocb {
94 ssize_t (*ki_retry)(struct kiocb *); 94 ssize_t (*ki_retry)(struct kiocb *);
95 void (*ki_dtor)(struct kiocb *); 95 void (*ki_dtor)(struct kiocb *);
96 96
97 struct list_head ki_list; /* the aio core uses this
98 * for cancellation */
99
100 union { 97 union {
101 void __user *user; 98 void __user *user;
102 struct task_struct *tsk; 99 struct task_struct *tsk;
103 } ki_obj; 100 } ki_obj;
101
104 __u64 ki_user_data; /* user's data for completion */ 102 __u64 ki_user_data; /* user's data for completion */
103 wait_queue_t ki_wait;
105 loff_t ki_pos; 104 loff_t ki_pos;
105
106 void *private;
106 /* State that we remember to be able to restart/retry */ 107 /* State that we remember to be able to restart/retry */
107 unsigned short ki_opcode; 108 unsigned short ki_opcode;
108 size_t ki_nbytes; /* copy of iocb->aio_nbytes */ 109 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
109 char __user *ki_buf; /* remaining iocb->aio_buf */ 110 char __user *ki_buf; /* remaining iocb->aio_buf */
110 size_t ki_left; /* remaining bytes */ 111 size_t ki_left; /* remaining bytes */
111 wait_queue_t ki_wait;
112 long ki_retried; /* just for testing */ 112 long ki_retried; /* just for testing */
113 long ki_kicked; /* just for testing */ 113 long ki_kicked; /* just for testing */
114 long ki_queued; /* just for testing */ 114 long ki_queued; /* just for testing */
115 115
116 void *private; 116 struct list_head ki_list; /* the aio core uses this
117 * for cancellation */
117}; 118};
118 119
119#define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY) 120#define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY)
@@ -126,6 +127,7 @@ struct kiocb {
126 (x)->ki_filp = (filp); \ 127 (x)->ki_filp = (filp); \
127 (x)->ki_ctx = NULL; \ 128 (x)->ki_ctx = NULL; \
128 (x)->ki_cancel = NULL; \ 129 (x)->ki_cancel = NULL; \
130 (x)->ki_retry = NULL; \
129 (x)->ki_dtor = NULL; \ 131 (x)->ki_dtor = NULL; \
130 (x)->ki_obj.tsk = tsk; \ 132 (x)->ki_obj.tsk = tsk; \
131 (x)->ki_user_data = 0; \ 133 (x)->ki_user_data = 0; \
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
new file mode 100644
index 000000000000..51e6e54b2aa1
--- /dev/null
+++ b/include/linux/amba/bus.h
@@ -0,0 +1,55 @@
1/*
2 * linux/include/asm-arm/hardware/amba.h
3 *
4 * Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef ASMARM_AMBA_H
11#define ASMARM_AMBA_H
12
13#define AMBA_NR_IRQS 2
14
15struct amba_device {
16 struct device dev;
17 struct resource res;
18 u64 dma_mask;
19 unsigned int periphid;
20 unsigned int irq[AMBA_NR_IRQS];
21};
22
23struct amba_id {
24 unsigned int id;
25 unsigned int mask;
26 void *data;
27};
28
29struct amba_driver {
30 struct device_driver drv;
31 int (*probe)(struct amba_device *, void *);
32 int (*remove)(struct amba_device *);
33 void (*shutdown)(struct amba_device *);
34 int (*suspend)(struct amba_device *, pm_message_t);
35 int (*resume)(struct amba_device *);
36 struct amba_id *id_table;
37};
38
39#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
40#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
41
42int amba_driver_register(struct amba_driver *);
43void amba_driver_unregister(struct amba_driver *);
44int amba_device_register(struct amba_device *, struct resource *);
45void amba_device_unregister(struct amba_device *);
46struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
47int amba_request_regions(struct amba_device *, const char *);
48void amba_release_regions(struct amba_device *);
49
50#define amba_config(d) (((d)->periphid >> 24) & 0xff)
51#define amba_rev(d) (((d)->periphid >> 20) & 0x0f)
52#define amba_manf(d) (((d)->periphid >> 12) & 0xff)
53#define amba_part(d) ((d)->periphid & 0xfff)
54
55#endif
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
new file mode 100644
index 000000000000..6b8d73dc1ab0
--- /dev/null
+++ b/include/linux/amba/clcd.h
@@ -0,0 +1,271 @@
1/*
2 * linux/include/asm-arm/hardware/amba_clcd.h -- Integrator LCD panel.
3 *
4 * David A Rusling
5 *
6 * Copyright (C) 2001 ARM Limited
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive
10 * for more details.
11 */
12#include <linux/config.h>
13#include <linux/fb.h>
14
15/*
16 * CLCD Controller Internal Register addresses
17 */
18#define CLCD_TIM0 0x00000000
19#define CLCD_TIM1 0x00000004
20#define CLCD_TIM2 0x00000008
21#define CLCD_TIM3 0x0000000c
22#define CLCD_UBAS 0x00000010
23#define CLCD_LBAS 0x00000014
24
25#if !defined(CONFIG_ARCH_VERSATILE) && !defined(CONFIG_ARCH_REALVIEW)
26#define CLCD_IENB 0x00000018
27#define CLCD_CNTL 0x0000001c
28#else
29/*
30 * Someone rearranged these two registers on the Versatile
31 * platform...
32 */
33#define CLCD_IENB 0x0000001c
34#define CLCD_CNTL 0x00000018
35#endif
36
37#define CLCD_STAT 0x00000020
38#define CLCD_INTR 0x00000024
39#define CLCD_UCUR 0x00000028
40#define CLCD_LCUR 0x0000002C
41#define CLCD_PALL 0x00000200
42#define CLCD_PALETTE 0x00000200
43
44#define TIM2_CLKSEL (1 << 5)
45#define TIM2_IVS (1 << 11)
46#define TIM2_IHS (1 << 12)
47#define TIM2_IPC (1 << 13)
48#define TIM2_IOE (1 << 14)
49#define TIM2_BCD (1 << 26)
50
51#define CNTL_LCDEN (1 << 0)
52#define CNTL_LCDBPP1 (0 << 1)
53#define CNTL_LCDBPP2 (1 << 1)
54#define CNTL_LCDBPP4 (2 << 1)
55#define CNTL_LCDBPP8 (3 << 1)
56#define CNTL_LCDBPP16 (4 << 1)
57#define CNTL_LCDBPP24 (5 << 1)
58#define CNTL_LCDBW (1 << 4)
59#define CNTL_LCDTFT (1 << 5)
60#define CNTL_LCDMONO8 (1 << 6)
61#define CNTL_LCDDUAL (1 << 7)
62#define CNTL_BGR (1 << 8)
63#define CNTL_BEBO (1 << 9)
64#define CNTL_BEPO (1 << 10)
65#define CNTL_LCDPWR (1 << 11)
66#define CNTL_LCDVCOMP(x) ((x) << 12)
67#define CNTL_LDMAFIFOTIME (1 << 15)
68#define CNTL_WATERMARK (1 << 16)
69
70struct clcd_panel {
71 struct fb_videomode mode;
72 signed short width; /* width in mm */
73 signed short height; /* height in mm */
74 u32 tim2;
75 u32 tim3;
76 u32 cntl;
77 unsigned int bpp:8,
78 fixedtimings:1,
79 grayscale:1;
80 unsigned int connector;
81};
82
83struct clcd_regs {
84 u32 tim0;
85 u32 tim1;
86 u32 tim2;
87 u32 tim3;
88 u32 cntl;
89 unsigned long pixclock;
90};
91
92struct clcd_fb;
93
94/*
95 * the board-type specific routines
96 */
97struct clcd_board {
98 const char *name;
99
100 /*
101 * Optional. Check whether the var structure is acceptable
102 * for this display.
103 */
104 int (*check)(struct clcd_fb *fb, struct fb_var_screeninfo *var);
105
106 /*
107 * Compulsary. Decode fb->fb.var into regs->*. In the case of
108 * fixed timing, set regs->* to the register values required.
109 */
110 void (*decode)(struct clcd_fb *fb, struct clcd_regs *regs);
111
112 /*
113 * Optional. Disable any extra display hardware.
114 */
115 void (*disable)(struct clcd_fb *);
116
117 /*
118 * Optional. Enable any extra display hardware.
119 */
120 void (*enable)(struct clcd_fb *);
121
122 /*
123 * Setup platform specific parts of CLCD driver
124 */
125 int (*setup)(struct clcd_fb *);
126
127 /*
128 * mmap the framebuffer memory
129 */
130 int (*mmap)(struct clcd_fb *, struct vm_area_struct *);
131
132 /*
133 * Remove platform specific parts of CLCD driver
134 */
135 void (*remove)(struct clcd_fb *);
136};
137
138struct amba_device;
139struct clk;
140
141/* this data structure describes each frame buffer device we find */
142struct clcd_fb {
143 struct fb_info fb;
144 struct amba_device *dev;
145 struct clk *clk;
146 struct clcd_panel *panel;
147 struct clcd_board *board;
148 void *board_data;
149 void __iomem *regs;
150 u32 clcd_cntl;
151 u32 cmap[16];
152};
153
154static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
155{
156 u32 val, cpl;
157
158 /*
159 * Program the CLCD controller registers and start the CLCD
160 */
161 val = ((fb->fb.var.xres / 16) - 1) << 2;
162 val |= (fb->fb.var.hsync_len - 1) << 8;
163 val |= (fb->fb.var.right_margin - 1) << 16;
164 val |= (fb->fb.var.left_margin - 1) << 24;
165 regs->tim0 = val;
166
167 val = fb->fb.var.yres;
168 if (fb->panel->cntl & CNTL_LCDDUAL)
169 val /= 2;
170 val -= 1;
171 val |= (fb->fb.var.vsync_len - 1) << 10;
172 val |= fb->fb.var.lower_margin << 16;
173 val |= fb->fb.var.upper_margin << 24;
174 regs->tim1 = val;
175
176 val = fb->panel->tim2;
177 val |= fb->fb.var.sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;
178 val |= fb->fb.var.sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;
179
180 cpl = fb->fb.var.xres_virtual;
181 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */
182 /* / 1 */;
183 else if (!fb->fb.var.grayscale) /* STN color */
184 cpl = cpl * 8 / 3;
185 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */
186 cpl /= 8;
187 else /* STN monochrome, 4bit */
188 cpl /= 4;
189
190 regs->tim2 = val | ((cpl - 1) << 16);
191
192 regs->tim3 = fb->panel->tim3;
193
194 val = fb->panel->cntl;
195 if (fb->fb.var.grayscale)
196 val |= CNTL_LCDBW;
197
198 switch (fb->fb.var.bits_per_pixel) {
199 case 1:
200 val |= CNTL_LCDBPP1;
201 break;
202 case 2:
203 val |= CNTL_LCDBPP2;
204 break;
205 case 4:
206 val |= CNTL_LCDBPP4;
207 break;
208 case 8:
209 val |= CNTL_LCDBPP8;
210 break;
211 case 16:
212 val |= CNTL_LCDBPP16;
213 break;
214 case 32:
215 val |= CNTL_LCDBPP24;
216 break;
217 }
218
219 regs->cntl = val;
220 regs->pixclock = fb->fb.var.pixclock;
221}
222
223static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
224{
225 var->xres_virtual = var->xres = (var->xres + 15) & ~15;
226 var->yres_virtual = var->yres = (var->yres + 1) & ~1;
227
228#define CHECK(e,l,h) (var->e < l || var->e > h)
229 if (CHECK(right_margin, (5+1), 256) || /* back porch */
230 CHECK(left_margin, (5+1), 256) || /* front porch */
231 CHECK(hsync_len, (5+1), 256) ||
232 var->xres > 4096 ||
233 var->lower_margin > 255 || /* back porch */
234 var->upper_margin > 255 || /* front porch */
235 var->vsync_len > 32 ||
236 var->yres > 1024)
237 return -EINVAL;
238#undef CHECK
239
240 /* single panel mode: PCD = max(PCD, 1) */
241 /* dual panel mode: PCD = max(PCD, 5) */
242
243 /*
244 * You can't change the grayscale setting, and
245 * we can only do non-interlaced video.
246 */
247 if (var->grayscale != fb->fb.var.grayscale ||
248 (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED)
249 return -EINVAL;
250
251#define CHECK(e) (var->e != fb->fb.var.e)
252 if (fb->panel->fixedtimings &&
253 (CHECK(xres) ||
254 CHECK(yres) ||
255 CHECK(bits_per_pixel) ||
256 CHECK(pixclock) ||
257 CHECK(left_margin) ||
258 CHECK(right_margin) ||
259 CHECK(upper_margin) ||
260 CHECK(lower_margin) ||
261 CHECK(hsync_len) ||
262 CHECK(vsync_len) ||
263 CHECK(sync)))
264 return -EINVAL;
265#undef CHECK
266
267 var->nonstd = 0;
268 var->accel_flags = 0;
269
270 return 0;
271}
diff --git a/include/linux/amba/kmi.h b/include/linux/amba/kmi.h
new file mode 100644
index 000000000000..a39e5be751b3
--- /dev/null
+++ b/include/linux/amba/kmi.h
@@ -0,0 +1,92 @@
1/*
2 * linux/include/asm-arm/hardware/amba_kmi.h
3 *
4 * Internal header file for AMBA KMI ports
5 *
6 * Copyright (C) 2000 Deep Blue Solutions Ltd.
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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU 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 * ---------------------------------------------------------------------------
24 * From ARM PrimeCell(tm) PS2 Keyboard/Mouse Interface (PL050) Technical
25 * Reference Manual - ARM DDI 0143B - see http://www.arm.com/
26 * ---------------------------------------------------------------------------
27 */
28#ifndef ASM_ARM_HARDWARE_AMBA_KMI_H
29#define ASM_ARM_HARDWARE_AMBA_KMI_H
30
31/*
32 * KMI control register:
33 * KMICR_TYPE 0 = PS2/AT mode, 1 = No line control bit mode
34 * KMICR_RXINTREN 1 = enable RX interrupts
35 * KMICR_TXINTREN 1 = enable TX interrupts
36 * KMICR_EN 1 = enable KMI
37 * KMICR_FD 1 = force KMI data low
38 * KMICR_FC 1 = force KMI clock low
39 */
40#define KMICR (KMI_BASE + 0x00)
41#define KMICR_TYPE (1 << 5)
42#define KMICR_RXINTREN (1 << 4)
43#define KMICR_TXINTREN (1 << 3)
44#define KMICR_EN (1 << 2)
45#define KMICR_FD (1 << 1)
46#define KMICR_FC (1 << 0)
47
48/*
49 * KMI status register:
50 * KMISTAT_TXEMPTY 1 = transmitter register empty
51 * KMISTAT_TXBUSY 1 = currently sending data
52 * KMISTAT_RXFULL 1 = receiver register ready to be read
53 * KMISTAT_RXBUSY 1 = currently receiving data
54 * KMISTAT_RXPARITY parity of last databyte received
55 * KMISTAT_IC current level of KMI clock input
56 * KMISTAT_ID current level of KMI data input
57 */
58#define KMISTAT (KMI_BASE + 0x04)
59#define KMISTAT_TXEMPTY (1 << 6)
60#define KMISTAT_TXBUSY (1 << 5)
61#define KMISTAT_RXFULL (1 << 4)
62#define KMISTAT_RXBUSY (1 << 3)
63#define KMISTAT_RXPARITY (1 << 2)
64#define KMISTAT_IC (1 << 1)
65#define KMISTAT_ID (1 << 0)
66
67/*
68 * KMI data register
69 */
70#define KMIDATA (KMI_BASE + 0x08)
71
72/*
73 * KMI clock divisor: to generate 8MHz internal clock
74 * div = (ref / 8MHz) - 1; 0 <= div <= 15
75 */
76#define KMICLKDIV (KMI_BASE + 0x0c)
77
78/*
79 * KMI interrupt register:
80 * KMIIR_TXINTR 1 = transmit interrupt asserted
81 * KMIIR_RXINTR 1 = receive interrupt asserted
82 */
83#define KMIIR (KMI_BASE + 0x10)
84#define KMIIR_TXINTR (1 << 1)
85#define KMIIR_RXINTR (1 << 0)
86
87/*
88 * The size of the KMI primecell
89 */
90#define KMI_SIZE (0x100)
91
92#endif
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
new file mode 100644
index 000000000000..dc726ffccebd
--- /dev/null
+++ b/include/linux/amba/serial.h
@@ -0,0 +1,161 @@
1/*
2 * linux/include/asm-arm/hardware/serial_amba.h
3 *
4 * Internal header file for AMBA serial ports
5 *
6 * Copyright (C) ARM Limited
7 * Copyright (C) 2000 Deep Blue Solutions Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H
24#define ASM_ARM_HARDWARE_SERIAL_AMBA_H
25
26/* -------------------------------------------------------------------------------
27 * From AMBA UART (PL010) Block Specification
28 * -------------------------------------------------------------------------------
29 * UART Register Offsets.
30 */
31#define UART01x_DR 0x00 /* Data read or written from the interface. */
32#define UART01x_RSR 0x04 /* Receive status register (Read). */
33#define UART01x_ECR 0x04 /* Error clear register (Write). */
34#define UART010_LCRH 0x08 /* Line control register, high byte. */
35#define UART010_LCRM 0x0C /* Line control register, middle byte. */
36#define UART010_LCRL 0x10 /* Line control register, low byte. */
37#define UART010_CR 0x14 /* Control register. */
38#define UART01x_FR 0x18 /* Flag register (Read only). */
39#define UART010_IIR 0x1C /* Interrupt indentification register (Read). */
40#define UART010_ICR 0x1C /* Interrupt clear register (Write). */
41#define UART01x_ILPR 0x20 /* IrDA low power counter register. */
42#define UART011_IBRD 0x24 /* Integer baud rate divisor register. */
43#define UART011_FBRD 0x28 /* Fractional baud rate divisor register. */
44#define UART011_LCRH 0x2c /* Line control register. */
45#define UART011_CR 0x30 /* Control register. */
46#define UART011_IFLS 0x34 /* Interrupt fifo level select. */
47#define UART011_IMSC 0x38 /* Interrupt mask. */
48#define UART011_RIS 0x3c /* Raw interrupt status. */
49#define UART011_MIS 0x40 /* Masked interrupt status. */
50#define UART011_ICR 0x44 /* Interrupt clear register. */
51#define UART011_DMACR 0x48 /* DMA control register. */
52
53#define UART011_DR_OE (1 << 11)
54#define UART011_DR_BE (1 << 10)
55#define UART011_DR_PE (1 << 9)
56#define UART011_DR_FE (1 << 8)
57
58#define UART01x_RSR_OE 0x08
59#define UART01x_RSR_BE 0x04
60#define UART01x_RSR_PE 0x02
61#define UART01x_RSR_FE 0x01
62
63#define UART011_FR_RI 0x100
64#define UART011_FR_TXFE 0x080
65#define UART011_FR_RXFF 0x040
66#define UART01x_FR_TXFF 0x020
67#define UART01x_FR_RXFE 0x010
68#define UART01x_FR_BUSY 0x008
69#define UART01x_FR_DCD 0x004
70#define UART01x_FR_DSR 0x002
71#define UART01x_FR_CTS 0x001
72#define UART01x_FR_TMSK (UART01x_FR_TXFF + UART01x_FR_BUSY)
73
74#define UART011_CR_CTSEN 0x8000 /* CTS hardware flow control */
75#define UART011_CR_RTSEN 0x4000 /* RTS hardware flow control */
76#define UART011_CR_OUT2 0x2000 /* OUT2 */
77#define UART011_CR_OUT1 0x1000 /* OUT1 */
78#define UART011_CR_RTS 0x0800 /* RTS */
79#define UART011_CR_DTR 0x0400 /* DTR */
80#define UART011_CR_RXE 0x0200 /* receive enable */
81#define UART011_CR_TXE 0x0100 /* transmit enable */
82#define UART011_CR_LBE 0x0080 /* loopback enable */
83#define UART010_CR_RTIE 0x0040
84#define UART010_CR_TIE 0x0020
85#define UART010_CR_RIE 0x0010
86#define UART010_CR_MSIE 0x0008
87#define UART01x_CR_IIRLP 0x0004 /* SIR low power mode */
88#define UART01x_CR_SIREN 0x0002 /* SIR enable */
89#define UART01x_CR_UARTEN 0x0001 /* UART enable */
90
91#define UART011_LCRH_SPS 0x80
92#define UART01x_LCRH_WLEN_8 0x60
93#define UART01x_LCRH_WLEN_7 0x40
94#define UART01x_LCRH_WLEN_6 0x20
95#define UART01x_LCRH_WLEN_5 0x00
96#define UART01x_LCRH_FEN 0x10
97#define UART01x_LCRH_STP2 0x08
98#define UART01x_LCRH_EPS 0x04
99#define UART01x_LCRH_PEN 0x02
100#define UART01x_LCRH_BRK 0x01
101
102#define UART010_IIR_RTIS 0x08
103#define UART010_IIR_TIS 0x04
104#define UART010_IIR_RIS 0x02
105#define UART010_IIR_MIS 0x01
106
107#define UART011_IFLS_RX1_8 (0 << 3)
108#define UART011_IFLS_RX2_8 (1 << 3)
109#define UART011_IFLS_RX4_8 (2 << 3)
110#define UART011_IFLS_RX6_8 (3 << 3)
111#define UART011_IFLS_RX7_8 (4 << 3)
112#define UART011_IFLS_TX1_8 (0 << 0)
113#define UART011_IFLS_TX2_8 (1 << 0)
114#define UART011_IFLS_TX4_8 (2 << 0)
115#define UART011_IFLS_TX6_8 (3 << 0)
116#define UART011_IFLS_TX7_8 (4 << 0)
117
118#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */
119#define UART011_BEIM (1 << 9) /* break error interrupt mask */
120#define UART011_PEIM (1 << 8) /* parity error interrupt mask */
121#define UART011_FEIM (1 << 7) /* framing error interrupt mask */
122#define UART011_RTIM (1 << 6) /* receive timeout interrupt mask */
123#define UART011_TXIM (1 << 5) /* transmit interrupt mask */
124#define UART011_RXIM (1 << 4) /* receive interrupt mask */
125#define UART011_DSRMIM (1 << 3) /* DSR interrupt mask */
126#define UART011_DCDMIM (1 << 2) /* DCD interrupt mask */
127#define UART011_CTSMIM (1 << 1) /* CTS interrupt mask */
128#define UART011_RIMIM (1 << 0) /* RI interrupt mask */
129
130#define UART011_OEIS (1 << 10) /* overrun error interrupt status */
131#define UART011_BEIS (1 << 9) /* break error interrupt status */
132#define UART011_PEIS (1 << 8) /* parity error interrupt status */
133#define UART011_FEIS (1 << 7) /* framing error interrupt status */
134#define UART011_RTIS (1 << 6) /* receive timeout interrupt status */
135#define UART011_TXIS (1 << 5) /* transmit interrupt status */
136#define UART011_RXIS (1 << 4) /* receive interrupt status */
137#define UART011_DSRMIS (1 << 3) /* DSR interrupt status */
138#define UART011_DCDMIS (1 << 2) /* DCD interrupt status */
139#define UART011_CTSMIS (1 << 1) /* CTS interrupt status */
140#define UART011_RIMIS (1 << 0) /* RI interrupt status */
141
142#define UART011_OEIC (1 << 10) /* overrun error interrupt clear */
143#define UART011_BEIC (1 << 9) /* break error interrupt clear */
144#define UART011_PEIC (1 << 8) /* parity error interrupt clear */
145#define UART011_FEIC (1 << 7) /* framing error interrupt clear */
146#define UART011_RTIC (1 << 6) /* receive timeout interrupt clear */
147#define UART011_TXIC (1 << 5) /* transmit interrupt clear */
148#define UART011_RXIC (1 << 4) /* receive interrupt clear */
149#define UART011_DSRMIC (1 << 3) /* DSR interrupt clear */
150#define UART011_DCDMIC (1 << 2) /* DCD interrupt clear */
151#define UART011_CTSMIC (1 << 1) /* CTS interrupt clear */
152#define UART011_RIMIC (1 << 0) /* RI interrupt clear */
153
154#define UART011_DMAONERR (1 << 2) /* disable dma on error */
155#define UART011_TXDMAE (1 << 1) /* enable transmit dma */
156#define UART011_RXDMAE (1 << 0) /* enable receive dma */
157
158#define UART01x_RSR_ANY (UART01x_RSR_OE|UART01x_RSR_BE|UART01x_RSR_PE|UART01x_RSR_FE)
159#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD|UART01x_FR_DSR|UART01x_FR_CTS)
160
161#endif
diff --git a/include/linux/ata.h b/include/linux/ata.h
index f512104a1a3f..29fa99bde2be 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -129,6 +129,7 @@ enum {
129 ATA_CMD_READ_EXT = 0x25, 129 ATA_CMD_READ_EXT = 0x25,
130 ATA_CMD_WRITE = 0xCA, 130 ATA_CMD_WRITE = 0xCA,
131 ATA_CMD_WRITE_EXT = 0x35, 131 ATA_CMD_WRITE_EXT = 0x35,
132 ATA_CMD_WRITE_FUA_EXT = 0x3D,
132 ATA_CMD_PIO_READ = 0x20, 133 ATA_CMD_PIO_READ = 0x20,
133 ATA_CMD_PIO_READ_EXT = 0x24, 134 ATA_CMD_PIO_READ_EXT = 0x24,
134 ATA_CMD_PIO_WRITE = 0x30, 135 ATA_CMD_PIO_WRITE = 0x30,
@@ -137,10 +138,13 @@ enum {
137 ATA_CMD_READ_MULTI_EXT = 0x29, 138 ATA_CMD_READ_MULTI_EXT = 0x29,
138 ATA_CMD_WRITE_MULTI = 0xC5, 139 ATA_CMD_WRITE_MULTI = 0xC5,
139 ATA_CMD_WRITE_MULTI_EXT = 0x39, 140 ATA_CMD_WRITE_MULTI_EXT = 0x39,
141 ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE,
140 ATA_CMD_SET_FEATURES = 0xEF, 142 ATA_CMD_SET_FEATURES = 0xEF,
141 ATA_CMD_PACKET = 0xA0, 143 ATA_CMD_PACKET = 0xA0,
142 ATA_CMD_VERIFY = 0x40, 144 ATA_CMD_VERIFY = 0x40,
143 ATA_CMD_VERIFY_EXT = 0x42, 145 ATA_CMD_VERIFY_EXT = 0x42,
146 ATA_CMD_STANDBYNOW1 = 0xE0,
147 ATA_CMD_IDLEIMMEDIATE = 0xE1,
144 ATA_CMD_INIT_DEV_PARAMS = 0x91, 148 ATA_CMD_INIT_DEV_PARAMS = 0x91,
145 149
146 /* SETFEATURES stuff */ 150 /* SETFEATURES stuff */
@@ -192,7 +196,8 @@ enum {
192 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ 196 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
193 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ 197 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
194 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ 198 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
195 ATA_TFLAG_POLLING = (1 << 5), /* set nIEN to 1 and use polling */ 199 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
200 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
196}; 201};
197 202
198enum ata_tf_protocols { 203enum ata_tf_protocols {
@@ -246,7 +251,8 @@ struct ata_taskfile {
246#define ata_id_is_sata(id) ((id)[93] == 0) 251#define ata_id_is_sata(id) ((id)[93] == 0)
247#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 252#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
248#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 253#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
249#define ata_id_has_flush(id) ((id)[83] & (1 << 12)) 254#define ata_id_has_fua(id) ((id)[84] & (1 << 6))
255#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
250#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13)) 256#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
251#define ata_id_has_lba48(id) ((id)[83] & (1 << 10)) 257#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
252#define ata_id_has_wcache(id) ((id)[82] & (1 << 5)) 258#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index 911c09cb9bf9..6ba3aa8a81f4 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -155,15 +155,15 @@ struct elapaarp {
155#define AARP_REQUEST 1 155#define AARP_REQUEST 1
156#define AARP_REPLY 2 156#define AARP_REPLY 2
157#define AARP_PROBE 3 157#define AARP_PROBE 3
158 __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); 158 __u8 hw_src[ETH_ALEN];
159 __u8 pa_src_zero __attribute__ ((packed)); 159 __u8 pa_src_zero;
160 __be16 pa_src_net __attribute__ ((packed)); 160 __be16 pa_src_net;
161 __u8 pa_src_node __attribute__ ((packed)); 161 __u8 pa_src_node;
162 __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); 162 __u8 hw_dst[ETH_ALEN];
163 __u8 pa_dst_zero __attribute__ ((packed)); 163 __u8 pa_dst_zero;
164 __be16 pa_dst_net __attribute__ ((packed)); 164 __be16 pa_dst_net;
165 __u8 pa_dst_node __attribute__ ((packed)); 165 __u8 pa_dst_node;
166}; 166} __attribute__ ((packed));
167 167
168static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) 168static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
169{ 169{
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h
index 9a7b374c9fb4..d2bc0d66e65d 100644
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -26,6 +26,6 @@
26 26
27#define AT_SECURE 23 /* secure mode boolean */ 27#define AT_SECURE 23 /* secure mode boolean */
28 28
29#define AT_VECTOR_SIZE 42 /* Size of auxiliary table. */ 29#define AT_VECTOR_SIZE 44 /* Size of auxiliary table. */
30 30
31#endif /* _LINUX_AUXVEC_H */ 31#endif /* _LINUX_AUXVEC_H */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 685fd3720df5..b60ffe32cd21 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -292,6 +292,8 @@ extern struct bio *bio_clone(struct bio *, gfp_t);
292extern void bio_init(struct bio *); 292extern void bio_init(struct bio *);
293 293
294extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); 294extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
295extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
296 unsigned int, unsigned int);
295extern int bio_get_nr_vecs(struct block_device *); 297extern int bio_get_nr_vecs(struct block_device *);
296extern struct bio *bio_map_user(struct request_queue *, struct block_device *, 298extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
297 unsigned long, unsigned int, int); 299 unsigned long, unsigned int, int);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 38c2fb7ebe09..6a2a19f14bb2 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -76,6 +76,15 @@ static __inline__ int generic_fls(int x)
76 */ 76 */
77#include <asm/bitops.h> 77#include <asm/bitops.h>
78 78
79
80static inline int generic_fls64(__u64 x)
81{
82 __u32 h = x >> 32;
83 if (h)
84 return fls(x) + 32;
85 return fls(x);
86}
87
79static __inline__ int get_bitmask_order(unsigned int count) 88static __inline__ int get_bitmask_order(unsigned int count)
80{ 89{
81 int order; 90 int order;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a33a31e71bbc..02a585faa62c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -102,7 +102,7 @@ void copy_io_context(struct io_context **pdst, struct io_context **psrc);
102void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); 102void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
103 103
104struct request; 104struct request;
105typedef void (rq_end_io_fn)(struct request *); 105typedef void (rq_end_io_fn)(struct request *, int);
106 106
107struct request_list { 107struct request_list {
108 int count[2]; 108 int count[2];
@@ -118,9 +118,9 @@ struct request_list {
118 * try to put the fields that are referenced together in the same cacheline 118 * try to put the fields that are referenced together in the same cacheline
119 */ 119 */
120struct request { 120struct request {
121 struct list_head queuelist; /* looking for ->queue? you must _not_ 121 struct list_head queuelist;
122 * access it directly, use 122 struct list_head donelist;
123 * blkdev_dequeue_request! */ 123
124 unsigned long flags; /* see REQ_ bits below */ 124 unsigned long flags; /* see REQ_ bits below */
125 125
126 /* Maintain bio traversal state for part by part I/O submission. 126 /* Maintain bio traversal state for part by part I/O submission.
@@ -141,6 +141,7 @@ struct request {
141 struct bio *biotail; 141 struct bio *biotail;
142 142
143 void *elevator_private; 143 void *elevator_private;
144 void *completion_data;
144 145
145 unsigned short ioprio; 146 unsigned short ioprio;
146 147
@@ -184,6 +185,7 @@ struct request {
184 void *sense; 185 void *sense;
185 186
186 unsigned int timeout; 187 unsigned int timeout;
188 int retries;
187 189
188 /* 190 /*
189 * For Power Management requests 191 * For Power Management requests
@@ -206,6 +208,7 @@ enum rq_flag_bits {
206 __REQ_SORTED, /* elevator knows about this request */ 208 __REQ_SORTED, /* elevator knows about this request */
207 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 209 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
208 __REQ_HARDBARRIER, /* may not be passed by drive either */ 210 __REQ_HARDBARRIER, /* may not be passed by drive either */
211 __REQ_FUA, /* forced unit access */
209 __REQ_CMD, /* is a regular fs rw request */ 212 __REQ_CMD, /* is a regular fs rw request */
210 __REQ_NOMERGE, /* don't touch this for merging */ 213 __REQ_NOMERGE, /* don't touch this for merging */
211 __REQ_STARTED, /* drive already may have started this one */ 214 __REQ_STARTED, /* drive already may have started this one */
@@ -229,9 +232,7 @@ enum rq_flag_bits {
229 __REQ_PM_SUSPEND, /* suspend request */ 232 __REQ_PM_SUSPEND, /* suspend request */
230 __REQ_PM_RESUME, /* resume request */ 233 __REQ_PM_RESUME, /* resume request */
231 __REQ_PM_SHUTDOWN, /* shutdown request */ 234 __REQ_PM_SHUTDOWN, /* shutdown request */
232 __REQ_BAR_PREFLUSH, /* barrier pre-flush done */ 235 __REQ_ORDERED_COLOR, /* is before or after barrier */
233 __REQ_BAR_POSTFLUSH, /* barrier post-flush */
234 __REQ_BAR_FLUSH, /* rq is the flush request */
235 __REQ_NR_BITS, /* stops here */ 236 __REQ_NR_BITS, /* stops here */
236}; 237};
237 238
@@ -240,6 +241,7 @@ enum rq_flag_bits {
240#define REQ_SORTED (1 << __REQ_SORTED) 241#define REQ_SORTED (1 << __REQ_SORTED)
241#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) 242#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
242#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) 243#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
244#define REQ_FUA (1 << __REQ_FUA)
243#define REQ_CMD (1 << __REQ_CMD) 245#define REQ_CMD (1 << __REQ_CMD)
244#define REQ_NOMERGE (1 << __REQ_NOMERGE) 246#define REQ_NOMERGE (1 << __REQ_NOMERGE)
245#define REQ_STARTED (1 << __REQ_STARTED) 247#define REQ_STARTED (1 << __REQ_STARTED)
@@ -259,9 +261,7 @@ enum rq_flag_bits {
259#define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND) 261#define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND)
260#define REQ_PM_RESUME (1 << __REQ_PM_RESUME) 262#define REQ_PM_RESUME (1 << __REQ_PM_RESUME)
261#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN) 263#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN)
262#define REQ_BAR_PREFLUSH (1 << __REQ_BAR_PREFLUSH) 264#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
263#define REQ_BAR_POSTFLUSH (1 << __REQ_BAR_POSTFLUSH)
264#define REQ_BAR_FLUSH (1 << __REQ_BAR_FLUSH)
265 265
266/* 266/*
267 * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME 267 * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME
@@ -291,8 +291,8 @@ struct bio_vec;
291typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *); 291typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
292typedef void (activity_fn) (void *data, int rw); 292typedef void (activity_fn) (void *data, int rw);
293typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *); 293typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *);
294typedef int (prepare_flush_fn) (request_queue_t *, struct request *); 294typedef void (prepare_flush_fn) (request_queue_t *, struct request *);
295typedef void (end_flush_fn) (request_queue_t *, struct request *); 295typedef void (softirq_done_fn)(struct request *);
296 296
297enum blk_queue_state { 297enum blk_queue_state {
298 Queue_down, 298 Queue_down,
@@ -334,7 +334,7 @@ struct request_queue
334 activity_fn *activity_fn; 334 activity_fn *activity_fn;
335 issue_flush_fn *issue_flush_fn; 335 issue_flush_fn *issue_flush_fn;
336 prepare_flush_fn *prepare_flush_fn; 336 prepare_flush_fn *prepare_flush_fn;
337 end_flush_fn *end_flush_fn; 337 softirq_done_fn *softirq_done_fn;
338 338
339 /* 339 /*
340 * Dispatch queue sorting 340 * Dispatch queue sorting
@@ -419,14 +419,11 @@ struct request_queue
419 /* 419 /*
420 * reserved for flush operations 420 * reserved for flush operations
421 */ 421 */
422 struct request *flush_rq; 422 unsigned int ordered, next_ordered, ordseq;
423 unsigned char ordered; 423 int orderr, ordcolor;
424}; 424 struct request pre_flush_rq, bar_rq, post_flush_rq;
425 425 struct request *orig_bar_rq;
426enum { 426 unsigned int bi_size;
427 QUEUE_ORDERED_NONE,
428 QUEUE_ORDERED_TAG,
429 QUEUE_ORDERED_FLUSH,
430}; 427};
431 428
432#define RQ_INACTIVE (-1) 429#define RQ_INACTIVE (-1)
@@ -444,12 +441,51 @@ enum {
444#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 441#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
445#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 442#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
446#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 443#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */
447#define QUEUE_FLAG_FLUSH 9 /* doing barrier flush sequence */ 444
445enum {
446 /*
447 * Hardbarrier is supported with one of the following methods.
448 *
449 * NONE : hardbarrier unsupported
450 * DRAIN : ordering by draining is enough
451 * DRAIN_FLUSH : ordering by draining w/ pre and post flushes
452 * DRAIN_FUA : ordering by draining w/ pre flush and FUA write
453 * TAG : ordering by tag is enough
454 * TAG_FLUSH : ordering by tag w/ pre and post flushes
455 * TAG_FUA : ordering by tag w/ pre flush and FUA write
456 */
457 QUEUE_ORDERED_NONE = 0x00,
458 QUEUE_ORDERED_DRAIN = 0x01,
459 QUEUE_ORDERED_TAG = 0x02,
460
461 QUEUE_ORDERED_PREFLUSH = 0x10,
462 QUEUE_ORDERED_POSTFLUSH = 0x20,
463 QUEUE_ORDERED_FUA = 0x40,
464
465 QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN |
466 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH,
467 QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN |
468 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA,
469 QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG |
470 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH,
471 QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG |
472 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA,
473
474 /*
475 * Ordered operation sequence
476 */
477 QUEUE_ORDSEQ_STARTED = 0x01, /* flushing in progress */
478 QUEUE_ORDSEQ_DRAIN = 0x02, /* waiting for the queue to be drained */
479 QUEUE_ORDSEQ_PREFLUSH = 0x04, /* pre-flushing in progress */
480 QUEUE_ORDSEQ_BAR = 0x08, /* original barrier req in progress */
481 QUEUE_ORDSEQ_POSTFLUSH = 0x10, /* post-flushing in progress */
482 QUEUE_ORDSEQ_DONE = 0x20,
483};
448 484
449#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) 485#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) 486#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) 487#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
452#define blk_queue_flushing(q) test_bit(QUEUE_FLAG_FLUSH, &(q)->queue_flags) 488#define blk_queue_flushing(q) ((q)->ordseq)
453 489
454#define blk_fs_request(rq) ((rq)->flags & REQ_CMD) 490#define blk_fs_request(rq) ((rq)->flags & REQ_CMD)
455#define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC) 491#define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC)
@@ -465,8 +501,7 @@ enum {
465 501
466#define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED) 502#define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED)
467#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER) 503#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER)
468#define blk_barrier_preflush(rq) ((rq)->flags & REQ_BAR_PREFLUSH) 504#define blk_fua_rq(rq) ((rq)->flags & REQ_FUA)
469#define blk_barrier_postflush(rq) ((rq)->flags & REQ_BAR_POSTFLUSH)
470 505
471#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 506#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
472 507
@@ -558,8 +593,8 @@ extern void blk_unregister_queue(struct gendisk *disk);
558extern void register_disk(struct gendisk *dev); 593extern void register_disk(struct gendisk *dev);
559extern void generic_make_request(struct bio *bio); 594extern void generic_make_request(struct bio *bio);
560extern void blk_put_request(struct request *); 595extern void blk_put_request(struct request *);
561extern void blk_end_sync_rq(struct request *rq); 596extern void __blk_put_request(request_queue_t *, struct request *);
562extern void blk_attempt_remerge(request_queue_t *, struct request *); 597extern void blk_end_sync_rq(struct request *rq, int error);
563extern struct request *blk_get_request(request_queue_t *, int, gfp_t); 598extern struct request *blk_get_request(request_queue_t *, int, gfp_t);
564extern void blk_insert_request(request_queue_t *, struct request *, int, void *); 599extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
565extern void blk_requeue_request(request_queue_t *, struct request *); 600extern void blk_requeue_request(request_queue_t *, struct request *);
@@ -579,6 +614,9 @@ extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned
579extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); 614extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int);
580extern int blk_execute_rq(request_queue_t *, struct gendisk *, 615extern int blk_execute_rq(request_queue_t *, struct gendisk *,
581 struct request *, int); 616 struct request *, int);
617extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *,
618 struct request *, int, rq_end_io_fn *);
619
582static inline request_queue_t *bdev_get_queue(struct block_device *bdev) 620static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
583{ 621{
584 return bdev->bd_disk->queue; 622 return bdev->bd_disk->queue;
@@ -608,8 +646,19 @@ static inline void blk_run_address_space(struct address_space *mapping)
608 */ 646 */
609extern int end_that_request_first(struct request *, int, int); 647extern int end_that_request_first(struct request *, int, int);
610extern int end_that_request_chunk(struct request *, int, int); 648extern int end_that_request_chunk(struct request *, int, int);
611extern void end_that_request_last(struct request *); 649extern void end_that_request_last(struct request *, int);
612extern void end_request(struct request *req, int uptodate); 650extern void end_request(struct request *req, int uptodate);
651extern void blk_complete_request(struct request *);
652
653static inline int rq_all_done(struct request *rq, unsigned int nr_bytes)
654{
655 if (blk_fs_request(rq))
656 return (nr_bytes >= (rq->hard_nr_sectors << 9));
657 else if (blk_pc_request(rq))
658 return nr_bytes >= rq->data_len;
659
660 return 0;
661}
613 662
614/* 663/*
615 * end_that_request_first/chunk() takes an uptodate argument. we account 664 * end_that_request_first/chunk() takes an uptodate argument. we account
@@ -658,12 +707,14 @@ extern void blk_queue_segment_boundary(request_queue_t *, unsigned long);
658extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn); 707extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn);
659extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *); 708extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *);
660extern void blk_queue_dma_alignment(request_queue_t *, int); 709extern void blk_queue_dma_alignment(request_queue_t *, int);
710extern void blk_queue_softirq_done(request_queue_t *, softirq_done_fn *);
661extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 711extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
662extern void blk_queue_ordered(request_queue_t *, int); 712extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *);
663extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); 713extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *);
664extern struct request *blk_start_pre_flush(request_queue_t *,struct request *); 714extern int blk_do_ordered(request_queue_t *, struct request **);
665extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int); 715extern unsigned blk_ordered_cur_seq(request_queue_t *);
666extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int); 716extern unsigned blk_ordered_req_seq(struct request *);
717extern void blk_ordered_complete_seq(request_queue_t *, unsigned, int);
667 718
668extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); 719extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *);
669extern void blk_dump_rq_flags(struct request *, char *); 720extern void blk_dump_rq_flags(struct request *, char *);
@@ -696,7 +747,8 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *);
696 747
697#define MAX_PHYS_SEGMENTS 128 748#define MAX_PHYS_SEGMENTS 128
698#define MAX_HW_SEGMENTS 128 749#define MAX_HW_SEGMENTS 128
699#define MAX_SECTORS 255 750#define SAFE_MAX_SECTORS 255
751#define BLK_DEF_MAX_SECTORS 1024
700 752
701#define MAX_SEGMENT_SIZE 65536 753#define MAX_SEGMENT_SIZE 65536
702 754
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 3b03b0b868dd..993da8cc9706 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -43,50 +43,38 @@ typedef struct bootmem_data {
43extern unsigned long __init bootmem_bootmap_pages (unsigned long); 43extern unsigned long __init bootmem_bootmap_pages (unsigned long);
44extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); 44extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend);
45extern void __init free_bootmem (unsigned long addr, unsigned long size); 45extern void __init free_bootmem (unsigned long addr, unsigned long size);
46extern void * __init __alloc_bootmem_limit (unsigned long size, unsigned long align, unsigned long goal, unsigned long limit); 46extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
47extern void * __init __alloc_bootmem_low(unsigned long size,
48 unsigned long align,
49 unsigned long goal);
50extern void * __init __alloc_bootmem_low_node(pg_data_t *pgdat,
51 unsigned long size,
52 unsigned long align,
53 unsigned long goal);
47#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 54#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
48extern void __init reserve_bootmem (unsigned long addr, unsigned long size); 55extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
49#define alloc_bootmem(x) \ 56#define alloc_bootmem(x) \
50 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 57 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
51#define alloc_bootmem_low(x) \ 58#define alloc_bootmem_low(x) \
52 __alloc_bootmem((x), SMP_CACHE_BYTES, 0) 59 __alloc_bootmem_low((x), SMP_CACHE_BYTES, 0)
53#define alloc_bootmem_pages(x) \ 60#define alloc_bootmem_pages(x) \
54 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 61 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
55#define alloc_bootmem_low_pages(x) \ 62#define alloc_bootmem_low_pages(x) \
56 __alloc_bootmem((x), PAGE_SIZE, 0) 63 __alloc_bootmem_low((x), PAGE_SIZE, 0)
57
58#define alloc_bootmem_limit(x, limit) \
59 __alloc_bootmem_limit((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS), (limit))
60#define alloc_bootmem_low_limit(x, limit) \
61 __alloc_bootmem_limit((x), SMP_CACHE_BYTES, 0, (limit))
62#define alloc_bootmem_pages_limit(x, limit) \
63 __alloc_bootmem_limit((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS), (limit))
64#define alloc_bootmem_low_pages_limit(x, limit) \
65 __alloc_bootmem_limit((x), PAGE_SIZE, 0, (limit))
66
67#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 64#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
68extern unsigned long __init free_all_bootmem (void); 65extern unsigned long __init free_all_bootmem (void);
69 66extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal);
70extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); 67extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn);
71extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); 68extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size);
72extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); 69extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size);
73extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat); 70extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat);
74extern void * __init __alloc_bootmem_node_limit (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal, unsigned long limit);
75#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 71#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
76#define alloc_bootmem_node(pgdat, x) \ 72#define alloc_bootmem_node(pgdat, x) \
77 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 73 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
78#define alloc_bootmem_pages_node(pgdat, x) \ 74#define alloc_bootmem_pages_node(pgdat, x) \
79 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 75 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
80#define alloc_bootmem_low_pages_node(pgdat, x) \ 76#define alloc_bootmem_low_pages_node(pgdat, x) \
81 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) 77 __alloc_bootmem_low_node((pgdat), (x), PAGE_SIZE, 0)
82
83#define alloc_bootmem_node_limit(pgdat, x, limit) \
84 __alloc_bootmem_node_limit((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS), (limit))
85#define alloc_bootmem_pages_node_limit(pgdat, x, limit) \
86 __alloc_bootmem_node_limit((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS), (limit))
87#define alloc_bootmem_low_pages_node_limit(pgdat, x, limit) \
88 __alloc_bootmem_node_limit((pgdat), (x), PAGE_SIZE, 0, (limit))
89
90#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 78#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
91 79
92#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP 80#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
@@ -123,15 +111,5 @@ extern void *__init alloc_large_system_hash(const char *tablename,
123#endif 111#endif
124extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */ 112extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */
125 113
126static inline void *__alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal)
127{
128 return __alloc_bootmem_limit(size, align, goal, 0);
129}
130
131static inline void *__alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align,
132 unsigned long goal)
133{
134 return __alloc_bootmem_node_limit(pgdat, size, align, goal, 0);
135}
136 114
137#endif /* _LINUX_BOOTMEM_H */ 115#endif /* _LINUX_BOOTMEM_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 1db061bb6b08..9f159baf153f 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -197,7 +197,8 @@ int block_read_full_page(struct page*, get_block_t*);
197int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); 197int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
198int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*, 198int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
199 loff_t *); 199 loff_t *);
200int generic_cont_expand(struct inode *inode, loff_t size) ; 200int generic_cont_expand(struct inode *inode, loff_t size);
201int generic_cont_expand_simple(struct inode *inode, loff_t size);
201int block_commit_write(struct page *page, unsigned from, unsigned to); 202int block_commit_write(struct page *page, unsigned from, unsigned to);
202int block_sync_page(struct page *); 203int block_sync_page(struct page *);
203sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 204sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 04bd756efc67..e86e4a938373 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -156,7 +156,7 @@ extern __be32 htonl(__u32);
156extern __u16 ntohs(__be16); 156extern __u16 ntohs(__be16);
157extern __be16 htons(__u16); 157extern __be16 htons(__u16);
158 158
159#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) 159#if defined(__GNUC__) && defined(__OPTIMIZE__)
160 160
161#define ___htonl(x) __cpu_to_be32(x) 161#define ___htonl(x) __cpu_to_be32(x)
162#define ___htons(x) __cpu_to_be16(x) 162#define ___htons(x) __cpu_to_be16(x)
diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h
index 2f1cb775125a..25f7f32883ec 100644
--- a/include/linux/byteorder/swab.h
+++ b/include/linux/byteorder/swab.h
@@ -110,7 +110,7 @@
110/* 110/*
111 * Allow constant folding 111 * Allow constant folding
112 */ 112 */
113#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) 113#if defined(__GNUC__) && defined(__OPTIMIZE__)
114# define __swab16(x) \ 114# define __swab16(x) \
115(__builtin_constant_p((__u16)(x)) ? \ 115(__builtin_constant_p((__u16)(x)) ? \
116 ___swab16((x)) : \ 116 ___swab16((x)) : \
diff --git a/include/linux/byteorder/swabb.h b/include/linux/byteorder/swabb.h
index d5f2a3205109..ae5e5f914bf4 100644
--- a/include/linux/byteorder/swabb.h
+++ b/include/linux/byteorder/swabb.h
@@ -77,7 +77,7 @@
77/* 77/*
78 * Allow constant folding 78 * Allow constant folding
79 */ 79 */
80#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) 80#if defined(__GNUC__) && defined(__OPTIMIZE__)
81# define __swahw32(x) \ 81# define __swahw32(x) \
82(__builtin_constant_p((__u32)(x)) ? \ 82(__builtin_constant_p((__u32)(x)) ? \
83 ___swahw32((x)) : \ 83 ___swahw32((x)) : \
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 0b7ecf3af78a..d22e632f41fb 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,7 +13,7 @@
13#define SMP_CACHE_BYTES L1_CACHE_BYTES 13#define SMP_CACHE_BYTES L1_CACHE_BYTES
14#endif 14#endif
15 15
16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) 16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) || defined(CONFIG_PARISC)
17#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18#else 18#else
19#define __read_mostly 19#define __read_mostly
@@ -45,12 +45,21 @@
45#endif /* CONFIG_SMP */ 45#endif /* CONFIG_SMP */
46#endif 46#endif
47 47
48#if !defined(____cacheline_maxaligned_in_smp) 48/*
49 * The maximum alignment needed for some critical structures
50 * These could be inter-node cacheline sizes/L3 cacheline
51 * size etc. Define this in asm/cache.h for your arch
52 */
53#ifndef INTERNODE_CACHE_SHIFT
54#define INTERNODE_CACHE_SHIFT L1_CACHE_SHIFT
55#endif
56
57#if !defined(____cacheline_internodealigned_in_smp)
49#if defined(CONFIG_SMP) 58#if defined(CONFIG_SMP)
50#define ____cacheline_maxaligned_in_smp \ 59#define ____cacheline_internodealigned_in_smp \
51 __attribute__((__aligned__(1 << (L1_CACHE_SHIFT_MAX)))) 60 __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT))))
52#else 61#else
53#define ____cacheline_maxaligned_in_smp 62#define ____cacheline_internodealigned_in_smp
54#endif 63#endif
55#endif 64#endif
56 65
diff --git a/include/linux/calc64.h b/include/linux/calc64.h
new file mode 100644
index 000000000000..ebf4b8f38d88
--- /dev/null
+++ b/include/linux/calc64.h
@@ -0,0 +1,49 @@
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 6b4618902d3d..5a23ce752629 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -43,6 +43,7 @@ typedef struct __user_cap_data_struct {
43#ifdef __KERNEL__ 43#ifdef __KERNEL__
44 44
45#include <linux/spinlock.h> 45#include <linux/spinlock.h>
46#include <asm/current.h>
46 47
47/* #define STRICT_CAP_T_TYPECHECKS */ 48/* #define STRICT_CAP_T_TYPECHECKS */
48 49
@@ -356,6 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c)
356 357
357#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) 358#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK)
358 359
360extern int capable(int cap);
361
359#endif /* __KERNEL__ */ 362#endif /* __KERNEL__ */
360 363
361#endif /* !_LINUX_CAPABILITY_H */ 364#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/clk.h b/include/linux/clk.h
new file mode 100644
index 000000000000..12848f81bb37
--- /dev/null
+++ b/include/linux/clk.h
@@ -0,0 +1,124 @@
1/*
2 * linux/include/linux/clk.h
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef ASMARM_CLOCK_H
12#define ASMARM_CLOCK_H
13
14struct device;
15
16/*
17 * The base API.
18 */
19
20
21/*
22 * struct clk - an machine class defined object / cookie.
23 */
24struct clk;
25
26/**
27 * clk_get - lookup and obtain a reference to a clock producer.
28 * @dev: device for clock "consumer"
29 * @id: clock comsumer ID
30 *
31 * Returns a struct clk corresponding to the clock producer, or
32 * valid IS_ERR() condition containing errno. The implementation
33 * uses @dev and @id to determine the clock consumer, and thereby
34 * the clock producer. (IOW, @id may be identical strings, but
35 * clk_get may return different clock producers depending on @dev.)
36 *
37 * Drivers must assume that the clock source is not enabled.
38 */
39struct clk *clk_get(struct device *dev, const char *id);
40
41/**
42 * clk_enable - inform the system when the clock source should be running.
43 * @clk: clock source
44 *
45 * If the clock can not be enabled/disabled, this should return success.
46 *
47 * Returns success (0) or negative errno.
48 */
49int clk_enable(struct clk *clk);
50
51/**
52 * clk_disable - inform the system when the clock source is no longer required.
53 * @clk: clock source
54 *
55 * Inform the system that a clock source is no longer required by
56 * a driver and may be shut down.
57 *
58 * Implementation detail: if the clock source is shared between
59 * multiple drivers, clk_enable() calls must be balanced by the
60 * same number of clk_disable() calls for the clock source to be
61 * disabled.
62 */
63void clk_disable(struct clk *clk);
64
65/**
66 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
67 * This is only valid once the clock source has been enabled.
68 * @clk: clock source
69 */
70unsigned long clk_get_rate(struct clk *clk);
71
72/**
73 * clk_put - "free" the clock source
74 * @clk: clock source
75 *
76 * Note: drivers must ensure that all clk_enable calls made on this
77 * clock source are balanced by clk_disable calls prior to calling
78 * this function.
79 */
80void clk_put(struct clk *clk);
81
82
83/*
84 * The remaining APIs are optional for machine class support.
85 */
86
87
88/**
89 * clk_round_rate - adjust a rate to the exact rate a clock can provide
90 * @clk: clock source
91 * @rate: desired clock rate in Hz
92 *
93 * Returns rounded clock rate in Hz, or negative errno.
94 */
95long clk_round_rate(struct clk *clk, unsigned long rate);
96
97/**
98 * clk_set_rate - set the clock rate for a clock source
99 * @clk: clock source
100 * @rate: desired clock rate in Hz
101 *
102 * Returns success (0) or negative errno.
103 */
104int clk_set_rate(struct clk *clk, unsigned long rate);
105
106/**
107 * clk_set_parent - set the parent clock source for this clock
108 * @clk: clock source
109 * @parent: parent clock source
110 *
111 * Returns success (0) or negative errno.
112 */
113int clk_set_parent(struct clk *clk, struct clk *parent);
114
115/**
116 * clk_get_parent - get the parent clock source for this clock
117 * @clk: clock source
118 *
119 * Returns struct clk corresponding to parent clock source, or
120 * valid IS_ERR() condition containing errno.
121 */
122struct clk *clk_get_parent(struct clk *clk);
123
124#endif
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 119f9d064cc6..8fad50f8e389 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -2,14 +2,6 @@
2 * compatible types passed or none at all... Please include 2 * compatible types passed or none at all... Please include
3 * only stuff that is compatible on *all architectures*. 3 * only stuff that is compatible on *all architectures*.
4 */ 4 */
5#ifndef COMPATIBLE_IOCTL /* pointer to compatible structure or no argument */
6#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl)
7#endif
8
9#ifndef ULONG_IOCTL /* argument is an unsigned long integer, not a pointer */
10#define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl)
11#endif
12
13 5
14COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ 6COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */
15COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ 7COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */
@@ -218,32 +210,6 @@ COMPATIBLE_IOCTL(VT_RESIZE)
218COMPATIBLE_IOCTL(VT_RESIZEX) 210COMPATIBLE_IOCTL(VT_RESIZEX)
219COMPATIBLE_IOCTL(VT_LOCKSWITCH) 211COMPATIBLE_IOCTL(VT_LOCKSWITCH)
220COMPATIBLE_IOCTL(VT_UNLOCKSWITCH) 212COMPATIBLE_IOCTL(VT_UNLOCKSWITCH)
221/* Little v */
222/* Little v, the video4linux ioctls (conflict?) */
223COMPATIBLE_IOCTL(VIDIOCGCAP)
224COMPATIBLE_IOCTL(VIDIOCGCHAN)
225COMPATIBLE_IOCTL(VIDIOCSCHAN)
226COMPATIBLE_IOCTL(VIDIOCGPICT)
227COMPATIBLE_IOCTL(VIDIOCSPICT)
228COMPATIBLE_IOCTL(VIDIOCCAPTURE)
229COMPATIBLE_IOCTL(VIDIOCKEY)
230COMPATIBLE_IOCTL(VIDIOCGAUDIO)
231COMPATIBLE_IOCTL(VIDIOCSAUDIO)
232COMPATIBLE_IOCTL(VIDIOCSYNC)
233COMPATIBLE_IOCTL(VIDIOCMCAPTURE)
234COMPATIBLE_IOCTL(VIDIOCGMBUF)
235COMPATIBLE_IOCTL(VIDIOCGUNIT)
236COMPATIBLE_IOCTL(VIDIOCGCAPTURE)
237COMPATIBLE_IOCTL(VIDIOCSCAPTURE)
238/* BTTV specific... */
239COMPATIBLE_IOCTL(_IOW('v', BASE_VIDIOCPRIVATE+0, char [256]))
240COMPATIBLE_IOCTL(_IOR('v', BASE_VIDIOCPRIVATE+1, char [256]))
241COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int))
242COMPATIBLE_IOCTL(_IOW('v' , BASE_VIDIOCPRIVATE+3, char [16])) /* struct bttv_pll_info */
243COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+4, int))
244COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+5, int))
245COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+6, int))
246COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+7, int))
247/* Little p (/dev/rtc, /dev/envctrl, etc.) */ 213/* Little p (/dev/rtc, /dev/envctrl, etc.) */
248COMPATIBLE_IOCTL(RTC_AIE_ON) 214COMPATIBLE_IOCTL(RTC_AIE_ON)
249COMPATIBLE_IOCTL(RTC_AIE_OFF) 215COMPATIBLE_IOCTL(RTC_AIE_OFF)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 152734055403..6e1c44a935d4 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -11,7 +11,22 @@
11 11
12/* This macro obfuscates arithmetic on a variable address so that gcc 12/* This macro obfuscates arithmetic on a variable address so that gcc
13 shouldn't recognize the original var, and make assumptions about it */ 13 shouldn't recognize the original var, and make assumptions about it */
14/*
15 * Versions of the ppc64 compiler before 4.1 had a bug where use of
16 * RELOC_HIDE could trash r30. The bug can be worked around by changing
17 * the inline assembly constraint from =g to =r, in this particular
18 * case either is valid.
19 */
14#define RELOC_HIDE(ptr, off) \ 20#define RELOC_HIDE(ptr, off) \
15 ({ unsigned long __ptr; \ 21 ({ unsigned long __ptr; \
16 __asm__ ("" : "=g"(__ptr) : "0"(ptr)); \ 22 __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
17 (typeof(ptr)) (__ptr + (off)); }) 23 (typeof(ptr)) (__ptr + (off)); })
24
25
26#define inline inline __attribute__((always_inline))
27#define __inline__ __inline__ __attribute__((always_inline))
28#define __inline __inline __attribute__((always_inline))
29#define __deprecated __attribute__((deprecated))
30#define noinline __attribute__((noinline))
31#define __attribute_pure__ __attribute__((pure))
32#define __attribute_const__ __attribute__((__const__))
diff --git a/include/linux/compiler-gcc2.h b/include/linux/compiler-gcc2.h
deleted file mode 100644
index ebed17660c5f..000000000000
--- a/include/linux/compiler-gcc2.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* Never include this file directly. Include <linux/compiler.h> instead. */
2
3/* These definitions are for GCC v2.x. */
4
5/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
6 a mechanism by which the user can annotate likely branch directions and
7 expect the blocks to be reordered appropriately. Define __builtin_expect
8 to nothing for earlier compilers. */
9#include <linux/compiler-gcc.h>
10
11#if __GNUC_MINOR__ < 96
12# define __builtin_expect(x, expected_value) (x)
13#endif
14
15#define __attribute_used__ __attribute__((__unused__))
16
17/*
18 * The attribute `pure' is not implemented in GCC versions earlier
19 * than 2.96.
20 */
21#if __GNUC_MINOR__ >= 96
22# define __attribute_pure__ __attribute__((pure))
23# define __attribute_const__ __attribute__((__const__))
24#endif
25
26/* GCC 2.95.x/2.96 recognize __va_copy, but not va_copy. Actually later GCC's
27 * define both va_copy and __va_copy, but the latter may go away, so limit this
28 * to this header */
29#define va_copy __va_copy
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index a6fa615afab5..1698b845761f 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -3,30 +3,14 @@
3/* These definitions are for GCC v3.x. */ 3/* These definitions are for GCC v3.x. */
4#include <linux/compiler-gcc.h> 4#include <linux/compiler-gcc.h>
5 5
6#if __GNUC_MINOR__ >= 1
7# define inline inline __attribute__((always_inline))
8# define __inline__ __inline__ __attribute__((always_inline))
9# define __inline __inline __attribute__((always_inline))
10#endif
11
12#if __GNUC_MINOR__ > 0
13# define __deprecated __attribute__((deprecated))
14#endif
15
16#if __GNUC_MINOR__ >= 3 6#if __GNUC_MINOR__ >= 3
17# define __attribute_used__ __attribute__((__used__)) 7# define __attribute_used__ __attribute__((__used__))
18#else 8#else
19# define __attribute_used__ __attribute__((__unused__)) 9# define __attribute_used__ __attribute__((__unused__))
20#endif 10#endif
21 11
22#define __attribute_pure__ __attribute__((pure))
23#define __attribute_const__ __attribute__((__const__))
24
25#if __GNUC_MINOR__ >= 1
26#define noinline __attribute__((noinline))
27#endif
28
29#if __GNUC_MINOR__ >= 4 12#if __GNUC_MINOR__ >= 4
30#define __must_check __attribute__((warn_unused_result)) 13#define __must_check __attribute__((warn_unused_result))
31#endif 14#endif
32 15
16#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 53686c037a06..6f5cc6f0e7a6 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -3,14 +3,16 @@
3/* These definitions are for GCC v4.x. */ 3/* These definitions are for GCC v4.x. */
4#include <linux/compiler-gcc.h> 4#include <linux/compiler-gcc.h>
5 5
6#define inline inline __attribute__((always_inline)) 6#ifdef CONFIG_FORCED_INLINING
7#define __inline__ __inline__ __attribute__((always_inline)) 7# undef inline
8#define __inline __inline __attribute__((always_inline)) 8# undef __inline__
9#define __deprecated __attribute__((deprecated)) 9# undef __inline
10# define inline inline __attribute__((always_inline))
11# define __inline__ __inline__ __attribute__((always_inline))
12# define __inline __inline __attribute__((always_inline))
13#endif
14
10#define __attribute_used__ __attribute__((__used__)) 15#define __attribute_used__ __attribute__((__used__))
11#define __attribute_pure__ __attribute__((pure))
12#define __attribute_const__ __attribute__((__const__))
13#define noinline __attribute__((noinline))
14#define __must_check __attribute__((warn_unused_result)) 16#define __must_check __attribute__((warn_unused_result))
15#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 17#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
16 18#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index d7378215b851..f23d3c6fc2c0 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -42,8 +42,6 @@ extern void __chk_io_ptr(void __iomem *);
42# include <linux/compiler-gcc4.h> 42# include <linux/compiler-gcc4.h>
43#elif __GNUC__ == 3 43#elif __GNUC__ == 3
44# include <linux/compiler-gcc3.h> 44# include <linux/compiler-gcc3.h>
45#elif __GNUC__ == 2
46# include <linux/compiler-gcc2.h>
47#else 45#else
48# error Sorry, your compiler is too old/not recognized. 46# error Sorry, your compiler is too old/not recognized.
49#endif 47#endif
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
new file mode 100644
index 000000000000..acffb8c9073a
--- /dev/null
+++ b/include/linux/configfs.h
@@ -0,0 +1,205 @@
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * configfs.h - definitions for the device driver filesystem
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (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 GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 021110-1307, USA.
20 *
21 * Based on sysfs:
22 * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
23 *
24 * Based on kobject.h:
25 * Copyright (c) 2002-2003 Patrick Mochel
26 * Copyright (c) 2002-2003 Open Source Development Labs
27 *
28 * configfs Copyright (C) 2005 Oracle. All rights reserved.
29 *
30 * Please read Documentation/filesystems/configfs.txt before using the
31 * configfs interface, ESPECIALLY the parts about reference counts and
32 * item destructors.
33 */
34
35#ifndef _CONFIGFS_H_
36#define _CONFIGFS_H_
37
38#ifdef __KERNEL__
39
40#include <linux/types.h>
41#include <linux/list.h>
42#include <linux/kref.h>
43
44#include <asm/atomic.h>
45#include <asm/semaphore.h>
46
47#define CONFIGFS_ITEM_NAME_LEN 20
48
49struct module;
50
51struct configfs_item_operations;
52struct configfs_group_operations;
53struct configfs_attribute;
54struct configfs_subsystem;
55
56struct config_item {
57 char *ci_name;
58 char ci_namebuf[CONFIGFS_ITEM_NAME_LEN];
59 struct kref ci_kref;
60 struct list_head ci_entry;
61 struct config_item *ci_parent;
62 struct config_group *ci_group;
63 struct config_item_type *ci_type;
64 struct dentry *ci_dentry;
65};
66
67extern int config_item_set_name(struct config_item *, const char *, ...);
68
69static inline char *config_item_name(struct config_item * item)
70{
71 return item->ci_name;
72}
73
74extern void config_item_init(struct config_item *);
75extern void config_item_init_type_name(struct config_item *item,
76 const char *name,
77 struct config_item_type *type);
78extern void config_item_cleanup(struct config_item *);
79
80extern struct config_item * config_item_get(struct config_item *);
81extern void config_item_put(struct config_item *);
82
83struct config_item_type {
84 struct module *ct_owner;
85 struct configfs_item_operations *ct_item_ops;
86 struct configfs_group_operations *ct_group_ops;
87 struct configfs_attribute **ct_attrs;
88};
89
90
91/**
92 * group - a group of config_items of a specific type, belonging
93 * to a specific subsystem.
94 */
95
96struct config_group {
97 struct config_item cg_item;
98 struct list_head cg_children;
99 struct configfs_subsystem *cg_subsys;
100 struct config_group **default_groups;
101};
102
103
104extern void config_group_init(struct config_group *group);
105extern void config_group_init_type_name(struct config_group *group,
106 const char *name,
107 struct config_item_type *type);
108
109
110static inline struct config_group *to_config_group(struct config_item *item)
111{
112 return item ? container_of(item,struct config_group,cg_item) : NULL;
113}
114
115static inline struct config_group *config_group_get(struct config_group *group)
116{
117 return group ? to_config_group(config_item_get(&group->cg_item)) : NULL;
118}
119
120static inline void config_group_put(struct config_group *group)
121{
122 config_item_put(&group->cg_item);
123}
124
125extern struct config_item *config_group_find_obj(struct config_group *, const char *);
126
127
128struct configfs_attribute {
129 char *ca_name;
130 struct module *ca_owner;
131 mode_t ca_mode;
132};
133
134
135/*
136 * If allow_link() exists, the item can symlink(2) out to other
137 * items. If the item is a group, it may support mkdir(2).
138 * Groups supply one of make_group() and make_item(). If the
139 * group supports make_group(), one can create group children. If it
140 * supports make_item(), one can create config_item children. If it has
141 * default_groups on group->default_groups, it has automatically created
142 * group children. default_groups may coexist alongsize make_group() or
143 * make_item(), but if the group wishes to have only default_groups
144 * children (disallowing mkdir(2)), it need not provide either function.
145 * If the group has commit(), it supports pending and commited (active)
146 * items.
147 */
148struct configfs_item_operations {
149 void (*release)(struct config_item *);
150 ssize_t (*show_attribute)(struct config_item *, struct configfs_attribute *,char *);
151 ssize_t (*store_attribute)(struct config_item *,struct configfs_attribute *,const char *, size_t);
152 int (*allow_link)(struct config_item *src, struct config_item *target);
153 int (*drop_link)(struct config_item *src, struct config_item *target);
154};
155
156struct configfs_group_operations {
157 struct config_item *(*make_item)(struct config_group *group, const char *name);
158 struct config_group *(*make_group)(struct config_group *group, const char *name);
159 int (*commit_item)(struct config_item *item);
160 void (*drop_item)(struct config_group *group, struct config_item *item);
161};
162
163
164
165/**
166 * Use these macros to make defining attributes easier. See include/linux/device.h
167 * for examples..
168 */
169
170#if 0
171#define __ATTR(_name,_mode,_show,_store) { \
172 .attr = {.ca_name = __stringify(_name), .ca_mode = _mode, .ca_owner = THIS_MODULE }, \
173 .show = _show, \
174 .store = _store, \
175}
176
177#define __ATTR_RO(_name) { \
178 .attr = { .ca_name = __stringify(_name), .ca_mode = 0444, .ca_owner = THIS_MODULE }, \
179 .show = _name##_show, \
180}
181
182#define __ATTR_NULL { .attr = { .name = NULL } }
183
184#define attr_name(_attr) (_attr).attr.name
185#endif
186
187
188struct configfs_subsystem {
189 struct config_group su_group;
190 struct semaphore su_sem;
191};
192
193static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group)
194{
195 return group ?
196 container_of(group, struct configfs_subsystem, su_group) :
197 NULL;
198}
199
200int configfs_register_subsystem(struct configfs_subsystem *subsys);
201void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
202
203#endif /* __KERNEL__ */
204
205#endif /* _CONFIGFS_H_ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index d068176b7ad7..c31650df9241 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -256,6 +256,16 @@ int cpufreq_update_policy(unsigned int cpu);
256/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 256/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
257unsigned int cpufreq_get(unsigned int cpu); 257unsigned int cpufreq_get(unsigned int cpu);
258 258
259/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
260#ifdef CONFIG_CPU_FREQ
261unsigned int cpufreq_quick_get(unsigned int cpu);
262#else
263static inline unsigned int cpufreq_quick_get(unsigned int cpu)
264{
265 return 0;
266}
267#endif
268
259 269
260/********************************************************************* 270/*********************************************************************
261 * CPUFREQ DEFAULT GOVERNOR * 271 * CPUFREQ DEFAULT GOVERNOR *
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 6e2deef96b34..3bc606927116 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -14,22 +14,46 @@
14 14
15#ifdef CONFIG_CPUSETS 15#ifdef CONFIG_CPUSETS
16 16
17extern int number_of_cpusets; /* How many cpusets are defined in system? */
18
19extern int cpuset_init_early(void);
17extern int cpuset_init(void); 20extern int cpuset_init(void);
18extern void cpuset_init_smp(void); 21extern void cpuset_init_smp(void);
19extern void cpuset_fork(struct task_struct *p); 22extern void cpuset_fork(struct task_struct *p);
20extern void cpuset_exit(struct task_struct *p); 23extern void cpuset_exit(struct task_struct *p);
21extern cpumask_t cpuset_cpus_allowed(const struct task_struct *p); 24extern cpumask_t cpuset_cpus_allowed(struct task_struct *p);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
22void cpuset_init_current_mems_allowed(void); 26void cpuset_init_current_mems_allowed(void);
23void cpuset_update_current_mems_allowed(void); 27void cpuset_update_task_memory_state(void);
24void cpuset_restrict_to_mems_allowed(unsigned long *nodes); 28#define cpuset_nodes_subset_current_mems_allowed(nodes) \
29 nodes_subset((nodes), current->mems_allowed)
25int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); 30int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
26extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask); 31
32extern int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask);
33static int inline cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
34{
35 return number_of_cpusets <= 1 || __cpuset_zone_allowed(z, gfp_mask);
36}
37
27extern int cpuset_excl_nodes_overlap(const struct task_struct *p); 38extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
39
40#define cpuset_memory_pressure_bump() \
41 do { \
42 if (cpuset_memory_pressure_enabled) \
43 __cpuset_memory_pressure_bump(); \
44 } while (0)
45extern int cpuset_memory_pressure_enabled;
46extern void __cpuset_memory_pressure_bump(void);
47
28extern struct file_operations proc_cpuset_operations; 48extern struct file_operations proc_cpuset_operations;
29extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 49extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
30 50
51extern void cpuset_lock(void);
52extern void cpuset_unlock(void);
53
31#else /* !CONFIG_CPUSETS */ 54#else /* !CONFIG_CPUSETS */
32 55
56static inline int cpuset_init_early(void) { return 0; }
33static inline int cpuset_init(void) { return 0; } 57static inline int cpuset_init(void) { return 0; }
34static inline void cpuset_init_smp(void) {} 58static inline void cpuset_init_smp(void) {}
35static inline void cpuset_fork(struct task_struct *p) {} 59static inline void cpuset_fork(struct task_struct *p) {}
@@ -40,9 +64,14 @@ static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p)
40 return cpu_possible_map; 64 return cpu_possible_map;
41} 65}
42 66
67static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
68{
69 return node_possible_map;
70}
71
43static inline void cpuset_init_current_mems_allowed(void) {} 72static inline void cpuset_init_current_mems_allowed(void) {}
44static inline void cpuset_update_current_mems_allowed(void) {} 73static inline void cpuset_update_task_memory_state(void) {}
45static inline void cpuset_restrict_to_mems_allowed(unsigned long *nodes) {} 74#define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
46 75
47static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) 76static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
48{ 77{
@@ -59,12 +88,17 @@ static inline int cpuset_excl_nodes_overlap(const struct task_struct *p)
59 return 1; 88 return 1;
60} 89}
61 90
91static inline void cpuset_memory_pressure_bump(void) {}
92
62static inline char *cpuset_task_status_allowed(struct task_struct *task, 93static inline char *cpuset_task_status_allowed(struct task_struct *task,
63 char *buffer) 94 char *buffer)
64{ 95{
65 return buffer; 96 return buffer;
66} 97}
67 98
99static inline void cpuset_lock(void) {}
100static inline void cpuset_unlock(void) {}
101
68#endif /* !CONFIG_CPUSETS */ 102#endif /* !CONFIG_CPUSETS */
69 103
70#endif /* _LINUX_CPUSET_H */ 104#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 3c89df6e7768..d88bf8aa8b47 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> 4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
5 * Copyright (c) 2002 David S. Miller (davem@redhat.com) 5 * Copyright (c) 2002 David S. Miller (davem@redhat.com)
6 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
6 * 7 *
7 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no> 8 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no>
8 * and Nettle, by Niels Möller. 9 * and Nettle, by Niels Möller.
@@ -126,7 +127,11 @@ struct crypto_alg {
126 unsigned int cra_blocksize; 127 unsigned int cra_blocksize;
127 unsigned int cra_ctxsize; 128 unsigned int cra_ctxsize;
128 unsigned int cra_alignmask; 129 unsigned int cra_alignmask;
130
131 int cra_priority;
132
129 const char cra_name[CRYPTO_MAX_ALG_NAME]; 133 const char cra_name[CRYPTO_MAX_ALG_NAME];
134 const char cra_driver_name[CRYPTO_MAX_ALG_NAME];
130 135
131 union { 136 union {
132 struct cipher_alg cipher; 137 struct cipher_alg cipher;
diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h
index b10a7f3a8cac..f7a906583463 100644
--- a/include/linux/cycx_x25.h
+++ b/include/linux/cycx_x25.h
@@ -38,11 +38,11 @@ extern unsigned int cycx_debug;
38/* Data Structures */ 38/* Data Structures */
39/* X.25 Command Block. */ 39/* X.25 Command Block. */
40struct cycx_x25_cmd { 40struct cycx_x25_cmd {
41 u16 command PACKED; 41 u16 command;
42 u16 link PACKED; /* values: 0 or 1 */ 42 u16 link; /* values: 0 or 1 */
43 u16 len PACKED; /* values: 0 thru 0x205 (517) */ 43 u16 len; /* values: 0 thru 0x205 (517) */
44 u32 buf PACKED; 44 u32 buf;
45}; 45} PACKED;
46 46
47/* Defines for the 'command' field. */ 47/* Defines for the 'command' field. */
48#define X25_CONNECT_REQUEST 0x4401 48#define X25_CONNECT_REQUEST 0x4401
@@ -92,34 +92,34 @@ struct cycx_x25_cmd {
92 * @flags - see dosx25.doc, in portuguese, for details 92 * @flags - see dosx25.doc, in portuguese, for details
93 */ 93 */
94struct cycx_x25_config { 94struct cycx_x25_config {
95 u8 link PACKED; 95 u8 link;
96 u8 speed PACKED; 96 u8 speed;
97 u8 clock PACKED; 97 u8 clock;
98 u8 n2 PACKED; 98 u8 n2;
99 u8 n2win PACKED; 99 u8 n2win;
100 u8 n3win PACKED; 100 u8 n3win;
101 u8 nvc PACKED; 101 u8 nvc;
102 u8 pktlen PACKED; 102 u8 pktlen;
103 u8 locaddr PACKED; 103 u8 locaddr;
104 u8 remaddr PACKED; 104 u8 remaddr;
105 u16 t1 PACKED; 105 u16 t1;
106 u16 t2 PACKED; 106 u16 t2;
107 u8 t21 PACKED; 107 u8 t21;
108 u8 npvc PACKED; 108 u8 npvc;
109 u8 t23 PACKED; 109 u8 t23;
110 u8 flags PACKED; 110 u8 flags;
111}; 111} PACKED;
112 112
113struct cycx_x25_stats { 113struct cycx_x25_stats {
114 u16 rx_crc_errors PACKED; 114 u16 rx_crc_errors;
115 u16 rx_over_errors PACKED; 115 u16 rx_over_errors;
116 u16 n2_tx_frames PACKED; 116 u16 n2_tx_frames;
117 u16 n2_rx_frames PACKED; 117 u16 n2_rx_frames;
118 u16 tx_timeouts PACKED; 118 u16 tx_timeouts;
119 u16 rx_timeouts PACKED; 119 u16 rx_timeouts;
120 u16 n3_tx_packets PACKED; 120 u16 n3_tx_packets;
121 u16 n3_rx_packets PACKED; 121 u16 n3_rx_packets;
122 u16 tx_aborts PACKED; 122 u16 tx_aborts;
123 u16 rx_aborts PACKED; 123 u16 rx_aborts;
124}; 124} PACKED;
125#endif /* _CYCX_X25_H */ 125#endif /* _CYCX_X25_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 46a2ba617595..a3ed5e059d47 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -95,14 +95,19 @@ struct dentry {
95 struct qstr d_name; 95 struct qstr d_name;
96 96
97 struct list_head d_lru; /* LRU list */ 97 struct list_head d_lru; /* LRU list */
98 struct list_head d_child; /* child of parent list */ 98 /*
99 * d_child and d_rcu can share memory
100 */
101 union {
102 struct list_head d_child; /* child of parent list */
103 struct rcu_head d_rcu;
104 } d_u;
99 struct list_head d_subdirs; /* our children */ 105 struct list_head d_subdirs; /* our children */
100 struct list_head d_alias; /* inode alias list */ 106 struct list_head d_alias; /* inode alias list */
101 unsigned long d_time; /* used by d_revalidate */ 107 unsigned long d_time; /* used by d_revalidate */
102 struct dentry_operations *d_op; 108 struct dentry_operations *d_op;
103 struct super_block *d_sb; /* The root of the dentry tree */ 109 struct super_block *d_sb; /* The root of the dentry tree */
104 void *d_fsdata; /* fs-specific data */ 110 void *d_fsdata; /* fs-specific data */
105 struct rcu_head d_rcu;
106 struct dcookie_struct *d_cookie; /* cookie, if any */ 111 struct dcookie_struct *d_cookie; /* cookie, if any */
107 int d_mounted; 112 int d_mounted;
108 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ 113 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 71fab4311e92..088529f54965 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -192,10 +192,9 @@ enum {
192#include <linux/workqueue.h> 192#include <linux/workqueue.h>
193 193
194#include <net/inet_connection_sock.h> 194#include <net/inet_connection_sock.h>
195#include <net/inet_sock.h>
195#include <net/inet_timewait_sock.h> 196#include <net/inet_timewait_sock.h>
196#include <net/sock.h>
197#include <net/tcp_states.h> 197#include <net/tcp_states.h>
198#include <net/tcp.h>
199 198
200enum dccp_state { 199enum dccp_state {
201 DCCP_OPEN = TCP_ESTABLISHED, 200 DCCP_OPEN = TCP_ESTABLISHED,
@@ -408,8 +407,6 @@ struct dccp_ackvec;
408 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss 407 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
409 * @dccps_timestamp_time - time of latest TIMESTAMP option 408 * @dccps_timestamp_time - time of latest TIMESTAMP option
410 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 409 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
411 * @dccps_ext_header_len - network protocol overhead (IP/IPv6 options)
412 * @dccps_pmtu_cookie - Last pmtu seen by socket
413 * @dccps_packet_size - Set thru setsockopt 410 * @dccps_packet_size - Set thru setsockopt
414 * @dccps_role - Role of this sock, one of %dccp_role 411 * @dccps_role - Role of this sock, one of %dccp_role
415 * @dccps_ndp_count - number of Non Data Packets since last data packet 412 * @dccps_ndp_count - number of Non Data Packets since last data packet
@@ -434,8 +431,6 @@ struct dccp_sock {
434 __u32 dccps_timestamp_echo; 431 __u32 dccps_timestamp_echo;
435 __u32 dccps_packet_size; 432 __u32 dccps_packet_size;
436 unsigned long dccps_ndp_count; 433 unsigned long dccps_ndp_count;
437 __u16 dccps_ext_header_len;
438 __u32 dccps_pmtu_cookie;
439 __u32 dccps_mss_cache; 434 __u32 dccps_mss_cache;
440 struct dccp_options dccps_options; 435 struct dccp_options dccps_options;
441 struct dccp_ackvec *dccps_hc_rx_ackvec; 436 struct dccp_ackvec *dccps_hc_rx_ackvec;
diff --git a/include/linux/device.h b/include/linux/device.h
index 17cbc6db67b4..58df18d9cd3e 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -47,8 +47,11 @@ struct bus_type {
47 struct driver_attribute * drv_attrs; 47 struct driver_attribute * drv_attrs;
48 48
49 int (*match)(struct device * dev, struct device_driver * drv); 49 int (*match)(struct device * dev, struct device_driver * drv);
50 int (*hotplug) (struct device *dev, char **envp, 50 int (*uevent)(struct device *dev, char **envp,
51 int num_envp, char *buffer, int buffer_size); 51 int num_envp, char *buffer, int buffer_size);
52 int (*probe)(struct device * dev);
53 int (*remove)(struct device * dev);
54 void (*shutdown)(struct device * dev);
52 int (*suspend)(struct device * dev, pm_message_t state); 55 int (*suspend)(struct device * dev, pm_message_t state);
53 int (*resume)(struct device * dev); 56 int (*resume)(struct device * dev);
54}; 57};
@@ -151,7 +154,7 @@ struct class {
151 struct class_attribute * class_attrs; 154 struct class_attribute * class_attrs;
152 struct class_device_attribute * class_dev_attrs; 155 struct class_device_attribute * class_dev_attrs;
153 156
154 int (*hotplug)(struct class_device *dev, char **envp, 157 int (*uevent)(struct class_device *dev, char **envp,
155 int num_envp, char *buffer, int buffer_size); 158 int num_envp, char *buffer, int buffer_size);
156 159
157 void (*release)(struct class_device *dev); 160 void (*release)(struct class_device *dev);
@@ -209,9 +212,9 @@ extern int class_device_create_file(struct class_device *,
209 * set, this will be called instead of the class specific release function. 212 * set, this will be called instead of the class specific release function.
210 * Only use this if you want to override the default release function, like 213 * Only use this if you want to override the default release function, like
211 * when you are nesting class_device structures. 214 * when you are nesting class_device structures.
212 * @hotplug: pointer to a hotplug function for this struct class_device. If 215 * @uevent: pointer to a uevent function for this struct class_device. If
213 * set, this will be called instead of the class specific hotplug function. 216 * set, this will be called instead of the class specific uevent function.
214 * Only use this if you want to override the default hotplug function, like 217 * Only use this if you want to override the default uevent function, like
215 * when you are nesting class_device structures. 218 * when you are nesting class_device structures.
216 */ 219 */
217struct class_device { 220struct class_device {
@@ -227,7 +230,7 @@ struct class_device {
227 struct class_device *parent; /* parent of this child device, if there is one */ 230 struct class_device *parent; /* parent of this child device, if there is one */
228 231
229 void (*release)(struct class_device *dev); 232 void (*release)(struct class_device *dev);
230 int (*hotplug)(struct class_device *dev, char **envp, 233 int (*uevent)(struct class_device *dev, char **envp,
231 int num_envp, char *buffer, int buffer_size); 234 int num_envp, char *buffer, int buffer_size);
232 char class_id[BUS_ID_SIZE]; /* unique to this class */ 235 char class_id[BUS_ID_SIZE]; /* unique to this class */
233}; 236};
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index f5eb6b6cd109..fa75ba0d635e 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -272,9 +272,9 @@ typedef char ioctl_struct[308];
272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) 272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
273 273
274#define DM_VERSION_MAJOR 4 274#define DM_VERSION_MAJOR 4
275#define DM_VERSION_MINOR 4 275#define DM_VERSION_MINOR 5
276#define DM_VERSION_PATCHLEVEL 0 276#define DM_VERSION_PATCHLEVEL 0
277#define DM_VERSION_EXTRA "-ioctl (2005-01-12)" 277#define DM_VERSION_EXTRA "-ioctl (2005-10-04)"
278 278
279/* Status bits */ 279/* Status bits */
280#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 280#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -301,8 +301,13 @@ typedef char ioctl_struct[308];
301#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ 301#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */
302 302
303/* 303/*
304 * Set this to improve performance when you aren't going to use open_count 304 * Set this to improve performance when you aren't going to use open_count.
305 */ 305 */
306#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ 306#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */
307 307
308/*
309 * Set this to avoid attempting to freeze any filesystem when suspending.
310 */
311#define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */
312
308#endif /* _LINUX_DM_IOCTL_H */ 313#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 05f4132622fc..2e6bbe014157 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -2,6 +2,7 @@
2#define __DMI_H__ 2#define __DMI_H__
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/config.h>
5 6
6enum dmi_field { 7enum dmi_field {
7 DMI_NONE, 8 DMI_NONE,
@@ -60,12 +61,14 @@ struct dmi_device {
60 void *device_data; /* Type specific data */ 61 void *device_data; /* Type specific data */
61}; 62};
62 63
63#if defined(CONFIG_X86_32) 64#ifdef CONFIG_DMI
64 65
65extern int dmi_check_system(struct dmi_system_id *list); 66extern int dmi_check_system(struct dmi_system_id *list);
66extern char * dmi_get_system_info(int field); 67extern char * dmi_get_system_info(int field);
67extern struct dmi_device * dmi_find_device(int type, const char *name, 68extern struct dmi_device * dmi_find_device(int type, const char *name,
68 struct dmi_device *from); 69 struct dmi_device *from);
70extern void dmi_scan_machine(void);
71
69#else 72#else
70 73
71static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } 74static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index d41df7047ed7..c8cbd90ba375 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -240,6 +240,15 @@ struct dvb_frontend_event {
240}; 240};
241 241
242 242
243/**
244 * When set, this flag will disable any zigzagging or other "normal" tuning
245 * behaviour. Additionally, there will be no automatic monitoring of the lock
246 * status, and hence no frontend events will be generated. If a frontend device
247 * is closed, this flag will be automatically turned off when the device is
248 * reopened read-write.
249 */
250#define FE_TUNE_MODE_ONESHOT 0x01
251
243 252
244#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) 253#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info)
245 254
@@ -260,6 +269,7 @@ struct dvb_frontend_event {
260 269
261#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) 270#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters)
262#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) 271#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters)
272#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */
263#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) 273#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event)
264 274
265#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ 275#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index a74c27e460ba..23fe746a1d51 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -66,7 +66,7 @@ struct elevator_type
66}; 66};
67 67
68/* 68/*
69 * each queue has an elevator_queue assoicated with it 69 * each queue has an elevator_queue associated with it
70 */ 70 */
71struct elevator_queue 71struct elevator_queue
72{ 72{
@@ -114,8 +114,6 @@ extern ssize_t elv_iosched_store(request_queue_t *, const char *, size_t);
114extern int elevator_init(request_queue_t *, char *); 114extern int elevator_init(request_queue_t *, char *);
115extern void elevator_exit(elevator_t *); 115extern void elevator_exit(elevator_t *);
116extern int elv_rq_merge_ok(struct request *, struct bio *); 116extern int elv_rq_merge_ok(struct request *, struct bio *);
117extern int elv_try_merge(struct request *, struct bio *);
118extern int elv_try_last_merge(request_queue_t *, struct bio *);
119 117
120/* 118/*
121 * Return values from elevator merger 119 * Return values from elevator merger
@@ -130,6 +128,7 @@ extern int elv_try_last_merge(request_queue_t *, struct bio *);
130#define ELEVATOR_INSERT_FRONT 1 128#define ELEVATOR_INSERT_FRONT 1
131#define ELEVATOR_INSERT_BACK 2 129#define ELEVATOR_INSERT_BACK 2
132#define ELEVATOR_INSERT_SORT 3 130#define ELEVATOR_INSERT_SORT 3
131#define ELEVATOR_INSERT_REQUEUE 4
133 132
134/* 133/*
135 * return values from elevator_may_queue_fn 134 * return values from elevator_may_queue_fn
diff --git a/include/linux/elf.h b/include/linux/elf.h
index ff955dbf510d..d3bfacb24496 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -151,6 +151,8 @@ typedef __s64 Elf64_Sxword;
151#define STT_FUNC 2 151#define STT_FUNC 2
152#define STT_SECTION 3 152#define STT_SECTION 3
153#define STT_FILE 4 153#define STT_FILE 4
154#define STT_COMMON 5
155#define STT_TLS 6
154 156
155#define ELF_ST_BIND(x) ((x) >> 4) 157#define ELF_ST_BIND(x) ((x) >> 4)
156#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) 158#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 5f49a30eb6f2..745c988359c0 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -63,10 +63,11 @@ static inline int is_zero_ether_addr(const u8 *addr)
63 * @addr: Pointer to a six-byte array containing the Ethernet address 63 * @addr: Pointer to a six-byte array containing the Ethernet address
64 * 64 *
65 * Return true if the address is a multicast address. 65 * Return true if the address is a multicast address.
66 * By definition the broadcast address is also a multicast address.
66 */ 67 */
67static inline int is_multicast_ether_addr(const u8 *addr) 68static inline int is_multicast_ether_addr(const u8 *addr)
68{ 69{
69 return ((addr[0] != 0xff) && (0x01 & addr[0])); 70 return (0x01 & addr[0]);
70} 71}
71 72
72/** 73/**
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 2914f7b07156..e71dd98dbcae 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -87,7 +87,7 @@ struct ext3_inode_info {
87#ifdef CONFIG_EXT3_FS_XATTR 87#ifdef CONFIG_EXT3_FS_XATTR
88 /* 88 /*
89 * Extended attributes can be read independently of the main file 89 * Extended attributes can be read independently of the main file
90 * data. Taking i_sem even when reading would cause contention 90 * data. Taking i_mutex even when reading would cause contention
91 * between readers of EAs and writers of regular file data, so 91 * between readers of EAs and writers of regular file data, so
92 * instead we synchronize on xattr_sem when reading or changing 92 * instead we synchronize on xattr_sem when reading or changing
93 * EAs. 93 * EAs.
diff --git a/include/linux/fb.h b/include/linux/fb.h
index a973be2cfe61..2cb19e6503aa 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -608,15 +608,15 @@ struct fb_ops {
608 int (*fb_sync)(struct fb_info *info); 608 int (*fb_sync)(struct fb_info *info);
609 609
610 /* perform fb specific ioctl (optional) */ 610 /* perform fb specific ioctl (optional) */
611 int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd, 611 int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
612 unsigned long arg, struct fb_info *info); 612 unsigned long arg);
613 613
614 /* Handle 32bit compat ioctl (optional) */ 614 /* Handle 32bit compat ioctl (optional) */
615 long (*fb_compat_ioctl)(struct file *f, unsigned cmd, unsigned long arg, 615 int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,
616 struct fb_info *info); 616 unsigned long arg);
617 617
618 /* perform fb specific mmap */ 618 /* perform fb specific mmap */
619 int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma); 619 int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
620 620
621 /* save current hardware state */ 621 /* save current hardware state */
622 void (*fb_save_state)(struct fb_info *info); 622 void (*fb_save_state)(struct fb_info *info);
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 3ba843c46382..c6cb8f095088 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -143,7 +143,7 @@ static inline unsigned int sk_filter_len(struct sk_filter *fp)
143struct sk_buff; 143struct sk_buff;
144struct sock; 144struct sock;
145 145
146extern int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); 146extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen);
147extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 147extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
148extern int sk_chk_filter(struct sock_filter *filter, int flen); 148extern int sk_chk_filter(struct sock_filter *filter, int flen);
149#endif /* __KERNEL__ */ 149#endif /* __KERNEL__ */
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 2063c0839d4f..2d716080be4a 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -14,7 +14,7 @@ struct device;
14int request_firmware(const struct firmware **fw, const char *name, 14int request_firmware(const struct firmware **fw, const char *name,
15 struct device *device); 15 struct device *device);
16int request_firmware_nowait( 16int request_firmware_nowait(
17 struct module *module, int hotplug, 17 struct module *module, int uevent,
18 const char *name, struct device *device, void *context, 18 const char *name, struct device *device, void *context,
19 void (*cont)(const struct firmware *fw, void *context)); 19 void (*cont)(const struct firmware *fw, void *context));
20 20
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cc35b6ac778d..b77f2608eef9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -9,7 +9,6 @@
9#include <linux/config.h> 9#include <linux/config.h>
10#include <linux/limits.h> 10#include <linux/limits.h>
11#include <linux/ioctl.h> 11#include <linux/ioctl.h>
12#include <linux/rcuref.h>
13 12
14/* 13/*
15 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -104,19 +103,18 @@ extern int dir_notify_enable;
104#define MS_MOVE 8192 103#define MS_MOVE 8192
105#define MS_REC 16384 104#define MS_REC 16384
106#define MS_VERBOSE 32768 105#define MS_VERBOSE 32768
106#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
107#define MS_UNBINDABLE (1<<17) /* change to unbindable */ 107#define MS_UNBINDABLE (1<<17) /* change to unbindable */
108#define MS_PRIVATE (1<<18) /* change to private */ 108#define MS_PRIVATE (1<<18) /* change to private */
109#define MS_SLAVE (1<<19) /* change to slave */ 109#define MS_SLAVE (1<<19) /* change to slave */
110#define MS_SHARED (1<<20) /* change to shared */ 110#define MS_SHARED (1<<20) /* change to shared */
111#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
112#define MS_ACTIVE (1<<30) 111#define MS_ACTIVE (1<<30)
113#define MS_NOUSER (1<<31) 112#define MS_NOUSER (1<<31)
114 113
115/* 114/*
116 * Superblock flags that can be altered by MS_REMOUNT 115 * Superblock flags that can be altered by MS_REMOUNT
117 */ 116 */
118#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|\ 117#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)
119 MS_NODIRATIME)
120 118
121/* 119/*
122 * Old magic mount flag and mask 120 * Old magic mount flag and mask
@@ -162,8 +160,6 @@ extern int dir_notify_enable;
162#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 160#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
163#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 161#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
164#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) 162#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
165#define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME))
166#define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME)
167#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) 163#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
168 164
169#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) 165#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
@@ -220,11 +216,13 @@ extern int dir_notify_enable;
220#include <linux/prio_tree.h> 216#include <linux/prio_tree.h>
221#include <linux/init.h> 217#include <linux/init.h>
222#include <linux/sched.h> 218#include <linux/sched.h>
219#include <linux/mutex.h>
223 220
224#include <asm/atomic.h> 221#include <asm/atomic.h>
225#include <asm/semaphore.h> 222#include <asm/semaphore.h>
226#include <asm/byteorder.h> 223#include <asm/byteorder.h>
227 224
225struct hd_geometry;
228struct iovec; 226struct iovec;
229struct nameidata; 227struct nameidata;
230struct kiocb; 228struct kiocb;
@@ -234,9 +232,6 @@ struct kstatfs;
234struct vm_area_struct; 232struct vm_area_struct;
235struct vfsmount; 233struct vfsmount;
236 234
237/* Used to be a macro which just called the function, now just a function */
238extern void update_atime (struct inode *);
239
240extern void __init inode_init(unsigned long); 235extern void __init inode_init(unsigned long);
241extern void __init inode_init_early(void); 236extern void __init inode_init_early(void);
242extern void __init mnt_init(unsigned long); 237extern void __init mnt_init(unsigned long);
@@ -302,6 +297,37 @@ struct iattr {
302 */ 297 */
303#include <linux/quota.h> 298#include <linux/quota.h>
304 299
300/**
301 * enum positive_aop_returns - aop return codes with specific semantics
302 *
303 * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has
304 * completed, that the page is still locked, and
305 * should be considered active. The VM uses this hint
306 * to return the page to the active list -- it won't
307 * be a candidate for writeback again in the near
308 * future. Other callers must be careful to unlock
309 * the page if they get this return. Returned by
310 * writepage();
311 *
312 * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has
313 * unlocked it and the page might have been truncated.
314 * The caller should back up to acquiring a new page and
315 * trying again. The aop will be taking reasonable
316 * precautions not to livelock. If the caller held a page
317 * reference, it should drop it before retrying. Returned
318 * by readpage(), prepare_write(), and commit_write().
319 *
320 * address_space_operation functions return these large constants to indicate
321 * special semantics to the caller. These are much larger than the bytes in a
322 * page to allow for functions that return the number of bytes operated on in a
323 * given page.
324 */
325
326enum positive_aop_returns {
327 AOP_WRITEPAGE_ACTIVATE = 0x80000,
328 AOP_TRUNCATED_PAGE = 0x80001,
329};
330
305/* 331/*
306 * oh the beauties of C type declarations. 332 * oh the beauties of C type declarations.
307 */ 333 */
@@ -453,7 +479,7 @@ struct inode {
453 unsigned long i_blocks; 479 unsigned long i_blocks;
454 unsigned short i_bytes; 480 unsigned short i_bytes;
455 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 481 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
456 struct semaphore i_sem; 482 struct mutex i_mutex;
457 struct rw_semaphore i_alloc_sem; 483 struct rw_semaphore i_alloc_sem;
458 struct inode_operations *i_op; 484 struct inode_operations *i_op;
459 struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 485 struct file_operations *i_fop; /* former ->i_op->default_file_ops */
@@ -622,7 +648,7 @@ extern spinlock_t files_lock;
622#define file_list_lock() spin_lock(&files_lock); 648#define file_list_lock() spin_lock(&files_lock);
623#define file_list_unlock() spin_unlock(&files_lock); 649#define file_list_unlock() spin_unlock(&files_lock);
624 650
625#define get_file(x) rcuref_inc(&(x)->f_count) 651#define get_file(x) atomic_inc(&(x)->f_count)
626#define file_count(x) atomic_read(&(x)->f_count) 652#define file_count(x) atomic_read(&(x)->f_count)
627 653
628#define MAX_NON_LFS ((1UL<<31) - 1) 654#define MAX_NON_LFS ((1UL<<31) - 1)
@@ -729,7 +755,7 @@ extern struct file_lock *posix_test_lock(struct file *, struct file_lock *);
729extern int posix_lock_file(struct file *, struct file_lock *); 755extern int posix_lock_file(struct file *, struct file_lock *);
730extern int posix_lock_file_wait(struct file *, struct file_lock *); 756extern int posix_lock_file_wait(struct file *, struct file_lock *);
731extern void posix_block_lock(struct file_lock *, struct file_lock *); 757extern void posix_block_lock(struct file_lock *, struct file_lock *);
732extern void posix_unblock_lock(struct file *, struct file_lock *); 758extern int posix_unblock_lock(struct file *, struct file_lock *);
733extern int posix_locks_deadlock(struct file_lock *, struct file_lock *); 759extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
734extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 760extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
735extern int __break_lease(struct inode *inode, unsigned int flags); 761extern int __break_lease(struct inode *inode, unsigned int flags);
@@ -777,7 +803,6 @@ struct super_block {
777 struct list_head s_list; /* Keep this first */ 803 struct list_head s_list; /* Keep this first */
778 dev_t s_dev; /* search index; _not_ kdev_t */ 804 dev_t s_dev; /* search index; _not_ kdev_t */
779 unsigned long s_blocksize; 805 unsigned long s_blocksize;
780 unsigned long s_old_blocksize;
781 unsigned char s_blocksize_bits; 806 unsigned char s_blocksize_bits;
782 unsigned char s_dirt; 807 unsigned char s_dirt;
783 unsigned long long s_maxbytes; /* Max file size */ 808 unsigned long long s_maxbytes; /* Max file size */
@@ -790,7 +815,7 @@ struct super_block {
790 unsigned long s_magic; 815 unsigned long s_magic;
791 struct dentry *s_root; 816 struct dentry *s_root;
792 struct rw_semaphore s_umount; 817 struct rw_semaphore s_umount;
793 struct semaphore s_lock; 818 struct mutex s_lock;
794 int s_count; 819 int s_count;
795 int s_syncing; 820 int s_syncing;
796 int s_need_sync_fs; 821 int s_need_sync_fs;
@@ -862,13 +887,13 @@ static inline int has_fs_excl(void)
862static inline void lock_super(struct super_block * sb) 887static inline void lock_super(struct super_block * sb)
863{ 888{
864 get_fs_excl(); 889 get_fs_excl();
865 down(&sb->s_lock); 890 mutex_lock(&sb->s_lock);
866} 891}
867 892
868static inline void unlock_super(struct super_block * sb) 893static inline void unlock_super(struct super_block * sb)
869{ 894{
870 put_fs_excl(); 895 put_fs_excl();
871 up(&sb->s_lock); 896 mutex_unlock(&sb->s_lock);
872} 897}
873 898
874/* 899/*
@@ -932,6 +957,7 @@ struct block_device_operations {
932 int (*direct_access) (struct block_device *, sector_t, unsigned long *); 957 int (*direct_access) (struct block_device *, sector_t, unsigned long *);
933 int (*media_changed) (struct gendisk *); 958 int (*media_changed) (struct gendisk *);
934 int (*revalidate_disk) (struct gendisk *); 959 int (*revalidate_disk) (struct gendisk *);
960 int (*getgeo)(struct block_device *, struct hd_geometry *);
935 struct module *owner; 961 struct module *owner;
936}; 962};
937 963
@@ -1019,6 +1045,7 @@ struct inode_operations {
1019 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); 1045 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1020 ssize_t (*listxattr) (struct dentry *, char *, size_t); 1046 ssize_t (*listxattr) (struct dentry *, char *, size_t);
1021 int (*removexattr) (struct dentry *, const char *); 1047 int (*removexattr) (struct dentry *, const char *);
1048 void (*truncate_range)(struct inode *, loff_t, loff_t);
1022}; 1049};
1023 1050
1024struct seq_file; 1051struct seq_file;
@@ -1085,12 +1112,7 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1085 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1112 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1086} 1113}
1087 1114
1088static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry) 1115extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1089{
1090 /* per-mountpoint checks will go here */
1091 update_atime(dentry->d_inode);
1092}
1093
1094static inline void file_accessed(struct file *file) 1116static inline void file_accessed(struct file *file)
1095{ 1117{
1096 if (!(file->f_flags & O_NOATIME)) 1118 if (!(file->f_flags & O_NOATIME))
@@ -1159,7 +1181,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1159 * directory. The name should be stored in the @name (with the 1181 * directory. The name should be stored in the @name (with the
1160 * understanding that it is already pointing to a a %NAME_MAX+1 sized 1182 * understanding that it is already pointing to a a %NAME_MAX+1 sized
1161 * buffer. get_name() should return %0 on success, a negative error code 1183 * buffer. get_name() should return %0 on success, a negative error code
1162 * or error. @get_name will be called without @parent->i_sem held. 1184 * or error. @get_name will be called without @parent->i_mutex held.
1163 * 1185 *
1164 * get_parent: 1186 * get_parent:
1165 * @get_parent should find the parent directory for the given @child which 1187 * @get_parent should find the parent directory for the given @child which
@@ -1181,7 +1203,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1181 * nfsd_find_fh_dentry() in either the @obj or @parent parameters. 1203 * nfsd_find_fh_dentry() in either the @obj or @parent parameters.
1182 * 1204 *
1183 * Locking rules: 1205 * Locking rules:
1184 * get_parent is called with child->d_inode->i_sem down 1206 * get_parent is called with child->d_inode->i_mutex down
1185 * get_name is not (which is possibly inconsistent) 1207 * get_name is not (which is possibly inconsistent)
1186 */ 1208 */
1187 1209
@@ -1268,6 +1290,9 @@ extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
1268 1290
1269extern int vfs_statfs(struct super_block *, struct kstatfs *); 1291extern int vfs_statfs(struct super_block *, struct kstatfs *);
1270 1292
1293/* /sys/fs */
1294extern struct subsystem fs_subsys;
1295
1271#define FLOCK_VERIFY_READ 1 1296#define FLOCK_VERIFY_READ 1
1272#define FLOCK_VERIFY_WRITE 2 1297#define FLOCK_VERIFY_WRITE 2
1273 1298
@@ -1313,7 +1338,8 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1313 1338
1314/* fs/open.c */ 1339/* fs/open.c */
1315 1340
1316extern int do_truncate(struct dentry *, loff_t start, struct file *filp); 1341extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
1342 struct file *filp);
1317extern long do_sys_open(const char __user *filename, int flags, int mode); 1343extern long do_sys_open(const char __user *filename, int flags, int mode);
1318extern struct file *filp_open(const char *, int, int); 1344extern struct file *filp_open(const char *, int, int);
1319extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1345extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
@@ -1360,6 +1386,12 @@ extern int register_chrdev(unsigned int, const char *,
1360extern int unregister_chrdev(unsigned int, const char *); 1386extern int unregister_chrdev(unsigned int, const char *);
1361extern void unregister_chrdev_region(dev_t, unsigned); 1387extern void unregister_chrdev_region(dev_t, unsigned);
1362extern int chrdev_open(struct inode *, struct file *); 1388extern int chrdev_open(struct inode *, struct file *);
1389extern int get_chrdev_list(char *);
1390extern void *acquire_chrdev_list(void);
1391extern int count_chrdev_list(void);
1392extern void *get_next_chrdev(void *);
1393extern int get_chrdev_info(void *, int *, char **);
1394extern void release_chrdev_list(void *);
1363 1395
1364/* fs/block_dev.c */ 1396/* fs/block_dev.c */
1365#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1397#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
@@ -1368,6 +1400,11 @@ extern const char *bdevname(struct block_device *bdev, char *buffer);
1368extern struct block_device *lookup_bdev(const char *); 1400extern struct block_device *lookup_bdev(const char *);
1369extern struct block_device *open_bdev_excl(const char *, int, void *); 1401extern struct block_device *open_bdev_excl(const char *, int, void *);
1370extern void close_bdev_excl(struct block_device *); 1402extern void close_bdev_excl(struct block_device *);
1403extern void *acquire_blkdev_list(void);
1404extern int count_blkdev_list(void);
1405extern void *get_next_blkdev(void *);
1406extern int get_blkdev_info(void *, int *, char **);
1407extern void release_blkdev_list(void *);
1371 1408
1372extern void init_special_inode(struct inode *, umode_t, dev_t); 1409extern void init_special_inode(struct inode *, umode_t, dev_t);
1373 1410
@@ -1682,7 +1719,7 @@ extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const vo
1682extern int inode_change_ok(struct inode *, struct iattr *); 1719extern int inode_change_ok(struct inode *, struct iattr *);
1683extern int __must_check inode_setattr(struct inode *, struct iattr *); 1720extern int __must_check inode_setattr(struct inode *, struct iattr *);
1684 1721
1685extern void inode_update_time(struct inode *inode, int ctime_too); 1722extern void file_update_time(struct file *file);
1686 1723
1687static inline ino_t parent_ino(struct dentry *dentry) 1724static inline ino_t parent_ino(struct dentry *dentry)
1688{ 1725{
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 934aa9bda481..a9f1cfd096ff 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -50,14 +50,12 @@ struct gianfar_platform_data {
50 50
51 /* board specific information */ 51 /* board specific information */
52 u32 board_flags; 52 u32 board_flags;
53 const char *bus_id; 53 u32 bus_id;
54 u32 phy_id;
54 u8 mac_addr[6]; 55 u8 mac_addr[6];
55}; 56};
56 57
57struct gianfar_mdio_data { 58struct gianfar_mdio_data {
58 /* device specific information */
59 u32 paddr;
60
61 /* board specific information */ 59 /* board specific information */
62 int irq[32]; 60 int irq[32];
63}; 61};
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index b76b558b03d4..528959c52f1b 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -14,7 +14,7 @@
14#define FUSE_KERNEL_VERSION 7 14#define FUSE_KERNEL_VERSION 7
15 15
16/** Minor version number of this interface */ 16/** Minor version number of this interface */
17#define FUSE_KERNEL_MINOR_VERSION 3 17#define FUSE_KERNEL_MINOR_VERSION 5
18 18
19/** The node ID of the root inode */ 19/** The node ID of the root inode */
20#define FUSE_ROOT_ID 1 20#define FUSE_ROOT_ID 1
@@ -53,6 +53,9 @@ struct fuse_kstatfs {
53 __u64 ffree; 53 __u64 ffree;
54 __u32 bsize; 54 __u32 bsize;
55 __u32 namelen; 55 __u32 namelen;
56 __u32 frsize;
57 __u32 padding;
58 __u32 spare[6];
56}; 59};
57 60
58#define FATTR_MODE (1 << 0) 61#define FATTR_MODE (1 << 0)
@@ -105,12 +108,8 @@ enum fuse_opcode {
105 FUSE_CREATE = 35 108 FUSE_CREATE = 35
106}; 109};
107 110
108/* Conservative buffer size for the client */ 111/* The read buffer is required to be at least 8k, but may be much larger */
109#define FUSE_MAX_IN 8192 112#define FUSE_MIN_READ_BUFFER 8192
110
111#define FUSE_NAME_MAX 1024
112#define FUSE_SYMLINK_MAX 4096
113#define FUSE_XATTR_SIZE_MAX 4096
114 113
115struct fuse_entry_out { 114struct fuse_entry_out {
116 __u64 nodeid; /* Inode ID */ 115 __u64 nodeid; /* Inode ID */
@@ -213,6 +212,8 @@ struct fuse_write_out {
213 __u32 padding; 212 __u32 padding;
214}; 213};
215 214
215#define FUSE_COMPAT_STATFS_SIZE 48
216
216struct fuse_statfs_out { 217struct fuse_statfs_out {
217 struct fuse_kstatfs st; 218 struct fuse_kstatfs st;
218}; 219};
@@ -243,9 +244,16 @@ struct fuse_access_in {
243 __u32 padding; 244 __u32 padding;
244}; 245};
245 246
246struct fuse_init_in_out { 247struct fuse_init_in {
248 __u32 major;
249 __u32 minor;
250};
251
252struct fuse_init_out {
247 __u32 major; 253 __u32 major;
248 __u32 minor; 254 __u32 minor;
255 __u32 unused[3];
256 __u32 max_write;
249}; 257};
250 258
251struct fuse_in_header { 259struct fuse_in_header {
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 8b2eab90abb6..20f9148e38d9 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -57,6 +57,7 @@ struct vm_area_struct;
57 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 57 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
58 __GFP_NOMEMALLOC|__GFP_HARDWALL) 58 __GFP_NOMEMALLOC|__GFP_HARDWALL)
59 59
60/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
60#define GFP_ATOMIC (__GFP_HIGH) 61#define GFP_ATOMIC (__GFP_HIGH)
61#define GFP_NOIO (__GFP_WAIT) 62#define GFP_NOIO (__GFP_WAIT)
62#define GFP_NOFS (__GFP_WAIT | __GFP_IO) 63#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
@@ -109,6 +110,10 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
109 if (unlikely(order >= MAX_ORDER)) 110 if (unlikely(order >= MAX_ORDER))
110 return NULL; 111 return NULL;
111 112
113 /* Unknown node is current node */
114 if (nid < 0)
115 nid = numa_node_id();
116
112 return __alloc_pages(gfp_mask, order, 117 return __alloc_pages(gfp_mask, order,
113 NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask)); 118 NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
114} 119}
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 71d2b8a723b9..eab537091f2a 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -93,10 +93,6 @@ extern void synchronize_irq(unsigned int irq);
93struct task_struct; 93struct task_struct;
94 94
95#ifndef CONFIG_VIRT_CPU_ACCOUNTING 95#ifndef CONFIG_VIRT_CPU_ACCOUNTING
96static inline void account_user_vtime(struct task_struct *tsk)
97{
98}
99
100static inline void account_system_vtime(struct task_struct *tsk) 96static inline void account_system_vtime(struct task_struct *tsk)
101{ 97{
102} 98}
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
new file mode 100644
index 000000000000..089bfb1fa01a
--- /dev/null
+++ b/include/linux/hrtimer.h
@@ -0,0 +1,139 @@
1/*
2 * include/linux/hrtimer.h
3 *
4 * hrtimers - High-resolution kernel timers
5 *
6 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de>
7 * Copyright(C) 2005, Red Hat, Inc., Ingo Molnar
8 *
9 * data type definitions, declarations, prototypes
10 *
11 * Started by: Thomas Gleixner and Ingo Molnar
12 *
13 * For licencing details see kernel-base/COPYING
14 */
15#ifndef _LINUX_HRTIMER_H
16#define _LINUX_HRTIMER_H
17
18#include <linux/rbtree.h>
19#include <linux/ktime.h>
20#include <linux/init.h>
21#include <linux/list.h>
22#include <linux/wait.h>
23
24/*
25 * Mode arguments of xxx_hrtimer functions:
26 */
27enum hrtimer_mode {
28 HRTIMER_ABS, /* Time value is absolute */
29 HRTIMER_REL, /* Time value is relative to now */
30};
31
32enum hrtimer_restart {
33 HRTIMER_NORESTART,
34 HRTIMER_RESTART,
35};
36
37/*
38 * Timer states:
39 */
40enum hrtimer_state {
41 HRTIMER_INACTIVE, /* Timer is inactive */
42 HRTIMER_EXPIRED, /* Timer is expired */
43 HRTIMER_PENDING, /* Timer is pending */
44};
45
46struct hrtimer_base;
47
48/**
49 * struct hrtimer - the basic hrtimer structure
50 *
51 * @node: red black tree node for time ordered insertion
52 * @expires: the absolute expiry time in the hrtimers internal
53 * representation. The time is related to the clock on
54 * which the timer is based.
55 * @state: state of the timer
56 * @function: timer expiry callback function
57 * @data: argument for the callback function
58 * @base: pointer to the timer base (per cpu and per clock)
59 *
60 * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE()
61 */
62struct hrtimer {
63 struct rb_node node;
64 ktime_t expires;
65 enum hrtimer_state state;
66 int (*function)(void *);
67 void *data;
68 struct hrtimer_base *base;
69};
70
71/**
72 * struct hrtimer_base - the timer base for a specific clock
73 *
74 * @index: clock type index for per_cpu support when moving a timer
75 * to a base on another cpu.
76 * @lock: lock protecting the base and associated timers
77 * @active: red black tree root node for the active timers
78 * @first: pointer to the timer node which expires first
79 * @resolution: the resolution of the clock, in nanoseconds
80 * @get_time: function to retrieve the current time of the clock
81 * @curr_timer: the timer which is executing a callback right now
82 */
83struct hrtimer_base {
84 clockid_t index;
85 spinlock_t lock;
86 struct rb_root active;
87 struct rb_node *first;
88 ktime_t resolution;
89 ktime_t (*get_time)(void);
90 struct hrtimer *curr_timer;
91};
92
93/*
94 * clock_was_set() is a NOP for non- high-resolution systems. The
95 * time-sorted order guarantees that a timer does not expire early and
96 * is expired in the next softirq when the clock was advanced.
97 */
98#define clock_was_set() do { } while (0)
99
100/* Exported timer functions: */
101
102/* Initialize timers: */
103extern void hrtimer_init(struct hrtimer *timer, const clockid_t which_clock);
104extern void hrtimer_rebase(struct hrtimer *timer, const clockid_t which_clock);
105
106
107/* Basic timer operations: */
108extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
109 const enum hrtimer_mode mode);
110extern int hrtimer_cancel(struct hrtimer *timer);
111extern int hrtimer_try_to_cancel(struct hrtimer *timer);
112
113#define hrtimer_restart(timer) hrtimer_start((timer), (timer)->expires, HRTIMER_ABS)
114
115/* Query timers: */
116extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer);
117extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp);
118
119static inline int hrtimer_active(const struct hrtimer *timer)
120{
121 return timer->state == HRTIMER_PENDING;
122}
123
124/* Forward a hrtimer so it expires after now: */
125extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval);
126
127/* Precise sleep: */
128extern long hrtimer_nanosleep(struct timespec *rqtp,
129 struct timespec __user *rmtp,
130 const enum hrtimer_mode mode,
131 const clockid_t clockid);
132
133/* Soft interrupt function to run the hrtimer queues: */
134extern void hrtimer_run_queues(void);
135
136/* Bootup initialization: */
137extern void __init hrtimers_init(void);
138
139#endif
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 1056717ee501..68d82ad6b17c 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -22,7 +22,7 @@ int hugetlb_report_meminfo(char *);
22int hugetlb_report_node_meminfo(int, char *); 22int hugetlb_report_node_meminfo(int, char *);
23int is_hugepage_mem_enough(size_t); 23int is_hugepage_mem_enough(size_t);
24unsigned long hugetlb_total_pages(void); 24unsigned long hugetlb_total_pages(void);
25struct page *alloc_huge_page(void); 25struct page *alloc_huge_page(struct vm_area_struct *, unsigned long);
26void free_huge_page(struct page *); 26void free_huge_page(struct page *);
27int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 27int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
28 unsigned long address, int write_access); 28 unsigned long address, int write_access);
@@ -97,7 +97,7 @@ static inline unsigned long hugetlb_total_pages(void)
97#define is_hugepage_only_range(mm, addr, len) 0 97#define is_hugepage_only_range(mm, addr, len) 0
98#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 98#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \
99 do { } while (0) 99 do { } while (0)
100#define alloc_huge_page() ({ NULL; }) 100#define alloc_huge_page(vma, addr) ({ NULL; })
101#define free_huge_page(p) ({ (void)(p); BUG(); }) 101#define free_huge_page(p) ({ (void)(p); BUG(); })
102#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) 102#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; })
103 103
diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h
index cd4b7a042b86..f346e4d5381c 100644
--- a/include/linux/hwmon-vid.h
+++ b/include/linux/hwmon-vid.h
@@ -23,14 +23,14 @@
23#ifndef _LINUX_HWMON_VID_H 23#ifndef _LINUX_HWMON_VID_H
24#define _LINUX_HWMON_VID_H 24#define _LINUX_HWMON_VID_H
25 25
26int vid_from_reg(int val, int vrm); 26int vid_from_reg(int val, u8 vrm);
27int vid_which_vrm(void); 27u8 vid_which_vrm(void);
28 28
29/* vrm is the VRM/VRD document version multiplied by 10. 29/* vrm is the VRM/VRD document version multiplied by 10.
30 val is in mV to avoid floating point in the kernel. 30 val is in mV to avoid floating point in the kernel.
31 Returned value is the 4-, 5- or 6-bit VID code. 31 Returned value is the 4-, 5- or 6-bit VID code.
32 Note that only VRM 9.x is supported for now. */ 32 Note that only VRM 9.x is supported for now. */
33static inline int vid_to_reg(int val, int vrm) 33static inline int vid_to_reg(int val, u8 vrm)
34{ 34{
35 switch (vrm) { 35 switch (vrm) {
36 case 91: /* VRM 9.1 */ 36 case 91: /* VRM 9.1 */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 006c81ef4d50..474c8f4f5d4f 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -25,12 +25,6 @@
25 25
26/* 26/*
27 * ---- Driver types ----------------------------------------------------- 27 * ---- Driver types -----------------------------------------------------
28 * device id name + number function description, i2c address(es)
29 *
30 * Range 1000-1999 range is defined in sensors/sensors.h
31 * Range 0x100 - 0x1ff is for V4L2 Common Components
32 * Range 0xf000 - 0xffff is reserved for local experimentation, and should
33 * never be used in official drivers
34 */ 28 */
35 29
36#define I2C_DRIVERID_MSP3400 1 30#define I2C_DRIVERID_MSP3400 1
@@ -109,14 +103,13 @@
109#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 103#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
110#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ 104#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */
111#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ 105#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
112 106#define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */
113#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ 107#define I2C_DRIVERID_WM8739 77 /* wm8739 audio processor */
114#define I2C_DRIVERID_EXP1 0xF1 108#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */
115#define I2C_DRIVERID_EXP2 0xF2 109#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
116#define I2C_DRIVERID_EXP3 0xF3 110#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
117 111
118#define I2C_DRIVERID_I2CDEV 900 112#define I2C_DRIVERID_I2CDEV 900
119#define I2C_DRIVERID_I2CPROC 901
120#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 113#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
121#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ 114#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */
122 115
@@ -131,15 +124,12 @@
131#define I2C_DRIVERID_ADM1021 1008 124#define I2C_DRIVERID_ADM1021 1008
132#define I2C_DRIVERID_ADM9240 1009 125#define I2C_DRIVERID_ADM9240 1009
133#define I2C_DRIVERID_LTC1710 1010 126#define I2C_DRIVERID_LTC1710 1010
134#define I2C_DRIVERID_SIS5595 1011
135#define I2C_DRIVERID_ICSPLL 1012 127#define I2C_DRIVERID_ICSPLL 1012
136#define I2C_DRIVERID_BT869 1013 128#define I2C_DRIVERID_BT869 1013
137#define I2C_DRIVERID_MAXILIFE 1014 129#define I2C_DRIVERID_MAXILIFE 1014
138#define I2C_DRIVERID_MATORB 1015 130#define I2C_DRIVERID_MATORB 1015
139#define I2C_DRIVERID_GL520 1016 131#define I2C_DRIVERID_GL520 1016
140#define I2C_DRIVERID_THMC50 1017 132#define I2C_DRIVERID_THMC50 1017
141#define I2C_DRIVERID_DDCMON 1018
142#define I2C_DRIVERID_VIA686A 1019
143#define I2C_DRIVERID_ADM1025 1020 133#define I2C_DRIVERID_ADM1025 1020
144#define I2C_DRIVERID_LM87 1021 134#define I2C_DRIVERID_LM87 1021
145#define I2C_DRIVERID_PCF8574 1022 135#define I2C_DRIVERID_PCF8574 1022
@@ -151,21 +141,16 @@
151#define I2C_DRIVERID_FSCPOS 1028 141#define I2C_DRIVERID_FSCPOS 1028
152#define I2C_DRIVERID_FSCSCY 1029 142#define I2C_DRIVERID_FSCSCY 1029
153#define I2C_DRIVERID_PCF8591 1030 143#define I2C_DRIVERID_PCF8591 1030
154#define I2C_DRIVERID_SMSC47M1 1031
155#define I2C_DRIVERID_VT1211 1032
156#define I2C_DRIVERID_LM92 1033 144#define I2C_DRIVERID_LM92 1033
157#define I2C_DRIVERID_VT8231 1034
158#define I2C_DRIVERID_SMARTBATT 1035 145#define I2C_DRIVERID_SMARTBATT 1035
159#define I2C_DRIVERID_BMCSENSORS 1036 146#define I2C_DRIVERID_BMCSENSORS 1036
160#define I2C_DRIVERID_FS451 1037 147#define I2C_DRIVERID_FS451 1037
161#define I2C_DRIVERID_W83627HF 1038
162#define I2C_DRIVERID_LM85 1039 148#define I2C_DRIVERID_LM85 1039
163#define I2C_DRIVERID_LM83 1040 149#define I2C_DRIVERID_LM83 1040
164#define I2C_DRIVERID_LM90 1042 150#define I2C_DRIVERID_LM90 1042
165#define I2C_DRIVERID_ASB100 1043 151#define I2C_DRIVERID_ASB100 1043
166#define I2C_DRIVERID_FSCHER 1046 152#define I2C_DRIVERID_FSCHER 1046
167#define I2C_DRIVERID_W83L785TS 1047 153#define I2C_DRIVERID_W83L785TS 1047
168#define I2C_DRIVERID_SMSC47B397 1050
169 154
170/* 155/*
171 * ---- Adapter types ---------------------------------------------------- 156 * ---- Adapter types ----------------------------------------------------
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 5e19a7ba69b2..7863a59bd598 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -105,14 +105,14 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
105 * A driver is capable of handling one or more physical devices present on 105 * A driver is capable of handling one or more physical devices present on
106 * I2C adapters. This information is used to inform the driver of adapter 106 * I2C adapters. This information is used to inform the driver of adapter
107 * events. 107 * events.
108 *
109 * The driver.owner field should be set to the module owner of this driver.
110 * The driver.name field should be set to the name of this driver.
108 */ 111 */
109 112
110struct i2c_driver { 113struct i2c_driver {
111 struct module *owner;
112 char name[32];
113 int id; 114 int id;
114 unsigned int class; 115 unsigned int class;
115 unsigned int flags; /* div., see below */
116 116
117 /* Notifies the driver that a new bus has appeared. This routine 117 /* Notifies the driver that a new bus has appeared. This routine
118 * can be used by the driver to test if the bus meets its conditions 118 * can be used by the driver to test if the bus meets its conditions
@@ -250,18 +250,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
250 dev_set_drvdata (&dev->dev, data); 250 dev_set_drvdata (&dev->dev, data);
251} 251}
252 252
253/*flags for the driver struct: */
254#define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */
255#if 0
256/* this flag is gone -- there is a (optional) driver->detach_adapter
257 * callback now which can be used instead */
258# define I2C_DF_DUMMY 0x02
259#endif
260
261/*flags for the client struct: */ 253/*flags for the client struct: */
262#define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */
263#define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */
264 /* on an i2c_client */
265#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ 254#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
266#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ 255#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
267 /* Must equal I2C_M_TEN below */ 256 /* Must equal I2C_M_TEN below */
@@ -302,26 +291,20 @@ struct i2c_client_address_data {
302extern int i2c_add_adapter(struct i2c_adapter *); 291extern int i2c_add_adapter(struct i2c_adapter *);
303extern int i2c_del_adapter(struct i2c_adapter *); 292extern int i2c_del_adapter(struct i2c_adapter *);
304 293
305extern int i2c_add_driver(struct i2c_driver *); 294extern int i2c_register_driver(struct module *, struct i2c_driver *);
306extern int i2c_del_driver(struct i2c_driver *); 295extern int i2c_del_driver(struct i2c_driver *);
307 296
297static inline int i2c_add_driver(struct i2c_driver *driver)
298{
299 return i2c_register_driver(THIS_MODULE, driver);
300}
301
308extern int i2c_attach_client(struct i2c_client *); 302extern int i2c_attach_client(struct i2c_client *);
309extern int i2c_detach_client(struct i2c_client *); 303extern int i2c_detach_client(struct i2c_client *);
310 304
311/* New function: This is to get an i2c_client-struct for controlling the 305/* Should be used to make sure that client-struct is valid and that it
312 client either by using i2c_control-function or having the 306 is okay to access the i2c-client.
313 client-module export functions that can be used with the i2c_client 307 returns -ENODEV if client has gone in the meantime */
314 -struct. */
315extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id,
316 struct i2c_client *prev);
317
318/* Should be used with new function
319 extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *);
320 to make sure that client-struct is valid and that it is okay to access
321 the i2c-client.
322 returns -EACCES if client doesn't allow use (default)
323 returns -EBUSY if client doesn't allow multiple use (default) and
324 usage_count >0 */
325extern int i2c_use_client(struct i2c_client *); 308extern int i2c_use_client(struct i2c_client *);
326extern int i2c_release_client(struct i2c_client *); 309extern int i2c_release_client(struct i2c_client *);
327 310
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index d79c8a4bc4f8..9ba806796667 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -30,6 +30,7 @@
30#include <linux/string.h> 30#include <linux/string.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/workqueue.h> /* work_struct */ 32#include <linux/workqueue.h> /* work_struct */
33#include <linux/mempool.h>
33 34
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/semaphore.h> /* Needed for MUTEX init macros */ 36#include <asm/semaphore.h> /* Needed for MUTEX init macros */
@@ -38,6 +39,355 @@
38#define I2O_QUEUE_EMPTY 0xffffffff 39#define I2O_QUEUE_EMPTY 0xffffffff
39 40
40/* 41/*
42 * Cache strategies
43 */
44
45/* The NULL strategy leaves everything up to the controller. This tends to be a
46 * pessimal but functional choice.
47 */
48#define CACHE_NULL 0
49/* Prefetch data when reading. We continually attempt to load the next 32 sectors
50 * into the controller cache.
51 */
52#define CACHE_PREFETCH 1
53/* Prefetch data when reading. We sometimes attempt to load the next 32 sectors
54 * into the controller cache. When an I/O is less <= 8K we assume its probably
55 * not sequential and don't prefetch (default)
56 */
57#define CACHE_SMARTFETCH 2
58/* Data is written to the cache and then out on to the disk. The I/O must be
59 * physically on the medium before the write is acknowledged (default without
60 * NVRAM)
61 */
62#define CACHE_WRITETHROUGH 17
63/* Data is written to the cache and then out on to the disk. The controller
64 * is permitted to write back the cache any way it wants. (default if battery
65 * backed NVRAM is present). It can be useful to set this for swap regardless of
66 * battery state.
67 */
68#define CACHE_WRITEBACK 18
69/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
70 * write large I/O's directly to disk bypassing the cache to avoid the extra
71 * memory copy hits. Small writes are writeback cached
72 */
73#define CACHE_SMARTBACK 19
74/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
75 * write large I/O's directly to disk bypassing the cache to avoid the extra
76 * memory copy hits. Small writes are writethrough cached. Suitable for devices
77 * lacking battery backup
78 */
79#define CACHE_SMARTTHROUGH 20
80
81/*
82 * Ioctl structures
83 */
84
85#define BLKI2OGRSTRAT _IOR('2', 1, int)
86#define BLKI2OGWSTRAT _IOR('2', 2, int)
87#define BLKI2OSRSTRAT _IOW('2', 3, int)
88#define BLKI2OSWSTRAT _IOW('2', 4, int)
89
90/*
91 * I2O Function codes
92 */
93
94/*
95 * Executive Class
96 */
97#define I2O_CMD_ADAPTER_ASSIGN 0xB3
98#define I2O_CMD_ADAPTER_READ 0xB2
99#define I2O_CMD_ADAPTER_RELEASE 0xB5
100#define I2O_CMD_BIOS_INFO_SET 0xA5
101#define I2O_CMD_BOOT_DEVICE_SET 0xA7
102#define I2O_CMD_CONFIG_VALIDATE 0xBB
103#define I2O_CMD_CONN_SETUP 0xCA
104#define I2O_CMD_DDM_DESTROY 0xB1
105#define I2O_CMD_DDM_ENABLE 0xD5
106#define I2O_CMD_DDM_QUIESCE 0xC7
107#define I2O_CMD_DDM_RESET 0xD9
108#define I2O_CMD_DDM_SUSPEND 0xAF
109#define I2O_CMD_DEVICE_ASSIGN 0xB7
110#define I2O_CMD_DEVICE_RELEASE 0xB9
111#define I2O_CMD_HRT_GET 0xA8
112#define I2O_CMD_ADAPTER_CLEAR 0xBE
113#define I2O_CMD_ADAPTER_CONNECT 0xC9
114#define I2O_CMD_ADAPTER_RESET 0xBD
115#define I2O_CMD_LCT_NOTIFY 0xA2
116#define I2O_CMD_OUTBOUND_INIT 0xA1
117#define I2O_CMD_PATH_ENABLE 0xD3
118#define I2O_CMD_PATH_QUIESCE 0xC5
119#define I2O_CMD_PATH_RESET 0xD7
120#define I2O_CMD_STATIC_MF_CREATE 0xDD
121#define I2O_CMD_STATIC_MF_RELEASE 0xDF
122#define I2O_CMD_STATUS_GET 0xA0
123#define I2O_CMD_SW_DOWNLOAD 0xA9
124#define I2O_CMD_SW_UPLOAD 0xAB
125#define I2O_CMD_SW_REMOVE 0xAD
126#define I2O_CMD_SYS_ENABLE 0xD1
127#define I2O_CMD_SYS_MODIFY 0xC1
128#define I2O_CMD_SYS_QUIESCE 0xC3
129#define I2O_CMD_SYS_TAB_SET 0xA3
130
131/*
132 * Utility Class
133 */
134#define I2O_CMD_UTIL_NOP 0x00
135#define I2O_CMD_UTIL_ABORT 0x01
136#define I2O_CMD_UTIL_CLAIM 0x09
137#define I2O_CMD_UTIL_RELEASE 0x0B
138#define I2O_CMD_UTIL_PARAMS_GET 0x06
139#define I2O_CMD_UTIL_PARAMS_SET 0x05
140#define I2O_CMD_UTIL_EVT_REGISTER 0x13
141#define I2O_CMD_UTIL_EVT_ACK 0x14
142#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
143#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
144#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
145#define I2O_CMD_UTIL_LOCK 0x17
146#define I2O_CMD_UTIL_LOCK_RELEASE 0x19
147#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
148
149/*
150 * SCSI Host Bus Adapter Class
151 */
152#define I2O_CMD_SCSI_EXEC 0x81
153#define I2O_CMD_SCSI_ABORT 0x83
154#define I2O_CMD_SCSI_BUSRESET 0x27
155
156/*
157 * Bus Adapter Class
158 */
159#define I2O_CMD_BUS_ADAPTER_RESET 0x85
160#define I2O_CMD_BUS_RESET 0x87
161#define I2O_CMD_BUS_SCAN 0x89
162#define I2O_CMD_BUS_QUIESCE 0x8b
163
164/*
165 * Random Block Storage Class
166 */
167#define I2O_CMD_BLOCK_READ 0x30
168#define I2O_CMD_BLOCK_WRITE 0x31
169#define I2O_CMD_BLOCK_CFLUSH 0x37
170#define I2O_CMD_BLOCK_MLOCK 0x49
171#define I2O_CMD_BLOCK_MUNLOCK 0x4B
172#define I2O_CMD_BLOCK_MMOUNT 0x41
173#define I2O_CMD_BLOCK_MEJECT 0x43
174#define I2O_CMD_BLOCK_POWER 0x70
175
176#define I2O_CMD_PRIVATE 0xFF
177
178/* Command status values */
179
180#define I2O_CMD_IN_PROGRESS 0x01
181#define I2O_CMD_REJECTED 0x02
182#define I2O_CMD_FAILED 0x03
183#define I2O_CMD_COMPLETED 0x04
184
185/* I2O API function return values */
186
187#define I2O_RTN_NO_ERROR 0
188#define I2O_RTN_NOT_INIT 1
189#define I2O_RTN_FREE_Q_EMPTY 2
190#define I2O_RTN_TCB_ERROR 3
191#define I2O_RTN_TRANSACTION_ERROR 4
192#define I2O_RTN_ADAPTER_ALREADY_INIT 5
193#define I2O_RTN_MALLOC_ERROR 6
194#define I2O_RTN_ADPTR_NOT_REGISTERED 7
195#define I2O_RTN_MSG_REPLY_TIMEOUT 8
196#define I2O_RTN_NO_STATUS 9
197#define I2O_RTN_NO_FIRM_VER 10
198#define I2O_RTN_NO_LINK_SPEED 11
199
200/* Reply message status defines for all messages */
201
202#define I2O_REPLY_STATUS_SUCCESS 0x00
203#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
204#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
205#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
206#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
207#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
208#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
209#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
210#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
211#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
212#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
213#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
214
215/* Status codes and Error Information for Parameter functions */
216
217#define I2O_PARAMS_STATUS_SUCCESS 0x00
218#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
219#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
220#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
221#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
222#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
223#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
224#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
225#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
226#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
227#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
228#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
229#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
230#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
231#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
232#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
233#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
234
235/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
236 * messages: Table 3-2 Detailed Status Codes.*/
237
238#define I2O_DSC_SUCCESS 0x0000
239#define I2O_DSC_BAD_KEY 0x0002
240#define I2O_DSC_TCL_ERROR 0x0003
241#define I2O_DSC_REPLY_BUFFER_FULL 0x0004
242#define I2O_DSC_NO_SUCH_PAGE 0x0005
243#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
244#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
245#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
246#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
247#define I2O_DSC_DEVICE_LOCKED 0x000B
248#define I2O_DSC_DEVICE_RESET 0x000C
249#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
250#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
251#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
252#define I2O_DSC_INVALID_OFFSET 0x0010
253#define I2O_DSC_INVALID_PARAMETER 0x0011
254#define I2O_DSC_INVALID_REQUEST 0x0012
255#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
256#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
257#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
258#define I2O_DSC_MISSING_PARAMETER 0x0016
259#define I2O_DSC_TIMEOUT 0x0017
260#define I2O_DSC_UNKNOWN_ERROR 0x0018
261#define I2O_DSC_UNKNOWN_FUNCTION 0x0019
262#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
263#define I2O_DSC_DEVICE_BUSY 0x001B
264#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
265
266/* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
267 Status Codes.*/
268
269#define I2O_BSA_DSC_SUCCESS 0x0000
270#define I2O_BSA_DSC_MEDIA_ERROR 0x0001
271#define I2O_BSA_DSC_ACCESS_ERROR 0x0002
272#define I2O_BSA_DSC_DEVICE_FAILURE 0x0003
273#define I2O_BSA_DSC_DEVICE_NOT_READY 0x0004
274#define I2O_BSA_DSC_MEDIA_NOT_PRESENT 0x0005
275#define I2O_BSA_DSC_MEDIA_LOCKED 0x0006
276#define I2O_BSA_DSC_MEDIA_FAILURE 0x0007
277#define I2O_BSA_DSC_PROTOCOL_FAILURE 0x0008
278#define I2O_BSA_DSC_BUS_FAILURE 0x0009
279#define I2O_BSA_DSC_ACCESS_VIOLATION 0x000A
280#define I2O_BSA_DSC_WRITE_PROTECTED 0x000B
281#define I2O_BSA_DSC_DEVICE_RESET 0x000C
282#define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
283#define I2O_BSA_DSC_TIMEOUT 0x000E
284
285/* FailureStatusCodes, Table 3-3 Message Failure Codes */
286
287#define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED 0x81
288#define I2O_FSC_TRANSPORT_SERVICE_TERMINATED 0x82
289#define I2O_FSC_TRANSPORT_CONGESTION 0x83
290#define I2O_FSC_TRANSPORT_FAILURE 0x84
291#define I2O_FSC_TRANSPORT_STATE_ERROR 0x85
292#define I2O_FSC_TRANSPORT_TIME_OUT 0x86
293#define I2O_FSC_TRANSPORT_ROUTING_FAILURE 0x87
294#define I2O_FSC_TRANSPORT_INVALID_VERSION 0x88
295#define I2O_FSC_TRANSPORT_INVALID_OFFSET 0x89
296#define I2O_FSC_TRANSPORT_INVALID_MSG_FLAGS 0x8A
297#define I2O_FSC_TRANSPORT_FRAME_TOO_SMALL 0x8B
298#define I2O_FSC_TRANSPORT_FRAME_TOO_LARGE 0x8C
299#define I2O_FSC_TRANSPORT_INVALID_TARGET_ID 0x8D
300#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_ID 0x8E
301#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F
302#define I2O_FSC_TRANSPORT_UNKNOWN_FAILURE 0xFF
303
304/* Device Claim Types */
305#define I2O_CLAIM_PRIMARY 0x01000000
306#define I2O_CLAIM_MANAGEMENT 0x02000000
307#define I2O_CLAIM_AUTHORIZED 0x03000000
308#define I2O_CLAIM_SECONDARY 0x04000000
309
310/* Message header defines for VersionOffset */
311#define I2OVER15 0x0001
312#define I2OVER20 0x0002
313
314/* Default is 1.5 */
315#define I2OVERSION I2OVER15
316
317#define SGL_OFFSET_0 I2OVERSION
318#define SGL_OFFSET_4 (0x0040 | I2OVERSION)
319#define SGL_OFFSET_5 (0x0050 | I2OVERSION)
320#define SGL_OFFSET_6 (0x0060 | I2OVERSION)
321#define SGL_OFFSET_7 (0x0070 | I2OVERSION)
322#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
323#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
324#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
325#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
326#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
327#define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
328
329/* Transaction Reply Lists (TRL) Control Word structure */
330#define TRL_SINGLE_FIXED_LENGTH 0x00
331#define TRL_SINGLE_VARIABLE_LENGTH 0x40
332#define TRL_MULTIPLE_FIXED_LENGTH 0x80
333
334 /* msg header defines for MsgFlags */
335#define MSG_STATIC 0x0100
336#define MSG_64BIT_CNTXT 0x0200
337#define MSG_MULTI_TRANS 0x1000
338#define MSG_FAIL 0x2000
339#define MSG_FINAL 0x4000
340#define MSG_REPLY 0x8000
341
342 /* minimum size msg */
343#define THREE_WORD_MSG_SIZE 0x00030000
344#define FOUR_WORD_MSG_SIZE 0x00040000
345#define FIVE_WORD_MSG_SIZE 0x00050000
346#define SIX_WORD_MSG_SIZE 0x00060000
347#define SEVEN_WORD_MSG_SIZE 0x00070000
348#define EIGHT_WORD_MSG_SIZE 0x00080000
349#define NINE_WORD_MSG_SIZE 0x00090000
350#define TEN_WORD_MSG_SIZE 0x000A0000
351#define ELEVEN_WORD_MSG_SIZE 0x000B0000
352#define I2O_MESSAGE_SIZE(x) ((x)<<16)
353
354/* special TID assignments */
355#define ADAPTER_TID 0
356#define HOST_TID 1
357
358/* outbound queue defines */
359#define I2O_MAX_OUTBOUND_MSG_FRAMES 128
360#define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
361
362/* inbound queue definitions */
363#define I2O_MSG_INPOOL_MIN 32
364#define I2O_INBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
365
366#define I2O_POST_WAIT_OK 0
367#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
368
369#define I2O_CONTEXT_LIST_MIN_LENGTH 15
370#define I2O_CONTEXT_LIST_USED 0x01
371#define I2O_CONTEXT_LIST_DELETED 0x02
372
373/* timeouts */
374#define I2O_TIMEOUT_INIT_OUTBOUND_QUEUE 15
375#define I2O_TIMEOUT_MESSAGE_GET 5
376#define I2O_TIMEOUT_RESET 30
377#define I2O_TIMEOUT_STATUS_GET 5
378#define I2O_TIMEOUT_LCT_GET 360
379#define I2O_TIMEOUT_SCSI_SCB_ABORT 240
380
381/* retries */
382#define I2O_HRT_GET_TRIES 3
383#define I2O_LCT_GET_TRIES 3
384
385/* defines for max_sectors and max_phys_segments */
386#define I2O_MAX_SECTORS 1024
387#define I2O_MAX_SECTORS_LIMITED 128
388#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
389
390/*
41 * Message structures 391 * Message structures
42 */ 392 */
43struct i2o_message { 393struct i2o_message {
@@ -58,6 +408,12 @@ struct i2o_message {
58 u32 body[0]; 408 u32 body[0];
59}; 409};
60 410
411/* MFA and I2O message used by mempool */
412struct i2o_msg_mfa {
413 u32 mfa; /* MFA returned by the controller */
414 struct i2o_message msg; /* I2O message */
415};
416
61/* 417/*
62 * Each I2O device entity has one of these. There is one per device. 418 * Each I2O device entity has one of these. There is one per device.
63 */ 419 */
@@ -130,6 +486,15 @@ struct i2o_dma {
130}; 486};
131 487
132/* 488/*
489 * Contains slab cache and mempool information
490 */
491struct i2o_pool {
492 char *name;
493 kmem_cache_t *slab;
494 mempool_t *mempool;
495};
496
497/*
133 * Contains IO mapped address information 498 * Contains IO mapped address information
134 */ 499 */
135struct i2o_io { 500struct i2o_io {
@@ -174,8 +539,6 @@ struct i2o_controller {
174 void __iomem *irq_status; /* Interrupt status register address */ 539 void __iomem *irq_status; /* Interrupt status register address */
175 void __iomem *irq_mask; /* Interrupt mask register address */ 540 void __iomem *irq_mask; /* Interrupt mask register address */
176 541
177 /* Dynamic LCT related data */
178
179 struct i2o_dma status; /* IOP status block */ 542 struct i2o_dma status; /* IOP status block */
180 543
181 struct i2o_dma hrt; /* HW Resource Table */ 544 struct i2o_dma hrt; /* HW Resource Table */
@@ -188,6 +551,8 @@ struct i2o_controller {
188 struct i2o_io in_queue; /* inbound message queue Host->IOP */ 551 struct i2o_io in_queue; /* inbound message queue Host->IOP */
189 struct i2o_dma out_queue; /* outbound message queue IOP->Host */ 552 struct i2o_dma out_queue; /* outbound message queue IOP->Host */
190 553
554 struct i2o_pool in_msg; /* mempool for inbound messages */
555
191 unsigned int battery:1; /* Has a battery backup */ 556 unsigned int battery:1; /* Has a battery backup */
192 unsigned int io_alloc:1; /* An I/O resource was allocated */ 557 unsigned int io_alloc:1; /* An I/O resource was allocated */
193 unsigned int mem_alloc:1; /* A memory resource was allocated */ 558 unsigned int mem_alloc:1; /* A memory resource was allocated */
@@ -196,7 +561,6 @@ struct i2o_controller {
196 struct resource mem_resource; /* Mem resource allocated to the IOP */ 561 struct resource mem_resource; /* Mem resource allocated to the IOP */
197 562
198 struct device device; 563 struct device device;
199 struct class_device *classdev; /* I2O controller class device */
200 struct i2o_device *exec; /* Executive */ 564 struct i2o_device *exec; /* Executive */
201#if BITS_PER_LONG == 64 565#if BITS_PER_LONG == 64
202 spinlock_t context_list_lock; /* lock for context_list */ 566 spinlock_t context_list_lock; /* lock for context_list */
@@ -247,16 +611,13 @@ struct i2o_sys_tbl {
247extern struct list_head i2o_controllers; 611extern struct list_head i2o_controllers;
248 612
249/* Message functions */ 613/* Message functions */
250static inline u32 i2o_msg_get(struct i2o_controller *, 614static inline struct i2o_message *i2o_msg_get(struct i2o_controller *);
251 struct i2o_message __iomem **); 615extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int);
252extern u32 i2o_msg_get_wait(struct i2o_controller *, 616static inline void i2o_msg_post(struct i2o_controller *, struct i2o_message *);
253 struct i2o_message __iomem **, int); 617static inline int i2o_msg_post_wait(struct i2o_controller *,
254static inline void i2o_msg_post(struct i2o_controller *, u32); 618 struct i2o_message *, unsigned long);
255static inline int i2o_msg_post_wait(struct i2o_controller *, u32, 619extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *,
256 unsigned long); 620 unsigned long, struct i2o_dma *);
257extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long,
258 struct i2o_dma *);
259extern void i2o_msg_nop(struct i2o_controller *, u32);
260static inline void i2o_flush_reply(struct i2o_controller *, u32); 621static inline void i2o_flush_reply(struct i2o_controller *, u32);
261 622
262/* IOP functions */ 623/* IOP functions */
@@ -384,10 +745,10 @@ static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
384static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr, 745static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
385 size_t size, 746 size_t size,
386 enum dma_data_direction direction, 747 enum dma_data_direction direction,
387 u32 __iomem ** sg_ptr) 748 u32 ** sg_ptr)
388{ 749{
389 u32 sg_flags; 750 u32 sg_flags;
390 u32 __iomem *mptr = *sg_ptr; 751 u32 *mptr = *sg_ptr;
391 dma_addr_t dma_addr; 752 dma_addr_t dma_addr;
392 753
393 switch (direction) { 754 switch (direction) {
@@ -405,16 +766,16 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
405 if (!dma_mapping_error(dma_addr)) { 766 if (!dma_mapping_error(dma_addr)) {
406#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 767#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
407 if ((sizeof(dma_addr_t) > 4) && c->pae_support) { 768 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
408 writel(0x7C020002, mptr++); 769 *mptr++ = cpu_to_le32(0x7C020002);
409 writel(PAGE_SIZE, mptr++); 770 *mptr++ = cpu_to_le32(PAGE_SIZE);
410 } 771 }
411#endif 772#endif
412 773
413 writel(sg_flags | size, mptr++); 774 *mptr++ = cpu_to_le32(sg_flags | size);
414 writel(i2o_dma_low(dma_addr), mptr++); 775 *mptr++ = cpu_to_le32(i2o_dma_low(dma_addr));
415#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 776#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
416 if ((sizeof(dma_addr_t) > 4) && c->pae_support) 777 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
417 writel(i2o_dma_high(dma_addr), mptr++); 778 *mptr++ = cpu_to_le32(i2o_dma_high(dma_addr));
418#endif 779#endif
419 *sg_ptr = mptr; 780 *sg_ptr = mptr;
420 } 781 }
@@ -439,10 +800,10 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
439static inline int i2o_dma_map_sg(struct i2o_controller *c, 800static inline int i2o_dma_map_sg(struct i2o_controller *c,
440 struct scatterlist *sg, int sg_count, 801 struct scatterlist *sg, int sg_count,
441 enum dma_data_direction direction, 802 enum dma_data_direction direction,
442 u32 __iomem ** sg_ptr) 803 u32 ** sg_ptr)
443{ 804{
444 u32 sg_flags; 805 u32 sg_flags;
445 u32 __iomem *mptr = *sg_ptr; 806 u32 *mptr = *sg_ptr;
446 807
447 switch (direction) { 808 switch (direction) {
448 case DMA_TO_DEVICE: 809 case DMA_TO_DEVICE:
@@ -461,19 +822,19 @@ static inline int i2o_dma_map_sg(struct i2o_controller *c,
461 822
462#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 823#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
463 if ((sizeof(dma_addr_t) > 4) && c->pae_support) { 824 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
464 writel(0x7C020002, mptr++); 825 *mptr++ = cpu_to_le32(0x7C020002);
465 writel(PAGE_SIZE, mptr++); 826 *mptr++ = cpu_to_le32(PAGE_SIZE);
466 } 827 }
467#endif 828#endif
468 829
469 while (sg_count-- > 0) { 830 while (sg_count-- > 0) {
470 if (!sg_count) 831 if (!sg_count)
471 sg_flags |= 0xC0000000; 832 sg_flags |= 0xC0000000;
472 writel(sg_flags | sg_dma_len(sg), mptr++); 833 *mptr++ = cpu_to_le32(sg_flags | sg_dma_len(sg));
473 writel(i2o_dma_low(sg_dma_address(sg)), mptr++); 834 *mptr++ = cpu_to_le32(i2o_dma_low(sg_dma_address(sg)));
474#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 835#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
475 if ((sizeof(dma_addr_t) > 4) && c->pae_support) 836 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
476 writel(i2o_dma_high(sg_dma_address(sg)), mptr++); 837 *mptr++ = cpu_to_le32(i2o_dma_high(sg_dma_address(sg)));
477#endif 838#endif
478 sg++; 839 sg++;
479 } 840 }
@@ -563,6 +924,64 @@ static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
563 return 0; 924 return 0;
564}; 925};
565 926
927/*
928 * i2o_pool_alloc - Allocate an slab cache and mempool
929 * @mempool: pointer to struct i2o_pool to write data into.
930 * @name: name which is used to identify cache
931 * @size: size of each object
932 * @min_nr: minimum number of objects
933 *
934 * First allocates a slab cache with name and size. Then allocates a
935 * mempool which uses the slab cache for allocation and freeing.
936 *
937 * Returns 0 on success or negative error code on failure.
938 */
939static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
940 size_t size, int min_nr)
941{
942 pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL);
943 if (!pool->name)
944 goto exit;
945 strcpy(pool->name, name);
946
947 pool->slab =
948 kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL,
949 NULL);
950 if (!pool->slab)
951 goto free_name;
952
953 pool->mempool =
954 mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab,
955 pool->slab);
956 if (!pool->mempool)
957 goto free_slab;
958
959 return 0;
960
961 free_slab:
962 kmem_cache_destroy(pool->slab);
963
964 free_name:
965 kfree(pool->name);
966
967 exit:
968 return -ENOMEM;
969};
970
971/*
972 * i2o_pool_free - Free slab cache and mempool again
973 * @mempool: pointer to struct i2o_pool which should be freed
974 *
975 * Note that you have to return all objects to the mempool again before
976 * calling i2o_pool_free().
977 */
978static inline void i2o_pool_free(struct i2o_pool *pool)
979{
980 mempool_destroy(pool->mempool);
981 kmem_cache_destroy(pool->slab);
982 kfree(pool->name);
983};
984
566/* I2O driver (OSM) functions */ 985/* I2O driver (OSM) functions */
567extern int i2o_driver_register(struct i2o_driver *); 986extern int i2o_driver_register(struct i2o_driver *);
568extern void i2o_driver_unregister(struct i2o_driver *); 987extern void i2o_driver_unregister(struct i2o_driver *);
@@ -638,39 +1057,89 @@ extern int i2o_exec_lct_get(struct i2o_controller *);
638#define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj)) 1057#define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj))
639 1058
640/** 1059/**
1060 * i2o_out_to_virt - Turn an I2O message to a virtual address
1061 * @c: controller
1062 * @m: message engine value
1063 *
1064 * Turn a receive message from an I2O controller bus address into
1065 * a Linux virtual address. The shared page frame is a linear block
1066 * so we simply have to shift the offset. This function does not
1067 * work for sender side messages as they are ioremap objects
1068 * provided by the I2O controller.
1069 */
1070static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c,
1071 u32 m)
1072{
1073 BUG_ON(m < c->out_queue.phys
1074 || m >= c->out_queue.phys + c->out_queue.len);
1075
1076 return c->out_queue.virt + (m - c->out_queue.phys);
1077};
1078
1079/**
1080 * i2o_msg_in_to_virt - Turn an I2O message to a virtual address
1081 * @c: controller
1082 * @m: message engine value
1083 *
1084 * Turn a send message from an I2O controller bus address into
1085 * a Linux virtual address. The shared page frame is a linear block
1086 * so we simply have to shift the offset. This function does not
1087 * work for receive side messages as they are kmalloc objects
1088 * in a different pool.
1089 */
1090static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct
1091 i2o_controller *c,
1092 u32 m)
1093{
1094 return c->in_queue.virt + m;
1095};
1096
1097/**
641 * i2o_msg_get - obtain an I2O message from the IOP 1098 * i2o_msg_get - obtain an I2O message from the IOP
642 * @c: I2O controller 1099 * @c: I2O controller
643 * @msg: pointer to a I2O message pointer
644 * 1100 *
645 * This function tries to get a message slot. If no message slot is 1101 * This function tries to get a message frame. If no message frame is
646 * available do not wait until one is availabe (see also i2o_msg_get_wait). 1102 * available do not wait until one is availabe (see also i2o_msg_get_wait).
1103 * The returned pointer to the message frame is not in I/O memory, it is
1104 * allocated from a mempool. But because a MFA is allocated from the
1105 * controller too it is guaranteed that i2o_msg_post() will never fail.
647 * 1106 *
648 * On a success the message is returned and the pointer to the message is 1107 * On a success a pointer to the message frame is returned. If the message
649 * set in msg. The returned message is the physical page frame offset 1108 * queue is empty -EBUSY is returned and if no memory is available -ENOMEM
650 * address from the read port (see the i2o spec). If no message is 1109 * is returned.
651 * available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
652 */ 1110 */
653static inline u32 i2o_msg_get(struct i2o_controller *c, 1111static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c)
654 struct i2o_message __iomem ** msg)
655{ 1112{
656 u32 m = readl(c->in_port); 1113 struct i2o_msg_mfa *mmsg = mempool_alloc(c->in_msg.mempool, GFP_ATOMIC);
657 1114 if (!mmsg)
658 if (m != I2O_QUEUE_EMPTY) 1115 return ERR_PTR(-ENOMEM);
659 *msg = c->in_queue.virt + m; 1116
1117 mmsg->mfa = readl(c->in_port);
1118 if (mmsg->mfa == I2O_QUEUE_EMPTY) {
1119 mempool_free(mmsg, c->in_msg.mempool);
1120 return ERR_PTR(-EBUSY);
1121 }
660 1122
661 return m; 1123 return &mmsg->msg;
662}; 1124};
663 1125
664/** 1126/**
665 * i2o_msg_post - Post I2O message to I2O controller 1127 * i2o_msg_post - Post I2O message to I2O controller
666 * @c: I2O controller to which the message should be send 1128 * @c: I2O controller to which the message should be send
667 * @m: the message identifier 1129 * @msg: message returned by i2o_msg_get()
668 * 1130 *
669 * Post the message to the I2O controller. 1131 * Post the message to the I2O controller and return immediately.
670 */ 1132 */
671static inline void i2o_msg_post(struct i2o_controller *c, u32 m) 1133static inline void i2o_msg_post(struct i2o_controller *c,
1134 struct i2o_message *msg)
672{ 1135{
673 writel(m, c->in_port); 1136 struct i2o_msg_mfa *mmsg;
1137
1138 mmsg = container_of(msg, struct i2o_msg_mfa, msg);
1139 memcpy_toio(i2o_msg_in_to_virt(c, mmsg->mfa), msg,
1140 (le32_to_cpu(msg->u.head[0]) >> 16) << 2);
1141 writel(mmsg->mfa, c->in_port);
1142 mempool_free(mmsg, c->in_msg.mempool);
674}; 1143};
675 1144
676/** 1145/**
@@ -685,62 +1154,66 @@ static inline void i2o_msg_post(struct i2o_controller *c, u32 m)
685 * 1154 *
686 * Returns 0 on success or negative error code on failure. 1155 * Returns 0 on success or negative error code on failure.
687 */ 1156 */
688static inline int i2o_msg_post_wait(struct i2o_controller *c, u32 m, 1157static inline int i2o_msg_post_wait(struct i2o_controller *c,
1158 struct i2o_message *msg,
689 unsigned long timeout) 1159 unsigned long timeout)
690{ 1160{
691 return i2o_msg_post_wait_mem(c, m, timeout, NULL); 1161 return i2o_msg_post_wait_mem(c, msg, timeout, NULL);
692}; 1162};
693 1163
694/** 1164/**
695 * i2o_flush_reply - Flush reply from I2O controller 1165 * i2o_msg_nop_mfa - Returns a fetched MFA back to the controller
696 * @c: I2O controller 1166 * @c: I2O controller from which the MFA was fetched
697 * @m: the message identifier 1167 * @mfa: MFA which should be returned
698 * 1168 *
699 * The I2O controller must be informed that the reply message is not needed 1169 * This function must be used for preserved messages, because i2o_msg_nop()
700 * anymore. If you forget to flush the reply, the message frame can't be 1170 * also returns the allocated memory back to the msg_pool mempool.
701 * used by the controller anymore and is therefore lost.
702 */ 1171 */
703static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) 1172static inline void i2o_msg_nop_mfa(struct i2o_controller *c, u32 mfa)
704{ 1173{
705 writel(m, c->out_port); 1174 struct i2o_message __iomem *msg;
1175 u32 nop[3] = {
1176 THREE_WORD_MSG_SIZE | SGL_OFFSET_0,
1177 I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | ADAPTER_TID,
1178 0x00000000
1179 };
1180
1181 msg = i2o_msg_in_to_virt(c, mfa);
1182 memcpy_toio(msg, nop, sizeof(nop));
1183 writel(mfa, c->in_port);
706}; 1184};
707 1185
708/** 1186/**
709 * i2o_out_to_virt - Turn an I2O message to a virtual address 1187 * i2o_msg_nop - Returns a message which is not used
710 * @c: controller 1188 * @c: I2O controller from which the message was created
711 * @m: message engine value 1189 * @msg: message which should be returned
712 * 1190 *
713 * Turn a receive message from an I2O controller bus address into 1191 * If you fetch a message via i2o_msg_get, and can't use it, you must
714 * a Linux virtual address. The shared page frame is a linear block 1192 * return the message with this function. Otherwise the MFA is lost as well
715 * so we simply have to shift the offset. This function does not 1193 * as the allocated memory from the mempool.
716 * work for sender side messages as they are ioremap objects
717 * provided by the I2O controller.
718 */ 1194 */
719static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c, 1195static inline void i2o_msg_nop(struct i2o_controller *c,
720 u32 m) 1196 struct i2o_message *msg)
721{ 1197{
722 BUG_ON(m < c->out_queue.phys 1198 struct i2o_msg_mfa *mmsg;
723 || m >= c->out_queue.phys + c->out_queue.len); 1199 mmsg = container_of(msg, struct i2o_msg_mfa, msg);
724 1200
725 return c->out_queue.virt + (m - c->out_queue.phys); 1201 i2o_msg_nop_mfa(c, mmsg->mfa);
1202 mempool_free(mmsg, c->in_msg.mempool);
726}; 1203};
727 1204
728/** 1205/**
729 * i2o_msg_in_to_virt - Turn an I2O message to a virtual address 1206 * i2o_flush_reply - Flush reply from I2O controller
730 * @c: controller 1207 * @c: I2O controller
731 * @m: message engine value 1208 * @m: the message identifier
732 * 1209 *
733 * Turn a send message from an I2O controller bus address into 1210 * The I2O controller must be informed that the reply message is not needed
734 * a Linux virtual address. The shared page frame is a linear block 1211 * anymore. If you forget to flush the reply, the message frame can't be
735 * so we simply have to shift the offset. This function does not 1212 * used by the controller anymore and is therefore lost.
736 * work for receive side messages as they are kmalloc objects
737 * in a different pool.
738 */ 1213 */
739static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct 1214static inline void i2o_flush_reply(struct i2o_controller *c, u32 m)
740 i2o_controller *c,
741 u32 m)
742{ 1215{
743 return c->in_queue.virt + m; 1216 writel(m, c->out_port);
744}; 1217};
745 1218
746/* 1219/*
@@ -779,350 +1252,5 @@ extern void i2o_dump_message(struct i2o_message *);
779extern void i2o_dump_hrt(struct i2o_controller *c); 1252extern void i2o_dump_hrt(struct i2o_controller *c);
780extern void i2o_debug_state(struct i2o_controller *c); 1253extern void i2o_debug_state(struct i2o_controller *c);
781 1254
782/*
783 * Cache strategies
784 */
785
786/* The NULL strategy leaves everything up to the controller. This tends to be a
787 * pessimal but functional choice.
788 */
789#define CACHE_NULL 0
790/* Prefetch data when reading. We continually attempt to load the next 32 sectors
791 * into the controller cache.
792 */
793#define CACHE_PREFETCH 1
794/* Prefetch data when reading. We sometimes attempt to load the next 32 sectors
795 * into the controller cache. When an I/O is less <= 8K we assume its probably
796 * not sequential and don't prefetch (default)
797 */
798#define CACHE_SMARTFETCH 2
799/* Data is written to the cache and then out on to the disk. The I/O must be
800 * physically on the medium before the write is acknowledged (default without
801 * NVRAM)
802 */
803#define CACHE_WRITETHROUGH 17
804/* Data is written to the cache and then out on to the disk. The controller
805 * is permitted to write back the cache any way it wants. (default if battery
806 * backed NVRAM is present). It can be useful to set this for swap regardless of
807 * battery state.
808 */
809#define CACHE_WRITEBACK 18
810/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
811 * write large I/O's directly to disk bypassing the cache to avoid the extra
812 * memory copy hits. Small writes are writeback cached
813 */
814#define CACHE_SMARTBACK 19
815/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
816 * write large I/O's directly to disk bypassing the cache to avoid the extra
817 * memory copy hits. Small writes are writethrough cached. Suitable for devices
818 * lacking battery backup
819 */
820#define CACHE_SMARTTHROUGH 20
821
822/*
823 * Ioctl structures
824 */
825
826#define BLKI2OGRSTRAT _IOR('2', 1, int)
827#define BLKI2OGWSTRAT _IOR('2', 2, int)
828#define BLKI2OSRSTRAT _IOW('2', 3, int)
829#define BLKI2OSWSTRAT _IOW('2', 4, int)
830
831/*
832 * I2O Function codes
833 */
834
835/*
836 * Executive Class
837 */
838#define I2O_CMD_ADAPTER_ASSIGN 0xB3
839#define I2O_CMD_ADAPTER_READ 0xB2
840#define I2O_CMD_ADAPTER_RELEASE 0xB5
841#define I2O_CMD_BIOS_INFO_SET 0xA5
842#define I2O_CMD_BOOT_DEVICE_SET 0xA7
843#define I2O_CMD_CONFIG_VALIDATE 0xBB
844#define I2O_CMD_CONN_SETUP 0xCA
845#define I2O_CMD_DDM_DESTROY 0xB1
846#define I2O_CMD_DDM_ENABLE 0xD5
847#define I2O_CMD_DDM_QUIESCE 0xC7
848#define I2O_CMD_DDM_RESET 0xD9
849#define I2O_CMD_DDM_SUSPEND 0xAF
850#define I2O_CMD_DEVICE_ASSIGN 0xB7
851#define I2O_CMD_DEVICE_RELEASE 0xB9
852#define I2O_CMD_HRT_GET 0xA8
853#define I2O_CMD_ADAPTER_CLEAR 0xBE
854#define I2O_CMD_ADAPTER_CONNECT 0xC9
855#define I2O_CMD_ADAPTER_RESET 0xBD
856#define I2O_CMD_LCT_NOTIFY 0xA2
857#define I2O_CMD_OUTBOUND_INIT 0xA1
858#define I2O_CMD_PATH_ENABLE 0xD3
859#define I2O_CMD_PATH_QUIESCE 0xC5
860#define I2O_CMD_PATH_RESET 0xD7
861#define I2O_CMD_STATIC_MF_CREATE 0xDD
862#define I2O_CMD_STATIC_MF_RELEASE 0xDF
863#define I2O_CMD_STATUS_GET 0xA0
864#define I2O_CMD_SW_DOWNLOAD 0xA9
865#define I2O_CMD_SW_UPLOAD 0xAB
866#define I2O_CMD_SW_REMOVE 0xAD
867#define I2O_CMD_SYS_ENABLE 0xD1
868#define I2O_CMD_SYS_MODIFY 0xC1
869#define I2O_CMD_SYS_QUIESCE 0xC3
870#define I2O_CMD_SYS_TAB_SET 0xA3
871
872/*
873 * Utility Class
874 */
875#define I2O_CMD_UTIL_NOP 0x00
876#define I2O_CMD_UTIL_ABORT 0x01
877#define I2O_CMD_UTIL_CLAIM 0x09
878#define I2O_CMD_UTIL_RELEASE 0x0B
879#define I2O_CMD_UTIL_PARAMS_GET 0x06
880#define I2O_CMD_UTIL_PARAMS_SET 0x05
881#define I2O_CMD_UTIL_EVT_REGISTER 0x13
882#define I2O_CMD_UTIL_EVT_ACK 0x14
883#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
884#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
885#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
886#define I2O_CMD_UTIL_LOCK 0x17
887#define I2O_CMD_UTIL_LOCK_RELEASE 0x19
888#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
889
890/*
891 * SCSI Host Bus Adapter Class
892 */
893#define I2O_CMD_SCSI_EXEC 0x81
894#define I2O_CMD_SCSI_ABORT 0x83
895#define I2O_CMD_SCSI_BUSRESET 0x27
896
897/*
898 * Bus Adapter Class
899 */
900#define I2O_CMD_BUS_ADAPTER_RESET 0x85
901#define I2O_CMD_BUS_RESET 0x87
902#define I2O_CMD_BUS_SCAN 0x89
903#define I2O_CMD_BUS_QUIESCE 0x8b
904
905/*
906 * Random Block Storage Class
907 */
908#define I2O_CMD_BLOCK_READ 0x30
909#define I2O_CMD_BLOCK_WRITE 0x31
910#define I2O_CMD_BLOCK_CFLUSH 0x37
911#define I2O_CMD_BLOCK_MLOCK 0x49
912#define I2O_CMD_BLOCK_MUNLOCK 0x4B
913#define I2O_CMD_BLOCK_MMOUNT 0x41
914#define I2O_CMD_BLOCK_MEJECT 0x43
915#define I2O_CMD_BLOCK_POWER 0x70
916
917#define I2O_CMD_PRIVATE 0xFF
918
919/* Command status values */
920
921#define I2O_CMD_IN_PROGRESS 0x01
922#define I2O_CMD_REJECTED 0x02
923#define I2O_CMD_FAILED 0x03
924#define I2O_CMD_COMPLETED 0x04
925
926/* I2O API function return values */
927
928#define I2O_RTN_NO_ERROR 0
929#define I2O_RTN_NOT_INIT 1
930#define I2O_RTN_FREE_Q_EMPTY 2
931#define I2O_RTN_TCB_ERROR 3
932#define I2O_RTN_TRANSACTION_ERROR 4
933#define I2O_RTN_ADAPTER_ALREADY_INIT 5
934#define I2O_RTN_MALLOC_ERROR 6
935#define I2O_RTN_ADPTR_NOT_REGISTERED 7
936#define I2O_RTN_MSG_REPLY_TIMEOUT 8
937#define I2O_RTN_NO_STATUS 9
938#define I2O_RTN_NO_FIRM_VER 10
939#define I2O_RTN_NO_LINK_SPEED 11
940
941/* Reply message status defines for all messages */
942
943#define I2O_REPLY_STATUS_SUCCESS 0x00
944#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
945#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
946#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
947#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
948#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
949#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
950#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
951#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
952#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
953#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
954#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
955
956/* Status codes and Error Information for Parameter functions */
957
958#define I2O_PARAMS_STATUS_SUCCESS 0x00
959#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
960#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
961#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
962#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
963#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
964#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
965#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
966#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
967#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
968#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
969#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
970#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
971#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
972#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
973#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
974#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
975
976/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
977 * messages: Table 3-2 Detailed Status Codes.*/
978
979#define I2O_DSC_SUCCESS 0x0000
980#define I2O_DSC_BAD_KEY 0x0002
981#define I2O_DSC_TCL_ERROR 0x0003
982#define I2O_DSC_REPLY_BUFFER_FULL 0x0004
983#define I2O_DSC_NO_SUCH_PAGE 0x0005
984#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
985#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
986#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
987#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
988#define I2O_DSC_DEVICE_LOCKED 0x000B
989#define I2O_DSC_DEVICE_RESET 0x000C
990#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
991#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
992#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
993#define I2O_DSC_INVALID_OFFSET 0x0010
994#define I2O_DSC_INVALID_PARAMETER 0x0011
995#define I2O_DSC_INVALID_REQUEST 0x0012
996#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
997#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
998#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
999#define I2O_DSC_MISSING_PARAMETER 0x0016
1000#define I2O_DSC_TIMEOUT 0x0017
1001#define I2O_DSC_UNKNOWN_ERROR 0x0018
1002#define I2O_DSC_UNKNOWN_FUNCTION 0x0019
1003#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
1004#define I2O_DSC_DEVICE_BUSY 0x001B
1005#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
1006
1007/* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
1008 Status Codes.*/
1009
1010#define I2O_BSA_DSC_SUCCESS 0x0000
1011#define I2O_BSA_DSC_MEDIA_ERROR 0x0001
1012#define I2O_BSA_DSC_ACCESS_ERROR 0x0002
1013#define I2O_BSA_DSC_DEVICE_FAILURE 0x0003
1014#define I2O_BSA_DSC_DEVICE_NOT_READY 0x0004
1015#define I2O_BSA_DSC_MEDIA_NOT_PRESENT 0x0005
1016#define I2O_BSA_DSC_MEDIA_LOCKED 0x0006
1017#define I2O_BSA_DSC_MEDIA_FAILURE 0x0007
1018#define I2O_BSA_DSC_PROTOCOL_FAILURE 0x0008
1019#define I2O_BSA_DSC_BUS_FAILURE 0x0009
1020#define I2O_BSA_DSC_ACCESS_VIOLATION 0x000A
1021#define I2O_BSA_DSC_WRITE_PROTECTED 0x000B
1022#define I2O_BSA_DSC_DEVICE_RESET 0x000C
1023#define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
1024#define I2O_BSA_DSC_TIMEOUT 0x000E
1025
1026/* FailureStatusCodes, Table 3-3 Message Failure Codes */
1027
1028#define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED 0x81
1029#define I2O_FSC_TRANSPORT_SERVICE_TERMINATED 0x82
1030#define I2O_FSC_TRANSPORT_CONGESTION 0x83
1031#define I2O_FSC_TRANSPORT_FAILURE 0x84
1032#define I2O_FSC_TRANSPORT_STATE_ERROR 0x85
1033#define I2O_FSC_TRANSPORT_TIME_OUT 0x86
1034#define I2O_FSC_TRANSPORT_ROUTING_FAILURE 0x87
1035#define I2O_FSC_TRANSPORT_INVALID_VERSION 0x88
1036#define I2O_FSC_TRANSPORT_INVALID_OFFSET 0x89
1037#define I2O_FSC_TRANSPORT_INVALID_MSG_FLAGS 0x8A
1038#define I2O_FSC_TRANSPORT_FRAME_TOO_SMALL 0x8B
1039#define I2O_FSC_TRANSPORT_FRAME_TOO_LARGE 0x8C
1040#define I2O_FSC_TRANSPORT_INVALID_TARGET_ID 0x8D
1041#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_ID 0x8E
1042#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F
1043#define I2O_FSC_TRANSPORT_UNKNOWN_FAILURE 0xFF
1044
1045/* Device Claim Types */
1046#define I2O_CLAIM_PRIMARY 0x01000000
1047#define I2O_CLAIM_MANAGEMENT 0x02000000
1048#define I2O_CLAIM_AUTHORIZED 0x03000000
1049#define I2O_CLAIM_SECONDARY 0x04000000
1050
1051/* Message header defines for VersionOffset */
1052#define I2OVER15 0x0001
1053#define I2OVER20 0x0002
1054
1055/* Default is 1.5 */
1056#define I2OVERSION I2OVER15
1057
1058#define SGL_OFFSET_0 I2OVERSION
1059#define SGL_OFFSET_4 (0x0040 | I2OVERSION)
1060#define SGL_OFFSET_5 (0x0050 | I2OVERSION)
1061#define SGL_OFFSET_6 (0x0060 | I2OVERSION)
1062#define SGL_OFFSET_7 (0x0070 | I2OVERSION)
1063#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
1064#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
1065#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
1066#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
1067#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
1068#define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
1069
1070/* Transaction Reply Lists (TRL) Control Word structure */
1071#define TRL_SINGLE_FIXED_LENGTH 0x00
1072#define TRL_SINGLE_VARIABLE_LENGTH 0x40
1073#define TRL_MULTIPLE_FIXED_LENGTH 0x80
1074
1075 /* msg header defines for MsgFlags */
1076#define MSG_STATIC 0x0100
1077#define MSG_64BIT_CNTXT 0x0200
1078#define MSG_MULTI_TRANS 0x1000
1079#define MSG_FAIL 0x2000
1080#define MSG_FINAL 0x4000
1081#define MSG_REPLY 0x8000
1082
1083 /* minimum size msg */
1084#define THREE_WORD_MSG_SIZE 0x00030000
1085#define FOUR_WORD_MSG_SIZE 0x00040000
1086#define FIVE_WORD_MSG_SIZE 0x00050000
1087#define SIX_WORD_MSG_SIZE 0x00060000
1088#define SEVEN_WORD_MSG_SIZE 0x00070000
1089#define EIGHT_WORD_MSG_SIZE 0x00080000
1090#define NINE_WORD_MSG_SIZE 0x00090000
1091#define TEN_WORD_MSG_SIZE 0x000A0000
1092#define ELEVEN_WORD_MSG_SIZE 0x000B0000
1093#define I2O_MESSAGE_SIZE(x) ((x)<<16)
1094
1095/* special TID assignments */
1096#define ADAPTER_TID 0
1097#define HOST_TID 1
1098
1099/* outbound queue defines */
1100#define I2O_MAX_OUTBOUND_MSG_FRAMES 128
1101#define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
1102
1103#define I2O_POST_WAIT_OK 0
1104#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
1105
1106#define I2O_CONTEXT_LIST_MIN_LENGTH 15
1107#define I2O_CONTEXT_LIST_USED 0x01
1108#define I2O_CONTEXT_LIST_DELETED 0x02
1109
1110/* timeouts */
1111#define I2O_TIMEOUT_INIT_OUTBOUND_QUEUE 15
1112#define I2O_TIMEOUT_MESSAGE_GET 5
1113#define I2O_TIMEOUT_RESET 30
1114#define I2O_TIMEOUT_STATUS_GET 5
1115#define I2O_TIMEOUT_LCT_GET 360
1116#define I2O_TIMEOUT_SCSI_SCB_ABORT 240
1117
1118/* retries */
1119#define I2O_HRT_GET_TRIES 3
1120#define I2O_LCT_GET_TRIES 3
1121
1122/* defines for max_sectors and max_phys_segments */
1123#define I2O_MAX_SECTORS 1024
1124#define I2O_MAX_SECTORS_LIMITED 256
1125#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
1126
1127#endif /* __KERNEL__ */ 1255#endif /* __KERNEL__ */
1128#endif /* _I2O_H */ 1256#endif /* _I2O_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 7b6a6a58e465..110b3cfac021 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -18,6 +18,7 @@
18#include <linux/bio.h> 18#include <linux/bio.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include <linux/completion.h>
21#include <asm/byteorder.h> 22#include <asm/byteorder.h>
22#include <asm/system.h> 23#include <asm/system.h>
23#include <asm/io.h> 24#include <asm/io.h>
@@ -638,7 +639,7 @@ typedef struct ide_drive_s {
638 int crc_count; /* crc counter to reduce drive speed */ 639 int crc_count; /* crc counter to reduce drive speed */
639 struct list_head list; 640 struct list_head list;
640 struct device gendev; 641 struct device gendev;
641 struct semaphore gendev_rel_sem; /* to deal with device release() */ 642 struct completion gendev_rel_comp; /* to deal with device release() */
642} ide_drive_t; 643} ide_drive_t;
643 644
644#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) 645#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev)
@@ -794,14 +795,14 @@ typedef struct hwif_s {
794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 795 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
795 796
796 struct device gendev; 797 struct device gendev;
797 struct semaphore gendev_rel_sem; /* To deal with device release() */ 798 struct completion gendev_rel_comp; /* To deal with device release() */
798 799
799 void *hwif_data; /* extra hwif data */ 800 void *hwif_data; /* extra hwif data */
800 801
801 unsigned dma; 802 unsigned dma;
802 803
803 void (*led_act)(void *data, int rw); 804 void (*led_act)(void *data, int rw);
804} ____cacheline_maxaligned_in_smp ide_hwif_t; 805} ____cacheline_internodealigned_in_smp ide_hwif_t;
805 806
806/* 807/*
807 * internal ide interrupt handler type 808 * internal ide interrupt handler type
@@ -982,8 +983,13 @@ typedef struct ide_driver_s {
982 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); 983 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
983 ide_proc_entry_t *proc; 984 ide_proc_entry_t *proc;
984 struct device_driver gen_driver; 985 struct device_driver gen_driver;
986 int (*probe)(ide_drive_t *);
987 void (*remove)(ide_drive_t *);
988 void (*shutdown)(ide_drive_t *);
985} ide_driver_t; 989} ide_driver_t;
986 990
991#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
992
987int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 993int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
988 994
989/* 995/*
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 511999c7eeda..395f0aad9cbf 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -131,17 +131,17 @@ struct frad_conf
131/* these are the fields of an RFC 1490 header */ 131/* these are the fields of an RFC 1490 header */
132struct frhdr 132struct frhdr
133{ 133{
134 unsigned char control __attribute__((packed)); 134 unsigned char control;
135 135
136 /* for IP packets, this can be the NLPID */ 136 /* for IP packets, this can be the NLPID */
137 unsigned char pad __attribute__((packed)); 137 unsigned char pad;
138 138
139 unsigned char NLPID __attribute__((packed)); 139 unsigned char NLPID;
140 unsigned char OUI[3] __attribute__((packed)); 140 unsigned char OUI[3];
141 unsigned short PID __attribute__((packed)); 141 unsigned short PID;
142 142
143#define IP_NLPID pad 143#define IP_NLPID pad
144}; 144} __attribute__((packed));
145 145
146/* see RFC 1490 for the definition of the following */ 146/* see RFC 1490 for the definition of the following */
147#define FRAD_I_UI 0x03 147#define FRAD_I_UI 0x03
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index e677f73f13dd..4fab3d0a4bce 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -157,8 +157,7 @@ struct pppox_proto {
157extern int register_pppox_proto(int proto_num, struct pppox_proto *pp); 157extern int register_pppox_proto(int proto_num, struct pppox_proto *pp);
158extern void unregister_pppox_proto(int proto_num); 158extern void unregister_pppox_proto(int proto_num);
159extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ 159extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
160extern int pppox_channel_ioctl(struct ppp_channel *pc, unsigned int cmd, 160extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
161 unsigned long arg);
162 161
163/* PPPoX socket states */ 162/* PPPoX socket states */
164enum { 163enum {
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 3b5e9fdff872..6c5587af118d 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -45,6 +45,6 @@
45#ifdef __KERNEL__ 45#ifdef __KERNEL__
46#include <linux/types.h> 46#include <linux/types.h>
47 47
48extern __u32 in_aton(const char *str); 48extern __be32 in_aton(const char *str);
49#endif 49#endif
50#endif /* _LINUX_INET_H */ 50#endif /* _LINUX_INET_H */
diff --git a/include/linux/init.h b/include/linux/init.h
index 59008c3826cf..ff8d8b8632f4 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -241,6 +241,18 @@ void __init parse_early_param(void);
241#define __cpuexitdata __exitdata 241#define __cpuexitdata __exitdata
242#endif 242#endif
243 243
244#ifdef CONFIG_MEMORY_HOTPLUG
245#define __meminit
246#define __meminitdata
247#define __memexit
248#define __memexitdata
249#else
250#define __meminit __init
251#define __meminitdata __initdata
252#define __memexit __exit
253#define __memexitdata __exitdata
254#endif
255
244/* Functions marked as __devexit may be discarded at kernel link time, depending 256/* Functions marked as __devexit may be discarded at kernel link time, depending
245 on config options. Newer versions of binutils detect references from 257 on config options. Newer versions of binutils detect references from
246 retained sections to discarded sections and flag an error. Pointers to 258 retained sections to discarded sections and flag an error. Pointers to
diff --git a/include/linux/input.h b/include/linux/input.h
index 3c5823368ddb..6d4cc3c110d6 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -13,6 +13,7 @@
13#include <linux/time.h> 13#include <linux/time.h>
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/mod_devicetable.h>
16#else 17#else
17#include <sys/time.h> 18#include <sys/time.h>
18#include <sys/ioctl.h> 19#include <sys/ioctl.h>
@@ -511,6 +512,8 @@ struct input_absinfo {
511#define KEY_FN_S 0x1e3 512#define KEY_FN_S 0x1e3
512#define KEY_FN_B 0x1e4 513#define KEY_FN_B 0x1e4
513 514
515/* We avoid low common keys in module aliases so they don't get huge. */
516#define KEY_MIN_INTERESTING KEY_MUTE
514#define KEY_MAX 0x1ff 517#define KEY_MAX 0x1ff
515 518
516/* 519/*
@@ -793,6 +796,44 @@ struct ff_effect {
793 796
794#define FF_MAX 0x7f 797#define FF_MAX 0x7f
795 798
799struct input_device_id {
800
801 kernel_ulong_t flags;
802
803 struct input_id id;
804
805 kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1];
806 kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1];
807 kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1];
808 kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1];
809 kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1];
810 kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1];
811 kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1];
812 kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1];
813 kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1];
814
815 kernel_ulong_t driver_info;
816};
817
818/*
819 * Structure for hotplug & device<->driver matching.
820 */
821
822#define INPUT_DEVICE_ID_MATCH_BUS 1
823#define INPUT_DEVICE_ID_MATCH_VENDOR 2
824#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
825#define INPUT_DEVICE_ID_MATCH_VERSION 8
826
827#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
828#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
829#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
830#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
831#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
832#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
833#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
834#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
835#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
836
796#ifdef __KERNEL__ 837#ifdef __KERNEL__
797 838
798/* 839/*
@@ -901,49 +942,11 @@ struct input_dev {
901}; 942};
902#define to_input_dev(d) container_of(d, struct input_dev, cdev) 943#define to_input_dev(d) container_of(d, struct input_dev, cdev)
903 944
904/*
905 * Structure for hotplug & device<->driver matching.
906 */
907
908#define INPUT_DEVICE_ID_MATCH_BUS 1
909#define INPUT_DEVICE_ID_MATCH_VENDOR 2
910#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
911#define INPUT_DEVICE_ID_MATCH_VERSION 8
912
913#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
914#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
915#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
916#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
917#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
918#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
919#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
920#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
921#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
922
923#define INPUT_DEVICE_ID_MATCH_DEVICE\ 945#define INPUT_DEVICE_ID_MATCH_DEVICE\
924 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) 946 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
925#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\ 947#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
926 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) 948 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
927 949
928struct input_device_id {
929
930 unsigned long flags;
931
932 struct input_id id;
933
934 unsigned long evbit[NBITS(EV_MAX)];
935 unsigned long keybit[NBITS(KEY_MAX)];
936 unsigned long relbit[NBITS(REL_MAX)];
937 unsigned long absbit[NBITS(ABS_MAX)];
938 unsigned long mscbit[NBITS(MSC_MAX)];
939 unsigned long ledbit[NBITS(LED_MAX)];
940 unsigned long sndbit[NBITS(SND_MAX)];
941 unsigned long ffbit[NBITS(FF_MAX)];
942 unsigned long swbit[NBITS(SW_MAX)];
943
944 unsigned long driver_info;
945};
946
947struct input_handle; 950struct input_handle;
948 951
949struct input_handler { 952struct input_handler {
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 41f150a3d2dd..2c08fdc2bdf7 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -79,7 +79,7 @@ static inline void __deprecated save_flags(unsigned long *x)
79{ 79{
80 local_save_flags(*x); 80 local_save_flags(*x);
81} 81}
82#define save_flags(x) save_flags(&x); 82#define save_flags(x) save_flags(&x)
83static inline void __deprecated restore_flags(unsigned long x) 83static inline void __deprecated restore_flags(unsigned long x)
84{ 84{
85 local_irq_restore(x); 85 local_irq_restore(x);
@@ -112,7 +112,7 @@ enum
112 TIMER_SOFTIRQ, 112 TIMER_SOFTIRQ,
113 NET_TX_SOFTIRQ, 113 NET_TX_SOFTIRQ,
114 NET_RX_SOFTIRQ, 114 NET_RX_SOFTIRQ,
115 SCSI_SOFTIRQ, 115 BLOCK_SOFTIRQ,
116 TASKLET_SOFTIRQ 116 TASKLET_SOFTIRQ
117}; 117};
118 118
diff --git a/include/linux/ioc3.h b/include/linux/ioc3.h
new file mode 100644
index 000000000000..e7906a72a4f1
--- /dev/null
+++ b/include/linux/ioc3.h
@@ -0,0 +1,93 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2005 Stanislaw Skowronek <skylark@linux-mips.org>
7 */
8
9#ifndef _LINUX_IOC3_H
10#define _LINUX_IOC3_H
11
12#include <asm/sn/ioc3.h>
13
14#define IOC3_MAX_SUBMODULES 32
15
16#define IOC3_CLASS_NONE 0
17#define IOC3_CLASS_BASE_IP27 1
18#define IOC3_CLASS_BASE_IP30 2
19#define IOC3_CLASS_MENET_123 3
20#define IOC3_CLASS_MENET_4 4
21#define IOC3_CLASS_CADDUO 5
22#define IOC3_CLASS_SERIAL 6
23
24/* One of these per IOC3 */
25struct ioc3_driver_data {
26 struct list_head list;
27 int id; /* IOC3 sequence number */
28 /* PCI mapping */
29 unsigned long pma; /* physical address */
30 struct __iomem ioc3 *vma; /* pointer to registers */
31 struct pci_dev *pdev; /* PCI device */
32 /* IRQ stuff */
33 int dual_irq; /* set if separate IRQs are used */
34 int irq_io, irq_eth; /* IRQ numbers */
35 /* GPIO magic */
36 spinlock_t gpio_lock;
37 unsigned int gpdr_shadow;
38 /* NIC identifiers */
39 char nic_part[32];
40 char nic_serial[16];
41 char nic_mac[6];
42 /* submodule set */
43 int class;
44 void *data[IOC3_MAX_SUBMODULES]; /* for submodule use */
45 int active[IOC3_MAX_SUBMODULES]; /* set if probe succeeds */
46 /* is_ir_lock must be held while
47 * modifying sio_ie values, so
48 * we can be sure that sio_ie is
49 * not changing when we read it
50 * along with sio_ir.
51 */
52 spinlock_t ir_lock; /* SIO_IE[SC] mod lock */
53};
54
55/* One per submodule */
56struct ioc3_submodule {
57 char *name; /* descriptive submodule name */
58 struct module *owner; /* owning kernel module */
59 int ethernet; /* set for ethernet drivers */
60 int (*probe) (struct ioc3_submodule *, struct ioc3_driver_data *);
61 int (*remove) (struct ioc3_submodule *, struct ioc3_driver_data *);
62 int id; /* assigned by IOC3, index for the "data" array */
63 /* IRQ stuff */
64 unsigned int irq_mask; /* IOC3 IRQ mask, leave clear for Ethernet */
65 int reset_mask; /* non-zero if you want the ioc3.c module to reset interrupts */
66 int (*intr) (struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int, struct pt_regs *);
67 /* private submodule data */
68 void *data; /* assigned by submodule */
69};
70
71/**********************************
72 * Functions needed by submodules *
73 **********************************/
74
75#define IOC3_W_IES 0
76#define IOC3_W_IEC 1
77
78/* registers a submodule for all existing and future IOC3 chips */
79extern int ioc3_register_submodule(struct ioc3_submodule *);
80/* unregisters a submodule */
81extern void ioc3_unregister_submodule(struct ioc3_submodule *);
82/* enables IRQs indicated by irq_mask for a specified IOC3 chip */
83extern void ioc3_enable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
84/* ackowledges specified IRQs */
85extern void ioc3_ack(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
86/* disables IRQs indicated by irq_mask for a specified IOC3 chip */
87extern void ioc3_disable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
88/* atomically sets GPCR bits */
89extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int);
90/* general ireg writer */
91extern void ioc3_write_ireg(struct ioc3_driver_data *idd, uint32_t value, int reg);
92
93#endif
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 33e8a19a1a0f..4b55cf1df732 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -16,6 +16,7 @@
16 */ 16 */
17#ifndef _LINUX_IP_H 17#ifndef _LINUX_IP_H
18#define _LINUX_IP_H 18#define _LINUX_IP_H
19#include <linux/types.h>
19#include <asm/byteorder.h> 20#include <asm/byteorder.h>
20 21
21#define IPTOS_TOS_MASK 0x1E 22#define IPTOS_TOS_MASK 0x1E
@@ -78,126 +79,6 @@
78#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ 79#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
79#define IPOPT_TS_PRESPEC 3 /* specified modules only */ 80#define IPOPT_TS_PRESPEC 3 /* specified modules only */
80 81
81#ifdef __KERNEL__
82#include <linux/config.h>
83#include <linux/types.h>
84#include <net/request_sock.h>
85#include <net/sock.h>
86#include <linux/igmp.h>
87#include <net/flow.h>
88
89struct ip_options {
90 __u32 faddr; /* Saved first hop address */
91 unsigned char optlen;
92 unsigned char srr;
93 unsigned char rr;
94 unsigned char ts;
95 unsigned char is_setbyuser:1, /* Set by setsockopt? */
96 is_data:1, /* Options in __data, rather than skb */
97 is_strictroute:1, /* Strict source route */
98 srr_is_hit:1, /* Packet destination addr was our one */
99 is_changed:1, /* IP checksum more not valid */
100 rr_needaddr:1, /* Need to record addr of outgoing dev */
101 ts_needtime:1, /* Need to record timestamp */
102 ts_needaddr:1; /* Need to record addr of outgoing dev */
103 unsigned char router_alert;
104 unsigned char __pad1;
105 unsigned char __pad2;
106 unsigned char __data[0];
107};
108
109#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
110
111struct inet_request_sock {
112 struct request_sock req;
113 u32 loc_addr;
114 u32 rmt_addr;
115 u16 rmt_port;
116 u16 snd_wscale : 4,
117 rcv_wscale : 4,
118 tstamp_ok : 1,
119 sack_ok : 1,
120 wscale_ok : 1,
121 ecn_ok : 1,
122 acked : 1;
123 struct ip_options *opt;
124};
125
126static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
127{
128 return (struct inet_request_sock *)sk;
129}
130
131struct ipv6_pinfo;
132
133struct inet_sock {
134 /* sk and pinet6 has to be the first two members of inet_sock */
135 struct sock sk;
136#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
137 struct ipv6_pinfo *pinet6;
138#endif
139 /* Socket demultiplex comparisons on incoming packets. */
140 __u32 daddr; /* Foreign IPv4 addr */
141 __u32 rcv_saddr; /* Bound local IPv4 addr */
142 __u16 dport; /* Destination port */
143 __u16 num; /* Local port */
144 __u32 saddr; /* Sending source */
145 __s16 uc_ttl; /* Unicast TTL */
146 __u16 cmsg_flags;
147 struct ip_options *opt;
148 __u16 sport; /* Source port */
149 __u16 id; /* ID counter for DF pkts */
150 __u8 tos; /* TOS */
151 __u8 mc_ttl; /* Multicasting TTL */
152 __u8 pmtudisc;
153 unsigned recverr : 1,
154 freebind : 1,
155 hdrincl : 1,
156 mc_loop : 1;
157 int mc_index; /* Multicast device index */
158 __u32 mc_addr;
159 struct ip_mc_socklist *mc_list; /* Group array */
160 /*
161 * Following members are used to retain the infomation to build
162 * an ip header on each ip fragmentation while the socket is corked.
163 */
164 struct {
165 unsigned int flags;
166 unsigned int fragsize;
167 struct ip_options *opt;
168 struct rtable *rt;
169 int length; /* Total length of all frames */
170 u32 addr;
171 struct flowi fl;
172 } cork;
173};
174
175#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
176#define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */
177
178static inline struct inet_sock *inet_sk(const struct sock *sk)
179{
180 return (struct inet_sock *)sk;
181}
182
183static inline void __inet_sk_copy_descendant(struct sock *sk_to,
184 const struct sock *sk_from,
185 const int ancestor_size)
186{
187 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
188 sk_from->sk_prot->obj_size - ancestor_size);
189}
190#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE))
191static inline void inet_sk_copy_descendant(struct sock *sk_to,
192 const struct sock *sk_from)
193{
194 __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock));
195}
196#endif
197#endif
198
199extern int inet_sk_rebuild_header(struct sock *sk);
200
201struct iphdr { 82struct iphdr {
202#if defined(__LITTLE_ENDIAN_BITFIELD) 83#if defined(__LITTLE_ENDIAN_BITFIELD)
203 __u8 ihl:4, 84 __u8 ihl:4,
@@ -209,14 +90,14 @@ struct iphdr {
209#error "Please fix <asm/byteorder.h>" 90#error "Please fix <asm/byteorder.h>"
210#endif 91#endif
211 __u8 tos; 92 __u8 tos;
212 __u16 tot_len; 93 __be16 tot_len;
213 __u16 id; 94 __be16 id;
214 __u16 frag_off; 95 __be16 frag_off;
215 __u8 ttl; 96 __u8 ttl;
216 __u8 protocol; 97 __u8 protocol;
217 __u16 check; 98 __u16 check;
218 __u32 saddr; 99 __be32 saddr;
219 __u32 daddr; 100 __be32 daddr;
220 /*The options start here. */ 101 /*The options start here. */
221}; 102};
222 103
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index e0b922785d98..9c8f4c9ed429 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -171,12 +171,13 @@ enum {
171}; 171};
172 172
173#ifdef __KERNEL__ 173#ifdef __KERNEL__
174#include <linux/in6.h> /* struct sockaddr_in6 */
175#include <linux/icmpv6.h> 174#include <linux/icmpv6.h>
176#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
177#include <linux/tcp.h> 175#include <linux/tcp.h>
178#include <linux/udp.h> 176#include <linux/udp.h>
179 177
178#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
179#include <net/inet_sock.h>
180
180/* 181/*
181 This structure contains results of exthdrs parsing 182 This structure contains results of exthdrs parsing
182 as offsets from skb->nh. 183 as offsets from skb->nh.
@@ -190,6 +191,10 @@ struct inet6_skb_parm {
190 __u16 srcrt; 191 __u16 srcrt;
191 __u16 dst1; 192 __u16 dst1;
192 __u16 lastopt; 193 __u16 lastopt;
194 __u32 nhoff;
195 __u16 flags;
196
197#define IP6SKB_XFRM_TRANSFORMED 1
193}; 198};
194 199
195#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 200#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
@@ -199,18 +204,17 @@ static inline int inet6_iif(const struct sk_buff *skb)
199 return IP6CB(skb)->iif; 204 return IP6CB(skb)->iif;
200} 205}
201 206
202struct tcp6_request_sock { 207struct inet6_request_sock {
203 struct tcp_request_sock req;
204 struct in6_addr loc_addr; 208 struct in6_addr loc_addr;
205 struct in6_addr rmt_addr; 209 struct in6_addr rmt_addr;
206 struct sk_buff *pktopts; 210 struct sk_buff *pktopts;
207 int iif; 211 int iif;
208}; 212};
209 213
210static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk) 214struct tcp6_request_sock {
211{ 215 struct tcp_request_sock tcp6rsk_tcp;
212 return (struct tcp6_request_sock *)sk; 216 struct inet6_request_sock tcp6rsk_inet6;
213} 217};
214 218
215/** 219/**
216 * struct ipv6_pinfo - ipv6 private area 220 * struct ipv6_pinfo - ipv6 private area
@@ -298,12 +302,36 @@ struct tcp6_sock {
298 struct ipv6_pinfo inet6; 302 struct ipv6_pinfo inet6;
299}; 303};
300 304
305extern int inet6_sk_rebuild_header(struct sock *sk);
306
301#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 307#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
302static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 308static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
303{ 309{
304 return inet_sk(__sk)->pinet6; 310 return inet_sk(__sk)->pinet6;
305} 311}
306 312
313static inline struct inet6_request_sock *
314 inet6_rsk(const struct request_sock *rsk)
315{
316 return (struct inet6_request_sock *)(((u8 *)rsk) +
317 inet_rsk(rsk)->inet6_rsk_offset);
318}
319
320static inline u32 inet6_rsk_offset(struct request_sock *rsk)
321{
322 return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock);
323}
324
325static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
326{
327 struct request_sock *req = reqsk_alloc(ops);
328
329 if (req != NULL)
330 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req);
331
332 return req;
333}
334
307static inline struct raw6_sock *raw6_sk(const struct sock *sk) 335static inline struct raw6_sock *raw6_sk(const struct sock *sk)
308{ 336{
309 return (struct raw6_sock *)sk; 337 return (struct raw6_sock *)sk;
@@ -323,28 +351,37 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
323#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 351#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
324#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 352#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
325 353
326#include <linux/tcp.h> 354struct inet6_timewait_sock {
355 struct in6_addr tw_v6_daddr;
356 struct in6_addr tw_v6_rcv_saddr;
357};
327 358
328struct tcp6_timewait_sock { 359struct tcp6_timewait_sock {
329 struct tcp_timewait_sock tw_v6_sk; 360 struct tcp_timewait_sock tcp6tw_tcp;
330 struct in6_addr tw_v6_daddr; 361 struct inet6_timewait_sock tcp6tw_inet6;
331 struct in6_addr tw_v6_rcv_saddr;
332}; 362};
333 363
334static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk) 364static inline u16 inet6_tw_offset(const struct proto *prot)
335{ 365{
336 return (struct tcp6_timewait_sock *)sk; 366 return prot->twsk_prot->twsk_obj_size -
367 sizeof(struct inet6_timewait_sock);
337} 368}
338 369
339static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) 370static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk)
371{
372 return (struct inet6_timewait_sock *)(((u8 *)sk) +
373 inet_twsk(sk)->tw_ipv6_offset);
374}
375
376static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk)
340{ 377{
341 return likely(sk->sk_state != TCP_TIME_WAIT) ? 378 return likely(sk->sk_state != TCP_TIME_WAIT) ?
342 &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr; 379 &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr;
343} 380}
344 381
345static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) 382static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
346{ 383{
347 return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; 384 return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL;
348} 385}
349 386
350static inline int inet_v6_ipv6only(const struct sock *sk) 387static inline int inet_v6_ipv6only(const struct sock *sk)
@@ -361,13 +398,19 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
361 return NULL; 398 return NULL;
362} 399}
363 400
401static inline struct inet6_request_sock *
402 inet6_rsk(const struct request_sock *rsk)
403{
404 return NULL;
405}
406
364static inline struct raw6_sock *raw6_sk(const struct sock *sk) 407static inline struct raw6_sock *raw6_sk(const struct sock *sk)
365{ 408{
366 return NULL; 409 return NULL;
367} 410}
368 411
369#define __tcp_v6_rcv_saddr(__sk) NULL 412#define __inet6_rcv_saddr(__sk) NULL
370#define tcp_v6_rcv_saddr(__sk) NULL 413#define inet6_rcv_saddr(__sk) NULL
371#define tcp_twsk_ipv6only(__sk) 0 414#define tcp_twsk_ipv6only(__sk) 0
372#define inet_v6_ipv6only(__sk) 0 415#define inet_v6_ipv6only(__sk) 0
373#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 416#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index f04ba20712a2..6c5d4c898ccb 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -12,7 +12,7 @@
12#include <linux/config.h> 12#include <linux/config.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14 14
15#if !defined(CONFIG_ARCH_S390) 15#if !defined(CONFIG_S390)
16 16
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <linux/cache.h> 18#include <linux/cache.h>
@@ -221,6 +221,17 @@ extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
221extern int can_request_irq(unsigned int irq, unsigned long irqflags); 221extern int can_request_irq(unsigned int irq, unsigned long irqflags);
222 222
223extern void init_irq_proc(void); 223extern void init_irq_proc(void);
224
225#ifdef CONFIG_AUTO_IRQ_AFFINITY
226extern int select_smp_affinity(unsigned int irq);
227#else
228static inline int
229select_smp_affinity(unsigned int irq)
230{
231 return 1;
232}
233#endif
234
224#endif 235#endif
225 236
226extern hw_irq_controller no_irq_type; /* needed in every arch ? */ 237extern hw_irq_controller no_irq_type; /* needed in every arch ? */
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index 7a4eacd77cb2..04e10f9f14f8 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -282,43 +282,43 @@ typedef struct setup_parm {
282 282
283typedef struct T30_s { 283typedef struct T30_s {
284 /* session parameters */ 284 /* session parameters */
285 __u8 resolution __attribute__ ((packed)); 285 __u8 resolution;
286 __u8 rate __attribute__ ((packed)); 286 __u8 rate;
287 __u8 width __attribute__ ((packed)); 287 __u8 width;
288 __u8 length __attribute__ ((packed)); 288 __u8 length;
289 __u8 compression __attribute__ ((packed)); 289 __u8 compression;
290 __u8 ecm __attribute__ ((packed)); 290 __u8 ecm;
291 __u8 binary __attribute__ ((packed)); 291 __u8 binary;
292 __u8 scantime __attribute__ ((packed)); 292 __u8 scantime;
293 __u8 id[FAXIDLEN] __attribute__ ((packed)); 293 __u8 id[FAXIDLEN];
294 /* additional parameters */ 294 /* additional parameters */
295 __u8 phase __attribute__ ((packed)); 295 __u8 phase;
296 __u8 direction __attribute__ ((packed)); 296 __u8 direction;
297 __u8 code __attribute__ ((packed)); 297 __u8 code;
298 __u8 badlin __attribute__ ((packed)); 298 __u8 badlin;
299 __u8 badmul __attribute__ ((packed)); 299 __u8 badmul;
300 __u8 bor __attribute__ ((packed)); 300 __u8 bor;
301 __u8 fet __attribute__ ((packed)); 301 __u8 fet;
302 __u8 pollid[FAXIDLEN] __attribute__ ((packed)); 302 __u8 pollid[FAXIDLEN];
303 __u8 cq __attribute__ ((packed)); 303 __u8 cq;
304 __u8 cr __attribute__ ((packed)); 304 __u8 cr;
305 __u8 ctcrty __attribute__ ((packed)); 305 __u8 ctcrty;
306 __u8 minsp __attribute__ ((packed)); 306 __u8 minsp;
307 __u8 phcto __attribute__ ((packed)); 307 __u8 phcto;
308 __u8 rel __attribute__ ((packed)); 308 __u8 rel;
309 __u8 nbc __attribute__ ((packed)); 309 __u8 nbc;
310 /* remote station parameters */ 310 /* remote station parameters */
311 __u8 r_resolution __attribute__ ((packed)); 311 __u8 r_resolution;
312 __u8 r_rate __attribute__ ((packed)); 312 __u8 r_rate;
313 __u8 r_width __attribute__ ((packed)); 313 __u8 r_width;
314 __u8 r_length __attribute__ ((packed)); 314 __u8 r_length;
315 __u8 r_compression __attribute__ ((packed)); 315 __u8 r_compression;
316 __u8 r_ecm __attribute__ ((packed)); 316 __u8 r_ecm;
317 __u8 r_binary __attribute__ ((packed)); 317 __u8 r_binary;
318 __u8 r_scantime __attribute__ ((packed)); 318 __u8 r_scantime;
319 __u8 r_id[FAXIDLEN] __attribute__ ((packed)); 319 __u8 r_id[FAXIDLEN];
320 __u8 r_code __attribute__ ((packed)); 320 __u8 r_code;
321} T30_s; 321} __attribute__((packed)) T30_s;
322 322
323#define ISDN_TTY_FAX_CONN_IN 0 323#define ISDN_TTY_FAX_CONN_IN 0
324#define ISDN_TTY_FAX_CONN_OUT 1 324#define ISDN_TTY_FAX_CONN_OUT 1
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
index 7c6eae7f6ed7..45b3d48f0978 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -4,47 +4,12 @@
4/*#define ISICOM_DEBUG*/ 4/*#define ISICOM_DEBUG*/
5/*#define ISICOM_DEBUG_DTR_RTS*/ 5/*#define ISICOM_DEBUG_DTR_RTS*/
6 6
7
8/*
9 * Firmware Loader definitions ...
10 */
11
12#define __MultiTech ('M'<<8)
13#define MIOCTL_LOAD_FIRMWARE (__MultiTech | 0x01)
14#define MIOCTL_READ_FIRMWARE (__MultiTech | 0x02)
15#define MIOCTL_XFER_CTRL (__MultiTech | 0x03)
16#define MIOCTL_RESET_CARD (__MultiTech | 0x04)
17
18#define DATA_SIZE 16
19
20typedef struct {
21 unsigned short exec_segment;
22 unsigned short exec_addr;
23} exec_record;
24
25typedef struct {
26 int board; /* Board to load */
27 unsigned short addr;
28 unsigned short count;
29} bin_header;
30
31typedef struct {
32 int board; /* Board to load */
33 unsigned short addr;
34 unsigned short count;
35 unsigned short segment;
36 unsigned char bin_data[DATA_SIZE];
37} bin_frame;
38
39#ifdef __KERNEL__ 7#ifdef __KERNEL__
40 8
41#define YES 1 9#define YES 1
42#define NO 0 10#define NO 0
43 11
44#define ISILOAD_MISC_MINOR 155 /* /dev/isctl */ 12/*
45#define ISILOAD_NAME "ISILoad"
46
47/*
48 * ISICOM Driver definitions ... 13 * ISICOM Driver definitions ...
49 * 14 *
50 */ 15 */
@@ -55,8 +20,8 @@ typedef struct {
55 * PCI definitions 20 * PCI definitions
56 */ 21 */
57 22
58 #define DEVID_COUNT 9 23#define DEVID_COUNT 9
59 #define VENDOR_ID 0x10b5 24#define VENDOR_ID 0x10b5
60 25
61/* 26/*
62 * These are now officially allocated numbers 27 * These are now officially allocated numbers
@@ -66,9 +31,9 @@ typedef struct {
66#define ISICOM_CMAJOR 113 /* callout */ 31#define ISICOM_CMAJOR 113 /* callout */
67#define ISICOM_MAGIC (('M' << 8) | 'T') 32#define ISICOM_MAGIC (('M' << 8) | 'T')
68 33
69#define WAKEUP_CHARS 256 /* hard coded for now */ 34#define WAKEUP_CHARS 256 /* hard coded for now */
70#define TX_SIZE 254 35#define TX_SIZE 254
71 36
72#define BOARD_COUNT 4 37#define BOARD_COUNT 4
73#define PORT_COUNT (BOARD_COUNT*16) 38#define PORT_COUNT (BOARD_COUNT*16)
74 39
@@ -98,18 +63,15 @@ typedef struct {
98#define ISICOM_INITIATE_XONXOFF 0x04 63#define ISICOM_INITIATE_XONXOFF 0x04
99#define ISICOM_RESPOND_XONXOFF 0x08 64#define ISICOM_RESPOND_XONXOFF 0x08
100 65
101#define InterruptTheCard(base) (outw(0,(base)+0xc))
102#define ClearInterrupt(base) (inw((base)+0x0a))
103
104#define BOARD(line) (((line) >> 4) & 0x3) 66#define BOARD(line) (((line) >> 4) & 0x3)
105 67
106 /* isi kill queue bitmap */ 68 /* isi kill queue bitmap */
107 69
108#define ISICOM_KILLTX 0x01 70#define ISICOM_KILLTX 0x01
109#define ISICOM_KILLRX 0x02 71#define ISICOM_KILLRX 0x02
110 72
111 /* isi_board status bitmap */ 73 /* isi_board status bitmap */
112 74
113#define FIRMWARE_LOADED 0x0001 75#define FIRMWARE_LOADED 0x0001
114#define BOARD_ACTIVE 0x0002 76#define BOARD_ACTIVE 0x0002
115 77
@@ -123,9 +85,8 @@ typedef struct {
123#define ISI_RTS 0x0200 85#define ISI_RTS 0x0200
124 86
125 87
126#define ISI_TXOK 0x0001 88#define ISI_TXOK 0x0001
127 89
128#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
129 91
130#endif /* ISICOM_H */ 92#endif /* ISICOM_H */
131
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index dcde7adfdce5..558cb4c26ec9 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -498,6 +498,12 @@ struct transaction_s
498 struct journal_head *t_checkpoint_list; 498 struct journal_head *t_checkpoint_list;
499 499
500 /* 500 /*
501 * Doubly-linked circular list of all buffers submitted for IO while
502 * checkpointing. [j_list_lock]
503 */
504 struct journal_head *t_checkpoint_io_list;
505
506 /*
501 * Doubly-linked circular list of temporary buffers currently undergoing 507 * Doubly-linked circular list of temporary buffers currently undergoing
502 * IO in the log [j_list_lock] 508 * IO in the log [j_list_lock]
503 */ 509 */
@@ -843,7 +849,7 @@ extern void journal_commit_transaction(journal_t *);
843 849
844/* Checkpoint list management */ 850/* Checkpoint list management */
845int __journal_clean_checkpoint_list(journal_t *journal); 851int __journal_clean_checkpoint_list(journal_t *journal);
846void __journal_remove_checkpoint(struct journal_head *); 852int __journal_remove_checkpoint(struct journal_head *);
847void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 853void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
848 854
849/* Buffer IO */ 855/* Buffer IO */
diff --git a/include/linux/jffs2_fs_i.h b/include/linux/jffs2_fs_i.h
index ef85ab56302b..ad565bf9dcc1 100644
--- a/include/linux/jffs2_fs_i.h
+++ b/include/linux/jffs2_fs_i.h
@@ -8,11 +8,11 @@
8#include <asm/semaphore.h> 8#include <asm/semaphore.h>
9 9
10struct jffs2_inode_info { 10struct jffs2_inode_info {
11 /* We need an internal semaphore similar to inode->i_sem. 11 /* We need an internal mutex similar to inode->i_mutex.
12 Unfortunately, we can't used the existing one, because 12 Unfortunately, we can't used the existing one, because
13 either the GC would deadlock, or we'd have to release it 13 either the GC would deadlock, or we'd have to release it
14 before letting GC proceed. Or we'd have to put ugliness 14 before letting GC proceed. Or we'd have to put ugliness
15 into the GC code so it didn't attempt to obtain the i_sem 15 into the GC code so it didn't attempt to obtain the i_mutex
16 for the inode(s) which are already locked */ 16 for the inode(s) which are already locked */
17 struct semaphore sem; 17 struct semaphore sem;
18 18
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 6acfdbba734b..99905e180532 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -1,21 +1,12 @@
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/kernel.h> 5#include <linux/kernel.h>
5#include <linux/types.h> 6#include <linux/types.h>
6#include <linux/time.h> 7#include <linux/time.h>
7#include <linux/timex.h> 8#include <linux/timex.h>
8#include <asm/param.h> /* for HZ */ 9#include <asm/param.h> /* for HZ */
9#include <asm/div64.h>
10
11#ifndef div_long_long_rem
12#define div_long_long_rem(dividend,divisor,remainder) \
13({ \
14 u64 result = dividend; \
15 *remainder = do_div(result,divisor); \
16 result; \
17})
18#endif
19 10
20/* 11/*
21 * The following defines establish the engineering parameters of the PLL 12 * The following defines establish the engineering parameters of the PLL
@@ -373,8 +364,11 @@ jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
373 * one divide. 364 * one divide.
374 */ 365 */
375 u64 nsec = (u64)jiffies * TICK_NSEC; 366 u64 nsec = (u64)jiffies * TICK_NSEC;
376 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec); 367 long tv_usec;
377 value->tv_usec /= NSEC_PER_USEC; 368
369 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tv_usec);
370 tv_usec /= NSEC_PER_USEC;
371 value->tv_usec = tv_usec;
378} 372}
379 373
380/* 374/*
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 7428198111eb..45f625d7d0b2 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -151,7 +151,7 @@ extern unsigned int keymap_count;
151 151
152static inline void con_schedule_flip(struct tty_struct *t) 152static inline void con_schedule_flip(struct tty_struct *t)
153{ 153{
154 schedule_work(&t->flip.work); 154 schedule_work(&t->buf.work);
155} 155}
156 156
157#endif 157#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index b1e407a4fbda..323924edb26a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -47,6 +47,8 @@ extern int console_printk[];
47#define default_console_loglevel (console_printk[3]) 47#define default_console_loglevel (console_printk[3])
48 48
49struct completion; 49struct completion;
50struct pt_regs;
51struct user;
50 52
51/** 53/**
52 * might_sleep - annotation for functions that can sleep 54 * might_sleep - annotation for functions that can sleep
@@ -123,6 +125,8 @@ extern int __kernel_text_address(unsigned long addr);
123extern int kernel_text_address(unsigned long addr); 125extern int kernel_text_address(unsigned long addr);
124extern int session_of_pgrp(int pgrp); 126extern int session_of_pgrp(int pgrp);
125 127
128extern void dump_thread(struct pt_regs *regs, struct user *dump);
129
126#ifdef CONFIG_PRINTK 130#ifdef CONFIG_PRINTK
127asmlinkage int vprintk(const char *fmt, va_list args) 131asmlinkage int vprintk(const char *fmt, va_list args)
128 __attribute__ ((format (printf, 1, 0))); 132 __attribute__ ((format (printf, 1, 0)));
@@ -212,6 +216,7 @@ extern void dump_stack(void);
212 ((unsigned char *)&addr)[1], \ 216 ((unsigned char *)&addr)[1], \
213 ((unsigned char *)&addr)[2], \ 217 ((unsigned char *)&addr)[2], \
214 ((unsigned char *)&addr)[3] 218 ((unsigned char *)&addr)[3]
219#define NIPQUAD_FMT "%u.%u.%u.%u"
215 220
216#define NIP6(addr) \ 221#define NIP6(addr) \
217 ntohs((addr).s6_addr16[0]), \ 222 ntohs((addr).s6_addr16[0]), \
@@ -222,6 +227,7 @@ extern void dump_stack(void);
222 ntohs((addr).s6_addr16[5]), \ 227 ntohs((addr).s6_addr16[5]), \
223 ntohs((addr).s6_addr16[6]), \ 228 ntohs((addr).s6_addr16[6]), \
224 ntohs((addr).s6_addr16[7]) 229 ntohs((addr).s6_addr16[7])
230#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
225 231
226#if defined(__LITTLE_ENDIAN) 232#if defined(__LITTLE_ENDIAN)
227#define HIPQUAD(addr) \ 233#define HIPQUAD(addr) \
@@ -286,6 +292,15 @@ extern void dump_stack(void);
286 1; \ 292 1; \
287}) 293})
288 294
295/*
296 * Check at compile time that 'function' is a certain type, or is a pointer
297 * to that type (needs to use typedef for the function type.)
298 */
299#define typecheck_fn(type,function) \
300({ typeof(type) __tmp = function; \
301 (void)__tmp; \
302})
303
289#endif /* __KERNEL__ */ 304#endif /* __KERNEL__ */
290 305
291#define SI_LOAD_SHIFT 16 306#define SI_LOAD_SHIFT 16
@@ -316,8 +331,6 @@ extern int randomize_va_space;
316#endif 331#endif
317 332
318/* Trap pasters of __FUNCTION__ at compile-time */ 333/* Trap pasters of __FUNCTION__ at compile-time */
319#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
320#define __FUNCTION__ (__func__) 334#define __FUNCTION__ (__func__)
321#endif
322 335
323#endif 336#endif
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index c8468472aec0..a311f58c8a7c 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -41,7 +41,7 @@ typedef unsigned long kimage_entry_t;
41#define IND_DONE 0x4 41#define IND_DONE 0x4
42#define IND_SOURCE 0x8 42#define IND_SOURCE 0x8
43 43
44#define KEXEC_SEGMENT_MAX 8 44#define KEXEC_SEGMENT_MAX 16
45struct kexec_segment { 45struct kexec_segment {
46 void __user *buf; 46 void __user *buf;
47 size_t bufsz; 47 size_t bufsz;
@@ -119,12 +119,15 @@ extern struct kimage *kexec_image;
119#define KEXEC_ARCH_PPC64 (21 << 16) 119#define KEXEC_ARCH_PPC64 (21 << 16)
120#define KEXEC_ARCH_IA_64 (50 << 16) 120#define KEXEC_ARCH_IA_64 (50 << 16)
121#define KEXEC_ARCH_S390 (22 << 16) 121#define KEXEC_ARCH_S390 (22 << 16)
122#define KEXEC_ARCH_SH (42 << 16)
122 123
123#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ 124#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */
124 125
125/* Location of a reserved region to hold the crash kernel. 126/* Location of a reserved region to hold the crash kernel.
126 */ 127 */
127extern struct resource crashk_res; 128extern struct resource crashk_res;
129typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
130extern note_buf_t *crash_notes;
128 131
129#else /* !CONFIG_KEXEC */ 132#else /* !CONFIG_KEXEC */
130struct pt_regs; 133struct pt_regs;
diff --git a/include/linux/key.h b/include/linux/key.h
index 53513a3be53b..cbf464ad9589 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -177,6 +177,8 @@ struct key {
177/* 177/*
178 * kernel managed key type definition 178 * kernel managed key type definition
179 */ 179 */
180typedef int (*request_key_actor_t)(struct key *key, struct key *authkey, const char *op);
181
180struct key_type { 182struct key_type {
181 /* name of the type */ 183 /* name of the type */
182 const char *name; 184 const char *name;
@@ -193,14 +195,6 @@ struct key_type {
193 */ 195 */
194 int (*instantiate)(struct key *key, const void *data, size_t datalen); 196 int (*instantiate)(struct key *key, const void *data, size_t datalen);
195 197
196 /* duplicate a key of this type (optional)
197 * - the source key will be locked against change
198 * - the new description will be attached
199 * - the quota will have been adjusted automatically from
200 * source->quotalen
201 */
202 int (*duplicate)(struct key *key, const struct key *source);
203
204 /* update a key of this type (optional) 198 /* update a key of this type (optional)
205 * - this method should call key_payload_reserve() to recalculate the 199 * - this method should call key_payload_reserve() to recalculate the
206 * quota consumption 200 * quota consumption
@@ -226,6 +220,16 @@ struct key_type {
226 */ 220 */
227 long (*read)(const struct key *key, char __user *buffer, size_t buflen); 221 long (*read)(const struct key *key, char __user *buffer, size_t buflen);
228 222
223 /* handle request_key() for this type instead of invoking
224 * /sbin/request-key (optional)
225 * - key is the key to instantiate
226 * - authkey is the authority to assume when instantiating this key
227 * - op is the operation to be done, usually "create"
228 * - the call must not return until the instantiation process has run
229 * its course
230 */
231 request_key_actor_t request_key;
232
229 /* internal fields */ 233 /* internal fields */
230 struct list_head link; /* link in types list */ 234 struct list_head link; /* link in types list */
231}; 235};
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 8d7c59a29e09..3365945640c9 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -19,6 +19,7 @@
19#define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */ 19#define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */
20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ 20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */
21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ 21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */
22#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */
22 23
23/* request-key default keyrings */ 24/* request-key default keyrings */
24#define KEY_REQKEY_DEFL_NO_CHANGE -1 25#define KEY_REQKEY_DEFL_NO_CHANGE -1
@@ -46,5 +47,7 @@
46#define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ 47#define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */
47#define KEYCTL_NEGATE 13 /* negate a partially constructed key */ 48#define KEYCTL_NEGATE 13 /* negate a partially constructed key */
48#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 */
51#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
49 52
50#endif /* _LINUX_KEYCTL_H */ 53#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 7f7403aa4a41..2a8d8da70961 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -23,14 +23,27 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/rwsem.h> 24#include <linux/rwsem.h>
25#include <linux/kref.h> 25#include <linux/kref.h>
26#include <linux/kobject_uevent.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <asm/atomic.h> 27#include <asm/atomic.h>
29 28
30#define KOBJ_NAME_LEN 20 29#define KOBJ_NAME_LEN 20
30#define UEVENT_HELPER_PATH_LEN 256
31 31
32/* counter to tag the hotplug event, read only except for the kobject core */ 32/* path to the userspace helper executed on an event */
33extern u64 hotplug_seqnum; 33extern char uevent_helper[];
34
35/* counter to tag the uevent, read only except for the kobject core */
36extern u64 uevent_seqnum;
37
38/* the actions here must match the proper string in lib/kobject_uevent.c */
39typedef int __bitwise kobject_action_t;
40enum kobject_action {
41 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */
42 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */
43 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */
44 KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */
45 KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */
46};
34 47
35struct kobject { 48struct kobject {
36 const char * k_name; 49 const char * k_name;
@@ -87,15 +100,14 @@ struct kobj_type {
87 * of object; multiple ksets can belong to one subsystem. All 100 * of object; multiple ksets can belong to one subsystem. All
88 * ksets of a subsystem share the subsystem's lock. 101 * ksets of a subsystem share the subsystem's lock.
89 * 102 *
90 * Each kset can support hotplugging; if it does, it will be given 103 * Each kset can support specific event variables; it can
91 * the opportunity to filter out specific kobjects from being 104 * supress the event generation or add subsystem specific
92 * reported, as well as to add its own "data" elements to the 105 * variables carried with the event.
93 * environment being passed to the hotplug helper.
94 */ 106 */
95struct kset_hotplug_ops { 107struct kset_uevent_ops {
96 int (*filter)(struct kset *kset, struct kobject *kobj); 108 int (*filter)(struct kset *kset, struct kobject *kobj);
97 const char *(*name)(struct kset *kset, struct kobject *kobj); 109 const char *(*name)(struct kset *kset, struct kobject *kobj);
98 int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, 110 int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp,
99 int num_envp, char *buffer, int buffer_size); 111 int num_envp, char *buffer, int buffer_size);
100}; 112};
101 113
@@ -105,7 +117,7 @@ struct kset {
105 struct list_head list; 117 struct list_head list;
106 spinlock_t list_lock; 118 spinlock_t list_lock;
107 struct kobject kobj; 119 struct kobject kobj;
108 struct kset_hotplug_ops * hotplug_ops; 120 struct kset_uevent_ops * uevent_ops;
109}; 121};
110 122
111 123
@@ -153,20 +165,20 @@ struct subsystem {
153 struct rw_semaphore rwsem; 165 struct rw_semaphore rwsem;
154}; 166};
155 167
156#define decl_subsys(_name,_type,_hotplug_ops) \ 168#define decl_subsys(_name,_type,_uevent_ops) \
157struct subsystem _name##_subsys = { \ 169struct subsystem _name##_subsys = { \
158 .kset = { \ 170 .kset = { \
159 .kobj = { .name = __stringify(_name) }, \ 171 .kobj = { .name = __stringify(_name) }, \
160 .ktype = _type, \ 172 .ktype = _type, \
161 .hotplug_ops =_hotplug_ops, \ 173 .uevent_ops =_uevent_ops, \
162 } \ 174 } \
163} 175}
164#define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \ 176#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
165struct subsystem _varname##_subsys = { \ 177struct subsystem _varname##_subsys = { \
166 .kset = { \ 178 .kset = { \
167 .kobj = { .name = __stringify(_name) }, \ 179 .kobj = { .name = __stringify(_name) }, \
168 .ktype = _type, \ 180 .ktype = _type, \
169 .hotplug_ops =_hotplug_ops, \ 181 .uevent_ops =_uevent_ops, \
170 } \ 182 } \
171} 183}
172 184
@@ -241,15 +253,17 @@ struct subsys_attribute {
241extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); 253extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
242extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); 254extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
243 255
244#ifdef CONFIG_HOTPLUG 256#if defined(CONFIG_HOTPLUG) & defined(CONFIG_NET)
245void kobject_hotplug(struct kobject *kobj, enum kobject_action action); 257void kobject_uevent(struct kobject *kobj, enum kobject_action action);
246int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 258
259int add_uevent_var(char **envp, int num_envp, int *cur_index,
247 char *buffer, int buffer_size, int *cur_len, 260 char *buffer, int buffer_size, int *cur_len,
248 const char *format, ...) 261 const char *format, ...)
249 __attribute__((format (printf, 7, 8))); 262 __attribute__((format (printf, 7, 8)));
250#else 263#else
251static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { } 264static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }
252static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 265
266static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,
253 char *buffer, int buffer_size, int *cur_len, 267 char *buffer, int buffer_size, int *cur_len,
254 const char *format, ...) 268 const char *format, ...)
255{ return 0; } 269{ return 0; }
diff --git a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h
deleted file mode 100644
index aa664fe7e561..000000000000
--- a/include/linux/kobject_uevent.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * kobject_uevent.h - list of kobject user events that can be generated
3 *
4 * Copyright (C) 2004 IBM Corp.
5 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
6 *
7 * This file is released under the GPLv2.
8 *
9 */
10
11#ifndef _KOBJECT_EVENT_H_
12#define _KOBJECT_EVENT_H_
13
14#define HOTPLUG_PATH_LEN 256
15
16/* path to the hotplug userspace helper executed on an event */
17extern char hotplug_path[];
18
19/*
20 * If you add an action here, you must also add the proper string to the
21 * lib/kobject_uevent.c file.
22 */
23typedef int __bitwise kobject_action_t;
24enum kobject_action {
25 KOBJ_ADD = (__force kobject_action_t) 0x01, /* add event, for hotplug */
26 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* remove event, for hotplug */
27 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* a sysfs attribute file has changed */
28 KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */
29 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */
30 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* offline event for hotplug devices */
31 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* online event for hotplug devices */
32};
33
34
35#ifdef CONFIG_KOBJECT_UEVENT
36int kobject_uevent(struct kobject *kobj,
37 enum kobject_action action,
38 struct attribute *attr);
39int kobject_uevent_atomic(struct kobject *kobj,
40 enum kobject_action action,
41 struct attribute *attr);
42#else
43static inline int kobject_uevent(struct kobject *kobj,
44 enum kobject_action action,
45 struct attribute *attr)
46{
47 return 0;
48}
49static inline int kobject_uevent_atomic(struct kobject *kobj,
50 enum kobject_action action,
51 struct attribute *attr)
52{
53 return 0;
54}
55#endif
56
57#endif
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index c03f2dc933de..669756bc20a2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -68,6 +68,9 @@ struct kprobe {
68 /* list of kprobes for multi-handler support */ 68 /* list of kprobes for multi-handler support */
69 struct list_head list; 69 struct list_head list;
70 70
71 /* Indicates that the corresponding module has been ref counted */
72 unsigned int mod_refcounted;
73
71 /*count the number of times this probe was temporarily disarmed */ 74 /*count the number of times this probe was temporarily disarmed */
72 unsigned long nmissed; 75 unsigned long nmissed;
73 76
@@ -149,11 +152,10 @@ struct kretprobe_instance {
149}; 152};
150 153
151extern spinlock_t kretprobe_lock; 154extern spinlock_t kretprobe_lock;
155extern struct semaphore kprobe_mutex;
152extern int arch_prepare_kprobe(struct kprobe *p); 156extern int arch_prepare_kprobe(struct kprobe *p);
153extern void arch_copy_kprobe(struct kprobe *p);
154extern void arch_arm_kprobe(struct kprobe *p); 157extern void arch_arm_kprobe(struct kprobe *p);
155extern void arch_disarm_kprobe(struct kprobe *p); 158extern void arch_disarm_kprobe(struct kprobe *p);
156extern void arch_remove_kprobe(struct kprobe *p);
157extern int arch_init_kprobes(void); 159extern int arch_init_kprobes(void);
158extern void show_registers(struct pt_regs *regs); 160extern void show_registers(struct pt_regs *regs);
159extern kprobe_opcode_t *get_insn_slot(void); 161extern kprobe_opcode_t *get_insn_slot(void);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
new file mode 100644
index 000000000000..1bd6552cc341
--- /dev/null
+++ b/include/linux/ktime.h
@@ -0,0 +1,284 @@
1/*
2 * include/linux/ktime.h
3 *
4 * ktime_t - nanosecond-resolution time format.
5 *
6 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de>
7 * Copyright(C) 2005, Red Hat, Inc., Ingo Molnar
8 *
9 * data type definitions, declarations, prototypes and macros.
10 *
11 * Started by: Thomas Gleixner and Ingo Molnar
12 *
13 * For licencing details see kernel-base/COPYING
14 */
15#ifndef _LINUX_KTIME_H
16#define _LINUX_KTIME_H
17
18#include <linux/time.h>
19#include <linux/jiffies.h>
20
21/*
22 * ktime_t:
23 *
24 * On 64-bit CPUs a single 64-bit variable is used to store the hrtimers
25 * internal representation of time values in scalar nanoseconds. The
26 * design plays out best on 64-bit CPUs, where most conversions are
27 * NOPs and most arithmetic ktime_t operations are plain arithmetic
28 * operations.
29 *
30 * On 32-bit CPUs an optimized representation of the timespec structure
31 * is used to avoid expensive conversions from and to timespecs. The
32 * endian-aware order of the tv struct members is choosen to allow
33 * mathematical operations on the tv64 member of the union too, which
34 * for certain operations produces better code.
35 *
36 * For architectures with efficient support for 64/32-bit conversions the
37 * plain scalar nanosecond based representation can be selected by the
38 * config switch CONFIG_KTIME_SCALAR.
39 */
40typedef union {
41 s64 tv64;
42#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
43 struct {
44# ifdef __BIG_ENDIAN
45 s32 sec, nsec;
46# else
47 s32 nsec, sec;
48# endif
49 } tv;
50#endif
51} ktime_t;
52
53#define KTIME_MAX (~((u64)1 << 63))
54
55/*
56 * ktime_t definitions when using the 64-bit scalar representation:
57 */
58
59#if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)
60
61/* Define a ktime_t variable and initialize it to zero: */
62#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
63
64/**
65 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
66 *
67 * @secs: seconds to set
68 * @nsecs: nanoseconds to set
69 *
70 * Return the ktime_t representation of the value
71 */
72static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
73{
74 return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs };
75}
76
77/* Subtract two ktime_t variables. rem = lhs -rhs: */
78#define ktime_sub(lhs, rhs) \
79 ({ (ktime_t){ .tv64 = (lhs).tv64 - (rhs).tv64 }; })
80
81/* Add two ktime_t variables. res = lhs + rhs: */
82#define ktime_add(lhs, rhs) \
83 ({ (ktime_t){ .tv64 = (lhs).tv64 + (rhs).tv64 }; })
84
85/*
86 * Add a ktime_t variable and a scalar nanosecond value.
87 * res = kt + nsval:
88 */
89#define ktime_add_ns(kt, nsval) \
90 ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
91
92/* convert a timespec to ktime_t format: */
93#define timespec_to_ktime(ts) ktime_set((ts).tv_sec, (ts).tv_nsec)
94
95/* convert a timeval to ktime_t format: */
96#define timeval_to_ktime(tv) ktime_set((tv).tv_sec, (tv).tv_usec * 1000)
97
98/* Map the ktime_t to timespec conversion to ns_to_timespec function */
99#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64)
100
101/* Map the ktime_t to timeval conversion to ns_to_timeval function */
102#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
103
104/* Map the ktime_t to clock_t conversion to the inline in jiffies.h: */
105#define ktime_to_clock_t(kt) nsec_to_clock_t((kt).tv64)
106
107/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
108#define ktime_to_ns(kt) ((kt).tv64)
109
110#else
111
112/*
113 * Helper macros/inlines to get the ktime_t math right in the timespec
114 * representation. The macros are sometimes ugly - their actual use is
115 * pretty okay-ish, given the circumstances. We do all this for
116 * performance reasons. The pure scalar nsec_t based code was nice and
117 * simple, but created too many 64-bit / 32-bit conversions and divisions.
118 *
119 * Be especially aware that negative values are represented in a way
120 * that the tv.sec field is negative and the tv.nsec field is greater
121 * or equal to zero but less than nanoseconds per second. This is the
122 * same representation which is used by timespecs.
123 *
124 * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC
125 */
126
127/* Define a ktime_t variable and initialize it to zero: */
128#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
129
130/* Set a ktime_t variable to a value in sec/nsec representation: */
131static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
132{
133 return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
134}
135
136/**
137 * ktime_sub - subtract two ktime_t variables
138 *
139 * @lhs: minuend
140 * @rhs: subtrahend
141 *
142 * Returns the remainder of the substraction
143 */
144static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
145{
146 ktime_t res;
147
148 res.tv64 = lhs.tv64 - rhs.tv64;
149 if (res.tv.nsec < 0)
150 res.tv.nsec += NSEC_PER_SEC;
151
152 return res;
153}
154
155/**
156 * ktime_add - add two ktime_t variables
157 *
158 * @add1: addend1
159 * @add2: addend2
160 *
161 * Returns the sum of addend1 and addend2
162 */
163static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
164{
165 ktime_t res;
166
167 res.tv64 = add1.tv64 + add2.tv64;
168 /*
169 * performance trick: the (u32) -NSEC gives 0x00000000Fxxxxxxx
170 * so we subtract NSEC_PER_SEC and add 1 to the upper 32 bit.
171 *
172 * it's equivalent to:
173 * tv.nsec -= NSEC_PER_SEC
174 * tv.sec ++;
175 */
176 if (res.tv.nsec >= NSEC_PER_SEC)
177 res.tv64 += (u32)-NSEC_PER_SEC;
178
179 return res;
180}
181
182/**
183 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable
184 *
185 * @kt: addend
186 * @nsec: the scalar nsec value to add
187 *
188 * Returns the sum of kt and nsec in ktime_t format
189 */
190extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
191
192/**
193 * timespec_to_ktime - convert a timespec to ktime_t format
194 *
195 * @ts: the timespec variable to convert
196 *
197 * Returns a ktime_t variable with the converted timespec value
198 */
199static inline ktime_t timespec_to_ktime(const struct timespec ts)
200{
201 return (ktime_t) { .tv = { .sec = (s32)ts.tv_sec,
202 .nsec = (s32)ts.tv_nsec } };
203}
204
205/**
206 * timeval_to_ktime - convert a timeval to ktime_t format
207 *
208 * @tv: the timeval variable to convert
209 *
210 * Returns a ktime_t variable with the converted timeval value
211 */
212static inline ktime_t timeval_to_ktime(const struct timeval tv)
213{
214 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
215 .nsec = (s32)tv.tv_usec * 1000 } };
216}
217
218/**
219 * ktime_to_timespec - convert a ktime_t variable to timespec format
220 *
221 * @kt: the ktime_t variable to convert
222 *
223 * Returns the timespec representation of the ktime value
224 */
225static inline struct timespec ktime_to_timespec(const ktime_t kt)
226{
227 return (struct timespec) { .tv_sec = (time_t) kt.tv.sec,
228 .tv_nsec = (long) kt.tv.nsec };
229}
230
231/**
232 * ktime_to_timeval - convert a ktime_t variable to timeval format
233 *
234 * @kt: the ktime_t variable to convert
235 *
236 * Returns the timeval representation of the ktime value
237 */
238static inline struct timeval ktime_to_timeval(const ktime_t kt)
239{
240 return (struct timeval) {
241 .tv_sec = (time_t) kt.tv.sec,
242 .tv_usec = (suseconds_t) (kt.tv.nsec / NSEC_PER_USEC) };
243}
244
245/**
246 * ktime_to_clock_t - convert a ktime_t variable to clock_t format
247 * @kt: the ktime_t variable to convert
248 *
249 * Returns a clock_t variable with the converted value
250 */
251static inline clock_t ktime_to_clock_t(const ktime_t kt)
252{
253 return nsec_to_clock_t( (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec);
254}
255
256/**
257 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
258 * @kt: the ktime_t variable to convert
259 *
260 * Returns the scalar nanoseconds representation of kt
261 */
262static inline u64 ktime_to_ns(const ktime_t kt)
263{
264 return (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
265}
266
267#endif
268
269/*
270 * The resolution of the clocks. The resolution value is returned in
271 * the clock_getres() system call to give application programmers an
272 * idea of the (in)accuracy of timers. Timer values are rounded up to
273 * this resolution values.
274 */
275#define KTIME_REALTIME_RES (ktime_t){ .tv64 = TICK_NSEC }
276#define KTIME_MONOTONIC_RES (ktime_t){ .tv64 = TICK_NSEC }
277
278/* Get the monotonic time in timespec format: */
279extern void ktime_get_ts(struct timespec *ts);
280
281/* Get the real (wall-) time in timespec format: */
282#define ktime_get_real_ts(ts) getnstimeofday(ts)
283
284#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 596858e37cc1..5aa8b133f011 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -125,6 +125,8 @@ enum {
125 ATA_FLAG_DEBUGMSG = (1 << 10), 125 ATA_FLAG_DEBUGMSG = (1 << 10),
126 ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */ 126 ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */
127 127
128 ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */
129
128 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 130 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
129 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 131 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
130 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ 132 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */
@@ -439,6 +441,8 @@ extern void ata_std_ports(struct ata_ioports *ioaddr);
439extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 441extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
440 unsigned int n_ports); 442 unsigned int n_ports);
441extern void ata_pci_remove_one (struct pci_dev *pdev); 443extern void ata_pci_remove_one (struct pci_dev *pdev);
444extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
445extern int ata_pci_device_resume(struct pci_dev *pdev);
442#endif /* CONFIG_PCI */ 446#endif /* CONFIG_PCI */
443extern int ata_device_add(const struct ata_probe_ent *ent); 447extern int ata_device_add(const struct ata_probe_ent *ent);
444extern void ata_host_set_remove(struct ata_host_set *host_set); 448extern void ata_host_set_remove(struct ata_host_set *host_set);
@@ -448,6 +452,10 @@ extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmn
448extern int ata_scsi_error(struct Scsi_Host *host); 452extern int ata_scsi_error(struct Scsi_Host *host);
449extern int ata_scsi_release(struct Scsi_Host *host); 453extern int ata_scsi_release(struct Scsi_Host *host);
450extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 454extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
455extern int ata_scsi_device_resume(struct scsi_device *);
456extern int ata_scsi_device_suspend(struct scsi_device *);
457extern int ata_device_resume(struct ata_port *, struct ata_device *);
458extern int ata_device_suspend(struct ata_port *, struct ata_device *);
451extern int ata_ratelimit(void); 459extern int ata_ratelimit(void);
452 460
453/* 461/*
@@ -483,7 +491,8 @@ extern u8 ata_bmdma_status(struct ata_port *ap);
483extern void ata_bmdma_irq_clear(struct ata_port *ap); 491extern void ata_bmdma_irq_clear(struct ata_port *ap);
484extern void ata_qc_complete(struct ata_queued_cmd *qc); 492extern void ata_qc_complete(struct ata_queued_cmd *qc);
485extern void ata_eng_timeout(struct ata_port *ap); 493extern void ata_eng_timeout(struct ata_port *ap);
486extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, 494extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
495 struct scsi_cmnd *cmd,
487 void (*done)(struct scsi_cmnd *)); 496 void (*done)(struct scsi_cmnd *));
488extern int ata_std_bios_param(struct scsi_device *sdev, 497extern int ata_std_bios_param(struct scsi_device *sdev,
489 struct block_device *bdev, 498 struct block_device *bdev,
@@ -493,6 +502,8 @@ extern int ata_scsi_slave_config(struct scsi_device *sdev);
493/* 502/*
494 * Timing helpers 503 * Timing helpers
495 */ 504 */
505
506extern unsigned int ata_pio_need_iordy(const struct ata_device *);
496extern int ata_timing_compute(struct ata_device *, unsigned short, 507extern int ata_timing_compute(struct ata_device *, unsigned short,
497 struct ata_timing *, int, int); 508 struct ata_timing *, int, int);
498extern void ata_timing_merge(const struct ata_timing *, 509extern void ata_timing_merge(const struct ata_timing *,
diff --git a/include/linux/list.h b/include/linux/list.h
index 8e3388284530..945daa1f13dd 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -436,6 +436,20 @@ static inline void list_splice_init(struct list_head *list,
436 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 436 pos = n, n = list_entry(n->member.next, typeof(*n), member))
437 437
438/** 438/**
439 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against
440 * removal of list entry
441 * @pos: the type * to use as a loop counter.
442 * @n: another type * to use as temporary storage
443 * @head: the head for your list.
444 * @member: the name of the list_struct within the struct.
445 */
446#define list_for_each_entry_safe_reverse(pos, n, head, member) \
447 for (pos = list_entry((head)->prev, typeof(*pos), member), \
448 n = list_entry(pos->member.prev, typeof(*pos), member); \
449 &pos->member != (head); \
450 pos = n, n = list_entry(n->member.prev, typeof(*n), member))
451
452/**
439 * list_for_each_rcu - iterate over an rcu-protected list 453 * list_for_each_rcu - iterate over an rcu-protected list
440 * @pos: the &struct list_head to use as a loop counter. 454 * @pos: the &struct list_head to use as a loop counter.
441 * @head: the head for your list. 455 * @head: the head for your list.
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 16d4e5a08e1d..95c8fea293ba 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -172,7 +172,7 @@ extern struct nlm_host *nlm_find_client(void);
172/* 172/*
173 * Server-side lock handling 173 * Server-side lock handling
174 */ 174 */
175int nlmsvc_async_call(struct nlm_rqst *, u32, rpc_action); 175int nlmsvc_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
177 struct nlm_lock *, int, struct nlm_cookie *); 177 struct nlm_lock *, int, struct nlm_cookie *);
178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 40f63c9879d2..f96506782ebe 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -58,9 +58,9 @@ struct loop_device {
58 struct bio *lo_bio; 58 struct bio *lo_bio;
59 struct bio *lo_biotail; 59 struct bio *lo_biotail;
60 int lo_state; 60 int lo_state;
61 struct semaphore lo_sem; 61 struct completion lo_done;
62 struct completion lo_bh_done;
62 struct semaphore lo_ctl_mutex; 63 struct semaphore lo_ctl_mutex;
63 struct semaphore lo_bh_mutex;
64 int lo_pending; 64 int lo_pending;
65 65
66 request_queue_t *lo_queue; 66 request_queue_t *lo_queue;
diff --git a/include/linux/memory.h b/include/linux/memory.h
index dc4081b6f161..e251dc43d0f5 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -70,21 +70,15 @@ static inline void unregister_memory_notifier(struct notifier_block *nb)
70{ 70{
71} 71}
72#else 72#else
73extern int register_memory(struct memory_block *, struct mem_section *section, struct node *);
74extern int register_new_memory(struct mem_section *); 73extern int register_new_memory(struct mem_section *);
75extern int unregister_memory_section(struct mem_section *); 74extern int unregister_memory_section(struct mem_section *);
76extern int memory_dev_init(void); 75extern int memory_dev_init(void);
77extern int register_memory_notifier(struct notifier_block *nb); 76extern int remove_memory_block(unsigned long, struct mem_section *, int);
78extern void unregister_memory_notifier(struct notifier_block *nb);
79 77
80#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 78#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
81 79
82extern int invalidate_phys_mapping(unsigned long, unsigned long);
83struct notifier_block; 80struct notifier_block;
84 81
85extern int register_memory_notifier(struct notifier_block *nb);
86extern void unregister_memory_notifier(struct notifier_block *nb);
87
88#endif /* CONFIG_MEMORY_HOTPLUG */ 82#endif /* CONFIG_MEMORY_HOTPLUG */
89 83
90#define hotplug_memory_notifier(fn, pri) { \ 84#define hotplug_memory_notifier(fn, pri) { \
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 8b67cf837ca9..d6a53ed6ab6c 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -22,6 +22,9 @@
22 22
23/* Flags for mbind */ 23/* Flags for mbind */
24#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ 24#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */
25#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */
26#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
27#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */
25 28
26#ifdef __KERNEL__ 29#ifdef __KERNEL__
27 30
@@ -65,6 +68,7 @@ struct mempolicy {
65 nodemask_t nodes; /* interleave */ 68 nodemask_t nodes; /* interleave */
66 /* undefined for default */ 69 /* undefined for default */
67 } v; 70 } v;
71 nodemask_t cpuset_mems_allowed; /* mempolicy relative to these nodes */
68}; 72};
69 73
70/* 74/*
@@ -110,14 +114,6 @@ static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
110#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL) 114#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL)
111 115
112/* 116/*
113 * Hugetlb policy. i386 hugetlb so far works with node numbers
114 * instead of zone lists, so give it special interfaces for now.
115 */
116extern int mpol_first_node(struct vm_area_struct *vma, unsigned long addr);
117extern int mpol_node_valid(int nid, struct vm_area_struct *vma,
118 unsigned long addr);
119
120/*
121 * Tree of shared policies for a shared memory region. 117 * Tree of shared policies for a shared memory region.
122 * Maintain the policies in a pseudo mm that contains vmas. The vmas 118 * Maintain the policies in a pseudo mm that contains vmas. The vmas
123 * carry the policy. As a special twist the pseudo mm is indexed in pages, not 119 * carry the policy. As a special twist the pseudo mm is indexed in pages, not
@@ -136,12 +132,8 @@ struct shared_policy {
136 spinlock_t lock; 132 spinlock_t lock;
137}; 133};
138 134
139static inline void mpol_shared_policy_init(struct shared_policy *info) 135void mpol_shared_policy_init(struct shared_policy *info, int policy,
140{ 136 nodemask_t *nodes);
141 info->root = RB_ROOT;
142 spin_lock_init(&info->lock);
143}
144
145int mpol_set_shared_policy(struct shared_policy *info, 137int mpol_set_shared_policy(struct shared_policy *info,
146 struct vm_area_struct *vma, 138 struct vm_area_struct *vma,
147 struct mempolicy *new); 139 struct mempolicy *new);
@@ -149,13 +141,37 @@ void mpol_free_shared_policy(struct shared_policy *p);
149struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, 141struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
150 unsigned long idx); 142 unsigned long idx);
151 143
152struct mempolicy *get_vma_policy(struct task_struct *task,
153 struct vm_area_struct *vma, unsigned long addr);
154
155extern void numa_default_policy(void); 144extern void numa_default_policy(void);
156extern void numa_policy_init(void); 145extern void numa_policy_init(void);
157extern void numa_policy_rebind(const nodemask_t *old, const nodemask_t *new); 146extern void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *new);
147extern void mpol_rebind_task(struct task_struct *tsk,
148 const nodemask_t *new);
149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x))
151
152#ifdef CONFIG_CPUSET
153#define current_cpuset_is_being_rebound() \
154 (cpuset_being_rebound == current->cpuset)
155#else
156#define current_cpuset_is_being_rebound() 0
157#endif
158
158extern struct mempolicy default_policy; 159extern struct mempolicy default_policy;
160extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
161 unsigned long addr);
162
163extern int policy_zone;
164
165static inline void check_highest_zone(int k)
166{
167 if (k > policy_zone)
168 policy_zone = k;
169}
170
171int do_migrate_pages(struct mm_struct *mm,
172 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags);
173
174extern void *cpuset_being_rebound; /* Trigger mpol_copy vma rebind */
159 175
160#else 176#else
161 177
@@ -182,17 +198,6 @@ static inline struct mempolicy *mpol_copy(struct mempolicy *old)
182 return NULL; 198 return NULL;
183} 199}
184 200
185static inline int mpol_first_node(struct vm_area_struct *vma, unsigned long a)
186{
187 return numa_node_id();
188}
189
190static inline int
191mpol_node_valid(int nid, struct vm_area_struct *vma, unsigned long a)
192{
193 return 1;
194}
195
196struct shared_policy {}; 201struct shared_policy {};
197 202
198static inline int mpol_set_shared_policy(struct shared_policy *info, 203static inline int mpol_set_shared_policy(struct shared_policy *info,
@@ -202,7 +207,8 @@ static inline int mpol_set_shared_policy(struct shared_policy *info,
202 return -EINVAL; 207 return -EINVAL;
203} 208}
204 209
205static inline void mpol_shared_policy_init(struct shared_policy *info) 210static inline void mpol_shared_policy_init(struct shared_policy *info,
211 int policy, nodemask_t *nodes)
206{ 212{
207} 213}
208 214
@@ -227,11 +233,38 @@ static inline void numa_default_policy(void)
227{ 233{
228} 234}
229 235
230static inline void numa_policy_rebind(const nodemask_t *old, 236static inline void mpol_rebind_policy(struct mempolicy *pol,
237 const nodemask_t *new)
238{
239}
240
241static inline void mpol_rebind_task(struct task_struct *tsk,
231 const nodemask_t *new) 242 const nodemask_t *new)
232{ 243{
233} 244}
234 245
246static inline void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
247{
248}
249
250#define set_cpuset_being_rebound(x) do {} while (0)
251
252static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
253 unsigned long addr)
254{
255 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER);
256}
257
258static inline int do_migrate_pages(struct mm_struct *mm,
259 const nodemask_t *from_nodes,
260 const nodemask_t *to_nodes, int flags)
261{
262 return 0;
263}
264
265static inline void check_highest_zone(int k)
266{
267}
235#endif /* CONFIG_NUMA */ 268#endif /* CONFIG_NUMA */
236#endif /* __KERNEL__ */ 269#endif /* __KERNEL__ */
237 270
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a06a84d347fb..85854b867463 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/errno.h> 5#include <linux/errno.h>
6#include <linux/capability.h>
6 7
7#ifdef __KERNEL__ 8#ifdef __KERNEL__
8 9
@@ -13,6 +14,7 @@
13#include <linux/rbtree.h> 14#include <linux/rbtree.h>
14#include <linux/prio_tree.h> 15#include <linux/prio_tree.h>
15#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/mutex.h>
16 18
17struct mempolicy; 19struct mempolicy;
18struct anon_vma; 20struct anon_vma;
@@ -223,24 +225,27 @@ struct page {
223 * & limit reverse map searches. 225 * & limit reverse map searches.
224 */ 226 */
225 union { 227 union {
226 unsigned long private; /* Mapping-private opaque data: 228 struct {
227 * usually used for buffer_heads 229 unsigned long private; /* Mapping-private opaque data:
228 * if PagePrivate set; used for 230 * usually used for buffer_heads
229 * swp_entry_t if PageSwapCache 231 * if PagePrivate set; used for
230 * When page is free, this indicates 232 * swp_entry_t if PageSwapCache.
231 * order in the buddy system. 233 * When page is free, this
232 */ 234 * indicates order in the buddy
235 * system.
236 */
237 struct address_space *mapping; /* If low bit clear, points to
238 * inode address_space, or NULL.
239 * If page mapped as anonymous
240 * memory, low bit is set, and
241 * it points to anon_vma object:
242 * see PAGE_MAPPING_ANON below.
243 */
244 };
233#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 245#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
234 spinlock_t ptl; 246 spinlock_t ptl;
235#endif 247#endif
236 } u; 248 };
237 struct address_space *mapping; /* If low bit clear, points to
238 * inode address_space, or NULL.
239 * If page mapped as anonymous
240 * memory, low bit is set, and
241 * it points to anon_vma object:
242 * see PAGE_MAPPING_ANON below.
243 */
244 pgoff_t index; /* Our offset within mapping. */ 249 pgoff_t index; /* Our offset within mapping. */
245 struct list_head lru; /* Pageout list, eg. active_list 250 struct list_head lru; /* Pageout list, eg. active_list
246 * protected by zone->lru_lock ! 251 * protected by zone->lru_lock !
@@ -261,8 +266,8 @@ struct page {
261#endif /* WANT_PAGE_VIRTUAL */ 266#endif /* WANT_PAGE_VIRTUAL */
262}; 267};
263 268
264#define page_private(page) ((page)->u.private) 269#define page_private(page) ((page)->private)
265#define set_page_private(page, v) ((page)->u.private = (v)) 270#define set_page_private(page, v) ((page)->private = (v))
266 271
267/* 272/*
268 * FIXME: take this include out, include page-flags.h in 273 * FIXME: take this include out, include page-flags.h in
@@ -308,7 +313,7 @@ struct page {
308 */ 313 */
309#define get_page_testone(p) atomic_inc_and_test(&(p)->_count) 314#define get_page_testone(p) atomic_inc_and_test(&(p)->_count)
310 315
311#define set_page_count(p,v) atomic_set(&(p)->_count, v - 1) 316#define set_page_count(p,v) atomic_set(&(p)->_count, (v) - 1)
312#define __put_page(p) atomic_dec(&(p)->_count) 317#define __put_page(p) atomic_dec(&(p)->_count)
313 318
314extern void FASTCALL(__page_cache_release(struct page *)); 319extern void FASTCALL(__page_cache_release(struct page *));
@@ -507,7 +512,7 @@ static inline void set_page_links(struct page *page, unsigned long zone,
507extern struct page *mem_map; 512extern struct page *mem_map;
508#endif 513#endif
509 514
510static inline void *lowmem_page_address(struct page *page) 515static __always_inline void *lowmem_page_address(struct page *page)
511{ 516{
512 return __va(page_to_pfn(page) << PAGE_SHIFT); 517 return __va(page_to_pfn(page) << PAGE_SHIFT);
513} 518}
@@ -634,14 +639,38 @@ struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
634int shmem_lock(struct file *file, int lock, struct user_struct *user); 639int shmem_lock(struct file *file, int lock, struct user_struct *user);
635#else 640#else
636#define shmem_nopage filemap_nopage 641#define shmem_nopage filemap_nopage
637#define shmem_lock(a, b, c) ({0;}) /* always in memory, no need to lock */ 642
638#define shmem_set_policy(a, b) (0) 643static inline int shmem_lock(struct file *file, int lock,
639#define shmem_get_policy(a, b) (NULL) 644 struct user_struct *user)
645{
646 return 0;
647}
648
649static inline int shmem_set_policy(struct vm_area_struct *vma,
650 struct mempolicy *new)
651{
652 return 0;
653}
654
655static inline struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
656 unsigned long addr)
657{
658 return NULL;
659}
640#endif 660#endif
641struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); 661struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags);
662extern int shmem_mmap(struct file *file, struct vm_area_struct *vma);
642 663
643int shmem_zero_setup(struct vm_area_struct *); 664int shmem_zero_setup(struct vm_area_struct *);
644 665
666#ifndef CONFIG_MMU
667extern unsigned long shmem_get_unmapped_area(struct file *file,
668 unsigned long addr,
669 unsigned long len,
670 unsigned long pgoff,
671 unsigned long flags);
672#endif
673
645static inline int can_do_mlock(void) 674static inline int can_do_mlock(void)
646{ 675{
647 if (capable(CAP_IPC_LOCK)) 676 if (capable(CAP_IPC_LOCK))
@@ -690,14 +719,31 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
690} 719}
691 720
692extern int vmtruncate(struct inode * inode, loff_t offset); 721extern int vmtruncate(struct inode * inode, loff_t offset);
722extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
693extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); 723extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
694extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); 724extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
695extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
696 725
697static inline int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access) 726#ifdef CONFIG_MMU
727extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma,
728 unsigned long address, int write_access);
729
730static inline int handle_mm_fault(struct mm_struct *mm,
731 struct vm_area_struct *vma, unsigned long address,
732 int write_access)
698{ 733{
699 return __handle_mm_fault(mm, vma, address, write_access) & (~VM_FAULT_WRITE); 734 return __handle_mm_fault(mm, vma, address, write_access) &
735 (~VM_FAULT_WRITE);
700} 736}
737#else
738static inline int handle_mm_fault(struct mm_struct *mm,
739 struct vm_area_struct *vma, unsigned long address,
740 int write_access)
741{
742 /* should never happen if there's no MMU */
743 BUG();
744 return VM_FAULT_SIGBUS;
745}
746#endif
701 747
702extern int make_pages_present(unsigned long addr, unsigned long end); 748extern int make_pages_present(unsigned long addr, unsigned long end);
703extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 749extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
@@ -774,7 +820,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
774 * overflow into the next struct page (as it might with DEBUG_SPINLOCK). 820 * overflow into the next struct page (as it might with DEBUG_SPINLOCK).
775 * When freeing, reset page->mapping so free_pages_check won't complain. 821 * When freeing, reset page->mapping so free_pages_check won't complain.
776 */ 822 */
777#define __pte_lockptr(page) &((page)->u.ptl) 823#define __pte_lockptr(page) &((page)->ptl)
778#define pte_lock_init(_page) do { \ 824#define pte_lock_init(_page) do { \
779 spin_lock_init(__pte_lockptr(_page)); \ 825 spin_lock_init(__pte_lockptr(_page)); \
780} while (0) 826} while (0)
@@ -896,6 +942,8 @@ extern unsigned long do_brk(unsigned long, unsigned long);
896/* filemap.c */ 942/* filemap.c */
897extern unsigned long page_unuse(struct page *); 943extern unsigned long page_unuse(struct page *);
898extern void truncate_inode_pages(struct address_space *, loff_t); 944extern void truncate_inode_pages(struct address_space *, loff_t);
945extern void truncate_inode_pages_range(struct address_space *,
946 loff_t lstart, loff_t lend);
899 947
900/* generic vm_area_ops exported for stackable file systems */ 948/* generic vm_area_ops exported for stackable file systems */
901extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int *); 949extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int *);
@@ -978,6 +1026,9 @@ static inline void vm_stat_account(struct mm_struct *mm,
978static inline void 1026static inline void
979kernel_map_pages(struct page *page, int numpages, int enable) 1027kernel_map_pages(struct page *page, int numpages, int enable)
980{ 1028{
1029 if (!PageHighMem(page) && !enable)
1030 mutex_debug_check_no_locks_freed(page_address(page),
1031 numpages * PAGE_SIZE);
981} 1032}
982#endif 1033#endif
983 1034
@@ -993,5 +1044,12 @@ int in_gate_area_no_task(unsigned long addr);
993/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ 1044/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
994#define OOM_DISABLE -17 1045#define OOM_DISABLE -17
995 1046
1047int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1048 void __user *, size_t *, loff_t *);
1049int shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1050 unsigned long lru_pages);
1051void drop_pagecache(void);
1052void drop_slab(void);
1053
996#endif /* __KERNEL__ */ 1054#endif /* __KERNEL__ */
997#endif /* _LINUX_MM_H */ 1055#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 47762ca695a5..49cc68af01f8 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -38,3 +38,25 @@ del_page_from_lru(struct zone *zone, struct page *page)
38 zone->nr_inactive--; 38 zone->nr_inactive--;
39 } 39 }
40} 40}
41
42/*
43 * Isolate one page from the LRU lists.
44 *
45 * - zone->lru_lock must be held
46 */
47static inline int __isolate_lru_page(struct page *page)
48{
49 if (unlikely(!TestClearPageLRU(page)))
50 return 0;
51
52 if (get_page_testone(page)) {
53 /*
54 * It is being freed elsewhere
55 */
56 __put_page(page);
57 SetPageLRU(page);
58 return -ENOENT;
59 }
60
61 return 1;
62}
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 18fc77f682de..30dd978c1ec8 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -30,7 +30,12 @@ struct mmc_csd {
30 unsigned int tacc_ns; 30 unsigned int tacc_ns;
31 unsigned int max_dtr; 31 unsigned int max_dtr;
32 unsigned int read_blkbits; 32 unsigned int read_blkbits;
33 unsigned int write_blkbits;
33 unsigned int capacity; 34 unsigned int capacity;
35 unsigned int read_partial:1,
36 read_misalign:1,
37 write_partial:1,
38 write_misalign:1;
34}; 39};
35 40
36struct sd_scr { 41struct sd_scr {
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index aef6042f8f0b..ccd3e13de1e8 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -27,14 +27,15 @@ struct mmc_command {
27#define MMC_RSP_MASK (3 << 0) 27#define MMC_RSP_MASK (3 << 0)
28#define MMC_RSP_CRC (1 << 3) /* expect valid crc */ 28#define MMC_RSP_CRC (1 << 3) /* expect valid crc */
29#define MMC_RSP_BUSY (1 << 4) /* card may send busy */ 29#define MMC_RSP_BUSY (1 << 4) /* card may send busy */
30#define MMC_RSP_OPCODE (1 << 5) /* response contains opcode */
30 31
31/* 32/*
32 * These are the response types, and correspond to valid bit 33 * These are the response types, and correspond to valid bit
33 * patterns of the above flags. One additional valid pattern 34 * patterns of the above flags. One additional valid pattern
34 * is all zeros, which means we don't expect a response. 35 * is all zeros, which means we don't expect a response.
35 */ 36 */
36#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC) 37#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_OPCODE)
37#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_BUSY) 38#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
38#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC) 39#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC)
39#define MMC_RSP_R3 (MMC_RSP_SHORT) 40#define MMC_RSP_R3 (MMC_RSP_SHORT)
40#define MMC_RSP_R6 (MMC_RSP_SHORT|MMC_RSP_CRC) 41#define MMC_RSP_R6 (MMC_RSP_SHORT|MMC_RSP_CRC)
@@ -64,6 +65,7 @@ struct mmc_data {
64#define MMC_DATA_WRITE (1 << 8) 65#define MMC_DATA_WRITE (1 << 8)
65#define MMC_DATA_READ (1 << 9) 66#define MMC_DATA_READ (1 << 9)
66#define MMC_DATA_STREAM (1 << 10) 67#define MMC_DATA_STREAM (1 << 10)
68#define MMC_DATA_MULTI (1 << 11)
67 69
68 unsigned int bytes_xfered; 70 unsigned int bytes_xfered;
69 71
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9f22090df7dd..34cbefd2ebde 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -38,7 +38,7 @@ struct pglist_data;
38#if defined(CONFIG_SMP) 38#if defined(CONFIG_SMP)
39struct zone_padding { 39struct zone_padding {
40 char x[0]; 40 char x[0];
41} ____cacheline_maxaligned_in_smp; 41} ____cacheline_internodealigned_in_smp;
42#define ZONE_PADDING(name) struct zone_padding name; 42#define ZONE_PADDING(name) struct zone_padding name;
43#else 43#else
44#define ZONE_PADDING(name) 44#define ZONE_PADDING(name)
@@ -46,7 +46,6 @@ struct zone_padding {
46 46
47struct per_cpu_pages { 47struct per_cpu_pages {
48 int count; /* number of pages in the list */ 48 int count; /* number of pages in the list */
49 int low; /* low watermark, refill needed */
50 int high; /* high watermark, emptying needed */ 49 int high; /* high watermark, emptying needed */
51 int batch; /* chunk size for buddy add/remove */ 50 int batch; /* chunk size for buddy add/remove */
52 struct list_head list; /* the list of pages */ 51 struct list_head list; /* the list of pages */
@@ -99,7 +98,7 @@ struct per_cpu_pageset {
99 98
100/* 99/*
101 * On machines where it is needed (eg PCs) we divide physical memory 100 * On machines where it is needed (eg PCs) we divide physical memory
102 * into multiple physical zones. On a PC we have 4 zones: 101 * into multiple physical zones. On a 32bit PC we have 4 zones:
103 * 102 *
104 * ZONE_DMA < 16 MB ISA DMA capable memory 103 * ZONE_DMA < 16 MB ISA DMA capable memory
105 * ZONE_DMA32 0 MB Empty 104 * ZONE_DMA32 0 MB Empty
@@ -234,7 +233,7 @@ struct zone {
234 * rarely used fields: 233 * rarely used fields:
235 */ 234 */
236 char *name; 235 char *name;
237} ____cacheline_maxaligned_in_smp; 236} ____cacheline_internodealigned_in_smp;
238 237
239 238
240/* 239/*
@@ -389,6 +388,11 @@ static inline struct zone *next_zone(struct zone *zone)
389#define for_each_zone(zone) \ 388#define for_each_zone(zone) \
390 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone)) 389 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone))
391 390
391static inline int populated_zone(struct zone *zone)
392{
393 return (!!zone->present_pages);
394}
395
392static inline int is_highmem_idx(int idx) 396static inline int is_highmem_idx(int idx)
393{ 397{
394 return (idx == ZONE_HIGHMEM); 398 return (idx == ZONE_HIGHMEM);
@@ -398,6 +402,7 @@ static inline int is_normal_idx(int idx)
398{ 402{
399 return (idx == ZONE_NORMAL); 403 return (idx == ZONE_NORMAL);
400} 404}
405
401/** 406/**
402 * is_highmem - helper function to quickly check if a struct zone is a 407 * is_highmem - helper function to quickly check if a struct zone is a
403 * highmem zone or not. This is an attempt to keep references 408 * highmem zone or not. This is an attempt to keep references
@@ -414,6 +419,16 @@ static inline int is_normal(struct zone *zone)
414 return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL; 419 return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
415} 420}
416 421
422static inline int is_dma32(struct zone *zone)
423{
424 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
425}
426
427static inline int is_dma(struct zone *zone)
428{
429 return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
430}
431
417/* These two functions are used to setup the per zone pages min values */ 432/* These two functions are used to setup the per zone pages min values */
418struct ctl_table; 433struct ctl_table;
419struct file; 434struct file;
@@ -422,6 +437,8 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *,
422extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1]; 437extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
423int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, 438int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
424 void __user *, size_t *, loff_t *); 439 void __user *, size_t *, loff_t *);
440int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *,
441 void __user *, size_t *, loff_t *);
425 442
426#include <linux/topology.h> 443#include <linux/topology.h>
427/* Returns the number of the current Node. */ 444/* Returns the number of the current Node. */
@@ -435,7 +452,6 @@ extern struct pglist_data contig_page_data;
435#define NODE_DATA(nid) (&contig_page_data) 452#define NODE_DATA(nid) (&contig_page_data)
436#define NODE_MEM_MAP(nid) mem_map 453#define NODE_MEM_MAP(nid) mem_map
437#define MAX_NODES_SHIFT 1 454#define MAX_NODES_SHIFT 1
438#define pfn_to_nid(pfn) (0)
439 455
440#else /* CONFIG_NEED_MULTIPLE_NODES */ 456#else /* CONFIG_NEED_MULTIPLE_NODES */
441 457
@@ -470,6 +486,10 @@ extern struct pglist_data contig_page_data;
470#define early_pfn_to_nid(nid) (0UL) 486#define early_pfn_to_nid(nid) (0UL)
471#endif 487#endif
472 488
489#ifdef CONFIG_FLATMEM
490#define pfn_to_nid(pfn) (0)
491#endif
492
473#define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT) 493#define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT)
474#define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT) 494#define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT)
475 495
@@ -564,11 +584,6 @@ static inline int valid_section_nr(unsigned long nr)
564 return valid_section(__nr_to_section(nr)); 584 return valid_section(__nr_to_section(nr));
565} 585}
566 586
567/*
568 * Given a kernel address, find the home node of the underlying memory.
569 */
570#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
571
572static inline struct mem_section *__pfn_to_section(unsigned long pfn) 587static inline struct mem_section *__pfn_to_section(unsigned long pfn)
573{ 588{
574 return __nr_to_section(pfn_to_section_nr(pfn)); 589 return __nr_to_section(pfn_to_section_nr(pfn));
@@ -598,13 +613,14 @@ static inline int pfn_valid(unsigned long pfn)
598 * this restriction. 613 * this restriction.
599 */ 614 */
600#ifdef CONFIG_NUMA 615#ifdef CONFIG_NUMA
601#define pfn_to_nid early_pfn_to_nid 616#define pfn_to_nid(pfn) \
602#endif
603
604#define pfn_to_pgdat(pfn) \
605({ \ 617({ \
606 NODE_DATA(pfn_to_nid(pfn)); \ 618 unsigned long __pfn_to_nid_pfn = (pfn); \
619 page_to_nid(pfn_to_page(__pfn_to_nid_pfn)); \
607}) 620})
621#else
622#define pfn_to_nid(pfn) (0)
623#endif
608 624
609#define early_pfn_valid(pfn) pfn_valid(pfn) 625#define early_pfn_valid(pfn) pfn_valid(pfn)
610void sparse_init(void); 626void sparse_init(void);
@@ -613,12 +629,6 @@ void sparse_init(void);
613#define sparse_index_init(_sec, _nid) do {} while (0) 629#define sparse_index_init(_sec, _nid) do {} while (0)
614#endif /* CONFIG_SPARSEMEM */ 630#endif /* CONFIG_SPARSEMEM */
615 631
616#ifdef CONFIG_NODES_SPAN_OTHER_NODES
617#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
618#else
619#define early_pfn_in_nid(pfn, nid) (1)
620#endif
621
622#ifndef early_pfn_valid 632#ifndef early_pfn_valid
623#define early_pfn_valid(pfn) (1) 633#define early_pfn_valid(pfn) (1)
624#endif 634#endif
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 368ec8e45bd0..b5c98c43779e 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -10,7 +10,7 @@
10#ifdef MODULE 10#ifdef MODULE
11#define MODULE_PARAM_PREFIX /* empty */ 11#define MODULE_PARAM_PREFIX /* empty */
12#else 12#else
13#define MODULE_PARAM_PREFIX __stringify(KBUILD_MODNAME) "." 13#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
14#endif 14#endif
15 15
16#ifdef MODULE 16#ifdef MODULE
diff --git a/include/linux/mount.h b/include/linux/mount.h
index dd4e83eba933..b7472ae91fa4 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -20,9 +20,12 @@
20#define MNT_NOSUID 0x01 20#define MNT_NOSUID 0x01
21#define MNT_NODEV 0x02 21#define MNT_NODEV 0x02
22#define MNT_NOEXEC 0x04 22#define MNT_NOEXEC 0x04
23#define MNT_SHARED 0x10 /* if the vfsmount is a shared mount */ 23#define MNT_NOATIME 0x08
24#define MNT_UNBINDABLE 0x20 /* if the vfsmount is a unbindable mount */ 24#define MNT_NODIRATIME 0x10
25#define MNT_PNODE_MASK 0x30 /* propogation flag mask */ 25
26#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
27#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
28#define MNT_PNODE_MASK 0x3000 /* propogation flag mask */
26 29
27struct vfsmount { 30struct vfsmount {
28 struct list_head mnt_hash; 31 struct list_head mnt_hash;
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 941da5c016a0..e933e2a355ad 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -329,7 +329,8 @@ static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len)
329extern void fat_cache_inval_inode(struct inode *inode); 329extern void fat_cache_inval_inode(struct inode *inode);
330extern int fat_get_cluster(struct inode *inode, int cluster, 330extern int fat_get_cluster(struct inode *inode, int cluster,
331 int *fclus, int *dclus); 331 int *fclus, int *dclus);
332extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys); 332extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
333 unsigned long *mapped_blocks);
333 334
334/* fat/dir.c */ 335/* fat/dir.c */
335extern struct file_operations fat_dir_operations; 336extern struct file_operations fat_dir_operations;
diff --git a/include/linux/mutex-debug.h b/include/linux/mutex-debug.h
new file mode 100644
index 000000000000..8b5769f00467
--- /dev/null
+++ b/include/linux/mutex-debug.h
@@ -0,0 +1,23 @@
1#ifndef __LINUX_MUTEX_DEBUG_H
2#define __LINUX_MUTEX_DEBUG_H
3
4#include <linux/linkage.h>
5
6/*
7 * Mutexes - debugging helpers:
8 */
9
10#define __DEBUG_MUTEX_INITIALIZER(lockname) \
11 , .held_list = LIST_HEAD_INIT(lockname.held_list), \
12 .name = #lockname , .magic = &lockname
13
14#define mutex_init(sem) __mutex_init(sem, __FUNCTION__)
15
16extern void FASTCALL(mutex_destroy(struct mutex *lock));
17
18extern void mutex_debug_show_all_locks(void);
19extern void mutex_debug_show_held_locks(struct task_struct *filter);
20extern void mutex_debug_check_no_locks_held(struct task_struct *task);
21extern void mutex_debug_check_no_locks_freed(const void *from, unsigned long len);
22
23#endif
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
new file mode 100644
index 000000000000..f1ac507fa20d
--- /dev/null
+++ b/include/linux/mutex.h
@@ -0,0 +1,120 @@
1/*
2 * Mutexes: blocking mutual exclusion locks
3 *
4 * started by Ingo Molnar:
5 *
6 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 *
8 * This file contains the main data structure and API definitions.
9 */
10#ifndef __LINUX_MUTEX_H
11#define __LINUX_MUTEX_H
12
13#include <linux/list.h>
14#include <linux/spinlock_types.h>
15#include <linux/linkage.h>
16
17#include <asm/atomic.h>
18
19/*
20 * Simple, straightforward mutexes with strict semantics:
21 *
22 * - only one task can hold the mutex at a time
23 * - only the owner can unlock the mutex
24 * - multiple unlocks are not permitted
25 * - recursive locking is not permitted
26 * - a mutex object must be initialized via the API
27 * - a mutex object must not be initialized via memset or copying
28 * - task may not exit with mutex held
29 * - memory areas where held locks reside must not be freed
30 * - held mutexes must not be reinitialized
31 * - mutexes may not be used in irq contexts
32 *
33 * These semantics are fully enforced when DEBUG_MUTEXES is
34 * enabled. Furthermore, besides enforcing the above rules, the mutex
35 * debugging code also implements a number of additional features
36 * that make lock debugging easier and faster:
37 *
38 * - uses symbolic names of mutexes, whenever they are printed in debug output
39 * - point-of-acquire tracking, symbolic lookup of function names
40 * - list of all locks held in the system, printout of them
41 * - owner tracking
42 * - detects self-recursing locks and prints out all relevant info
43 * - detects multi-task circular deadlocks and prints out all affected
44 * locks and tasks (and only those tasks)
45 */
46struct mutex {
47 /* 1: unlocked, 0: locked, negative: locked, possible waiters */
48 atomic_t count;
49 spinlock_t wait_lock;
50 struct list_head wait_list;
51#ifdef CONFIG_DEBUG_MUTEXES
52 struct thread_info *owner;
53 struct list_head held_list;
54 unsigned long acquire_ip;
55 const char *name;
56 void *magic;
57#endif
58};
59
60/*
61 * This is the control structure for tasks blocked on mutex,
62 * which resides on the blocked task's kernel stack:
63 */
64struct mutex_waiter {
65 struct list_head list;
66 struct task_struct *task;
67#ifdef CONFIG_DEBUG_MUTEXES
68 struct mutex *lock;
69 void *magic;
70#endif
71};
72
73#ifdef CONFIG_DEBUG_MUTEXES
74# include <linux/mutex-debug.h>
75#else
76# define __DEBUG_MUTEX_INITIALIZER(lockname)
77# define mutex_init(mutex) __mutex_init(mutex, NULL)
78# define mutex_destroy(mutex) do { } while (0)
79# define mutex_debug_show_all_locks() do { } while (0)
80# define mutex_debug_show_held_locks(p) do { } while (0)
81# define mutex_debug_check_no_locks_held(task) do { } while (0)
82# define mutex_debug_check_no_locks_freed(from, len) do { } while (0)
83#endif
84
85#define __MUTEX_INITIALIZER(lockname) \
86 { .count = ATOMIC_INIT(1) \
87 , .wait_lock = SPIN_LOCK_UNLOCKED \
88 , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \
89 __DEBUG_MUTEX_INITIALIZER(lockname) }
90
91#define DEFINE_MUTEX(mutexname) \
92 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
93
94extern void fastcall __mutex_init(struct mutex *lock, const char *name);
95
96/***
97 * mutex_is_locked - is the mutex locked
98 * @lock: the mutex to be queried
99 *
100 * Returns 1 if the mutex is locked, 0 if unlocked.
101 */
102static inline int fastcall mutex_is_locked(struct mutex *lock)
103{
104 return atomic_read(&lock->count) != 1;
105}
106
107/*
108 * See kernel/mutex.c for detailed documentation of these APIs.
109 * Also see Documentation/mutex-design.txt.
110 */
111extern void fastcall mutex_lock(struct mutex *lock);
112extern int fastcall mutex_lock_interruptible(struct mutex *lock);
113/*
114 * NOTE: mutex_trylock() follows the spin_trylock() convention,
115 * not the down_trylock() convention!
116 */
117extern int fastcall mutex_trylock(struct mutex *lock);
118extern void fastcall mutex_unlock(struct mutex *lock);
119
120#endif
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 455660eafba9..b699e427c00c 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -74,7 +74,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
74extern void release_open_intent(struct nameidata *); 74extern void release_open_intent(struct nameidata *);
75 75
76extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 76extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
77extern struct dentry * lookup_hash(struct nameidata *); 77extern __deprecated_for_modules struct dentry * lookup_hash(struct nameidata *);
78 78
79extern int follow_down(struct vfsmount **, struct dentry **); 79extern int follow_down(struct vfsmount **, struct dentry **);
80extern int follow_up(struct vfsmount **, struct dentry **); 80extern int follow_up(struct vfsmount **, struct dentry **);
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 090e210e98f0..f95d51fae733 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -37,18 +37,26 @@ enum {
37/* userspace doesn't need the nbd_device structure */ 37/* userspace doesn't need the nbd_device structure */
38#ifdef __KERNEL__ 38#ifdef __KERNEL__
39 39
40#include <linux/wait.h>
41
40/* values for flags field */ 42/* values for flags field */
41#define NBD_READ_ONLY 0x0001 43#define NBD_READ_ONLY 0x0001
42#define NBD_WRITE_NOCHK 0x0002 44#define NBD_WRITE_NOCHK 0x0002
43 45
46struct request;
47
44struct nbd_device { 48struct nbd_device {
45 int flags; 49 int flags;
46 int harderror; /* Code of hard error */ 50 int harderror; /* Code of hard error */
47 struct socket * sock; 51 struct socket * sock;
48 struct file * file; /* If == NULL, device is not ready, yet */ 52 struct file * file; /* If == NULL, device is not ready, yet */
49 int magic; 53 int magic;
54
50 spinlock_t queue_lock; 55 spinlock_t queue_lock;
51 struct list_head queue_head;/* Requests are added here... */ 56 struct list_head queue_head;/* Requests are added here... */
57 struct request *active_req;
58 wait_queue_head_t active_wq;
59
52 struct semaphore tx_lock; 60 struct semaphore tx_lock;
53 struct gendisk *disk; 61 struct gendisk *disk;
54 int blksize; 62 int blksize;
diff --git a/include/linux/ncp.h b/include/linux/ncp.h
index 99f77876b716..99f0adeeb3f3 100644
--- a/include/linux/ncp.h
+++ b/include/linux/ncp.h
@@ -20,29 +20,29 @@
20#define NCP_DEALLOC_SLOT_REQUEST (0x5555) 20#define NCP_DEALLOC_SLOT_REQUEST (0x5555)
21 21
22struct ncp_request_header { 22struct ncp_request_header {
23 __u16 type __attribute__((packed)); 23 __u16 type;
24 __u8 sequence __attribute__((packed)); 24 __u8 sequence;
25 __u8 conn_low __attribute__((packed)); 25 __u8 conn_low;
26 __u8 task __attribute__((packed)); 26 __u8 task;
27 __u8 conn_high __attribute__((packed)); 27 __u8 conn_high;
28 __u8 function __attribute__((packed)); 28 __u8 function;
29 __u8 data[0] __attribute__((packed)); 29 __u8 data[0];
30}; 30} __attribute__((packed));
31 31
32#define NCP_REPLY (0x3333) 32#define NCP_REPLY (0x3333)
33#define NCP_WATCHDOG (0x3E3E) 33#define NCP_WATCHDOG (0x3E3E)
34#define NCP_POSITIVE_ACK (0x9999) 34#define NCP_POSITIVE_ACK (0x9999)
35 35
36struct ncp_reply_header { 36struct ncp_reply_header {
37 __u16 type __attribute__((packed)); 37 __u16 type;
38 __u8 sequence __attribute__((packed)); 38 __u8 sequence;
39 __u8 conn_low __attribute__((packed)); 39 __u8 conn_low;
40 __u8 task __attribute__((packed)); 40 __u8 task;
41 __u8 conn_high __attribute__((packed)); 41 __u8 conn_high;
42 __u8 completion_code __attribute__((packed)); 42 __u8 completion_code;
43 __u8 connection_state __attribute__((packed)); 43 __u8 connection_state;
44 __u8 data[0] __attribute__((packed)); 44 __u8 data[0];
45}; 45} __attribute__((packed));
46 46
47#define NCP_VOLNAME_LEN (16) 47#define NCP_VOLNAME_LEN (16)
48#define NCP_NUMBER_OF_VOLUMES (256) 48#define NCP_NUMBER_OF_VOLUMES (256)
@@ -128,37 +128,37 @@ struct nw_nfs_info {
128}; 128};
129 129
130struct nw_info_struct { 130struct nw_info_struct {
131 __u32 spaceAlloc __attribute__((packed)); 131 __u32 spaceAlloc;
132 __le32 attributes __attribute__((packed)); 132 __le32 attributes;
133 __u16 flags __attribute__((packed)); 133 __u16 flags;
134 __le32 dataStreamSize __attribute__((packed)); 134 __le32 dataStreamSize;
135 __le32 totalStreamSize __attribute__((packed)); 135 __le32 totalStreamSize;
136 __u16 numberOfStreams __attribute__((packed)); 136 __u16 numberOfStreams;
137 __le16 creationTime __attribute__((packed)); 137 __le16 creationTime;
138 __le16 creationDate __attribute__((packed)); 138 __le16 creationDate;
139 __u32 creatorID __attribute__((packed)); 139 __u32 creatorID;
140 __le16 modifyTime __attribute__((packed)); 140 __le16 modifyTime;
141 __le16 modifyDate __attribute__((packed)); 141 __le16 modifyDate;
142 __u32 modifierID __attribute__((packed)); 142 __u32 modifierID;
143 __le16 lastAccessDate __attribute__((packed)); 143 __le16 lastAccessDate;
144 __u16 archiveTime __attribute__((packed)); 144 __u16 archiveTime;
145 __u16 archiveDate __attribute__((packed)); 145 __u16 archiveDate;
146 __u32 archiverID __attribute__((packed)); 146 __u32 archiverID;
147 __u16 inheritedRightsMask __attribute__((packed)); 147 __u16 inheritedRightsMask;
148 __le32 dirEntNum __attribute__((packed)); 148 __le32 dirEntNum;
149 __le32 DosDirNum __attribute__((packed)); 149 __le32 DosDirNum;
150 __u32 volNumber __attribute__((packed)); 150 __u32 volNumber;
151 __u32 EADataSize __attribute__((packed)); 151 __u32 EADataSize;
152 __u32 EAKeyCount __attribute__((packed)); 152 __u32 EAKeyCount;
153 __u32 EAKeySize __attribute__((packed)); 153 __u32 EAKeySize;
154 __u32 NSCreator __attribute__((packed)); 154 __u32 NSCreator;
155 __u8 nameLen __attribute__((packed)); 155 __u8 nameLen;
156 __u8 entryName[256] __attribute__((packed)); 156 __u8 entryName[256];
157 /* libncp may depend on there being nothing after entryName */ 157 /* libncp may depend on there being nothing after entryName */
158#ifdef __KERNEL__ 158#ifdef __KERNEL__
159 struct nw_nfs_info nfs; 159 struct nw_nfs_info nfs;
160#endif 160#endif
161}; 161} __attribute__((packed));
162 162
163/* modify mask - use with MODIFY_DOS_INFO structure */ 163/* modify mask - use with MODIFY_DOS_INFO structure */
164#define DM_ATTRIBUTES (cpu_to_le32(0x02)) 164#define DM_ATTRIBUTES (cpu_to_le32(0x02))
@@ -176,26 +176,26 @@ struct nw_info_struct {
176#define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000)) 176#define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000))
177 177
178struct nw_modify_dos_info { 178struct nw_modify_dos_info {
179 __le32 attributes __attribute__((packed)); 179 __le32 attributes;
180 __le16 creationDate __attribute__((packed)); 180 __le16 creationDate;
181 __le16 creationTime __attribute__((packed)); 181 __le16 creationTime;
182 __u32 creatorID __attribute__((packed)); 182 __u32 creatorID;
183 __le16 modifyDate __attribute__((packed)); 183 __le16 modifyDate;
184 __le16 modifyTime __attribute__((packed)); 184 __le16 modifyTime;
185 __u32 modifierID __attribute__((packed)); 185 __u32 modifierID;
186 __u16 archiveDate __attribute__((packed)); 186 __u16 archiveDate;
187 __u16 archiveTime __attribute__((packed)); 187 __u16 archiveTime;
188 __u32 archiverID __attribute__((packed)); 188 __u32 archiverID;
189 __le16 lastAccessDate __attribute__((packed)); 189 __le16 lastAccessDate;
190 __u16 inheritanceGrantMask __attribute__((packed)); 190 __u16 inheritanceGrantMask;
191 __u16 inheritanceRevokeMask __attribute__((packed)); 191 __u16 inheritanceRevokeMask;
192 __u32 maximumSpace __attribute__((packed)); 192 __u32 maximumSpace;
193}; 193} __attribute__((packed));
194 194
195struct nw_search_sequence { 195struct nw_search_sequence {
196 __u8 volNumber __attribute__((packed)); 196 __u8 volNumber;
197 __u32 dirBase __attribute__((packed)); 197 __u32 dirBase;
198 __u32 sequence __attribute__((packed)); 198 __u32 sequence;
199}; 199} __attribute__((packed));
200 200
201#endif /* _LINUX_NCP_H */ 201#endif /* _LINUX_NCP_H */
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 7297e4372c0f..e01342568530 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -201,34 +201,6 @@ static inline struct ncp_inode_info *NCP_FINFO(struct inode *inode)
201 return container_of(inode, struct ncp_inode_info, vfs_inode); 201 return container_of(inode, struct ncp_inode_info, vfs_inode);
202} 202}
203 203
204#ifdef DEBUG_NCP_MALLOC
205
206#include <linux/slab.h>
207
208extern int ncp_malloced;
209extern int ncp_current_malloced;
210
211static inline void *
212 ncp_kmalloc(unsigned int size, int priority)
213{
214 ncp_malloced += 1;
215 ncp_current_malloced += 1;
216 return kmalloc(size, priority);
217}
218
219static inline void ncp_kfree_s(void *obj, int size)
220{
221 ncp_current_malloced -= 1;
222 kfree(obj);
223}
224
225#else /* DEBUG_NCP_MALLOC */
226
227#define ncp_kmalloc(s,p) kmalloc(s,p)
228#define ncp_kfree_s(o,s) kfree(o)
229
230#endif /* DEBUG_NCP_MALLOC */
231
232/* linux/fs/ncpfs/inode.c */ 204/* linux/fs/ncpfs/inode.c */
233int ncp_notify_change(struct dentry *, struct iattr *); 205int ncp_notify_change(struct dentry *, struct iattr *);
234struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); 206struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *);
diff --git a/include/linux/net.h b/include/linux/net.h
index d6a41e6577f6..28195a2d8ff0 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -107,7 +107,7 @@ enum sock_type {
107struct socket { 107struct socket {
108 socket_state state; 108 socket_state state;
109 unsigned long flags; 109 unsigned long flags;
110 struct proto_ops *ops; 110 const struct proto_ops *ops;
111 struct fasync_struct *fasync_list; 111 struct fasync_struct *fasync_list;
112 struct file *file; 112 struct file *file;
113 struct sock *sk; 113 struct sock *sk;
@@ -260,7 +260,7 @@ SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct ms
260SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \ 260SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \
261 (file, sock, vma)) \ 261 (file, sock, vma)) \
262 \ 262 \
263static struct proto_ops name##_ops = { \ 263static const struct proto_ops name##_ops = { \
264 .family = fam, \ 264 .family = fam, \
265 .owner = THIS_MODULE, \ 265 .owner = THIS_MODULE, \
266 .release = __lock_##name##_release, \ 266 .release = __lock_##name##_release, \
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 936f8b76114e..7fda03d338d1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -684,6 +684,7 @@ extern int netif_rx(struct sk_buff *skb);
684extern int netif_rx_ni(struct sk_buff *skb); 684extern int netif_rx_ni(struct sk_buff *skb);
685#define HAVE_NETIF_RECEIVE_SKB 1 685#define HAVE_NETIF_RECEIVE_SKB 1
686extern int netif_receive_skb(struct sk_buff *skb); 686extern int netif_receive_skb(struct sk_buff *skb);
687extern int dev_valid_name(const char *name);
687extern int dev_ioctl(unsigned int cmd, void __user *); 688extern int dev_ioctl(unsigned int cmd, void __user *);
688extern int dev_ethtool(struct ifreq *); 689extern int dev_ethtool(struct ifreq *);
689extern unsigned dev_get_flags(const struct net_device *); 690extern unsigned dev_get_flags(const struct net_device *);
@@ -801,12 +802,16 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
801 return (1 << debug_value) - 1; 802 return (1 << debug_value) - 1;
802} 803}
803 804
804/* Schedule rx intr now? */ 805/* Test if receive needs to be scheduled */
806static inline int __netif_rx_schedule_prep(struct net_device *dev)
807{
808 return !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
809}
805 810
811/* Test if receive needs to be scheduled but only if up */
806static inline int netif_rx_schedule_prep(struct net_device *dev) 812static inline int netif_rx_schedule_prep(struct net_device *dev)
807{ 813{
808 return netif_running(dev) && 814 return netif_running(dev) && __netif_rx_schedule_prep(dev);
809 !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
810} 815}
811 816
812/* Add interface to tail of rx poll list. This assumes that _prep has 817/* Add interface to tail of rx poll list. This assumes that _prep has
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index be365e70ee99..4cf6088625c1 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -168,6 +168,37 @@ void nf_log_packet(int pf,
168 const struct net_device *out, 168 const struct net_device *out,
169 struct nf_loginfo *li, 169 struct nf_loginfo *li,
170 const char *fmt, ...); 170 const char *fmt, ...);
171
172int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb,
173 struct net_device *indev, struct net_device *outdev,
174 int (*okfn)(struct sk_buff *), int thresh);
175
176/**
177 * nf_hook_thresh - call a netfilter hook
178 *
179 * Returns 1 if the hook has allowed the packet to pass. The function
180 * okfn must be invoked by the caller in this case. Any other return
181 * value indicates the packet has been consumed by the hook.
182 */
183static inline int nf_hook_thresh(int pf, unsigned int hook,
184 struct sk_buff **pskb,
185 struct net_device *indev,
186 struct net_device *outdev,
187 int (*okfn)(struct sk_buff *), int thresh)
188{
189#ifndef CONFIG_NETFILTER_DEBUG
190 if (list_empty(&nf_hooks[pf][hook]))
191 return 1;
192#endif
193 return nf_hook_slow(pf, hook, pskb, indev, outdev, okfn, thresh);
194}
195
196static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
197 struct net_device *indev, struct net_device *outdev,
198 int (*okfn)(struct sk_buff *))
199{
200 return nf_hook_thresh(pf, hook, pskb, indev, outdev, okfn, INT_MIN);
201}
171 202
172/* Activate hook; either okfn or kfree_skb called, unless a hook 203/* Activate hook; either okfn or kfree_skb called, unless a hook
173 returns NF_STOLEN (in which case, it's up to the hook to deal with 204 returns NF_STOLEN (in which case, it's up to the hook to deal with
@@ -188,35 +219,17 @@ void nf_log_packet(int pf,
188 219
189/* This is gross, but inline doesn't cut it for avoiding the function 220/* This is gross, but inline doesn't cut it for avoiding the function
190 call in fast path: gcc doesn't inline (needs value tracking?). --RR */ 221 call in fast path: gcc doesn't inline (needs value tracking?). --RR */
191#ifdef CONFIG_NETFILTER_DEBUG 222
192#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ 223/* HX: It's slightly less gross now. */
193({int __ret; \ 224
194if ((__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN)) == 1) \
195 __ret = (okfn)(skb); \
196__ret;})
197#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \
198({int __ret; \
199if ((__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1) \
200 __ret = (okfn)(skb); \
201__ret;})
202#else
203#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
204({int __ret; \
205if (list_empty(&nf_hooks[pf][hook]) || \
206 (__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN)) == 1) \
207 __ret = (okfn)(skb); \
208__ret;})
209#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ 225#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \
210({int __ret; \ 226({int __ret; \
211if (list_empty(&nf_hooks[pf][hook]) || \ 227if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1)\
212 (__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1) \
213 __ret = (okfn)(skb); \ 228 __ret = (okfn)(skb); \
214__ret;}) 229__ret;})
215#endif
216 230
217int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb, 231#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
218 struct net_device *indev, struct net_device *outdev, 232 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN)
219 int (*okfn)(struct sk_buff *), int thresh);
220 233
221/* Call setsockopt() */ 234/* Call setsockopt() */
222int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, 235int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt,
@@ -261,6 +274,20 @@ struct nf_queue_rerouter {
261extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer); 274extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer);
262extern int nf_unregister_queue_rerouter(int pf); 275extern int nf_unregister_queue_rerouter(int pf);
263 276
277#include <net/flow.h>
278extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
279
280static inline void
281nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
282{
283#ifdef CONFIG_IP_NF_NAT_NEEDED
284 void (*decodefn)(struct sk_buff *, struct flowi *);
285
286 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL)
287 decodefn(skb, fl);
288#endif
289}
290
264#ifdef CONFIG_PROC_FS 291#ifdef CONFIG_PROC_FS
265#include <linux/proc_fs.h> 292#include <linux/proc_fs.h>
266extern struct proc_dir_entry *proc_net_netfilter; 293extern struct proc_dir_entry *proc_net_netfilter;
@@ -268,7 +295,24 @@ extern struct proc_dir_entry *proc_net_netfilter;
268 295
269#else /* !CONFIG_NETFILTER */ 296#else /* !CONFIG_NETFILTER */
270#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 297#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
298static inline int nf_hook_thresh(int pf, unsigned int hook,
299 struct sk_buff **pskb,
300 struct net_device *indev,
301 struct net_device *outdev,
302 int (*okfn)(struct sk_buff *), int thresh)
303{
304 return okfn(*pskb);
305}
306static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
307 struct net_device *indev, struct net_device *outdev,
308 int (*okfn)(struct sk_buff *))
309{
310 return okfn(*pskb);
311}
271static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 312static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
313struct flowi;
314static inline void
315nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}
272#endif /*CONFIG_NETFILTER*/ 316#endif /*CONFIG_NETFILTER*/
273 317
274#endif /*__KERNEL__*/ 318#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 6d39b518486b..3ff88c878308 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -154,6 +154,9 @@ struct ip_conntrack_stat
154 unsigned int expect_delete; 154 unsigned int expect_delete;
155}; 155};
156 156
157/* call to create an explicit dependency on nf_conntrack. */
158extern void need_conntrack(void);
159
157#endif /* __KERNEL__ */ 160#endif /* __KERNEL__ */
158 161
159#endif /* _NF_CONNTRACK_COMMON_H */ 162#endif /* _NF_CONNTRACK_COMMON_H */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 116fcaced909..668ec946c8e2 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -64,6 +64,9 @@ enum ctattr_l4proto {
64 CTA_PROTO_ICMP_ID, 64 CTA_PROTO_ICMP_ID,
65 CTA_PROTO_ICMP_TYPE, 65 CTA_PROTO_ICMP_TYPE,
66 CTA_PROTO_ICMP_CODE, 66 CTA_PROTO_ICMP_CODE,
67 CTA_PROTO_ICMPV6_ID,
68 CTA_PROTO_ICMPV6_TYPE,
69 CTA_PROTO_ICMPV6_CODE,
67 __CTA_PROTO_MAX 70 __CTA_PROTO_MAX
68}; 71};
69#define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) 72#define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1)
@@ -128,6 +131,4 @@ enum ctattr_help {
128}; 131};
129#define CTA_HELP_MAX (__CTA_HELP_MAX - 1) 132#define CTA_HELP_MAX (__CTA_HELP_MAX - 1)
130 133
131#define CTA_HELP_MAXNAMESIZE 32
132
133#endif /* _IPCONNTRACK_NETLINK_H */ 134#endif /* _IPCONNTRACK_NETLINK_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
new file mode 100644
index 000000000000..472f04834809
--- /dev/null
+++ b/include/linux/netfilter/x_tables.h
@@ -0,0 +1,224 @@
1#ifndef _X_TABLES_H
2#define _X_TABLES_H
3
4#define XT_FUNCTION_MAXNAMELEN 30
5#define XT_TABLE_MAXNAMELEN 32
6
7/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
8 * kernel supports, if >= revision. */
9struct xt_get_revision
10{
11 char name[XT_FUNCTION_MAXNAMELEN-1];
12
13 u_int8_t revision;
14};
15
16/* CONTINUE verdict for targets */
17#define XT_CONTINUE 0xFFFFFFFF
18
19/* For standard target */
20#define XT_RETURN (-NF_REPEAT - 1)
21
22#define XT_ALIGN(s) (((s) + (__alignof__(void *)-1)) & ~(__alignof__(void *)-1))
23
24/* Standard return verdict, or do jump. */
25#define XT_STANDARD_TARGET ""
26/* Error verdict. */
27#define XT_ERROR_TARGET "ERROR"
28
29/*
30 * New IP firewall options for [gs]etsockopt at the RAW IP level.
31 * Unlike BSD Linux inherits IP options so you don't have to use a raw
32 * socket for this. Instead we check rights in the calls. */
33#define XT_BASE_CTL 64 /* base for firewall socket options */
34
35#define XT_SO_SET_REPLACE (XT_BASE_CTL)
36#define XT_SO_SET_ADD_COUNTERS (XT_BASE_CTL + 1)
37#define XT_SO_SET_MAX XT_SO_SET_ADD_COUNTERS
38
39#define XT_SO_GET_INFO (XT_BASE_CTL)
40#define XT_SO_GET_ENTRIES (XT_BASE_CTL + 1)
41#define XT_SO_GET_REVISION_MATCH (XT_BASE_CTL + 2)
42#define XT_SO_GET_REVISION_TARGET (XT_BASE_CTL + 3)
43#define XT_SO_GET_MAX XT_SO_GET_REVISION_TARGET
44
45#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
46#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
47
48struct xt_counters
49{
50 u_int64_t pcnt, bcnt; /* Packet and byte counters */
51};
52
53/* The argument to IPT_SO_ADD_COUNTERS. */
54struct xt_counters_info
55{
56 /* Which table. */
57 char name[XT_TABLE_MAXNAMELEN];
58
59 unsigned int num_counters;
60
61 /* The counters (actually `number' of these). */
62 struct xt_counters counters[0];
63};
64
65#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
66
67#ifdef __KERNEL__
68
69#include <linux/netdevice.h>
70
71#define ASSERT_READ_LOCK(x)
72#define ASSERT_WRITE_LOCK(x)
73#include <linux/netfilter_ipv4/listhelp.h>
74
75struct xt_match
76{
77 struct list_head list;
78
79 const char name[XT_FUNCTION_MAXNAMELEN-1];
80
81 u_int8_t revision;
82
83 /* Return true or false: return FALSE and set *hotdrop = 1 to
84 force immediate packet drop. */
85 /* Arguments changed since 2.6.9, as this must now handle
86 non-linear skb, using skb_header_pointer and
87 skb_ip_make_writable. */
88 int (*match)(const struct sk_buff *skb,
89 const struct net_device *in,
90 const struct net_device *out,
91 const void *matchinfo,
92 int offset,
93 unsigned int protoff,
94 int *hotdrop);
95
96 /* Called when user tries to insert an entry of this type. */
97 /* Should return true or false. */
98 int (*checkentry)(const char *tablename,
99 const void *ip,
100 void *matchinfo,
101 unsigned int matchinfosize,
102 unsigned int hook_mask);
103
104 /* Called when entry of this type deleted. */
105 void (*destroy)(void *matchinfo, unsigned int matchinfosize);
106
107 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
108 struct module *me;
109};
110
111/* Registration hooks for targets. */
112struct xt_target
113{
114 struct list_head list;
115
116 const char name[XT_FUNCTION_MAXNAMELEN-1];
117
118 u_int8_t revision;
119
120 /* Returns verdict. Argument order changed since 2.6.9, as this
121 must now handle non-linear skbs, using skb_copy_bits and
122 skb_ip_make_writable. */
123 unsigned int (*target)(struct sk_buff **pskb,
124 const struct net_device *in,
125 const struct net_device *out,
126 unsigned int hooknum,
127 const void *targinfo,
128 void *userdata);
129
130 /* Called when user tries to insert an entry of this type:
131 hook_mask is a bitmask of hooks from which it can be
132 called. */
133 /* Should return true or false. */
134 int (*checkentry)(const char *tablename,
135 const void *entry,
136 void *targinfo,
137 unsigned int targinfosize,
138 unsigned int hook_mask);
139
140 /* Called when entry of this type deleted. */
141 void (*destroy)(void *targinfo, unsigned int targinfosize);
142
143 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
144 struct module *me;
145};
146
147/* Furniture shopping... */
148struct xt_table
149{
150 struct list_head list;
151
152 /* A unique name... */
153 char name[XT_TABLE_MAXNAMELEN];
154
155 /* What hooks you will enter on */
156 unsigned int valid_hooks;
157
158 /* Lock for the curtain */
159 rwlock_t lock;
160
161 /* Man behind the curtain... */
162 //struct ip6t_table_info *private;
163 void *private;
164
165 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
166 struct module *me;
167
168 int af; /* address/protocol family */
169};
170
171#include <linux/netfilter_ipv4.h>
172
173/* The table itself */
174struct xt_table_info
175{
176 /* Size per table */
177 unsigned int size;
178 /* Number of entries: FIXME. --RR */
179 unsigned int number;
180 /* Initial number of entries. Needed for module usage count */
181 unsigned int initial_entries;
182
183 /* Entry points and underflows */
184 unsigned int hook_entry[NF_IP_NUMHOOKS];
185 unsigned int underflow[NF_IP_NUMHOOKS];
186
187 /* ipt_entry tables: one per CPU */
188 char *entries[NR_CPUS];
189};
190
191extern int xt_register_target(int af, struct xt_target *target);
192extern void xt_unregister_target(int af, struct xt_target *target);
193extern int xt_register_match(int af, struct xt_match *target);
194extern void xt_unregister_match(int af, struct xt_match *target);
195
196extern int xt_register_table(struct xt_table *table,
197 struct xt_table_info *bootstrap,
198 struct xt_table_info *newinfo);
199extern void *xt_unregister_table(struct xt_table *table);
200
201extern struct xt_table_info *xt_replace_table(struct xt_table *table,
202 unsigned int num_counters,
203 struct xt_table_info *newinfo,
204 int *error);
205
206extern struct xt_match *xt_find_match(int af, const char *name, u8 revision);
207extern struct xt_target *xt_find_target(int af, const char *name, u8 revision);
208extern struct xt_target *xt_request_find_target(int af, const char *name,
209 u8 revision);
210extern int xt_find_revision(int af, const char *name, u8 revision, int target,
211 int *err);
212
213extern struct xt_table *xt_find_table_lock(int af, const char *name);
214extern void xt_table_unlock(struct xt_table *t);
215
216extern int xt_proto_init(int af);
217extern void xt_proto_fini(int af);
218
219extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
220extern void xt_free_table_info(struct xt_table_info *info);
221
222#endif /* __KERNEL__ */
223
224#endif /* _X_TABLES_H */
diff --git a/include/linux/netfilter/xt_CLASSIFY.h b/include/linux/netfilter/xt_CLASSIFY.h
new file mode 100644
index 000000000000..58111355255d
--- /dev/null
+++ b/include/linux/netfilter/xt_CLASSIFY.h
@@ -0,0 +1,8 @@
1#ifndef _XT_CLASSIFY_H
2#define _XT_CLASSIFY_H
3
4struct xt_classify_target_info {
5 u_int32_t priority;
6};
7
8#endif /*_XT_CLASSIFY_H */
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
new file mode 100644
index 000000000000..9f744689fffc
--- /dev/null
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -0,0 +1,25 @@
1#ifndef _XT_CONNMARK_H_target
2#define _XT_CONNMARK_H_target
3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13enum {
14 XT_CONNMARK_SET = 0,
15 XT_CONNMARK_SAVE,
16 XT_CONNMARK_RESTORE
17};
18
19struct xt_connmark_target_info {
20 unsigned long mark;
21 unsigned long mask;
22 u_int8_t mode;
23};
24
25#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
new file mode 100644
index 000000000000..b021e93ee5d6
--- /dev/null
+++ b/include/linux/netfilter/xt_MARK.h
@@ -0,0 +1,21 @@
1#ifndef _XT_MARK_H_target
2#define _XT_MARK_H_target
3
4/* Version 0 */
5struct xt_mark_target_info {
6 unsigned long mark;
7};
8
9/* Version 1 */
10enum {
11 XT_MARK_SET=0,
12 XT_MARK_AND,
13 XT_MARK_OR,
14};
15
16struct xt_mark_target_info_v1 {
17 unsigned long mark;
18 u_int8_t mode;
19};
20
21#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
new file mode 100644
index 000000000000..9a9af79f74d2
--- /dev/null
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -0,0 +1,16 @@
1/* iptables module for using NFQUEUE mechanism
2 *
3 * (C) 2005 Harald Welte <laforge@netfilter.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7*/
8#ifndef _XT_NFQ_TARGET_H
9#define _XT_NFQ_TARGET_H
10
11/* target info */
12struct xt_NFQ_info {
13 u_int16_t queuenum;
14};
15
16#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_comment.h b/include/linux/netfilter/xt_comment.h
new file mode 100644
index 000000000000..eacfedc6b5d0
--- /dev/null
+++ b/include/linux/netfilter/xt_comment.h
@@ -0,0 +1,10 @@
1#ifndef _XT_COMMENT_H
2#define _XT_COMMENT_H
3
4#define XT_MAX_COMMENT_LEN 256
5
6struct xt_comment_info {
7 unsigned char comment[XT_MAX_COMMENT_LEN];
8};
9
10#endif /* XT_COMMENT_H */
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/linux/netfilter/xt_connbytes.h
new file mode 100644
index 000000000000..c022c989754d
--- /dev/null
+++ b/include/linux/netfilter/xt_connbytes.h
@@ -0,0 +1,25 @@
1#ifndef _XT_CONNBYTES_H
2#define _XT_CONNBYTES_H
3
4enum xt_connbytes_what {
5 XT_CONNBYTES_PKTS,
6 XT_CONNBYTES_BYTES,
7 XT_CONNBYTES_AVGPKT,
8};
9
10enum xt_connbytes_direction {
11 XT_CONNBYTES_DIR_ORIGINAL,
12 XT_CONNBYTES_DIR_REPLY,
13 XT_CONNBYTES_DIR_BOTH,
14};
15
16struct xt_connbytes_info
17{
18 struct {
19 aligned_u64 from; /* count to be matched */
20 aligned_u64 to; /* count to be matched */
21 } count;
22 u_int8_t what; /* ipt_connbytes_what */
23 u_int8_t direction; /* ipt_connbytes_direction */
24};
25#endif
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
new file mode 100644
index 000000000000..c592f6ae0883
--- /dev/null
+++ b/include/linux/netfilter/xt_connmark.h
@@ -0,0 +1,18 @@
1#ifndef _XT_CONNMARK_H
2#define _XT_CONNMARK_H
3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13struct xt_connmark_info {
14 unsigned long mark, mask;
15 u_int8_t invert;
16};
17
18#endif /*_XT_CONNMARK_H*/
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
new file mode 100644
index 000000000000..34f63cf2e293
--- /dev/null
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -0,0 +1,63 @@
1/* Header file for kernel module to match connection tracking information.
2 * GPL (C) 2001 Marc Boucher (marc@mbsi.ca).
3 */
4
5#ifndef _XT_CONNTRACK_H
6#define _XT_CONNTRACK_H
7
8#include <linux/netfilter/nf_conntrack_tuple_common.h>
9#include <linux/in.h>
10
11#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
12#define XT_CONNTRACK_STATE_INVALID (1 << 0)
13
14#define XT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1))
15#define XT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2))
16#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
17
18/* flags, invflags: */
19#define XT_CONNTRACK_STATE 0x01
20#define XT_CONNTRACK_PROTO 0x02
21#define XT_CONNTRACK_ORIGSRC 0x04
22#define XT_CONNTRACK_ORIGDST 0x08
23#define XT_CONNTRACK_REPLSRC 0x10
24#define XT_CONNTRACK_REPLDST 0x20
25#define XT_CONNTRACK_STATUS 0x40
26#define XT_CONNTRACK_EXPIRES 0x80
27
28/* This is exposed to userspace, so remains frozen in time. */
29struct ip_conntrack_old_tuple
30{
31 struct {
32 __u32 ip;
33 union {
34 __u16 all;
35 } u;
36 } src;
37
38 struct {
39 __u32 ip;
40 union {
41 __u16 all;
42 } u;
43
44 /* The protocol. */
45 u16 protonum;
46 } dst;
47};
48
49struct xt_conntrack_info
50{
51 unsigned int statemask, statusmask;
52
53 struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX];
54 struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX];
55
56 unsigned long expires_min, expires_max;
57
58 /* Flags word */
59 u_int8_t flags;
60 /* Inverse flags */
61 u_int8_t invflags;
62};
63#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_dccp.h b/include/linux/netfilter/xt_dccp.h
new file mode 100644
index 000000000000..e0221b9d32cb
--- /dev/null
+++ b/include/linux/netfilter/xt_dccp.h
@@ -0,0 +1,23 @@
1#ifndef _XT_DCCP_H_
2#define _XT_DCCP_H_
3
4#define XT_DCCP_SRC_PORTS 0x01
5#define XT_DCCP_DEST_PORTS 0x02
6#define XT_DCCP_TYPE 0x04
7#define XT_DCCP_OPTION 0x08
8
9#define XT_DCCP_VALID_FLAGS 0x0f
10
11struct xt_dccp_info {
12 u_int16_t dpts[2]; /* Min, Max */
13 u_int16_t spts[2]; /* Min, Max */
14
15 u_int16_t flags;
16 u_int16_t invflags;
17
18 u_int16_t typemask;
19 u_int8_t option;
20};
21
22#endif /* _XT_DCCP_H_ */
23
diff --git a/include/linux/netfilter/xt_helper.h b/include/linux/netfilter/xt_helper.h
new file mode 100644
index 000000000000..6b42763f999d
--- /dev/null
+++ b/include/linux/netfilter/xt_helper.h
@@ -0,0 +1,8 @@
1#ifndef _XT_HELPER_H
2#define _XT_HELPER_H
3
4struct xt_helper_info {
5 int invert;
6 char name[30];
7};
8#endif /* _XT_HELPER_H */
diff --git a/include/linux/netfilter/xt_length.h b/include/linux/netfilter/xt_length.h
new file mode 100644
index 000000000000..7c2b439f73fe
--- /dev/null
+++ b/include/linux/netfilter/xt_length.h
@@ -0,0 +1,9 @@
1#ifndef _XT_LENGTH_H
2#define _XT_LENGTH_H
3
4struct xt_length_info {
5 u_int16_t min, max;
6 u_int8_t invert;
7};
8
9#endif /*_XT_LENGTH_H*/
diff --git a/include/linux/netfilter/xt_limit.h b/include/linux/netfilter/xt_limit.h
new file mode 100644
index 000000000000..b3ce65375ecb
--- /dev/null
+++ b/include/linux/netfilter/xt_limit.h
@@ -0,0 +1,21 @@
1#ifndef _XT_RATE_H
2#define _XT_RATE_H
3
4/* timings are in milliseconds. */
5#define XT_LIMIT_SCALE 10000
6
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
8 seconds, or one every 59 hours. */
9struct xt_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */
12
13 /* Used internally by the kernel */
14 unsigned long prev;
15 u_int32_t credit;
16 u_int32_t credit_cap, cost;
17
18 /* Ugly, ugly fucker. */
19 struct xt_rateinfo *master;
20};
21#endif /*_XT_RATE_H*/
diff --git a/include/linux/netfilter/xt_mac.h b/include/linux/netfilter/xt_mac.h
new file mode 100644
index 000000000000..b892cdc67e06
--- /dev/null
+++ b/include/linux/netfilter/xt_mac.h
@@ -0,0 +1,8 @@
1#ifndef _XT_MAC_H
2#define _XT_MAC_H
3
4struct xt_mac_info {
5 unsigned char srcaddr[ETH_ALEN];
6 int invert;
7};
8#endif /*_XT_MAC_H*/
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
new file mode 100644
index 000000000000..802dd4842caf
--- /dev/null
+++ b/include/linux/netfilter/xt_mark.h
@@ -0,0 +1,9 @@
1#ifndef _XT_MARK_H
2#define _XT_MARK_H
3
4struct xt_mark_info {
5 unsigned long mark, mask;
6 u_int8_t invert;
7};
8
9#endif /*_XT_MARK_H*/
diff --git a/include/linux/netfilter/xt_physdev.h b/include/linux/netfilter/xt_physdev.h
new file mode 100644
index 000000000000..25a7a1815b5b
--- /dev/null
+++ b/include/linux/netfilter/xt_physdev.h
@@ -0,0 +1,24 @@
1#ifndef _XT_PHYSDEV_H
2#define _XT_PHYSDEV_H
3
4#ifdef __KERNEL__
5#include <linux/if.h>
6#endif
7
8#define XT_PHYSDEV_OP_IN 0x01
9#define XT_PHYSDEV_OP_OUT 0x02
10#define XT_PHYSDEV_OP_BRIDGED 0x04
11#define XT_PHYSDEV_OP_ISIN 0x08
12#define XT_PHYSDEV_OP_ISOUT 0x10
13#define XT_PHYSDEV_OP_MASK (0x20 - 1)
14
15struct xt_physdev_info {
16 char physindev[IFNAMSIZ];
17 char in_mask[IFNAMSIZ];
18 char physoutdev[IFNAMSIZ];
19 char out_mask[IFNAMSIZ];
20 u_int8_t invert;
21 u_int8_t bitmask;
22};
23
24#endif /*_XT_PHYSDEV_H*/
diff --git a/include/linux/netfilter/xt_pkttype.h b/include/linux/netfilter/xt_pkttype.h
new file mode 100644
index 000000000000..f265cf52faea
--- /dev/null
+++ b/include/linux/netfilter/xt_pkttype.h
@@ -0,0 +1,8 @@
1#ifndef _XT_PKTTYPE_H
2#define _XT_PKTTYPE_H
3
4struct xt_pkttype_info {
5 int pkttype;
6 int invert;
7};
8#endif /*_XT_PKTTYPE_H*/
diff --git a/include/linux/netfilter/xt_realm.h b/include/linux/netfilter/xt_realm.h
new file mode 100644
index 000000000000..220e87245716
--- /dev/null
+++ b/include/linux/netfilter/xt_realm.h
@@ -0,0 +1,10 @@
1#ifndef _XT_REALM_H
2#define _XT_REALM_H
3
4struct xt_realm_info {
5 u_int32_t id;
6 u_int32_t mask;
7 u_int8_t invert;
8};
9
10#endif /* _XT_REALM_H */
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
new file mode 100644
index 000000000000..b157897e7792
--- /dev/null
+++ b/include/linux/netfilter/xt_sctp.h
@@ -0,0 +1,107 @@
1#ifndef _XT_SCTP_H_
2#define _XT_SCTP_H_
3
4#define XT_SCTP_SRC_PORTS 0x01
5#define XT_SCTP_DEST_PORTS 0x02
6#define XT_SCTP_CHUNK_TYPES 0x04
7
8#define XT_SCTP_VALID_FLAGS 0x07
9
10#define ELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
11
12
13struct xt_sctp_flag_info {
14 u_int8_t chunktype;
15 u_int8_t flag;
16 u_int8_t flag_mask;
17};
18
19#define XT_NUM_SCTP_FLAGS 4
20
21struct xt_sctp_info {
22 u_int16_t dpts[2]; /* Min, Max */
23 u_int16_t spts[2]; /* Min, Max */
24
25 u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */
26
27#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */
28#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */
29#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */
30
31 u_int32_t chunk_match_type;
32 struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS];
33 int flag_count;
34
35 u_int32_t flags;
36 u_int32_t invflags;
37};
38
39#define bytes(type) (sizeof(type) * 8)
40
41#define SCTP_CHUNKMAP_SET(chunkmap, type) \
42 do { \
43 chunkmap[type / bytes(u_int32_t)] |= \
44 1 << (type % bytes(u_int32_t)); \
45 } while (0)
46
47#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
48 do { \
49 chunkmap[type / bytes(u_int32_t)] &= \
50 ~(1 << (type % bytes(u_int32_t))); \
51 } while (0)
52
53#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
54({ \
55 (chunkmap[type / bytes (u_int32_t)] & \
56 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
57})
58
59#define SCTP_CHUNKMAP_RESET(chunkmap) \
60 do { \
61 int i; \
62 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
63 chunkmap[i] = 0; \
64 } while (0)
65
66#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
67 do { \
68 int i; \
69 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
70 chunkmap[i] = ~0; \
71 } while (0)
72
73#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
74 do { \
75 int i; \
76 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
77 destmap[i] = srcmap[i]; \
78 } while (0)
79
80#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
81({ \
82 int i; \
83 int flag = 1; \
84 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \
85 if (chunkmap[i]) { \
86 flag = 0; \
87 break; \
88 } \
89 } \
90 flag; \
91})
92
93#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
94({ \
95 int i; \
96 int flag = 1; \
97 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \
98 if (chunkmap[i] != ~0) { \
99 flag = 0; \
100 break; \
101 } \
102 } \
103 flag; \
104})
105
106#endif /* _XT_SCTP_H_ */
107
diff --git a/include/linux/netfilter/xt_state.h b/include/linux/netfilter/xt_state.h
new file mode 100644
index 000000000000..c06f32edee07
--- /dev/null
+++ b/include/linux/netfilter/xt_state.h
@@ -0,0 +1,13 @@
1#ifndef _XT_STATE_H
2#define _XT_STATE_H
3
4#define XT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
5#define XT_STATE_INVALID (1 << 0)
6
7#define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1))
8
9struct xt_state_info
10{
11 unsigned int statemask;
12};
13#endif /*_XT_STATE_H*/
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
new file mode 100644
index 000000000000..3b3419f2637d
--- /dev/null
+++ b/include/linux/netfilter/xt_string.h
@@ -0,0 +1,18 @@
1#ifndef _XT_STRING_H
2#define _XT_STRING_H
3
4#define XT_STRING_MAX_PATTERN_SIZE 128
5#define XT_STRING_MAX_ALGO_NAME_SIZE 16
6
7struct xt_string_info
8{
9 u_int16_t from_offset;
10 u_int16_t to_offset;
11 char algo[XT_STRING_MAX_ALGO_NAME_SIZE];
12 char pattern[XT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen;
14 u_int8_t invert;
15 struct ts_config __attribute__((aligned(8))) *config;
16};
17
18#endif /*_XT_STRING_H*/
diff --git a/include/linux/netfilter/xt_tcpmss.h b/include/linux/netfilter/xt_tcpmss.h
new file mode 100644
index 000000000000..e03274c4c790
--- /dev/null
+++ b/include/linux/netfilter/xt_tcpmss.h
@@ -0,0 +1,9 @@
1#ifndef _XT_TCPMSS_MATCH_H
2#define _XT_TCPMSS_MATCH_H
3
4struct xt_tcpmss_match_info {
5 u_int16_t mss_min, mss_max;
6 u_int8_t invert;
7};
8
9#endif /*_XT_TCPMSS_MATCH_H*/
diff --git a/include/linux/netfilter/xt_tcpudp.h b/include/linux/netfilter/xt_tcpudp.h
new file mode 100644
index 000000000000..78bc65f11adf
--- /dev/null
+++ b/include/linux/netfilter/xt_tcpudp.h
@@ -0,0 +1,36 @@
1#ifndef _XT_TCPUDP_H
2#define _XT_TCPUDP_H
3
4/* TCP matching stuff */
5struct xt_tcp
6{
7 u_int16_t spts[2]; /* Source port range. */
8 u_int16_t dpts[2]; /* Destination port range. */
9 u_int8_t option; /* TCP Option iff non-zero*/
10 u_int8_t flg_mask; /* TCP flags mask byte */
11 u_int8_t flg_cmp; /* TCP flags compare byte */
12 u_int8_t invflags; /* Inverse flags */
13};
14
15/* Values for "inv" field in struct ipt_tcp. */
16#define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
17#define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
18#define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */
19#define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */
20#define XT_TCP_INV_MASK 0x0F /* All possible flags. */
21
22/* UDP matching stuff */
23struct xt_udp
24{
25 u_int16_t spts[2]; /* Source port range. */
26 u_int16_t dpts[2]; /* Destination port range. */
27 u_int8_t invflags; /* Inverse flags */
28};
29
30/* Values for "invflags" field in struct ipt_udp. */
31#define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
32#define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
33#define XT_UDP_INV_MASK 0x03 /* All possible flags. */
34
35
36#endif
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index e98a870a20be..fd21796e5131 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -19,8 +19,12 @@
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/netfilter_arp.h> 20#include <linux/netfilter_arp.h>
21 21
22#define ARPT_FUNCTION_MAXNAMELEN 30 22#include <linux/netfilter/x_tables.h>
23#define ARPT_TABLE_MAXNAMELEN 32 23
24#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
25#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
26#define arpt_target xt_target
27#define arpt_table xt_table
24 28
25#define ARPT_DEV_ADDR_LEN_MAX 16 29#define ARPT_DEV_ADDR_LEN_MAX 16
26 30
@@ -91,11 +95,6 @@ struct arpt_standard_target
91 int verdict; 95 int verdict;
92}; 96};
93 97
94struct arpt_counters
95{
96 u_int64_t pcnt, bcnt; /* Packet and byte counters */
97};
98
99/* Values for "flag" field in struct arpt_ip (general arp structure). 98/* Values for "flag" field in struct arpt_ip (general arp structure).
100 * No flags defined yet. 99 * No flags defined yet.
101 */ 100 */
@@ -130,7 +129,7 @@ struct arpt_entry
130 unsigned int comefrom; 129 unsigned int comefrom;
131 130
132 /* Packet and byte counters. */ 131 /* Packet and byte counters. */
133 struct arpt_counters counters; 132 struct xt_counters counters;
134 133
135 /* The matches (if any), then the target. */ 134 /* The matches (if any), then the target. */
136 unsigned char elems[0]; 135 unsigned char elems[0];
@@ -141,23 +140,24 @@ struct arpt_entry
141 * Unlike BSD Linux inherits IP options so you don't have to use a raw 140 * Unlike BSD Linux inherits IP options so you don't have to use a raw
142 * socket for this. Instead we check rights in the calls. 141 * socket for this. Instead we check rights in the calls.
143 */ 142 */
144#define ARPT_BASE_CTL 96 /* base for firewall socket options */ 143#define ARPT_CTL_OFFSET 32
144#define ARPT_BASE_CTL (XT_BASE_CTL+ARPT_CTL_OFFSET)
145 145
146#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) 146#define ARPT_SO_SET_REPLACE (XT_SO_SET_REPLACE+ARPT_CTL_OFFSET)
147#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1) 147#define ARPT_SO_SET_ADD_COUNTERS (XT_SO_SET_ADD_COUNTERS+ARPT_CTL_OFFSET)
148#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS 148#define ARPT_SO_SET_MAX (XT_SO_SET_MAX+ARPT_CTL_OFFSET)
149 149
150#define ARPT_SO_GET_INFO (ARPT_BASE_CTL) 150#define ARPT_SO_GET_INFO (XT_SO_GET_INFO+ARPT_CTL_OFFSET)
151#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) 151#define ARPT_SO_GET_ENTRIES (XT_SO_GET_ENTRIES+ARPT_CTL_OFFSET)
152/* #define ARPT_SO_GET_REVISION_MATCH (ARPT_BASE_CTL + 2)*/ 152/* #define ARPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH */
153#define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3) 153#define ARPT_SO_GET_REVISION_TARGET (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
154#define ARPT_SO_GET_MAX ARPT_SO_GET_REVISION_TARGET 154#define ARPT_SO_GET_MAX (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
155 155
156/* CONTINUE verdict for targets */ 156/* CONTINUE verdict for targets */
157#define ARPT_CONTINUE 0xFFFFFFFF 157#define ARPT_CONTINUE XT_CONTINUE
158 158
159/* For standard target */ 159/* For standard target */
160#define ARPT_RETURN (-NF_REPEAT - 1) 160#define ARPT_RETURN XT_RETURN
161 161
162/* The argument to ARPT_SO_GET_INFO */ 162/* The argument to ARPT_SO_GET_INFO */
163struct arpt_getinfo 163struct arpt_getinfo
@@ -208,23 +208,14 @@ struct arpt_replace
208 /* Number of counters (must be equal to current number of entries). */ 208 /* Number of counters (must be equal to current number of entries). */
209 unsigned int num_counters; 209 unsigned int num_counters;
210 /* The old entries' counters. */ 210 /* The old entries' counters. */
211 struct arpt_counters __user *counters; 211 struct xt_counters __user *counters;
212 212
213 /* The entries (hang off end: not really an array). */ 213 /* The entries (hang off end: not really an array). */
214 struct arpt_entry entries[0]; 214 struct arpt_entry entries[0];
215}; 215};
216 216
217/* The argument to ARPT_SO_ADD_COUNTERS. */ 217/* The argument to ARPT_SO_ADD_COUNTERS. */
218struct arpt_counters_info 218#define arpt_counters_info xt_counters_info
219{
220 /* Which table. */
221 char name[ARPT_TABLE_MAXNAMELEN];
222
223 unsigned int num_counters;
224
225 /* The counters (actually `number' of these). */
226 struct arpt_counters counters[0];
227};
228 219
229/* The argument to ARPT_SO_GET_ENTRIES. */ 220/* The argument to ARPT_SO_GET_ENTRIES. */
230struct arpt_get_entries 221struct arpt_get_entries
@@ -239,19 +230,10 @@ struct arpt_get_entries
239 struct arpt_entry entrytable[0]; 230 struct arpt_entry entrytable[0];
240}; 231};
241 232
242/* The argument to ARPT_SO_GET_REVISION_*. Returns highest revision
243 * kernel supports, if >= revision. */
244struct arpt_get_revision
245{
246 char name[ARPT_FUNCTION_MAXNAMELEN-1];
247
248 u_int8_t revision;
249};
250
251/* Standard return verdict, or do jump. */ 233/* Standard return verdict, or do jump. */
252#define ARPT_STANDARD_TARGET "" 234#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
253/* Error verdict. */ 235/* Error verdict. */
254#define ARPT_ERROR_TARGET "ERROR" 236#define ARPT_ERROR_TARGET XT_ERROR_TARGET
255 237
256/* Helper functions */ 238/* Helper functions */
257static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e) 239static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e)
@@ -281,63 +263,8 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e
281 */ 263 */
282#ifdef __KERNEL__ 264#ifdef __KERNEL__
283 265
284/* Registration hooks for targets. */ 266#define arpt_register_target(tgt) xt_register_target(NF_ARP, tgt)
285struct arpt_target 267#define arpt_unregister_target(tgt) xt_unregister_target(NF_ARP, tgt)
286{
287 struct list_head list;
288
289 const char name[ARPT_FUNCTION_MAXNAMELEN-1];
290
291 u_int8_t revision;
292
293 /* Returns verdict. */
294 unsigned int (*target)(struct sk_buff **pskb,
295 unsigned int hooknum,
296 const struct net_device *in,
297 const struct net_device *out,
298 const void *targinfo,
299 void *userdata);
300
301 /* Called when user tries to insert an entry of this type:
302 hook_mask is a bitmask of hooks from which it can be
303 called. */
304 /* Should return true or false. */
305 int (*checkentry)(const char *tablename,
306 const struct arpt_entry *e,
307 void *targinfo,
308 unsigned int targinfosize,
309 unsigned int hook_mask);
310
311 /* Called when entry of this type deleted. */
312 void (*destroy)(void *targinfo, unsigned int targinfosize);
313
314 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
315 struct module *me;
316};
317
318extern int arpt_register_target(struct arpt_target *target);
319extern void arpt_unregister_target(struct arpt_target *target);
320
321/* Furniture shopping... */
322struct arpt_table
323{
324 struct list_head list;
325
326 /* A unique name... */
327 char name[ARPT_TABLE_MAXNAMELEN];
328
329 /* What hooks you will enter on */
330 unsigned int valid_hooks;
331
332 /* Lock for the curtain */
333 rwlock_t lock;
334
335 /* Man behind the curtain... */
336 struct arpt_table_info *private;
337
338 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
339 struct module *me;
340};
341 268
342extern int arpt_register_table(struct arpt_table *table, 269extern int arpt_register_table(struct arpt_table *table,
343 const struct arpt_replace *repl); 270 const struct arpt_replace *repl);
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index b3432ab59a17..215765f043e6 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -199,9 +199,6 @@ ip_conntrack_put(struct ip_conntrack *ct)
199 nf_conntrack_put(&ct->ct_general); 199 nf_conntrack_put(&ct->ct_general);
200} 200}
201 201
202/* call to create an explicit dependency on ip_conntrack. */
203extern void need_ip_conntrack(void);
204
205extern int invert_tuplepr(struct ip_conntrack_tuple *inverse, 202extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
206 const struct ip_conntrack_tuple *orig); 203 const struct ip_conntrack_tuple *orig);
207 204
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h
index ef63aa991a06..612a43614e7b 100644
--- a/include/linux/netfilter_ipv4/ip_nat_protocol.h
+++ b/include/linux/netfilter_ipv4/ip_nat_protocol.h
@@ -42,13 +42,6 @@ struct ip_nat_protocol
42 enum ip_nat_manip_type maniptype, 42 enum ip_nat_manip_type maniptype,
43 const struct ip_conntrack *conntrack); 43 const struct ip_conntrack *conntrack);
44 44
45 unsigned int (*print)(char *buffer,
46 const struct ip_conntrack_tuple *match,
47 const struct ip_conntrack_tuple *mask);
48
49 unsigned int (*print_range)(char *buffer,
50 const struct ip_nat_range *range);
51
52 int (*range_to_nfattr)(struct sk_buff *skb, 45 int (*range_to_nfattr)(struct sk_buff *skb,
53 const struct ip_nat_range *range); 46 const struct ip_nat_range *range);
54 47
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index d19d65cf4530..76ba24b68515 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -25,8 +25,14 @@
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv4.h> 26#include <linux/netfilter_ipv4.h>
27 27
28#define IPT_FUNCTION_MAXNAMELEN 30 28#include <linux/netfilter/x_tables.h>
29#define IPT_TABLE_MAXNAMELEN 32 29
30#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
31#define IPT_TABLE_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
32#define ipt_match xt_match
33#define ipt_target xt_target
34#define ipt_table xt_table
35#define ipt_get_revision xt_get_revision
30 36
31/* Yes, Virginia, you have to zero the padding. */ 37/* Yes, Virginia, you have to zero the padding. */
32struct ipt_ip { 38struct ipt_ip {
@@ -102,10 +108,7 @@ struct ipt_standard_target
102 int verdict; 108 int verdict;
103}; 109};
104 110
105struct ipt_counters 111#define ipt_counters xt_counters
106{
107 u_int64_t pcnt, bcnt; /* Packet and byte counters */
108};
109 112
110/* Values for "flag" field in struct ipt_ip (general ip structure). */ 113/* Values for "flag" field in struct ipt_ip (general ip structure). */
111#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ 114#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */
@@ -119,7 +122,7 @@ struct ipt_counters
119#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ 122#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
120#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ 123#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
121#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */ 124#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */
122#define IPT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 125#define IPT_INV_PROTO XT_INV_PROTO
123#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */ 126#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */
124 127
125/* This structure defines each of the firewall rules. Consists of 3 128/* This structure defines each of the firewall rules. Consists of 3
@@ -141,7 +144,7 @@ struct ipt_entry
141 unsigned int comefrom; 144 unsigned int comefrom;
142 145
143 /* Packet and byte counters. */ 146 /* Packet and byte counters. */
144 struct ipt_counters counters; 147 struct xt_counters counters;
145 148
146 /* The matches (if any), then the target. */ 149 /* The matches (if any), then the target. */
147 unsigned char elems[0]; 150 unsigned char elems[0];
@@ -151,54 +154,34 @@ struct ipt_entry
151 * New IP firewall options for [gs]etsockopt at the RAW IP level. 154 * New IP firewall options for [gs]etsockopt at the RAW IP level.
152 * Unlike BSD Linux inherits IP options so you don't have to use a raw 155 * Unlike BSD Linux inherits IP options so you don't have to use a raw
153 * socket for this. Instead we check rights in the calls. */ 156 * socket for this. Instead we check rights in the calls. */
154#define IPT_BASE_CTL 64 /* base for firewall socket options */ 157#define IPT_BASE_CTL XT_BASE_CTL
155 158
156#define IPT_SO_SET_REPLACE (IPT_BASE_CTL) 159#define IPT_SO_SET_REPLACE XT_SO_SET_REPLACE
157#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1) 160#define IPT_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS
158#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS 161#define IPT_SO_SET_MAX XT_SO_SET_MAX
159 162
160#define IPT_SO_GET_INFO (IPT_BASE_CTL) 163#define IPT_SO_GET_INFO XT_SO_GET_INFO
161#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) 164#define IPT_SO_GET_ENTRIES XT_SO_GET_ENTRIES
162#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) 165#define IPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH
163#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) 166#define IPT_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET
164#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET 167#define IPT_SO_GET_MAX XT_SO_GET_REVISION_TARGET
165 168
166/* CONTINUE verdict for targets */ 169#define IPT_CONTINUE XT_CONTINUE
167#define IPT_CONTINUE 0xFFFFFFFF 170#define IPT_RETURN XT_RETURN
168 171
169/* For standard target */ 172#include <linux/netfilter/xt_tcpudp.h>
170#define IPT_RETURN (-NF_REPEAT - 1) 173#define ipt_udp xt_udp
174#define ipt_tcp xt_tcp
171 175
172/* TCP matching stuff */ 176#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT
173struct ipt_tcp 177#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT
174{ 178#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS
175 u_int16_t spts[2]; /* Source port range. */ 179#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION
176 u_int16_t dpts[2]; /* Destination port range. */ 180#define IPT_TCP_INV_MASK XT_TCP_INV_MASK
177 u_int8_t option; /* TCP Option iff non-zero*/
178 u_int8_t flg_mask; /* TCP flags mask byte */
179 u_int8_t flg_cmp; /* TCP flags compare byte */
180 u_int8_t invflags; /* Inverse flags */
181};
182
183/* Values for "inv" field in struct ipt_tcp. */
184#define IPT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
185#define IPT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
186#define IPT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */
187#define IPT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */
188#define IPT_TCP_INV_MASK 0x0F /* All possible flags. */
189
190/* UDP matching stuff */
191struct ipt_udp
192{
193 u_int16_t spts[2]; /* Source port range. */
194 u_int16_t dpts[2]; /* Destination port range. */
195 u_int8_t invflags; /* Inverse flags */
196};
197 181
198/* Values for "invflags" field in struct ipt_udp. */ 182#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT
199#define IPT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 183#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT
200#define IPT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 184#define IPT_UDP_INV_MASK XT_UDP_INV_MASK
201#define IPT_UDP_INV_MASK 0x03 /* All possible flags. */
202 185
203/* ICMP matching stuff */ 186/* ICMP matching stuff */
204struct ipt_icmp 187struct ipt_icmp
@@ -260,23 +243,14 @@ struct ipt_replace
260 /* Number of counters (must be equal to current number of entries). */ 243 /* Number of counters (must be equal to current number of entries). */
261 unsigned int num_counters; 244 unsigned int num_counters;
262 /* The old entries' counters. */ 245 /* The old entries' counters. */
263 struct ipt_counters __user *counters; 246 struct xt_counters __user *counters;
264 247
265 /* The entries (hang off end: not really an array). */ 248 /* The entries (hang off end: not really an array). */
266 struct ipt_entry entries[0]; 249 struct ipt_entry entries[0];
267}; 250};
268 251
269/* The argument to IPT_SO_ADD_COUNTERS. */ 252/* The argument to IPT_SO_ADD_COUNTERS. */
270struct ipt_counters_info 253#define ipt_counters_info xt_counters_info
271{
272 /* Which table. */
273 char name[IPT_TABLE_MAXNAMELEN];
274
275 unsigned int num_counters;
276
277 /* The counters (actually `number' of these). */
278 struct ipt_counters counters[0];
279};
280 254
281/* The argument to IPT_SO_GET_ENTRIES. */ 255/* The argument to IPT_SO_GET_ENTRIES. */
282struct ipt_get_entries 256struct ipt_get_entries
@@ -291,19 +265,10 @@ struct ipt_get_entries
291 struct ipt_entry entrytable[0]; 265 struct ipt_entry entrytable[0];
292}; 266};
293 267
294/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
295 * kernel supports, if >= revision. */
296struct ipt_get_revision
297{
298 char name[IPT_FUNCTION_MAXNAMELEN-1];
299
300 u_int8_t revision;
301};
302
303/* Standard return verdict, or do jump. */ 268/* Standard return verdict, or do jump. */
304#define IPT_STANDARD_TARGET "" 269#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
305/* Error verdict. */ 270/* Error verdict. */
306#define IPT_ERROR_TARGET "ERROR" 271#define IPT_ERROR_TARGET XT_ERROR_TARGET
307 272
308/* Helper functions */ 273/* Helper functions */
309static __inline__ struct ipt_entry_target * 274static __inline__ struct ipt_entry_target *
@@ -356,103 +321,18 @@ ipt_get_target(struct ipt_entry *e)
356#include <linux/init.h> 321#include <linux/init.h>
357extern void ipt_init(void) __init; 322extern void ipt_init(void) __init;
358 323
359struct ipt_match 324#define ipt_register_target(tgt) xt_register_target(AF_INET, tgt)
360{ 325#define ipt_unregister_target(tgt) xt_unregister_target(AF_INET, tgt)
361 struct list_head list;
362
363 const char name[IPT_FUNCTION_MAXNAMELEN-1];
364
365 u_int8_t revision;
366
367 /* Return true or false: return FALSE and set *hotdrop = 1 to
368 force immediate packet drop. */
369 /* Arguments changed since 2.4, as this must now handle
370 non-linear skbs, using skb_copy_bits and
371 skb_ip_make_writable. */
372 int (*match)(const struct sk_buff *skb,
373 const struct net_device *in,
374 const struct net_device *out,
375 const void *matchinfo,
376 int offset,
377 int *hotdrop);
378
379 /* Called when user tries to insert an entry of this type. */
380 /* Should return true or false. */
381 int (*checkentry)(const char *tablename,
382 const struct ipt_ip *ip,
383 void *matchinfo,
384 unsigned int matchinfosize,
385 unsigned int hook_mask);
386
387 /* Called when entry of this type deleted. */
388 void (*destroy)(void *matchinfo, unsigned int matchinfosize);
389
390 /* Set this to THIS_MODULE. */
391 struct module *me;
392};
393
394/* Registration hooks for targets. */
395struct ipt_target
396{
397 struct list_head list;
398
399 const char name[IPT_FUNCTION_MAXNAMELEN-1];
400
401 u_int8_t revision;
402
403 /* Called when user tries to insert an entry of this type:
404 hook_mask is a bitmask of hooks from which it can be
405 called. */
406 /* Should return true or false. */
407 int (*checkentry)(const char *tablename,
408 const struct ipt_entry *e,
409 void *targinfo,
410 unsigned int targinfosize,
411 unsigned int hook_mask);
412
413 /* Called when entry of this type deleted. */
414 void (*destroy)(void *targinfo, unsigned int targinfosize);
415
416 /* Returns verdict. Argument order changed since 2.4, as this
417 must now handle non-linear skbs, using skb_copy_bits and
418 skb_ip_make_writable. */
419 unsigned int (*target)(struct sk_buff **pskb,
420 const struct net_device *in,
421 const struct net_device *out,
422 unsigned int hooknum,
423 const void *targinfo,
424 void *userdata);
425
426 /* Set this to THIS_MODULE. */
427 struct module *me;
428};
429 326
430extern int ipt_register_target(struct ipt_target *target); 327#define ipt_register_match(mtch) xt_register_match(AF_INET, mtch)
431extern void ipt_unregister_target(struct ipt_target *target); 328#define ipt_unregister_match(mtch) xt_unregister_match(AF_INET, mtch)
432 329
433extern int ipt_register_match(struct ipt_match *match); 330//#define ipt_register_table(tbl, repl) xt_register_table(AF_INET, tbl, repl)
434extern void ipt_unregister_match(struct ipt_match *match); 331//#define ipt_unregister_table(tbl) xt_unregister_table(AF_INET, tbl)
435 332
436/* Furniture shopping... */ 333extern int ipt_register_table(struct ipt_table *table,
437struct ipt_table 334 const struct ipt_replace *repl);
438{ 335extern void ipt_unregister_table(struct ipt_table *table);
439 struct list_head list;
440
441 /* A unique name... */
442 char name[IPT_TABLE_MAXNAMELEN];
443
444 /* What hooks you will enter on */
445 unsigned int valid_hooks;
446
447 /* Lock for the curtain */
448 rwlock_t lock;
449
450 /* Man behind the curtain... */
451 struct ipt_table_info *private;
452
453 /* Set to THIS_MODULE. */
454 struct module *me;
455};
456 336
457/* net/sched/ipt.c: Gimme access to your targets! Gets target->me. */ 337/* net/sched/ipt.c: Gimme access to your targets! Gets target->me. */
458extern struct ipt_target *ipt_find_target(const char *name, u8 revision); 338extern struct ipt_target *ipt_find_target(const char *name, u8 revision);
@@ -476,9 +356,6 @@ struct ipt_error
476 struct ipt_error_target target; 356 struct ipt_error_target target;
477}; 357};
478 358
479extern int ipt_register_table(struct ipt_table *table,
480 const struct ipt_replace *repl);
481extern void ipt_unregister_table(struct ipt_table *table);
482extern unsigned int ipt_do_table(struct sk_buff **pskb, 359extern unsigned int ipt_do_table(struct sk_buff **pskb,
483 unsigned int hook, 360 unsigned int hook,
484 const struct net_device *in, 361 const struct net_device *in,
@@ -486,6 +363,6 @@ extern unsigned int ipt_do_table(struct sk_buff **pskb,
486 struct ipt_table *table, 363 struct ipt_table *table,
487 void *userdata); 364 void *userdata);
488 365
489#define IPT_ALIGN(s) (((s) + (__alignof__(struct ipt_entry)-1)) & ~(__alignof__(struct ipt_entry)-1)) 366#define IPT_ALIGN(s) XT_ALIGN(s)
490#endif /*__KERNEL__*/ 367#endif /*__KERNEL__*/
491#endif /* _IPTABLES_H */ 368#endif /* _IPTABLES_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
index 7596e3dd00ca..a46d511b5c36 100644
--- a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
+++ b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_CLASSIFY_H 1#ifndef _IPT_CLASSIFY_H
2#define _IPT_CLASSIFY_H 2#define _IPT_CLASSIFY_H
3 3
4struct ipt_classify_target_info { 4#include <linux/netfilter/xt_CLASSIFY.h>
5 u_int32_t priority; 5#define ipt_classify_target_info xt_classify_target_info
6};
7 6
8#endif /*_IPT_CLASSIFY_H */ 7#endif /*_IPT_CLASSIFY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CONNMARK.h b/include/linux/netfilter_ipv4/ipt_CONNMARK.h
index d3c02536fc4c..9ecfee0a9e33 100644
--- a/include/linux/netfilter_ipv4/ipt_CONNMARK.h
+++ b/include/linux/netfilter_ipv4/ipt_CONNMARK.h
@@ -9,17 +9,11 @@
9 * the Free Software Foundation; either version 2 of the License, or 9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version. 10 * (at your option) any later version.
11 */ 11 */
12#include <linux/netfilter/xt_CONNMARK.h>
13#define IPT_CONNMARK_SET XT_CONNMARK_SET
14#define IPT_CONNMARK_SAVE XT_CONNMARK_SAVE
15#define IPT_CONNMARK_RESTORE XT_CONNMARK_RESTORE
12 16
13enum { 17#define ipt_connmark_target_info xt_connmark_target_info
14 IPT_CONNMARK_SET = 0,
15 IPT_CONNMARK_SAVE,
16 IPT_CONNMARK_RESTORE
17};
18
19struct ipt_connmark_target_info {
20 unsigned long mark;
21 unsigned long mask;
22 u_int8_t mode;
23};
24 18
25#endif /*_IPT_CONNMARK_H_target*/ 19#endif /*_IPT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_MARK.h b/include/linux/netfilter_ipv4/ipt_MARK.h
index f47485790ed4..697a486a96d3 100644
--- a/include/linux/netfilter_ipv4/ipt_MARK.h
+++ b/include/linux/netfilter_ipv4/ipt_MARK.h
@@ -1,20 +1,18 @@
1#ifndef _IPT_MARK_H_target 1#ifndef _IPT_MARK_H_target
2#define _IPT_MARK_H_target 2#define _IPT_MARK_H_target
3 3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_MARK.h>
7
4/* Version 0 */ 8/* Version 0 */
5struct ipt_mark_target_info { 9#define ipt_mark_target_info xt_mark_target_info
6 unsigned long mark;
7};
8 10
9/* Version 1 */ 11/* Version 1 */
10enum { 12#define IPT_MARK_SET XT_MARK_SET
11 IPT_MARK_SET=0, 13#define IPT_MARK_AND XT_MARK_AND
12 IPT_MARK_AND, 14#define IPT_MARK_OR XT_MARK_OR
13 IPT_MARK_OR 15
14}; 16#define ipt_mark_target_info_v1 xt_mark_target_info_v1
15 17
16struct ipt_mark_target_info_v1 {
17 unsigned long mark;
18 u_int8_t mode;
19};
20#endif /*_IPT_MARK_H_target*/ 18#endif /*_IPT_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
index b5b2943b0c66..97a2a7557cb9 100644
--- a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
+++ b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
@@ -8,9 +8,9 @@
8#ifndef _IPT_NFQ_TARGET_H 8#ifndef _IPT_NFQ_TARGET_H
9#define _IPT_NFQ_TARGET_H 9#define _IPT_NFQ_TARGET_H
10 10
11/* target info */ 11/* Backwards compatibility for old userspace */
12struct ipt_NFQ_info { 12#include <linux/netfilter/xt_NFQUEUE.h>
13 u_int16_t queuenum; 13
14}; 14#define ipt_NFQ_info xt_NFQ_info
15 15
16#endif /* _IPT_DSCP_TARGET_H */ 16#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_comment.h b/include/linux/netfilter_ipv4/ipt_comment.h
index 85c1123c29ce..ae2afc2f7481 100644
--- a/include/linux/netfilter_ipv4/ipt_comment.h
+++ b/include/linux/netfilter_ipv4/ipt_comment.h
@@ -1,10 +1,10 @@
1#ifndef _IPT_COMMENT_H 1#ifndef _IPT_COMMENT_H
2#define _IPT_COMMENT_H 2#define _IPT_COMMENT_H
3 3
4#define IPT_MAX_COMMENT_LEN 256 4#include <linux/netfilter/xt_comment.h>
5 5
6struct ipt_comment_info { 6#define IPT_MAX_COMMENT_LEN XT_MAX_COMMENT_LEN
7 unsigned char comment[IPT_MAX_COMMENT_LEN]; 7
8}; 8#define ipt_comment_info xt_comment_info
9 9
10#endif /* _IPT_COMMENT_H */ 10#endif /* _IPT_COMMENT_H */
diff --git a/include/linux/netfilter_ipv4/ipt_connbytes.h b/include/linux/netfilter_ipv4/ipt_connbytes.h
index 9e5532f8d8ac..b04dfa3083c9 100644
--- a/include/linux/netfilter_ipv4/ipt_connbytes.h
+++ b/include/linux/netfilter_ipv4/ipt_connbytes.h
@@ -1,25 +1,18 @@
1#ifndef _IPT_CONNBYTES_H 1#ifndef _IPT_CONNBYTES_H
2#define _IPT_CONNBYTES_H 2#define _IPT_CONNBYTES_H
3 3
4enum ipt_connbytes_what { 4#include <net/netfilter/xt_connbytes.h>
5 IPT_CONNBYTES_PKTS, 5#define ipt_connbytes_what xt_connbytes_what
6 IPT_CONNBYTES_BYTES,
7 IPT_CONNBYTES_AVGPKT,
8};
9 6
10enum ipt_connbytes_direction { 7#define IPT_CONNBYTES_PKTS XT_CONNBYTES_PACKETS
11 IPT_CONNBYTES_DIR_ORIGINAL, 8#define IPT_CONNBYTES_BYTES XT_CONNBYTES_BYTES
12 IPT_CONNBYTES_DIR_REPLY, 9#define IPT_CONNBYTES_AVGPKT XT_CONNBYTES_AVGPKT
13 IPT_CONNBYTES_DIR_BOTH, 10
14}; 11#define ipt_connbytes_direction xt_connbytes_direction
12#define IPT_CONNBYTES_DIR_ORIGINAL XT_CONNBYTES_DIR_ORIGINAL
13#define IPT_CONNBYTES_DIR_REPLY XT_CONNBYTES_DIR_REPLY
14#define IPT_CONNBYTES_DIR_BOTH XT_CONNBYTES_DIR_BOTH
15
16#define ipt_connbytes_info xt_connbytes_info
15 17
16struct ipt_connbytes_info
17{
18 struct {
19 aligned_u64 from; /* count to be matched */
20 aligned_u64 to; /* count to be matched */
21 } count;
22 u_int8_t what; /* ipt_connbytes_what */
23 u_int8_t direction; /* ipt_connbytes_direction */
24};
25#endif 18#endif
diff --git a/include/linux/netfilter_ipv4/ipt_connmark.h b/include/linux/netfilter_ipv4/ipt_connmark.h
index 46573270d9aa..c7ba6560d44c 100644
--- a/include/linux/netfilter_ipv4/ipt_connmark.h
+++ b/include/linux/netfilter_ipv4/ipt_connmark.h
@@ -1,18 +1,7 @@
1#ifndef _IPT_CONNMARK_H 1#ifndef _IPT_CONNMARK_H
2#define _IPT_CONNMARK_H 2#define _IPT_CONNMARK_H
3 3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> 4#include <linux/netfilter/xt_connmark.h>
5 * by Henrik Nordstrom <hno@marasystems.com> 5#define ipt_connmark_info xt_connmark_info
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 of the License, or
10 * (at your option) any later version.
11 */
12
13struct ipt_connmark_info {
14 unsigned long mark, mask;
15 u_int8_t invert;
16};
17 6
18#endif /*_IPT_CONNMARK_H*/ 7#endif /*_IPT_CONNMARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_conntrack.h b/include/linux/netfilter_ipv4/ipt_conntrack.h
index 413c5658bd3a..cde6762949c5 100644
--- a/include/linux/netfilter_ipv4/ipt_conntrack.h
+++ b/include/linux/netfilter_ipv4/ipt_conntrack.h
@@ -5,56 +5,24 @@
5#ifndef _IPT_CONNTRACK_H 5#ifndef _IPT_CONNTRACK_H
6#define _IPT_CONNTRACK_H 6#define _IPT_CONNTRACK_H
7 7
8#define IPT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 8#include <linux/netfilter/xt_conntrack.h>
9#define IPT_CONNTRACK_STATE_INVALID (1 << 0)
10 9
11#define IPT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1)) 10#define IPT_CONNTRACK_STATE_BIT(ctinfo) XT_CONNTRACK_STATE_BIT(ctinfo)
12#define IPT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2)) 11#define IPT_CONNTRACK_STATE_INVALID XT_CONNTRACK_STATE_INVALID
13#define IPT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
14 12
15/* flags, invflags: */ 13#define IPT_CONNTRACK_STATE_SNAT XT_CONNTRACK_STATE_SNAT
16#define IPT_CONNTRACK_STATE 0x01 14#define IPT_CONNTRACK_STATE_DNAT XT_CONNTRACK_STATE_DNAT
17#define IPT_CONNTRACK_PROTO 0x02 15#define IPT_CONNTRACK_STATE_UNTRACKED XT_CONNTRACK_STATE_UNTRACKED
18#define IPT_CONNTRACK_ORIGSRC 0x04
19#define IPT_CONNTRACK_ORIGDST 0x08
20#define IPT_CONNTRACK_REPLSRC 0x10
21#define IPT_CONNTRACK_REPLDST 0x20
22#define IPT_CONNTRACK_STATUS 0x40
23#define IPT_CONNTRACK_EXPIRES 0x80
24
25/* This is exposed to userspace, so remains frozen in time. */
26struct ip_conntrack_old_tuple
27{
28 struct {
29 __u32 ip;
30 union {
31 __u16 all;
32 } u;
33 } src;
34
35 struct {
36 __u32 ip;
37 union {
38 __u16 all;
39 } u;
40
41 /* The protocol. */
42 u16 protonum;
43 } dst;
44};
45 16
46struct ipt_conntrack_info 17/* flags, invflags: */
47{ 18#define IPT_CONNTRACK_STATE XT_CONNTRACK_STATE
48 unsigned int statemask, statusmask; 19#define IPT_CONNTRACK_PROTO XT_CONNTRACK_PROTO
49 20#define IPT_CONNTRACK_ORIGSRC XT_CONNTRACK_ORIGSRC
50 struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX]; 21#define IPT_CONNTRACK_ORIGDST XT_CONNTRACK_ORIGDST
51 struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX]; 22#define IPT_CONNTRACK_REPLSRC XT_CONNTRACK_REPLSRC
52 23#define IPT_CONNTRACK_REPLDST XT_CONNTRACK_REPLDST
53 unsigned long expires_min, expires_max; 24#define IPT_CONNTRACK_STATUS XT_CONNTRACK_STATUS
54 25#define IPT_CONNTRACK_EXPIRES XT_CONNTRACK_EXPIRES
55 /* Flags word */ 26
56 u_int8_t flags; 27#define ipt_conntrack_info xt_conntrack_info
57 /* Inverse flags */
58 u_int8_t invflags;
59};
60#endif /*_IPT_CONNTRACK_H*/ 28#endif /*_IPT_CONNTRACK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_dccp.h b/include/linux/netfilter_ipv4/ipt_dccp.h
index 3cb3a522e62b..e70d11e1f53c 100644
--- a/include/linux/netfilter_ipv4/ipt_dccp.h
+++ b/include/linux/netfilter_ipv4/ipt_dccp.h
@@ -1,23 +1,15 @@
1#ifndef _IPT_DCCP_H_ 1#ifndef _IPT_DCCP_H_
2#define _IPT_DCCP_H_ 2#define _IPT_DCCP_H_
3 3
4#define IPT_DCCP_SRC_PORTS 0x01 4#include <linux/netfilter/xt_dccp.h>
5#define IPT_DCCP_DEST_PORTS 0x02 5#define IPT_DCCP_SRC_PORTS XT_DCCP_SRC_PORTS
6#define IPT_DCCP_TYPE 0x04 6#define IPT_DCCP_DEST_PORTS XT_DCCP_DEST_PORTS
7#define IPT_DCCP_OPTION 0x08 7#define IPT_DCCP_TYPE XT_DCCP_TYPE
8#define IPT_DCCP_OPTION XT_DCCP_OPTION
8 9
9#define IPT_DCCP_VALID_FLAGS 0x0f 10#define IPT_DCCP_VALID_FLAGS XT_DCCP_VALID_FLAGS
10 11
11struct ipt_dccp_info { 12#define ipt_dccp_info xt_dccp_info
12 u_int16_t dpts[2]; /* Min, Max */
13 u_int16_t spts[2]; /* Min, Max */
14
15 u_int16_t flags;
16 u_int16_t invflags;
17
18 u_int16_t typemask;
19 u_int8_t option;
20};
21 13
22#endif /* _IPT_DCCP_H_ */ 14#endif /* _IPT_DCCP_H_ */
23 15
diff --git a/include/linux/netfilter_ipv4/ipt_helper.h b/include/linux/netfilter_ipv4/ipt_helper.h
index 6f12ecb8c93d..80452c218551 100644
--- a/include/linux/netfilter_ipv4/ipt_helper.h
+++ b/include/linux/netfilter_ipv4/ipt_helper.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_HELPER_H 1#ifndef _IPT_HELPER_H
2#define _IPT_HELPER_H 2#define _IPT_HELPER_H
3 3
4struct ipt_helper_info { 4#include <linux/netfilter/xt_helper.h>
5 int invert; 5#define ipt_helper_info xt_helper_info
6 char name[30]; 6
7};
8#endif /* _IPT_HELPER_H */ 7#endif /* _IPT_HELPER_H */
diff --git a/include/linux/netfilter_ipv4/ipt_length.h b/include/linux/netfilter_ipv4/ipt_length.h
index 6e0885229615..9b45206ffcef 100644
--- a/include/linux/netfilter_ipv4/ipt_length.h
+++ b/include/linux/netfilter_ipv4/ipt_length.h
@@ -1,9 +1,7 @@
1#ifndef _IPT_LENGTH_H 1#ifndef _IPT_LENGTH_H
2#define _IPT_LENGTH_H 2#define _IPT_LENGTH_H
3 3
4struct ipt_length_info { 4#include <linux/netfilter/xt_length.h>
5 u_int16_t min, max; 5#define ipt_length_info xt_length_info
6 u_int8_t invert;
7};
8 6
9#endif /*_IPT_LENGTH_H*/ 7#endif /*_IPT_LENGTH_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_limit.h b/include/linux/netfilter_ipv4/ipt_limit.h
index 256453409e21..92f5cd07bbc4 100644
--- a/include/linux/netfilter_ipv4/ipt_limit.h
+++ b/include/linux/netfilter_ipv4/ipt_limit.h
@@ -1,21 +1,8 @@
1#ifndef _IPT_RATE_H 1#ifndef _IPT_RATE_H
2#define _IPT_RATE_H 2#define _IPT_RATE_H
3 3
4/* timings are in milliseconds. */ 4#include <linux/netfilter/xt_limit.h>
5#define IPT_LIMIT_SCALE 10000 5#define IPT_LIMIT_SCALE XT_LIMIT_SCALE
6#define ipt_rateinfo xt_rateinfo
6 7
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
8 seconds, or one every 59 hours. */
9struct ipt_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */
12
13 /* Used internally by the kernel */
14 unsigned long prev;
15 u_int32_t credit;
16 u_int32_t credit_cap, cost;
17
18 /* Ugly, ugly fucker. */
19 struct ipt_rateinfo *master;
20};
21#endif /*_IPT_RATE_H*/ 8#endif /*_IPT_RATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mac.h b/include/linux/netfilter_ipv4/ipt_mac.h
index f8d5b8e7ccdb..b186008a3c47 100644
--- a/include/linux/netfilter_ipv4/ipt_mac.h
+++ b/include/linux/netfilter_ipv4/ipt_mac.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_MAC_H 1#ifndef _IPT_MAC_H
2#define _IPT_MAC_H 2#define _IPT_MAC_H
3 3
4struct ipt_mac_info { 4#include <linux/netfilter/xt_mac.h>
5 unsigned char srcaddr[ETH_ALEN]; 5#define ipt_mac_info xt_mac_info
6 int invert; 6
7};
8#endif /*_IPT_MAC_H*/ 7#endif /*_IPT_MAC_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mark.h b/include/linux/netfilter_ipv4/ipt_mark.h
index f3952b563d4c..bfde67c61224 100644
--- a/include/linux/netfilter_ipv4/ipt_mark.h
+++ b/include/linux/netfilter_ipv4/ipt_mark.h
@@ -1,9 +1,9 @@
1#ifndef _IPT_MARK_H 1#ifndef _IPT_MARK_H
2#define _IPT_MARK_H 2#define _IPT_MARK_H
3 3
4struct ipt_mark_info { 4/* Backwards compatibility for old userspace */
5 unsigned long mark, mask; 5#include <linux/netfilter/xt_mark.h>
6 u_int8_t invert; 6
7}; 7#define ipt_mark_info xt_mark_info
8 8
9#endif /*_IPT_MARK_H*/ 9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_physdev.h b/include/linux/netfilter_ipv4/ipt_physdev.h
index 7538c8655ec0..2400e7140f26 100644
--- a/include/linux/netfilter_ipv4/ipt_physdev.h
+++ b/include/linux/netfilter_ipv4/ipt_physdev.h
@@ -1,24 +1,17 @@
1#ifndef _IPT_PHYSDEV_H 1#ifndef _IPT_PHYSDEV_H
2#define _IPT_PHYSDEV_H 2#define _IPT_PHYSDEV_H
3 3
4#ifdef __KERNEL__ 4/* Backwards compatibility for old userspace */
5#include <linux/if.h>
6#endif
7 5
8#define IPT_PHYSDEV_OP_IN 0x01 6#include <linux/netfilter/xt_physdev.h>
9#define IPT_PHYSDEV_OP_OUT 0x02
10#define IPT_PHYSDEV_OP_BRIDGED 0x04
11#define IPT_PHYSDEV_OP_ISIN 0x08
12#define IPT_PHYSDEV_OP_ISOUT 0x10
13#define IPT_PHYSDEV_OP_MASK (0x20 - 1)
14 7
15struct ipt_physdev_info { 8#define IPT_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
16 char physindev[IFNAMSIZ]; 9#define IPT_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
17 char in_mask[IFNAMSIZ]; 10#define IPT_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
18 char physoutdev[IFNAMSIZ]; 11#define IPT_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
19 char out_mask[IFNAMSIZ]; 12#define IPT_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
20 u_int8_t invert; 13#define IPT_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
21 u_int8_t bitmask; 14
22}; 15#define ipt_physdev_info xt_physdev_info
23 16
24#endif /*_IPT_PHYSDEV_H*/ 17#endif /*_IPT_PHYSDEV_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_pkttype.h b/include/linux/netfilter_ipv4/ipt_pkttype.h
index d53a65848683..ff1fbc949a0c 100644
--- a/include/linux/netfilter_ipv4/ipt_pkttype.h
+++ b/include/linux/netfilter_ipv4/ipt_pkttype.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_PKTTYPE_H 1#ifndef _IPT_PKTTYPE_H
2#define _IPT_PKTTYPE_H 2#define _IPT_PKTTYPE_H
3 3
4struct ipt_pkttype_info { 4#include <linux/netfilter/xt_pkttype.h>
5 int pkttype; 5#define ipt_pkttype_info xt_pkttype_info
6 int invert; 6
7};
8#endif /*_IPT_PKTTYPE_H*/ 7#endif /*_IPT_PKTTYPE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
new file mode 100644
index 000000000000..7fd1bec453f1
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_policy.h
@@ -0,0 +1,52 @@
1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H
3
4#define IPT_POLICY_MAX_ELEM 4
5
6enum ipt_policy_flags
7{
8 IPT_POLICY_MATCH_IN = 0x1,
9 IPT_POLICY_MATCH_OUT = 0x2,
10 IPT_POLICY_MATCH_NONE = 0x4,
11 IPT_POLICY_MATCH_STRICT = 0x8,
12};
13
14enum ipt_policy_modes
15{
16 IPT_POLICY_MODE_TRANSPORT,
17 IPT_POLICY_MODE_TUNNEL
18};
19
20struct ipt_policy_spec
21{
22 u_int8_t saddr:1,
23 daddr:1,
24 proto:1,
25 mode:1,
26 spi:1,
27 reqid:1;
28};
29
30struct ipt_policy_elem
31{
32 u_int32_t saddr;
33 u_int32_t smask;
34 u_int32_t daddr;
35 u_int32_t dmask;
36 u_int32_t spi;
37 u_int32_t reqid;
38 u_int8_t proto;
39 u_int8_t mode;
40
41 struct ipt_policy_spec match;
42 struct ipt_policy_spec invert;
43};
44
45struct ipt_policy_info
46{
47 struct ipt_policy_elem pol[IPT_POLICY_MAX_ELEM];
48 u_int16_t flags;
49 u_int16_t len;
50};
51
52#endif /* _IPT_POLICY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_realm.h b/include/linux/netfilter_ipv4/ipt_realm.h
index a4d6698723ac..b3996eaa0188 100644
--- a/include/linux/netfilter_ipv4/ipt_realm.h
+++ b/include/linux/netfilter_ipv4/ipt_realm.h
@@ -1,10 +1,7 @@
1#ifndef _IPT_REALM_H 1#ifndef _IPT_REALM_H
2#define _IPT_REALM_H 2#define _IPT_REALM_H
3 3
4struct ipt_realm_info { 4#include <linux/netfilter/xt_realm.h>
5 u_int32_t id; 5#define ipt_realm_info xt_realm_info
6 u_int32_t mask;
7 u_int8_t invert;
8};
9 6
10#endif /* _IPT_REALM_H */ 7#endif /* _IPT_REALM_H */
diff --git a/include/linux/netfilter_ipv4/ipt_state.h b/include/linux/netfilter_ipv4/ipt_state.h
index 5df37868933d..a44a99cc28cc 100644
--- a/include/linux/netfilter_ipv4/ipt_state.h
+++ b/include/linux/netfilter_ipv4/ipt_state.h
@@ -1,13 +1,15 @@
1#ifndef _IPT_STATE_H 1#ifndef _IPT_STATE_H
2#define _IPT_STATE_H 2#define _IPT_STATE_H
3 3
4#define IPT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 4/* Backwards compatibility for old userspace */
5#define IPT_STATE_INVALID (1 << 0)
6 5
7#define IPT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) 6#include <linux/netfilter/xt_state.h>
7
8#define IPT_STATE_BIT XT_STATE_BIT
9#define IPT_STATE_INVALID XT_STATE_INVALID
10
11#define IPT_STATE_UNTRACKED XT_STATE_UNTRACKED
12
13#define ipt_state_info xt_state_info
8 14
9struct ipt_state_info
10{
11 unsigned int statemask;
12};
13#endif /*_IPT_STATE_H*/ 15#endif /*_IPT_STATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_string.h b/include/linux/netfilter_ipv4/ipt_string.h
index a265f6e44eab..c26de3059903 100644
--- a/include/linux/netfilter_ipv4/ipt_string.h
+++ b/include/linux/netfilter_ipv4/ipt_string.h
@@ -1,18 +1,10 @@
1#ifndef _IPT_STRING_H 1#ifndef _IPT_STRING_H
2#define _IPT_STRING_H 2#define _IPT_STRING_H
3 3
4#define IPT_STRING_MAX_PATTERN_SIZE 128 4#include <linux/netfilter/xt_string.h>
5#define IPT_STRING_MAX_ALGO_NAME_SIZE 16
6 5
7struct ipt_string_info 6#define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE
8{ 7#define IPT_STRING_MAX_ALGO_NAME_SIZE XT_STRING_MAX_ALGO_NAME_SIZE
9 u_int16_t from_offset; 8#define ipt_string_info xt_string_info
10 u_int16_t to_offset;
11 char algo[IPT_STRING_MAX_ALGO_NAME_SIZE];
12 char pattern[IPT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen;
14 u_int8_t invert;
15 struct ts_config __attribute__((aligned(8))) *config;
16};
17 9
18#endif /*_IPT_STRING_H*/ 10#endif /*_IPT_STRING_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_tcpmss.h b/include/linux/netfilter_ipv4/ipt_tcpmss.h
index e2b14397f701..18bbc8e8e009 100644
--- a/include/linux/netfilter_ipv4/ipt_tcpmss.h
+++ b/include/linux/netfilter_ipv4/ipt_tcpmss.h
@@ -1,9 +1,7 @@
1#ifndef _IPT_TCPMSS_MATCH_H 1#ifndef _IPT_TCPMSS_MATCH_H
2#define _IPT_TCPMSS_MATCH_H 2#define _IPT_TCPMSS_MATCH_H
3 3
4struct ipt_tcpmss_match_info { 4#include <linux/netfilter/xt_tcpmss.h>
5 u_int16_t mss_min, mss_max; 5#define ipt_tcpmss_match_info xt_tcpmss_match_info
6 u_int8_t invert;
7};
8 6
9#endif /*_IPT_TCPMSS_MATCH_H*/ 7#endif /*_IPT_TCPMSS_MATCH_H*/
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 53b2983f6278..14f2bd010884 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -72,7 +72,12 @@ enum nf_ip6_hook_priorities {
72 NF_IP6_PRI_LAST = INT_MAX, 72 NF_IP6_PRI_LAST = INT_MAX,
73}; 73};
74 74
75#ifdef CONFIG_NETFILTER
75extern int ipv6_netfilter_init(void); 76extern int ipv6_netfilter_init(void);
76extern void ipv6_netfilter_fini(void); 77extern void ipv6_netfilter_fini(void);
78#else /* CONFIG_NETFILTER */
79static inline int ipv6_netfilter_init(void) { return 0; }
80static inline void ipv6_netfilter_fini(void) { return; }
81#endif /* CONFIG_NETFILTER */
77 82
78#endif /*__LINUX_IP6_NETFILTER_H*/ 83#endif /*__LINUX_IP6_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 2efc046d9e94..f249b574f0fa 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -25,8 +25,15 @@
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv6.h> 26#include <linux/netfilter_ipv6.h>
27 27
28#define IP6T_FUNCTION_MAXNAMELEN 30 28#include <linux/netfilter/x_tables.h>
29#define IP6T_TABLE_MAXNAMELEN 32 29
30#define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
31#define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
32
33#define ip6t_match xt_match
34#define ip6t_target xt_target
35#define ip6t_table xt_table
36#define ip6t_get_revision xt_get_revision
30 37
31/* Yes, Virginia, you have to zero the padding. */ 38/* Yes, Virginia, you have to zero the padding. */
32struct ip6t_ip6 { 39struct ip6t_ip6 {
@@ -104,10 +111,7 @@ struct ip6t_standard_target
104 int verdict; 111 int verdict;
105}; 112};
106 113
107struct ip6t_counters 114#define ip6t_counters xt_counters
108{
109 u_int64_t pcnt, bcnt; /* Packet and byte counters */
110};
111 115
112/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */ 116/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
113#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper 117#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper
@@ -123,7 +127,7 @@ struct ip6t_counters
123#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ 127#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
124#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ 128#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
125#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */ 129#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */
126#define IP6T_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 130#define IP6T_INV_PROTO XT_INV_PROTO
127#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */ 131#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */
128 132
129/* This structure defines each of the firewall rules. Consists of 3 133/* This structure defines each of the firewall rules. Consists of 3
@@ -145,7 +149,7 @@ struct ip6t_entry
145 unsigned int comefrom; 149 unsigned int comefrom;
146 150
147 /* Packet and byte counters. */ 151 /* Packet and byte counters. */
148 struct ip6t_counters counters; 152 struct xt_counters counters;
149 153
150 /* The matches (if any), then the target. */ 154 /* The matches (if any), then the target. */
151 unsigned char elems[0]; 155 unsigned char elems[0];
@@ -155,54 +159,41 @@ struct ip6t_entry
155 * New IP firewall options for [gs]etsockopt at the RAW IP level. 159 * New IP firewall options for [gs]etsockopt at the RAW IP level.
156 * Unlike BSD Linux inherits IP options so you don't have to use 160 * Unlike BSD Linux inherits IP options so you don't have to use
157 * a raw socket for this. Instead we check rights in the calls. */ 161 * a raw socket for this. Instead we check rights in the calls. */
158#define IP6T_BASE_CTL 64 /* base for firewall socket options */ 162#define IP6T_BASE_CTL XT_BASE_CTL
159 163
160#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL) 164#define IP6T_SO_SET_REPLACE XT_SO_SET_REPLACE
161#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1) 165#define IP6T_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS
162#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS 166#define IP6T_SO_SET_MAX XT_SO_SET_MAX
163 167
164#define IP6T_SO_GET_INFO (IP6T_BASE_CTL) 168#define IP6T_SO_GET_INFO XT_SO_GET_INFO
165#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1) 169#define IP6T_SO_GET_ENTRIES XT_SO_GET_ENTRIES
166#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 2) 170#define IP6T_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH
167#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 3) 171#define IP6T_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET
168#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET 172#define IP6T_SO_GET_MAX XT_SO_GET_REVISION_TARGET
169 173
170/* CONTINUE verdict for targets */ 174/* CONTINUE verdict for targets */
171#define IP6T_CONTINUE 0xFFFFFFFF 175#define IP6T_CONTINUE XT_CONTINUE
172 176
173/* For standard target */ 177/* For standard target */
174#define IP6T_RETURN (-NF_REPEAT - 1) 178#define IP6T_RETURN XT_RETURN
175 179
176/* TCP matching stuff */ 180/* TCP/UDP matching stuff */
177struct ip6t_tcp 181#include <linux/netfilter/xt_tcpudp.h>
178{ 182
179 u_int16_t spts[2]; /* Source port range. */ 183#define ip6t_tcp xt_tcp
180 u_int16_t dpts[2]; /* Destination port range. */ 184#define ip6t_udp xt_udp
181 u_int8_t option; /* TCP Option iff non-zero*/
182 u_int8_t flg_mask; /* TCP flags mask byte */
183 u_int8_t flg_cmp; /* TCP flags compare byte */
184 u_int8_t invflags; /* Inverse flags */
185};
186 185
187/* Values for "inv" field in struct ipt_tcp. */ 186/* Values for "inv" field in struct ipt_tcp. */
188#define IP6T_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 187#define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT
189#define IP6T_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 188#define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT
190#define IP6T_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ 189#define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS
191#define IP6T_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ 190#define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION
192#define IP6T_TCP_INV_MASK 0x0F /* All possible flags. */ 191#define IP6T_TCP_INV_MASK XT_TCP_INV_MASK
193
194/* UDP matching stuff */
195struct ip6t_udp
196{
197 u_int16_t spts[2]; /* Source port range. */
198 u_int16_t dpts[2]; /* Destination port range. */
199 u_int8_t invflags; /* Inverse flags */
200};
201 192
202/* Values for "invflags" field in struct ipt_udp. */ 193/* Values for "invflags" field in struct ipt_udp. */
203#define IP6T_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 194#define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT
204#define IP6T_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 195#define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT
205#define IP6T_UDP_INV_MASK 0x03 /* All possible flags. */ 196#define IP6T_UDP_INV_MASK XT_UDP_INV_MASK
206 197
207/* ICMP matching stuff */ 198/* ICMP matching stuff */
208struct ip6t_icmp 199struct ip6t_icmp
@@ -264,23 +255,14 @@ struct ip6t_replace
264 /* Number of counters (must be equal to current number of entries). */ 255 /* Number of counters (must be equal to current number of entries). */
265 unsigned int num_counters; 256 unsigned int num_counters;
266 /* The old entries' counters. */ 257 /* The old entries' counters. */
267 struct ip6t_counters __user *counters; 258 struct xt_counters __user *counters;
268 259
269 /* The entries (hang off end: not really an array). */ 260 /* The entries (hang off end: not really an array). */
270 struct ip6t_entry entries[0]; 261 struct ip6t_entry entries[0];
271}; 262};
272 263
273/* The argument to IP6T_SO_ADD_COUNTERS. */ 264/* The argument to IP6T_SO_ADD_COUNTERS. */
274struct ip6t_counters_info 265#define ip6t_counters_info xt_counters_info
275{
276 /* Which table. */
277 char name[IP6T_TABLE_MAXNAMELEN];
278
279 unsigned int num_counters;
280
281 /* The counters (actually `number' of these). */
282 struct ip6t_counters counters[0];
283};
284 266
285/* The argument to IP6T_SO_GET_ENTRIES. */ 267/* The argument to IP6T_SO_GET_ENTRIES. */
286struct ip6t_get_entries 268struct ip6t_get_entries
@@ -295,19 +277,10 @@ struct ip6t_get_entries
295 struct ip6t_entry entrytable[0]; 277 struct ip6t_entry entrytable[0];
296}; 278};
297 279
298/* The argument to IP6T_SO_GET_REVISION_*. Returns highest revision
299 * kernel supports, if >= revision. */
300struct ip6t_get_revision
301{
302 char name[IP6T_FUNCTION_MAXNAMELEN-1];
303
304 u_int8_t revision;
305};
306
307/* Standard return verdict, or do jump. */ 280/* Standard return verdict, or do jump. */
308#define IP6T_STANDARD_TARGET "" 281#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
309/* Error verdict. */ 282/* Error verdict. */
310#define IP6T_ERROR_TARGET "ERROR" 283#define IP6T_ERROR_TARGET XT_ERROR_TARGET
311 284
312/* Helper functions */ 285/* Helper functions */
313static __inline__ struct ip6t_entry_target * 286static __inline__ struct ip6t_entry_target *
@@ -361,104 +334,11 @@ ip6t_get_target(struct ip6t_entry *e)
361#include <linux/init.h> 334#include <linux/init.h>
362extern void ip6t_init(void) __init; 335extern void ip6t_init(void) __init;
363 336
364struct ip6t_match 337#define ip6t_register_target(tgt) xt_register_target(AF_INET6, tgt)
365{ 338#define ip6t_unregister_target(tgt) xt_unregister_target(AF_INET6, tgt)
366 struct list_head list;
367
368 const char name[IP6T_FUNCTION_MAXNAMELEN-1];
369
370 u_int8_t revision;
371
372 /* Return true or false: return FALSE and set *hotdrop = 1 to
373 force immediate packet drop. */
374 /* Arguments changed since 2.6.9, as this must now handle
375 non-linear skb, using skb_header_pointer and
376 skb_ip_make_writable. */
377 int (*match)(const struct sk_buff *skb,
378 const struct net_device *in,
379 const struct net_device *out,
380 const void *matchinfo,
381 int offset,
382 unsigned int protoff,
383 int *hotdrop);
384
385 /* Called when user tries to insert an entry of this type. */
386 /* Should return true or false. */
387 int (*checkentry)(const char *tablename,
388 const struct ip6t_ip6 *ip,
389 void *matchinfo,
390 unsigned int matchinfosize,
391 unsigned int hook_mask);
392
393 /* Called when entry of this type deleted. */
394 void (*destroy)(void *matchinfo, unsigned int matchinfosize);
395
396 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
397 struct module *me;
398};
399
400/* Registration hooks for targets. */
401struct ip6t_target
402{
403 struct list_head list;
404
405 const char name[IP6T_FUNCTION_MAXNAMELEN-1];
406
407 u_int8_t revision;
408
409 /* Returns verdict. Argument order changed since 2.6.9, as this
410 must now handle non-linear skbs, using skb_copy_bits and
411 skb_ip_make_writable. */
412 unsigned int (*target)(struct sk_buff **pskb,
413 const struct net_device *in,
414 const struct net_device *out,
415 unsigned int hooknum,
416 const void *targinfo,
417 void *userdata);
418
419 /* Called when user tries to insert an entry of this type:
420 hook_mask is a bitmask of hooks from which it can be
421 called. */
422 /* Should return true or false. */
423 int (*checkentry)(const char *tablename,
424 const struct ip6t_entry *e,
425 void *targinfo,
426 unsigned int targinfosize,
427 unsigned int hook_mask);
428
429 /* Called when entry of this type deleted. */
430 void (*destroy)(void *targinfo, unsigned int targinfosize);
431
432 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
433 struct module *me;
434};
435
436extern int ip6t_register_target(struct ip6t_target *target);
437extern void ip6t_unregister_target(struct ip6t_target *target);
438 339
439extern int ip6t_register_match(struct ip6t_match *match); 340#define ip6t_register_match(match) xt_register_match(AF_INET6, match)
440extern void ip6t_unregister_match(struct ip6t_match *match); 341#define ip6t_unregister_match(match) xt_unregister_match(AF_INET6, match)
441
442/* Furniture shopping... */
443struct ip6t_table
444{
445 struct list_head list;
446
447 /* A unique name... */
448 char name[IP6T_TABLE_MAXNAMELEN];
449
450 /* What hooks you will enter on */
451 unsigned int valid_hooks;
452
453 /* Lock for the curtain */
454 rwlock_t lock;
455
456 /* Man behind the curtain... */
457 struct ip6t_table_info *private;
458
459 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
460 struct module *me;
461};
462 342
463extern int ip6t_register_table(struct ip6t_table *table, 343extern int ip6t_register_table(struct ip6t_table *table,
464 const struct ip6t_replace *repl); 344 const struct ip6t_replace *repl);
@@ -474,7 +354,11 @@ extern unsigned int ip6t_do_table(struct sk_buff **pskb,
474extern int ip6t_ext_hdr(u8 nexthdr); 354extern int ip6t_ext_hdr(u8 nexthdr);
475/* find specified header and get offset to it */ 355/* find specified header and get offset to it */
476extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 356extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
477 u8 target); 357 int target, unsigned short *fragoff);
358
359extern int ip6_masked_addrcmp(const struct in6_addr *addr1,
360 const struct in6_addr *mask,
361 const struct in6_addr *addr2);
478 362
479#define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1)) 363#define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1))
480 364
diff --git a/include/linux/netfilter_ipv6/ip6t_MARK.h b/include/linux/netfilter_ipv6/ip6t_MARK.h
index 7ade8d8f5246..7cf629a8ab92 100644
--- a/include/linux/netfilter_ipv6/ip6t_MARK.h
+++ b/include/linux/netfilter_ipv6/ip6t_MARK.h
@@ -1,8 +1,9 @@
1#ifndef _IP6T_MARK_H_target 1#ifndef _IP6T_MARK_H_target
2#define _IP6T_MARK_H_target 2#define _IP6T_MARK_H_target
3 3
4struct ip6t_mark_target_info { 4/* Backwards compatibility for old userspace */
5 unsigned long mark; 5#include <linux/netfilter/xt_MARK.h>
6};
7 6
8#endif /*_IPT_MARK_H_target*/ 7#define ip6t_mark_target_info xt_mark_target_info
8
9#endif /*_IP6T_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv6/ip6t_length.h b/include/linux/netfilter_ipv6/ip6t_length.h
index 7fc09f9f9d63..9e9689d03ed7 100644
--- a/include/linux/netfilter_ipv6/ip6t_length.h
+++ b/include/linux/netfilter_ipv6/ip6t_length.h
@@ -1,10 +1,8 @@
1#ifndef _IP6T_LENGTH_H 1#ifndef _IP6T_LENGTH_H
2#define _IP6T_LENGTH_H 2#define _IP6T_LENGTH_H
3 3
4struct ip6t_length_info { 4#include <linux/netfilter/xt_length.h>
5 u_int16_t min, max; 5#define ip6t_length_info xt_length_info
6 u_int8_t invert;
7};
8 6
9#endif /*_IP6T_LENGTH_H*/ 7#endif /*_IP6T_LENGTH_H*/
10 8
diff --git a/include/linux/netfilter_ipv6/ip6t_limit.h b/include/linux/netfilter_ipv6/ip6t_limit.h
index f2866e50f3b4..487e5ea342c6 100644
--- a/include/linux/netfilter_ipv6/ip6t_limit.h
+++ b/include/linux/netfilter_ipv6/ip6t_limit.h
@@ -1,21 +1,8 @@
1#ifndef _IP6T_RATE_H 1#ifndef _IP6T_RATE_H
2#define _IP6T_RATE_H 2#define _IP6T_RATE_H
3 3
4/* timings are in milliseconds. */ 4#include <linux/netfilter/xt_limit.h>
5#define IP6T_LIMIT_SCALE 10000 5#define IP6T_LIMIT_SCALE XT_LIMIT_SCALE
6#define ip6t_rateinfo xt_rateinfo
6 7
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 8#endif /*_IP6T_RATE_H*/
8 seconds, or one every 59 hours. */
9struct ip6t_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */
12
13 /* Used internally by the kernel */
14 unsigned long prev;
15 u_int32_t credit;
16 u_int32_t credit_cap, cost;
17
18 /* Ugly, ugly fucker. */
19 struct ip6t_rateinfo *master;
20};
21#endif /*_IPT_RATE_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mac.h b/include/linux/netfilter_ipv6/ip6t_mac.h
index 87c088c21848..ac58e83e9423 100644
--- a/include/linux/netfilter_ipv6/ip6t_mac.h
+++ b/include/linux/netfilter_ipv6/ip6t_mac.h
@@ -1,8 +1,7 @@
1#ifndef _IP6T_MAC_H 1#ifndef _IP6T_MAC_H
2#define _IP6T_MAC_H 2#define _IP6T_MAC_H
3 3
4struct ip6t_mac_info { 4#include <linux/netfilter/xt_mac.h>
5 unsigned char srcaddr[ETH_ALEN]; 5#define ip6t_mac_info xt_mac_info
6 int invert; 6
7}; 7#endif /*_IP6T_MAC_H*/
8#endif /*_IPT_MAC_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mark.h b/include/linux/netfilter_ipv6/ip6t_mark.h
index a734441e1c19..ff204951ddc3 100644
--- a/include/linux/netfilter_ipv6/ip6t_mark.h
+++ b/include/linux/netfilter_ipv6/ip6t_mark.h
@@ -1,9 +1,9 @@
1#ifndef _IP6T_MARK_H 1#ifndef _IP6T_MARK_H
2#define _IP6T_MARK_H 2#define _IP6T_MARK_H
3 3
4struct ip6t_mark_info { 4/* Backwards compatibility for old userspace */
5 unsigned long mark, mask; 5#include <linux/netfilter/xt_mark.h>
6 u_int8_t invert; 6
7}; 7#define ip6t_mark_info xt_mark_info
8 8
9#endif /*_IPT_MARK_H*/ 9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_physdev.h b/include/linux/netfilter_ipv6/ip6t_physdev.h
index c234731cd66b..c161c0a81b55 100644
--- a/include/linux/netfilter_ipv6/ip6t_physdev.h
+++ b/include/linux/netfilter_ipv6/ip6t_physdev.h
@@ -1,24 +1,17 @@
1#ifndef _IP6T_PHYSDEV_H 1#ifndef _IP6T_PHYSDEV_H
2#define _IP6T_PHYSDEV_H 2#define _IP6T_PHYSDEV_H
3 3
4#ifdef __KERNEL__ 4/* Backwards compatibility for old userspace */
5#include <linux/if.h>
6#endif
7 5
8#define IP6T_PHYSDEV_OP_IN 0x01 6#include <linux/netfilter/xt_physdev.h>
9#define IP6T_PHYSDEV_OP_OUT 0x02
10#define IP6T_PHYSDEV_OP_BRIDGED 0x04
11#define IP6T_PHYSDEV_OP_ISIN 0x08
12#define IP6T_PHYSDEV_OP_ISOUT 0x10
13#define IP6T_PHYSDEV_OP_MASK (0x20 - 1)
14 7
15struct ip6t_physdev_info { 8#define IP6T_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
16 char physindev[IFNAMSIZ]; 9#define IP6T_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
17 char in_mask[IFNAMSIZ]; 10#define IP6T_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
18 char physoutdev[IFNAMSIZ]; 11#define IP6T_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
19 char out_mask[IFNAMSIZ]; 12#define IP6T_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
20 u_int8_t invert; 13#define IP6T_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
21 u_int8_t bitmask; 14
22}; 15#define ip6t_physdev_info xt_physdev_info
23 16
24#endif /*_IP6T_PHYSDEV_H*/ 17#endif /*_IP6T_PHYSDEV_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
new file mode 100644
index 000000000000..5a93afcd2ff1
--- /dev/null
+++ b/include/linux/netfilter_ipv6/ip6t_policy.h
@@ -0,0 +1,52 @@
1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H
3
4#define IP6T_POLICY_MAX_ELEM 4
5
6enum ip6t_policy_flags
7{
8 IP6T_POLICY_MATCH_IN = 0x1,
9 IP6T_POLICY_MATCH_OUT = 0x2,
10 IP6T_POLICY_MATCH_NONE = 0x4,
11 IP6T_POLICY_MATCH_STRICT = 0x8,
12};
13
14enum ip6t_policy_modes
15{
16 IP6T_POLICY_MODE_TRANSPORT,
17 IP6T_POLICY_MODE_TUNNEL
18};
19
20struct ip6t_policy_spec
21{
22 u_int8_t saddr:1,
23 daddr:1,
24 proto:1,
25 mode:1,
26 spi:1,
27 reqid:1;
28};
29
30struct ip6t_policy_elem
31{
32 struct in6_addr saddr;
33 struct in6_addr smask;
34 struct in6_addr daddr;
35 struct in6_addr dmask;
36 u_int32_t spi;
37 u_int32_t reqid;
38 u_int8_t proto;
39 u_int8_t mode;
40
41 struct ip6t_policy_spec match;
42 struct ip6t_policy_spec invert;
43};
44
45struct ip6t_policy_info
46{
47 struct ip6t_policy_elem pol[IP6T_POLICY_MAX_ELEM];
48 u_int16_t flags;
49 u_int16_t len;
50};
51
52#endif /* _IP6T_POLICY_H */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 2516adeccecf..547d649b274e 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -38,9 +38,6 @@
38# define NFS_DEBUG 38# define NFS_DEBUG
39#endif 39#endif
40 40
41#define NFS_MAX_FILE_IO_BUFFER_SIZE 32768
42#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096
43
44/* Default timeout values */ 41/* Default timeout values */
45#define NFS_MAX_UDP_TIMEOUT (60*HZ) 42#define NFS_MAX_UDP_TIMEOUT (60*HZ)
46#define NFS_MAX_TCP_TIMEOUT (600*HZ) 43#define NFS_MAX_TCP_TIMEOUT (600*HZ)
@@ -65,6 +62,7 @@
65#define FLUSH_STABLE 4 /* commit to stable storage */ 62#define FLUSH_STABLE 4 /* commit to stable storage */
66#define FLUSH_LOWPRI 8 /* low priority background flush */ 63#define FLUSH_LOWPRI 8 /* low priority background flush */
67#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 64#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
65#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */
68 66
69#ifdef __KERNEL__ 67#ifdef __KERNEL__
70 68
@@ -394,6 +392,17 @@ extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_
394extern struct inode_operations nfs_symlink_inode_operations; 392extern struct inode_operations nfs_symlink_inode_operations;
395 393
396/* 394/*
395 * linux/fs/nfs/sysctl.c
396 */
397#ifdef CONFIG_SYSCTL
398extern int nfs_register_sysctl(void);
399extern void nfs_unregister_sysctl(void);
400#else
401#define nfs_register_sysctl() do { } while(0)
402#define nfs_unregister_sysctl() do { } while(0)
403#endif
404
405/*
397 * linux/fs/nfs/unlink.c 406 * linux/fs/nfs/unlink.c
398 */ 407 */
399extern int nfs_async_unlink(struct dentry *); 408extern int nfs_async_unlink(struct dentry *);
@@ -406,10 +415,12 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
406extern int nfs_writepages(struct address_space *, struct writeback_control *); 415extern int nfs_writepages(struct address_space *, struct writeback_control *);
407extern int nfs_flush_incompatible(struct file *file, struct page *page); 416extern int nfs_flush_incompatible(struct file *file, struct page *page);
408extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 417extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
409extern void nfs_writeback_done(struct rpc_task *task); 418extern void nfs_writeback_done(struct rpc_task *task, void *data);
419extern void nfs_writedata_release(void *data);
410 420
411#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
412extern void nfs_commit_done(struct rpc_task *); 422extern void nfs_commit_done(struct rpc_task *, void *data);
423extern void nfs_commit_release(void *data);
413#endif 424#endif
414 425
415/* 426/*
@@ -460,18 +471,33 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
460 */ 471 */
461extern mempool_t *nfs_wdata_mempool; 472extern mempool_t *nfs_wdata_mempool;
462 473
463static inline struct nfs_write_data *nfs_writedata_alloc(void) 474static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
464{ 475{
465 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); 476 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS);
477
466 if (p) { 478 if (p) {
467 memset(p, 0, sizeof(*p)); 479 memset(p, 0, sizeof(*p));
468 INIT_LIST_HEAD(&p->pages); 480 INIT_LIST_HEAD(&p->pages);
481 if (pagecount < NFS_PAGEVEC_SIZE)
482 p->pagevec = &p->page_array[0];
483 else {
484 size_t size = ++pagecount * sizeof(struct page *);
485 p->pagevec = kmalloc(size, GFP_NOFS);
486 if (p->pagevec) {
487 memset(p->pagevec, 0, size);
488 } else {
489 mempool_free(p, nfs_wdata_mempool);
490 p = NULL;
491 }
492 }
469 } 493 }
470 return p; 494 return p;
471} 495}
472 496
473static inline void nfs_writedata_free(struct nfs_write_data *p) 497static inline void nfs_writedata_free(struct nfs_write_data *p)
474{ 498{
499 if (p && (p->pagevec != &p->page_array[0]))
500 kfree(p->pagevec);
475 mempool_free(p, nfs_wdata_mempool); 501 mempool_free(p, nfs_wdata_mempool);
476} 502}
477 503
@@ -481,28 +507,45 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
481extern int nfs_readpage(struct file *, struct page *); 507extern int nfs_readpage(struct file *, struct page *);
482extern int nfs_readpages(struct file *, struct address_space *, 508extern int nfs_readpages(struct file *, struct address_space *,
483 struct list_head *, unsigned); 509 struct list_head *, unsigned);
484extern void nfs_readpage_result(struct rpc_task *); 510extern void nfs_readpage_result(struct rpc_task *, void *);
511extern void nfs_readdata_release(void *data);
512
485 513
486/* 514/*
487 * Allocate and free nfs_read_data structures 515 * Allocate and free nfs_read_data structures
488 */ 516 */
489extern mempool_t *nfs_rdata_mempool; 517extern mempool_t *nfs_rdata_mempool;
490 518
491static inline struct nfs_read_data *nfs_readdata_alloc(void) 519static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
492{ 520{
493 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); 521 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS);
494 if (p) 522
523 if (p) {
495 memset(p, 0, sizeof(*p)); 524 memset(p, 0, sizeof(*p));
525 INIT_LIST_HEAD(&p->pages);
526 if (pagecount < NFS_PAGEVEC_SIZE)
527 p->pagevec = &p->page_array[0];
528 else {
529 size_t size = ++pagecount * sizeof(struct page *);
530 p->pagevec = kmalloc(size, GFP_NOFS);
531 if (p->pagevec) {
532 memset(p->pagevec, 0, size);
533 } else {
534 mempool_free(p, nfs_rdata_mempool);
535 p = NULL;
536 }
537 }
538 }
496 return p; 539 return p;
497} 540}
498 541
499static inline void nfs_readdata_free(struct nfs_read_data *p) 542static inline void nfs_readdata_free(struct nfs_read_data *p)
500{ 543{
544 if (p && (p->pagevec != &p->page_array[0]))
545 kfree(p->pagevec);
501 mempool_free(p, nfs_rdata_mempool); 546 mempool_free(p, nfs_rdata_mempool);
502} 547}
503 548
504extern void nfs_readdata_release(struct rpc_task *task);
505
506/* 549/*
507 * linux/fs/nfs3proc.c 550 * linux/fs/nfs3proc.c
508 */ 551 */
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index a0f1f25e0ead..102e56094296 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -71,6 +71,8 @@ int nfs_map_name_to_uid(struct nfs4_client *, const char *, size_t, __u32 *);
71int nfs_map_group_to_gid(struct nfs4_client *, const char *, size_t, __u32 *); 71int nfs_map_group_to_gid(struct nfs4_client *, const char *, size_t, __u32 *);
72int nfs_map_uid_to_name(struct nfs4_client *, __u32, char *); 72int nfs_map_uid_to_name(struct nfs4_client *, __u32, char *);
73int nfs_map_gid_to_group(struct nfs4_client *, __u32, char *); 73int nfs_map_gid_to_group(struct nfs4_client *, __u32, char *);
74
75extern unsigned int nfs_idmap_cache_timeout;
74#endif /* __KERNEL__ */ 76#endif /* __KERNEL__ */
75 77
76#endif /* NFS_IDMAP_H */ 78#endif /* NFS_IDMAP_H */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index da2e077b65e2..66e2ed658527 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -79,9 +79,7 @@ extern void nfs_clear_page_writeback(struct nfs_page *req);
79static inline int 79static inline int
80nfs_lock_request_dontget(struct nfs_page *req) 80nfs_lock_request_dontget(struct nfs_page *req)
81{ 81{
82 if (test_and_set_bit(PG_BUSY, &req->wb_flags)) 82 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
83 return 0;
84 return 1;
85} 83}
86 84
87/* 85/*
@@ -125,9 +123,7 @@ nfs_list_remove_request(struct nfs_page *req)
125static inline int 123static inline int
126nfs_defer_commit(struct nfs_page *req) 124nfs_defer_commit(struct nfs_page *req)
127{ 125{
128 if (test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags)) 126 return !test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags);
129 return 0;
130 return 1;
131} 127}
132 128
133static inline void 129static inline void
@@ -141,9 +137,7 @@ nfs_clear_commit(struct nfs_page *req)
141static inline int 137static inline int
142nfs_defer_reschedule(struct nfs_page *req) 138nfs_defer_reschedule(struct nfs_page *req)
143{ 139{
144 if (test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags)) 140 return !test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags);
145 return 0;
146 return 1;
147} 141}
148 142
149static inline void 143static inline void
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 40718669b9c8..6d6f69ec5675 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -4,6 +4,16 @@
4#include <linux/sunrpc/xprt.h> 4#include <linux/sunrpc/xprt.h>
5#include <linux/nfsacl.h> 5#include <linux/nfsacl.h>
6 6
7/*
8 * To change the maximum rsize and wsize supported by the NFS client, adjust
9 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
10 * support a megabyte or more. The default is left at 4096 bytes, which is
11 * reasonable for NFS over UDP.
12 */
13#define NFS_MAX_FILE_IO_SIZE (1048576U)
14#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U)
16
7struct nfs4_fsid { 17struct nfs4_fsid {
8 __u64 major; 18 __u64 major;
9 __u64 minor; 19 __u64 minor;
@@ -137,7 +147,7 @@ struct nfs_openres {
137 */ 147 */
138struct nfs_open_confirmargs { 148struct nfs_open_confirmargs {
139 const struct nfs_fh * fh; 149 const struct nfs_fh * fh;
140 nfs4_stateid stateid; 150 nfs4_stateid * stateid;
141 struct nfs_seqid * seqid; 151 struct nfs_seqid * seqid;
142}; 152};
143 153
@@ -165,66 +175,62 @@ struct nfs_closeres {
165 * * Arguments to the lock,lockt, and locku call. 175 * * Arguments to the lock,lockt, and locku call.
166 * */ 176 * */
167struct nfs_lowner { 177struct nfs_lowner {
168 __u64 clientid; 178 __u64 clientid;
169 u32 id; 179 u32 id;
170}; 180};
171 181
172struct nfs_lock_opargs { 182struct nfs_lock_args {
183 struct nfs_fh * fh;
184 struct file_lock * fl;
173 struct nfs_seqid * lock_seqid; 185 struct nfs_seqid * lock_seqid;
174 nfs4_stateid * lock_stateid; 186 nfs4_stateid * lock_stateid;
175 struct nfs_seqid * open_seqid; 187 struct nfs_seqid * open_seqid;
176 nfs4_stateid * open_stateid; 188 nfs4_stateid * open_stateid;
177 struct nfs_lowner lock_owner; 189 struct nfs_lowner lock_owner;
178 __u32 reclaim; 190 unsigned char block : 1;
179 __u32 new_lock_owner; 191 unsigned char reclaim : 1;
192 unsigned char new_lock_owner : 1;
180}; 193};
181 194
182struct nfs_locku_opargs { 195struct nfs_lock_res {
196 nfs4_stateid stateid;
197};
198
199struct nfs_locku_args {
200 struct nfs_fh * fh;
201 struct file_lock * fl;
183 struct nfs_seqid * seqid; 202 struct nfs_seqid * seqid;
184 nfs4_stateid * stateid; 203 nfs4_stateid * stateid;
185}; 204};
186 205
187struct nfs_lockargs { 206struct nfs_locku_res {
188 struct nfs_fh * fh; 207 nfs4_stateid stateid;
189 __u32 type;
190 __u64 offset;
191 __u64 length;
192 union {
193 struct nfs_lock_opargs *lock; /* LOCK */
194 struct nfs_lowner *lockt; /* LOCKT */
195 struct nfs_locku_opargs *locku; /* LOCKU */
196 } u;
197}; 208};
198 209
199struct nfs_lock_denied { 210struct nfs_lockt_args {
200 __u64 offset; 211 struct nfs_fh * fh;
201 __u64 length; 212 struct file_lock * fl;
202 __u32 type; 213 struct nfs_lowner lock_owner;
203 struct nfs_lowner owner;
204}; 214};
205 215
206struct nfs_lockres { 216struct nfs_lockt_res {
207 union { 217 struct file_lock * denied; /* LOCK, LOCKT failed */
208 nfs4_stateid stateid;/* LOCK success, LOCKU */
209 struct nfs_lock_denied denied; /* LOCK failed, LOCKT success */
210 } u;
211 const struct nfs_server * server;
212}; 218};
213 219
214struct nfs4_delegreturnargs { 220struct nfs4_delegreturnargs {
215 const struct nfs_fh *fhandle; 221 const struct nfs_fh *fhandle;
216 const nfs4_stateid *stateid; 222 const nfs4_stateid *stateid;
223 const u32 * bitmask;
224};
225
226struct nfs4_delegreturnres {
227 struct nfs_fattr * fattr;
228 const struct nfs_server *server;
217}; 229};
218 230
219/* 231/*
220 * Arguments to the read call. 232 * Arguments to the read call.
221 */ 233 */
222
223#define NFS_READ_MAXIOV (9U)
224#if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
225#error "NFS_READ_MAXIOV is too large"
226#endif
227
228struct nfs_readargs { 234struct nfs_readargs {
229 struct nfs_fh * fh; 235 struct nfs_fh * fh;
230 struct nfs_open_context *context; 236 struct nfs_open_context *context;
@@ -243,11 +249,6 @@ struct nfs_readres {
243/* 249/*
244 * Arguments to the write call. 250 * Arguments to the write call.
245 */ 251 */
246#define NFS_WRITE_MAXIOV (9U)
247#if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
248#error "NFS_WRITE_MAXIOV is too large"
249#endif
250
251struct nfs_writeargs { 252struct nfs_writeargs {
252 struct nfs_fh * fh; 253 struct nfs_fh * fh;
253 struct nfs_open_context *context; 254 struct nfs_open_context *context;
@@ -678,6 +679,8 @@ struct nfs4_server_caps_res {
678 679
679struct nfs_page; 680struct nfs_page;
680 681
682#define NFS_PAGEVEC_SIZE (8U)
683
681struct nfs_read_data { 684struct nfs_read_data {
682 int flags; 685 int flags;
683 struct rpc_task task; 686 struct rpc_task task;
@@ -686,13 +689,14 @@ struct nfs_read_data {
686 struct nfs_fattr fattr; /* fattr storage */ 689 struct nfs_fattr fattr; /* fattr storage */
687 struct list_head pages; /* Coalesced read requests */ 690 struct list_head pages; /* Coalesced read requests */
688 struct nfs_page *req; /* multi ops per nfs_page */ 691 struct nfs_page *req; /* multi ops per nfs_page */
689 struct page *pagevec[NFS_READ_MAXIOV]; 692 struct page **pagevec;
690 struct nfs_readargs args; 693 struct nfs_readargs args;
691 struct nfs_readres res; 694 struct nfs_readres res;
692#ifdef CONFIG_NFS_V4 695#ifdef CONFIG_NFS_V4
693 unsigned long timestamp; /* For lease renewal */ 696 unsigned long timestamp; /* For lease renewal */
694#endif 697#endif
695 void (*complete) (struct nfs_read_data *, int); 698 void (*complete) (struct nfs_read_data *, int);
699 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
696}; 700};
697 701
698struct nfs_write_data { 702struct nfs_write_data {
@@ -704,13 +708,14 @@ struct nfs_write_data {
704 struct nfs_writeverf verf; 708 struct nfs_writeverf verf;
705 struct list_head pages; /* Coalesced requests we wish to flush */ 709 struct list_head pages; /* Coalesced requests we wish to flush */
706 struct nfs_page *req; /* multi ops per nfs_page */ 710 struct nfs_page *req; /* multi ops per nfs_page */
707 struct page *pagevec[NFS_WRITE_MAXIOV]; 711 struct page **pagevec;
708 struct nfs_writeargs args; /* argument struct */ 712 struct nfs_writeargs args; /* argument struct */
709 struct nfs_writeres res; /* result struct */ 713 struct nfs_writeres res; /* result struct */
710#ifdef CONFIG_NFS_V4 714#ifdef CONFIG_NFS_V4
711 unsigned long timestamp; /* For lease renewal */ 715 unsigned long timestamp; /* For lease renewal */
712#endif 716#endif
713 void (*complete) (struct nfs_write_data *, int); 717 void (*complete) (struct nfs_write_data *, int);
718 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
714}; 719};
715 720
716struct nfs_access_entry; 721struct nfs_access_entry;
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index bb842ea41033..0798b7781a6e 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -294,7 +294,7 @@ fill_post_wcc(struct svc_fh *fhp)
294/* 294/*
295 * Lock a file handle/inode 295 * Lock a file handle/inode
296 * NOTE: both fh_lock and fh_unlock are done "by hand" in 296 * NOTE: both fh_lock and fh_unlock are done "by hand" in
297 * vfs.c:nfsd_rename as it needs to grab 2 i_sem's at once 297 * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once
298 * so, any changes here should be reflected there. 298 * so, any changes here should be reflected there.
299 */ 299 */
300static inline void 300static inline void
@@ -317,7 +317,7 @@ fh_lock(struct svc_fh *fhp)
317 } 317 }
318 318
319 inode = dentry->d_inode; 319 inode = dentry->d_inode;
320 down(&inode->i_sem); 320 mutex_lock(&inode->i_mutex);
321 fill_pre_wcc(fhp); 321 fill_pre_wcc(fhp);
322 fhp->fh_locked = 1; 322 fhp->fh_locked = 1;
323} 323}
@@ -333,7 +333,7 @@ fh_unlock(struct svc_fh *fhp)
333 333
334 if (fhp->fh_locked) { 334 if (fhp->fh_locked) {
335 fill_post_wcc(fhp); 335 fill_post_wcc(fhp);
336 up(&fhp->fh_dentry->d_inode->i_sem); 336 mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex);
337 fhp->fh_locked = 0; 337 fhp->fh_locked = 0;
338 } 338 }
339} 339}
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 130d4f588a37..3f4f7142bbe3 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -88,10 +88,12 @@ struct nfsd_readdirargs {
88 88
89struct nfsd_attrstat { 89struct nfsd_attrstat {
90 struct svc_fh fh; 90 struct svc_fh fh;
91 struct kstat stat;
91}; 92};
92 93
93struct nfsd_diropres { 94struct nfsd_diropres {
94 struct svc_fh fh; 95 struct svc_fh fh;
96 struct kstat stat;
95}; 97};
96 98
97struct nfsd_readlinkres { 99struct nfsd_readlinkres {
@@ -101,6 +103,7 @@ struct nfsd_readlinkres {
101struct nfsd_readres { 103struct nfsd_readres {
102 struct svc_fh fh; 104 struct svc_fh fh;
103 unsigned long count; 105 unsigned long count;
106 struct kstat stat;
104}; 107};
105 108
106struct nfsd_readdirres { 109struct nfsd_readdirres {
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 3c2a71b43bac..a4322741f8b9 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -126,6 +126,7 @@ struct nfsd3_setaclargs {
126struct nfsd3_attrstat { 126struct nfsd3_attrstat {
127 __u32 status; 127 __u32 status;
128 struct svc_fh fh; 128 struct svc_fh fh;
129 struct kstat stat;
129}; 130};
130 131
131/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ 132/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 343083fec258..d52999c43336 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -79,13 +79,23 @@
79/* 79/*
80 * Global page accounting. One instance per CPU. Only unsigned longs are 80 * Global page accounting. One instance per CPU. Only unsigned longs are
81 * allowed. 81 * allowed.
82 *
83 * - Fields can be modified with xxx_page_state and xxx_page_state_zone at
84 * any time safely (which protects the instance from modification by
85 * interrupt.
86 * - The __xxx_page_state variants can be used safely when interrupts are
87 * disabled.
88 * - The __xxx_page_state variants can be used if the field is only
89 * modified from process context, or only modified from interrupt context.
90 * In this case, the field should be commented here.
82 */ 91 */
83struct page_state { 92struct page_state {
84 unsigned long nr_dirty; /* Dirty writeable pages */ 93 unsigned long nr_dirty; /* Dirty writeable pages */
85 unsigned long nr_writeback; /* Pages under writeback */ 94 unsigned long nr_writeback; /* Pages under writeback */
86 unsigned long nr_unstable; /* NFS unstable pages */ 95 unsigned long nr_unstable; /* NFS unstable pages */
87 unsigned long nr_page_table_pages;/* Pages used for pagetables */ 96 unsigned long nr_page_table_pages;/* Pages used for pagetables */
88 unsigned long nr_mapped; /* mapped into pagetables */ 97 unsigned long nr_mapped; /* mapped into pagetables.
98 * only modified from process context */
89 unsigned long nr_slab; /* In slab */ 99 unsigned long nr_slab; /* In slab */
90#define GET_PAGE_STATE_LAST nr_slab 100#define GET_PAGE_STATE_LAST nr_slab
91 101
@@ -97,32 +107,40 @@ struct page_state {
97 unsigned long pgpgout; /* Disk writes */ 107 unsigned long pgpgout; /* Disk writes */
98 unsigned long pswpin; /* swap reads */ 108 unsigned long pswpin; /* swap reads */
99 unsigned long pswpout; /* swap writes */ 109 unsigned long pswpout; /* swap writes */
100 unsigned long pgalloc_high; /* page allocations */
101 110
111 unsigned long pgalloc_high; /* page allocations */
102 unsigned long pgalloc_normal; 112 unsigned long pgalloc_normal;
113 unsigned long pgalloc_dma32;
103 unsigned long pgalloc_dma; 114 unsigned long pgalloc_dma;
115
104 unsigned long pgfree; /* page freeings */ 116 unsigned long pgfree; /* page freeings */
105 unsigned long pgactivate; /* pages moved inactive->active */ 117 unsigned long pgactivate; /* pages moved inactive->active */
106 unsigned long pgdeactivate; /* pages moved active->inactive */ 118 unsigned long pgdeactivate; /* pages moved active->inactive */
107 119
108 unsigned long pgfault; /* faults (major+minor) */ 120 unsigned long pgfault; /* faults (major+minor) */
109 unsigned long pgmajfault; /* faults (major only) */ 121 unsigned long pgmajfault; /* faults (major only) */
122
110 unsigned long pgrefill_high; /* inspected in refill_inactive_zone */ 123 unsigned long pgrefill_high; /* inspected in refill_inactive_zone */
111 unsigned long pgrefill_normal; 124 unsigned long pgrefill_normal;
125 unsigned long pgrefill_dma32;
112 unsigned long pgrefill_dma; 126 unsigned long pgrefill_dma;
113 127
114 unsigned long pgsteal_high; /* total highmem pages reclaimed */ 128 unsigned long pgsteal_high; /* total highmem pages reclaimed */
115 unsigned long pgsteal_normal; 129 unsigned long pgsteal_normal;
130 unsigned long pgsteal_dma32;
116 unsigned long pgsteal_dma; 131 unsigned long pgsteal_dma;
132
117 unsigned long pgscan_kswapd_high;/* total highmem pages scanned */ 133 unsigned long pgscan_kswapd_high;/* total highmem pages scanned */
118 unsigned long pgscan_kswapd_normal; 134 unsigned long pgscan_kswapd_normal;
119 135 unsigned long pgscan_kswapd_dma32;
120 unsigned long pgscan_kswapd_dma; 136 unsigned long pgscan_kswapd_dma;
137
121 unsigned long pgscan_direct_high;/* total highmem pages scanned */ 138 unsigned long pgscan_direct_high;/* total highmem pages scanned */
122 unsigned long pgscan_direct_normal; 139 unsigned long pgscan_direct_normal;
140 unsigned long pgscan_direct_dma32;
123 unsigned long pgscan_direct_dma; 141 unsigned long pgscan_direct_dma;
124 unsigned long pginodesteal; /* pages reclaimed via inode freeing */
125 142
143 unsigned long pginodesteal; /* pages reclaimed via inode freeing */
126 unsigned long slabs_scanned; /* slab objects scanned */ 144 unsigned long slabs_scanned; /* slab objects scanned */
127 unsigned long kswapd_steal; /* pages reclaimed by kswapd */ 145 unsigned long kswapd_steal; /* pages reclaimed by kswapd */
128 unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */ 146 unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */
@@ -136,31 +154,54 @@ struct page_state {
136extern void get_page_state(struct page_state *ret); 154extern void get_page_state(struct page_state *ret);
137extern void get_page_state_node(struct page_state *ret, int node); 155extern void get_page_state_node(struct page_state *ret, int node);
138extern void get_full_page_state(struct page_state *ret); 156extern void get_full_page_state(struct page_state *ret);
139extern unsigned long __read_page_state(unsigned long offset); 157extern unsigned long read_page_state_offset(unsigned long offset);
140extern void __mod_page_state(unsigned long offset, unsigned long delta); 158extern void mod_page_state_offset(unsigned long offset, unsigned long delta);
159extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
141 160
142#define read_page_state(member) \ 161#define read_page_state(member) \
143 __read_page_state(offsetof(struct page_state, member)) 162 read_page_state_offset(offsetof(struct page_state, member))
144 163
145#define mod_page_state(member, delta) \ 164#define mod_page_state(member, delta) \
146 __mod_page_state(offsetof(struct page_state, member), (delta)) 165 mod_page_state_offset(offsetof(struct page_state, member), (delta))
147 166
148#define inc_page_state(member) mod_page_state(member, 1UL) 167#define __mod_page_state(member, delta) \
149#define dec_page_state(member) mod_page_state(member, 0UL - 1) 168 __mod_page_state_offset(offsetof(struct page_state, member), (delta))
150#define add_page_state(member,delta) mod_page_state(member, (delta)) 169
151#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta)) 170#define inc_page_state(member) mod_page_state(member, 1UL)
152 171#define dec_page_state(member) mod_page_state(member, 0UL - 1)
153#define mod_page_state_zone(zone, member, delta) \ 172#define add_page_state(member,delta) mod_page_state(member, (delta))
154 do { \ 173#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
155 unsigned offset; \ 174
156 if (is_highmem(zone)) \ 175#define __inc_page_state(member) __mod_page_state(member, 1UL)
157 offset = offsetof(struct page_state, member##_high); \ 176#define __dec_page_state(member) __mod_page_state(member, 0UL - 1)
158 else if (is_normal(zone)) \ 177#define __add_page_state(member,delta) __mod_page_state(member, (delta))
159 offset = offsetof(struct page_state, member##_normal); \ 178#define __sub_page_state(member,delta) __mod_page_state(member, 0UL - (delta))
160 else \ 179
161 offset = offsetof(struct page_state, member##_dma); \ 180#define page_state(member) (*__page_state(offsetof(struct page_state, member)))
162 __mod_page_state(offset, (delta)); \ 181
163 } while (0) 182#define state_zone_offset(zone, member) \
183({ \
184 unsigned offset; \
185 if (is_highmem(zone)) \
186 offset = offsetof(struct page_state, member##_high); \
187 else if (is_normal(zone)) \
188 offset = offsetof(struct page_state, member##_normal); \
189 else if (is_dma32(zone)) \
190 offset = offsetof(struct page_state, member##_dma32); \
191 else \
192 offset = offsetof(struct page_state, member##_dma); \
193 offset; \
194})
195
196#define __mod_page_state_zone(zone, member, delta) \
197 do { \
198 __mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
199 } while (0)
200
201#define mod_page_state_zone(zone, member, delta) \
202 do { \
203 mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
204 } while (0)
164 205
165/* 206/*
166 * Manipulation of page state flags 207 * Manipulation of page state flags
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index def32c5715be..8eb7fa76c1d0 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -5,6 +5,9 @@
5 * pages. A pagevec is a multipage container which is used for that. 5 * pages. A pagevec is a multipage container which is used for that.
6 */ 6 */
7 7
8#ifndef _LINUX_PAGEVEC_H
9#define _LINUX_PAGEVEC_H
10
8/* 14 pointers + two long's align the pagevec structure to a power of two */ 11/* 14 pointers + two long's align the pagevec structure to a power of two */
9#define PAGEVEC_SIZE 14 12#define PAGEVEC_SIZE 14
10 13
@@ -83,3 +86,5 @@ static inline void pagevec_lru_add(struct pagevec *pvec)
83 if (pagevec_count(pvec)) 86 if (pagevec_count(pvec))
84 __pagevec_lru_add(pvec); 87 __pagevec_lru_add(pvec);
85} 88}
89
90#endif /* _LINUX_PAGEVEC_H */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index d2a4d9e1e6d1..f67f838a3a1f 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -236,7 +236,8 @@ struct pardevice {
236 236
237/* IEEE1284 information */ 237/* IEEE1284 information */
238 238
239/* IEEE1284 phases */ 239/* IEEE1284 phases. These are exposed to userland through ppdev IOCTL
240 * PP[GS]ETPHASE, so do not change existing values. */
240enum ieee1284_phase { 241enum ieee1284_phase {
241 IEEE1284_PH_FWD_DATA, 242 IEEE1284_PH_FWD_DATA,
242 IEEE1284_PH_FWD_IDLE, 243 IEEE1284_PH_FWD_IDLE,
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index c6f762470879..1cc0f6b1a49a 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -79,13 +79,13 @@ static __inline__ unsigned char parport_pc_read_data(struct parport *p)
79} 79}
80 80
81#ifdef DEBUG_PARPORT 81#ifdef DEBUG_PARPORT
82extern __inline__ void dump_parport_state (char *str, struct parport *p) 82static inline void dump_parport_state (char *str, struct parport *p)
83{ 83{
84 /* here's hoping that reading these ports won't side-effect anything underneath */ 84 /* here's hoping that reading these ports won't side-effect anything underneath */
85 unsigned char ecr = inb (ECONTROL (p)); 85 unsigned char ecr = inb (ECONTROL (p));
86 unsigned char dcr = inb (CONTROL (p)); 86 unsigned char dcr = inb (CONTROL (p));
87 unsigned char dsr = inb (STATUS (p)); 87 unsigned char dsr = inb (STATUS (p));
88 static char *ecr_modes[] = {"SPP", "PS2", "PPFIFO", "ECP", "xXx", "yYy", "TST", "CFG"}; 88 static const char *const ecr_modes[] = {"SPP", "PS2", "PPFIFO", "ECP", "xXx", "yYy", "TST", "CFG"};
89 const struct parport_pc_private *priv = p->physport->private_data; 89 const struct parport_pc_private *priv = p->physport->private_data;
90 int i; 90 int i;
91 91
diff --git a/include/linux/pci.h b/include/linux/pci.h
index de690ca73d58..0a44072383ec 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -78,6 +78,23 @@ typedef int __bitwise pci_power_t;
78#define PCI_UNKNOWN ((pci_power_t __force) 5) 78#define PCI_UNKNOWN ((pci_power_t __force) 5)
79#define PCI_POWER_ERROR ((pci_power_t __force) -1) 79#define PCI_POWER_ERROR ((pci_power_t __force) -1)
80 80
81/** The pci_channel state describes connectivity between the CPU and
82 * the pci device. If some PCI bus between here and the pci device
83 * has crashed or locked up, this info is reflected here.
84 */
85typedef unsigned int __bitwise pci_channel_state_t;
86
87enum pci_channel_state {
88 /* I/O channel is in normal state */
89 pci_channel_io_normal = (__force pci_channel_state_t) 1,
90
91 /* I/O to channel is blocked */
92 pci_channel_io_frozen = (__force pci_channel_state_t) 2,
93
94 /* PCI card is dead */
95 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
96};
97
81/* 98/*
82 * The pci_dev structure is used to describe PCI devices. 99 * The pci_dev structure is used to describe PCI devices.
83 */ 100 */
@@ -98,6 +115,7 @@ struct pci_dev {
98 unsigned int class; /* 3 bytes: (base,sub,prog-if) */ 115 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
99 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 116 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
100 u8 rom_base_reg; /* which config register controls the ROM */ 117 u8 rom_base_reg; /* which config register controls the ROM */
118 u8 pin; /* which interrupt pin this device uses */
101 119
102 struct pci_driver *driver; /* which driver has allocated this device */ 120 struct pci_driver *driver; /* which driver has allocated this device */
103 u64 dma_mask; /* Mask of the bits of bus address this 121 u64 dma_mask; /* Mask of the bits of bus address this
@@ -110,6 +128,7 @@ struct pci_dev {
110 this is D0-D3, D0 being fully functional, 128 this is D0-D3, D0 being fully functional,
111 and D3 being off. */ 129 and D3 being off. */
112 130
131 pci_channel_state_t error_state; /* current connectivity state */
113 struct device dev; /* Generic device interface */ 132 struct device dev; /* Generic device interface */
114 133
115 /* device is compatible with these IDs */ 134 /* device is compatible with these IDs */
@@ -232,6 +251,54 @@ struct pci_dynids {
232 unsigned int use_driver_data:1; /* pci_driver->driver_data is used */ 251 unsigned int use_driver_data:1; /* pci_driver->driver_data is used */
233}; 252};
234 253
254/* ---------------------------------------------------------------- */
255/** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
256 * a set fof callbacks in struct pci_error_handlers, then that device driver
257 * will be notified of PCI bus errors, and will be driven to recovery
258 * when an error occurs.
259 */
260
261typedef unsigned int __bitwise pci_ers_result_t;
262
263enum pci_ers_result {
264 /* no result/none/not supported in device driver */
265 PCI_ERS_RESULT_NONE = (__force pci_ers_result_t) 1,
266
267 /* Device driver can recover without slot reset */
268 PCI_ERS_RESULT_CAN_RECOVER = (__force pci_ers_result_t) 2,
269
270 /* Device driver wants slot to be reset. */
271 PCI_ERS_RESULT_NEED_RESET = (__force pci_ers_result_t) 3,
272
273 /* Device has completely failed, is unrecoverable */
274 PCI_ERS_RESULT_DISCONNECT = (__force pci_ers_result_t) 4,
275
276 /* Device driver is fully recovered and operational */
277 PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5,
278};
279
280/* PCI bus error event callbacks */
281struct pci_error_handlers
282{
283 /* PCI bus error detected on this device */
284 pci_ers_result_t (*error_detected)(struct pci_dev *dev,
285 enum pci_channel_state error);
286
287 /* MMIO has been re-enabled, but not DMA */
288 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
289
290 /* PCI Express link has been reset */
291 pci_ers_result_t (*link_reset)(struct pci_dev *dev);
292
293 /* PCI slot has been reset */
294 pci_ers_result_t (*slot_reset)(struct pci_dev *dev);
295
296 /* Device driver may resume normal operations */
297 void (*resume)(struct pci_dev *dev);
298};
299
300/* ---------------------------------------------------------------- */
301
235struct module; 302struct module;
236struct pci_driver { 303struct pci_driver {
237 struct list_head node; 304 struct list_head node;
@@ -244,6 +311,7 @@ struct pci_driver {
244 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ 311 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
245 void (*shutdown) (struct pci_dev *dev); 312 void (*shutdown) (struct pci_dev *dev);
246 313
314 struct pci_error_handlers *err_handler;
247 struct device_driver driver; 315 struct device_driver driver;
248 struct pci_dynids dynids; 316 struct pci_dynids dynids;
249}; 317};
@@ -448,6 +516,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
448 516
449void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 517void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
450 void *userdata); 518 void *userdata);
519int pci_cfg_space_size(struct pci_dev *dev);
451 520
452/* kmem_cache style wrapper around pci_alloc_consistent() */ 521/* kmem_cache style wrapper around pci_alloc_consistent() */
453 522
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 4db67b3b05cc..5403257ae3e7 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -15,6 +15,7 @@
15#define PCI_CLASS_STORAGE_FLOPPY 0x0102 15#define PCI_CLASS_STORAGE_FLOPPY 0x0102
16#define PCI_CLASS_STORAGE_IPI 0x0103 16#define PCI_CLASS_STORAGE_IPI 0x0103
17#define PCI_CLASS_STORAGE_RAID 0x0104 17#define PCI_CLASS_STORAGE_RAID 0x0104
18#define PCI_CLASS_STORAGE_SAS 0x0107
18#define PCI_CLASS_STORAGE_OTHER 0x0180 19#define PCI_CLASS_STORAGE_OTHER 0x0180
19 20
20#define PCI_BASE_CLASS_NETWORK 0x02 21#define PCI_BASE_CLASS_NETWORK 0x02
@@ -180,6 +181,7 @@
180#define PCI_DEVICE_ID_LSI_FC929X 0x0626 181#define PCI_DEVICE_ID_LSI_FC929X 0x0626
181#define PCI_DEVICE_ID_LSI_FC939X 0x0642 182#define PCI_DEVICE_ID_LSI_FC939X 0x0642
182#define PCI_DEVICE_ID_LSI_FC949X 0x0640 183#define PCI_DEVICE_ID_LSI_FC949X 0x0640
184#define PCI_DEVICE_ID_LSI_FC949ES 0x0646
183#define PCI_DEVICE_ID_LSI_FC919X 0x0628 185#define PCI_DEVICE_ID_LSI_FC919X 0x0628
184#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701 186#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701
185#define PCI_DEVICE_ID_LSI_61C102 0x0901 187#define PCI_DEVICE_ID_LSI_61C102 0x0901
@@ -376,6 +378,11 @@
376#define PCI_DEVICE_ID_NS_87560_USB 0x0012 378#define PCI_DEVICE_ID_NS_87560_USB 0x0012
377#define PCI_DEVICE_ID_NS_83815 0x0020 379#define PCI_DEVICE_ID_NS_83815 0x0020
378#define PCI_DEVICE_ID_NS_83820 0x0022 380#define PCI_DEVICE_ID_NS_83820 0x0022
381#define PCI_DEVICE_ID_NS_CS5535_ISA 0x002b
382#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
383#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
384#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
385#define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030
379#define PCI_DEVICE_ID_NS_SATURN 0x0035 386#define PCI_DEVICE_ID_NS_SATURN 0x0035
380#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 387#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500
381#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 388#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501
@@ -389,6 +396,13 @@
389#define PCI_DEVICE_ID_NS_87410 0xd001 396#define PCI_DEVICE_ID_NS_87410 0xd001
390#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d 397#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
391 398
399#define PCI_DEVICE_ID_NS_CS5535_HOST_BRIDGE 0x0028
400#define PCI_DEVICE_ID_NS_CS5535_ISA_BRIDGE 0x002b
401#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
402#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
403#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
404#define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030
405
392#define PCI_VENDOR_ID_TSENG 0x100c 406#define PCI_VENDOR_ID_TSENG 0x100c
393#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 407#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202
394#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 408#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205
@@ -488,9 +502,20 @@
488#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d 502#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d
489#define PCI_DEVICE_ID_AMD_8151_0 0x7454 503#define PCI_DEVICE_ID_AMD_8151_0 0x7454
490#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 504#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450
505#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
506#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
507#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093
508#define PCI_DEVICE_ID_AMD_CS5536_OHC 0x2094
509#define PCI_DEVICE_ID_AMD_CS5536_EHC 0x2095
510#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096
511#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097
512#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
491 513
492#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 514#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
493 515
516#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081
517#define PCI_DEVICE_ID_AMD_LX_AES 0x2082
518
494#define PCI_VENDOR_ID_TRIDENT 0x1023 519#define PCI_VENDOR_ID_TRIDENT 0x1023
495#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 520#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
496#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 521#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001
@@ -971,6 +996,7 @@
971#define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a 996#define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a
972#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C 997#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C
973#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D 998#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D
999#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034
974#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 1000#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035
975#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 1001#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036
976#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037 1002#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037
@@ -1025,6 +1051,11 @@
1025#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6 1051#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6
1026#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea 1052#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea
1027#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee 1053#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee
1054#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0
1055#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1 0x00f1
1056#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2
1057#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3
1058#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9
1028#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 1059#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
1029#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 1060#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
1030#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 1061#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103
@@ -1567,6 +1598,23 @@
1567#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009 1598#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009
1568#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A 1599#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A
1569#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B 1600#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B
1601#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ 0x000C
1602#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_PTM 0x000D
1603#define PCI_SUBDEVICE_ID_CONNECT_TECH_NT960PCI 0x0100
1604#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2 0x0201
1605#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4 0x0202
1606#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232 0x0300
1607#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232 0x0301
1608#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232 0x0302
1609#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1 0x0310
1610#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2 0x0311
1611#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4 0x0312
1612#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2 0x0320
1613#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4 0x0321
1614#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8 0x0322
1615#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485 0x0330
1616#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 0x0331
1617#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 0x0332
1570 1618
1571 1619
1572#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 1620#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2
@@ -2105,6 +2153,9 @@
2105#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 2153#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004
2106#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 2154#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
2107 2155
2156#define PCI_VENDOR_ID_SCALEMP 0x8686
2157#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
2158
2108#define PCI_VENDOR_ID_COMPUTONE 0x8e0e 2159#define PCI_VENDOR_ID_COMPUTONE 0x8e0e
2109#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 2160#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291
2110#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 2161#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index e2a089b051ed..d27a78b71297 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -196,6 +196,7 @@
196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ 196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
199#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */
199#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 200#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
200#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 201#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
201#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 202#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index fb8d2d24e4bb..cb9039a21f2a 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -19,7 +19,6 @@
19 19
20struct percpu_data { 20struct percpu_data {
21 void *ptrs[NR_CPUS]; 21 void *ptrs[NR_CPUS];
22 void *blkp;
23}; 22};
24 23
25/* 24/*
@@ -33,14 +32,14 @@ struct percpu_data {
33 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 32 (__typeof__(ptr))__p->ptrs[(cpu)]; \
34}) 33})
35 34
36extern void *__alloc_percpu(size_t size, size_t align); 35extern void *__alloc_percpu(size_t size);
37extern void free_percpu(const void *); 36extern void free_percpu(const void *);
38 37
39#else /* CONFIG_SMP */ 38#else /* CONFIG_SMP */
40 39
41#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 40#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
42 41
43static inline void *__alloc_percpu(size_t size, size_t align) 42static inline void *__alloc_percpu(size_t size)
44{ 43{
45 void *ret = kmalloc(size, GFP_KERNEL); 44 void *ret = kmalloc(size, GFP_KERNEL);
46 if (ret) 45 if (ret)
@@ -55,7 +54,6 @@ static inline void free_percpu(const void *ptr)
55#endif /* CONFIG_SMP */ 54#endif /* CONFIG_SMP */
56 55
57/* Simple wrapper for the common case: zeros memory. */ 56/* Simple wrapper for the common case: zeros memory. */
58#define alloc_percpu(type) \ 57#define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type))))
59 ((type *)(__alloc_percpu(sizeof(type), __alignof__(type))))
60 58
61#endif /* __LINUX_PERCPU_H */ 59#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 724066778aff..bac0fb389cf1 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -104,7 +104,7 @@ struct sadb_prop {
104/* followed by: 104/* followed by:
105 struct sadb_comb sadb_combs[(sadb_prop_len + 105 struct sadb_comb sadb_combs[(sadb_prop_len +
106 sizeof(uint64_t) - sizeof(struct sadb_prop)) / 106 sizeof(uint64_t) - sizeof(struct sadb_prop)) /
107 sizeof(strut sadb_comb)]; */ 107 sizeof(struct sadb_comb)]; */
108 108
109struct sadb_comb { 109struct sadb_comb {
110 uint8_t sadb_comb_auth; 110 uint8_t sadb_comb_auth;
@@ -216,6 +216,16 @@ struct sadb_x_nat_t_port {
216} __attribute__((packed)); 216} __attribute__((packed));
217/* sizeof(struct sadb_x_nat_t_port) == 8 */ 217/* sizeof(struct sadb_x_nat_t_port) == 8 */
218 218
219/* Generic LSM security context */
220struct sadb_x_sec_ctx {
221 uint16_t sadb_x_sec_len;
222 uint16_t sadb_x_sec_exttype;
223 uint8_t sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */
224 uint8_t sadb_x_ctx_doi;
225 uint16_t sadb_x_ctx_len;
226} __attribute__((packed));
227/* sizeof(struct sadb_sec_ctx) = 8 */
228
219/* Message types */ 229/* Message types */
220#define SADB_RESERVED 0 230#define SADB_RESERVED 0
221#define SADB_GETSPI 1 231#define SADB_GETSPI 1
@@ -325,7 +335,8 @@ struct sadb_x_nat_t_port {
325#define SADB_X_EXT_NAT_T_SPORT 21 335#define SADB_X_EXT_NAT_T_SPORT 21
326#define SADB_X_EXT_NAT_T_DPORT 22 336#define SADB_X_EXT_NAT_T_DPORT 22
327#define SADB_X_EXT_NAT_T_OA 23 337#define SADB_X_EXT_NAT_T_OA 23
328#define SADB_EXT_MAX 23 338#define SADB_X_EXT_SEC_CTX 24
339#define SADB_EXT_MAX 24
329 340
330/* Identity Extension values */ 341/* Identity Extension values */
331#define SADB_IDENTTYPE_RESERVED 0 342#define SADB_IDENTTYPE_RESERVED 0
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 92a9696fdebe..331521a10a2d 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -53,6 +53,9 @@
53 53
54#define PHY_MAX_ADDR 32 54#define PHY_MAX_ADDR 32
55 55
56/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
57#define PHY_ID_FMT "%x:%02x"
58
56/* The Bus class for PHYs. Devices which provide access to 59/* The Bus class for PHYs. Devices which provide access to
57 * PHYs should register using this structure */ 60 * PHYs should register using this structure */
58struct mii_bus { 61struct mii_bus {
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 1767073df26f..b12e59c75752 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -37,7 +37,7 @@ struct pipe_inode_info {
37 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ 37 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
38#define PIPE_SIZE PAGE_SIZE 38#define PIPE_SIZE PAGE_SIZE
39 39
40#define PIPE_SEM(inode) (&(inode).i_sem) 40#define PIPE_MUTEX(inode) (&(inode).i_mutex)
41#define PIPE_WAIT(inode) (&(inode).i_pipe->wait) 41#define PIPE_WAIT(inode) (&(inode).i_pipe->wait)
42#define PIPE_READERS(inode) ((inode).i_pipe->readers) 42#define PIPE_READERS(inode) ((inode).i_pipe->readers)
43#define PIPE_WRITERS(inode) ((inode).i_pipe->writers) 43#define PIPE_WRITERS(inode) ((inode).i_pipe->writers)
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index e87b233615b3..d10f35338507 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -429,6 +429,7 @@ enum
429 TCA_NETEM_CORR, 429 TCA_NETEM_CORR,
430 TCA_NETEM_DELAY_DIST, 430 TCA_NETEM_DELAY_DIST,
431 TCA_NETEM_REORDER, 431 TCA_NETEM_REORDER,
432 TCA_NETEM_CORRUPT,
432 __TCA_NETEM_MAX, 433 __TCA_NETEM_MAX,
433}; 434};
434 435
@@ -457,6 +458,12 @@ struct tc_netem_reorder
457 __u32 correlation; 458 __u32 correlation;
458}; 459};
459 460
461struct tc_netem_corrupt
462{
463 __u32 probability;
464 __u32 correlation;
465};
466
460#define NETEM_DIST_SCALE 8192 467#define NETEM_DIST_SCALE 8192
461 468
462#endif 469#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 17e336f40b47..782090c68932 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -41,6 +41,7 @@ extern struct platform_device *platform_device_alloc(const char *name, unsigned
41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
42extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size); 42extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size);
43extern int platform_device_add(struct platform_device *pdev); 43extern int platform_device_add(struct platform_device *pdev);
44extern void platform_device_del(struct platform_device *pdev);
44extern void platform_device_put(struct platform_device *pdev); 45extern void platform_device_put(struct platform_device *pdev);
45 46
46struct platform_driver { 47struct platform_driver {
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index 373bd3b9b330..217d3daf7336 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -140,7 +140,7 @@ extern int find_via_pmu(void);
140 140
141extern int pmu_request(struct adb_request *req, 141extern int pmu_request(struct adb_request *req,
142 void (*done)(struct adb_request *), int nbytes, ...); 142 void (*done)(struct adb_request *), int nbytes, ...);
143 143extern int pmu_queue_request(struct adb_request *req);
144extern void pmu_poll(void); 144extern void pmu_poll(void);
145extern void pmu_poll_adb(void); /* For use by xmon */ 145extern void pmu_poll_adb(void); /* For use by xmon */
146extern void pmu_wait_complete(struct adb_request *req); 146extern void pmu_wait_complete(struct adb_request *req);
@@ -160,12 +160,6 @@ extern void pmu_unlock(void);
160extern int pmu_present(void); 160extern int pmu_present(void);
161extern int pmu_get_model(void); 161extern int pmu_get_model(void);
162 162
163extern int pmu_i2c_combined_read(int bus, int addr, int subaddr, u8* data, int len);
164extern int pmu_i2c_stdsub_write(int bus, int addr, int subaddr, u8* data, int len);
165extern int pmu_i2c_simple_read(int bus, int addr, u8* data, int len);
166extern int pmu_i2c_simple_write(int bus, int addr, u8* data, int len);
167
168
169#ifdef CONFIG_PM 163#ifdef CONFIG_PM
170/* 164/*
171 * Stuff for putting the powerbook to sleep and waking it again. 165 * Stuff for putting the powerbook to sleep and waking it again.
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 584d57cb393a..93b0959eb40f 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -162,6 +162,7 @@ struct pnp_card_link {
162 struct pnp_card * card; 162 struct pnp_card * card;
163 struct pnp_card_driver * driver; 163 struct pnp_card_driver * driver;
164 void * driver_data; 164 void * driver_data;
165 pm_message_t pm_state;
165}; 166};
166 167
167static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard) 168static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard)
@@ -294,6 +295,8 @@ struct pnp_driver {
294 unsigned int flags; 295 unsigned int flags;
295 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); 296 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
296 void (*remove) (struct pnp_dev *dev); 297 void (*remove) (struct pnp_dev *dev);
298 int (*suspend) (struct pnp_dev *dev, pm_message_t state);
299 int (*resume) (struct pnp_dev *dev);
297 struct device_driver driver; 300 struct device_driver driver;
298}; 301};
299 302
@@ -306,6 +309,8 @@ struct pnp_card_driver {
306 unsigned int flags; 309 unsigned int flags;
307 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id); 310 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id);
308 void (*remove) (struct pnp_card_link *card); 311 void (*remove) (struct pnp_card_link *card);
312 int (*suspend) (struct pnp_card_link *card, pm_message_t state);
313 int (*resume) (struct pnp_card_link *card);
309 struct pnp_driver link; 314 struct pnp_driver link;
310}; 315};
311 316
@@ -380,6 +385,8 @@ void pnp_init_resource_table(struct pnp_resource_table *table);
380int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode); 385int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode);
381int pnp_auto_config_dev(struct pnp_dev *dev); 386int pnp_auto_config_dev(struct pnp_dev *dev);
382int pnp_validate_config(struct pnp_dev *dev); 387int pnp_validate_config(struct pnp_dev *dev);
388int pnp_start_dev(struct pnp_dev *dev);
389int pnp_stop_dev(struct pnp_dev *dev);
383int pnp_activate_dev(struct pnp_dev *dev); 390int pnp_activate_dev(struct pnp_dev *dev);
384int pnp_disable_dev(struct pnp_dev *dev); 391int pnp_disable_dev(struct pnp_dev *dev);
385void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size); 392void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size);
@@ -423,6 +430,8 @@ static inline void pnp_init_resource_table(struct pnp_resource_table *table) { }
423static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; } 430static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; }
424static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } 431static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
425static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; } 432static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; }
433static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
434static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
426static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 435static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
427static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 436static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
428static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { } 437static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { }
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index f942e2bad8e3..54faf5236da0 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -42,7 +42,7 @@ struct k_itimer {
42 timer_t it_id; /* timer id */ 42 timer_t it_id; /* timer id */
43 int it_overrun; /* overrun on pending signal */ 43 int it_overrun; /* overrun on pending signal */
44 int it_overrun_last; /* overrun on last delivered signal */ 44 int it_overrun_last; /* overrun on last delivered signal */
45 int it_requeue_pending; /* waiting to requeue this timer */ 45 int it_requeue_pending; /* waiting to requeue this timer */
46#define REQUEUE_PENDING 1 46#define REQUEUE_PENDING 1
47 int it_sigev_notify; /* notify word of sigevent struct */ 47 int it_sigev_notify; /* notify word of sigevent struct */
48 int it_sigev_signo; /* signo word of sigevent struct */ 48 int it_sigev_signo; /* signo word of sigevent struct */
@@ -51,10 +51,8 @@ struct k_itimer {
51 struct sigqueue *sigq; /* signal queue entry. */ 51 struct sigqueue *sigq; /* signal queue entry. */
52 union { 52 union {
53 struct { 53 struct {
54 struct timer_list timer; 54 struct hrtimer timer;
55 struct list_head abs_timer_entry; /* clock abs_timer_list */ 55 ktime_t interval;
56 struct timespec wall_to_prev; /* wall_to_monotonic used when set */
57 unsigned long incr; /* interval in jiffies */
58 } real; 56 } real;
59 struct cpu_timer_list cpu; 57 struct cpu_timer_list cpu;
60 struct { 58 struct {
@@ -66,18 +64,14 @@ struct k_itimer {
66 } it; 64 } it;
67}; 65};
68 66
69struct k_clock_abs {
70 struct list_head list;
71 spinlock_t lock;
72};
73struct k_clock { 67struct k_clock {
74 int res; /* in nano seconds */ 68 int res; /* in nanoseconds */
75 int (*clock_getres) (clockid_t which_clock, struct timespec *tp); 69 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
76 struct k_clock_abs *abs_struct; 70 int (*clock_set) (const clockid_t which_clock, struct timespec * tp);
77 int (*clock_set) (clockid_t which_clock, struct timespec * tp); 71 int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
78 int (*clock_get) (clockid_t which_clock, struct timespec * tp);
79 int (*timer_create) (struct k_itimer *timer); 72 int (*timer_create) (struct k_itimer *timer);
80 int (*nsleep) (clockid_t which_clock, int flags, struct timespec *); 73 int (*nsleep) (const clockid_t which_clock, int flags,
74 struct timespec *, struct timespec __user *);
81 int (*timer_set) (struct k_itimer * timr, int flags, 75 int (*timer_set) (struct k_itimer * timr, int flags,
82 struct itimerspec * new_setting, 76 struct itimerspec * new_setting,
83 struct itimerspec * old_setting); 77 struct itimerspec * old_setting);
@@ -87,53 +81,35 @@ struct k_clock {
87 struct itimerspec * cur_setting); 81 struct itimerspec * cur_setting);
88}; 82};
89 83
90void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock); 84void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock);
91 85
92/* Error handlers for timer_create, nanosleep and settime */ 86/* error handlers for timer_create, nanosleep and settime */
93int do_posix_clock_notimer_create(struct k_itimer *timer); 87int do_posix_clock_notimer_create(struct k_itimer *timer);
94int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *); 88int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *,
95int do_posix_clock_nosettime(clockid_t, struct timespec *tp); 89 struct timespec __user *);
90int do_posix_clock_nosettime(const clockid_t, struct timespec *tp);
96 91
97/* function to call to trigger timer event */ 92/* function to call to trigger timer event */
98int posix_timer_event(struct k_itimer *timr, int si_private); 93int posix_timer_event(struct k_itimer *timr, int si_private);
99 94
100struct now_struct { 95int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *ts);
101 unsigned long jiffies; 96int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *ts);
102}; 97int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts);
103 98int posix_cpu_timer_create(struct k_itimer *timer);
104#define posix_get_now(now) (now)->jiffies = jiffies; 99int posix_cpu_nsleep(const clockid_t which_clock, int flags,
105#define posix_time_before(timer, now) \ 100 struct timespec *rqtp, struct timespec __user *rmtp);
106 time_before((timer)->expires, (now)->jiffies) 101int posix_cpu_timer_set(struct k_itimer *timer, int flags,
107 102 struct itimerspec *new, struct itimerspec *old);
108#define posix_bump_timer(timr, now) \ 103int posix_cpu_timer_del(struct k_itimer *timer);
109 do { \ 104void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp);
110 long delta, orun; \ 105
111 delta = now.jiffies - (timr)->it.real.timer.expires; \ 106void posix_cpu_timer_schedule(struct k_itimer *timer);
112 if (delta >= 0) { \ 107
113 orun = 1 + (delta / (timr)->it.real.incr); \ 108void run_posix_cpu_timers(struct task_struct *task);
114 (timr)->it.real.timer.expires += \ 109void posix_cpu_timers_exit(struct task_struct *task);
115 orun * (timr)->it.real.incr; \ 110void posix_cpu_timers_exit_group(struct task_struct *task);
116 (timr)->it_overrun += orun; \ 111
117 } \ 112void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
118 }while (0) 113 cputime_t *newval, cputime_t *oldval);
119
120int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *);
121int posix_cpu_clock_get(clockid_t which_clock, struct timespec *);
122int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp);
123int posix_cpu_timer_create(struct k_itimer *);
124int posix_cpu_nsleep(clockid_t, int, struct timespec *);
125int posix_cpu_timer_set(struct k_itimer *, int,
126 struct itimerspec *, struct itimerspec *);
127int posix_cpu_timer_del(struct k_itimer *);
128void posix_cpu_timer_get(struct k_itimer *, struct itimerspec *);
129
130void posix_cpu_timer_schedule(struct k_itimer *);
131
132void run_posix_cpu_timers(struct task_struct *);
133void posix_cpu_timers_exit(struct task_struct *);
134void posix_cpu_timers_exit_group(struct task_struct *);
135
136void set_process_cpu_timer(struct task_struct *, unsigned int,
137 cputime_t *, cputime_t *);
138 114
139#endif 115#endif
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 74488e49166d..aa6322d45198 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -146,6 +146,11 @@ struct property;
146extern void proc_device_tree_init(void); 146extern void proc_device_tree_init(void);
147extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); 147extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
148extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); 148extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
149extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
150 struct property *prop);
151extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
152 struct property *newprop,
153 struct property *oldprop);
149#endif /* CONFIG_PROC_DEVICETREE */ 154#endif /* CONFIG_PROC_DEVICETREE */
150 155
151extern struct proc_dir_entry *proc_symlink(const char *, 156extern struct proc_dir_entry *proc_symlink(const char *,
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index b2b3dba1298d..9d5cd106b344 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -20,8 +20,6 @@
20#define PTRACE_DETACH 0x11 20#define PTRACE_DETACH 0x11
21 21
22#define PTRACE_SYSCALL 24 22#define PTRACE_SYSCALL 24
23#define PTRACE_SYSEMU 31
24#define PTRACE_SYSEMU_SINGLESTEP 32
25 23
26/* 0x4200-0x4300 are reserved for architecture-independent additions. */ 24/* 0x4200-0x4300 are reserved for architecture-independent additions. */
27#define PTRACE_SETOPTIONS 0x4200 25#define PTRACE_SETOPTIONS 0x4200
@@ -80,6 +78,8 @@
80 78
81 79
82extern long arch_ptrace(struct task_struct *child, long request, long addr, long data); 80extern long arch_ptrace(struct task_struct *child, long request, long addr, long data);
81extern struct task_struct *ptrace_get_task_struct(pid_t pid);
82extern int ptrace_traceme(void);
83extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 83extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
84extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 84extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
85extern int ptrace_attach(struct task_struct *tsk); 85extern int ptrace_attach(struct task_struct *tsk);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 36e5d269612f..c57ff2fcb30a 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -19,6 +19,7 @@
19#ifndef _LINUX_RADIX_TREE_H 19#ifndef _LINUX_RADIX_TREE_H
20#define _LINUX_RADIX_TREE_H 20#define _LINUX_RADIX_TREE_H
21 21
22#include <linux/sched.h>
22#include <linux/preempt.h> 23#include <linux/preempt.h>
23#include <linux/types.h> 24#include <linux/types.h>
24 25
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 13e7c4b62367..b6e0bcad84e1 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -71,8 +71,8 @@
71 */ 71 */
72#define MD_PATCHLEVEL_VERSION 3 72#define MD_PATCHLEVEL_VERSION 3
73 73
74extern int register_md_personality (int p_num, mdk_personality_t *p); 74extern int register_md_personality (struct mdk_personality *p);
75extern int unregister_md_personality (int p_num); 75extern int unregister_md_personality (struct mdk_personality *p);
76extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev), 76extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
77 mddev_t *mddev, const char *name); 77 mddev_t *mddev, const char *name);
78extern void md_unregister_thread (mdk_thread_t *thread); 78extern void md_unregister_thread (mdk_thread_t *thread);
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 46629a275ba9..617b9506c760 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -18,62 +18,19 @@
18/* and dm-bio-list.h is not under include/linux because.... ??? */ 18/* and dm-bio-list.h is not under include/linux because.... ??? */
19#include "../../../drivers/md/dm-bio-list.h" 19#include "../../../drivers/md/dm-bio-list.h"
20 20
21#define MD_RESERVED 0UL
22#define LINEAR 1UL
23#define RAID0 2UL
24#define RAID1 3UL
25#define RAID5 4UL
26#define TRANSLUCENT 5UL
27#define HSM 6UL
28#define MULTIPATH 7UL
29#define RAID6 8UL
30#define RAID10 9UL
31#define FAULTY 10UL
32#define MAX_PERSONALITY 11UL
33
34#define LEVEL_MULTIPATH (-4) 21#define LEVEL_MULTIPATH (-4)
35#define LEVEL_LINEAR (-1) 22#define LEVEL_LINEAR (-1)
36#define LEVEL_FAULTY (-5) 23#define LEVEL_FAULTY (-5)
37 24
25/* we need a value for 'no level specified' and 0
26 * means 'raid0', so we need something else. This is
27 * for internal use only
28 */
29#define LEVEL_NONE (-1000000)
30
38#define MaxSector (~(sector_t)0) 31#define MaxSector (~(sector_t)0)
39#define MD_THREAD_NAME_MAX 14 32#define MD_THREAD_NAME_MAX 14
40 33
41static inline int pers_to_level (int pers)
42{
43 switch (pers) {
44 case FAULTY: return LEVEL_FAULTY;
45 case MULTIPATH: return LEVEL_MULTIPATH;
46 case HSM: return -3;
47 case TRANSLUCENT: return -2;
48 case LINEAR: return LEVEL_LINEAR;
49 case RAID0: return 0;
50 case RAID1: return 1;
51 case RAID5: return 5;
52 case RAID6: return 6;
53 case RAID10: return 10;
54 }
55 BUG();
56 return MD_RESERVED;
57}
58
59static inline int level_to_pers (int level)
60{
61 switch (level) {
62 case LEVEL_FAULTY: return FAULTY;
63 case LEVEL_MULTIPATH: return MULTIPATH;
64 case -3: return HSM;
65 case -2: return TRANSLUCENT;
66 case LEVEL_LINEAR: return LINEAR;
67 case 0: return RAID0;
68 case 1: return RAID1;
69 case 4:
70 case 5: return RAID5;
71 case 6: return RAID6;
72 case 10: return RAID10;
73 }
74 return MD_RESERVED;
75}
76
77typedef struct mddev_s mddev_t; 34typedef struct mddev_s mddev_t;
78typedef struct mdk_rdev_s mdk_rdev_t; 35typedef struct mdk_rdev_s mdk_rdev_t;
79 36
@@ -138,14 +95,16 @@ struct mdk_rdev_s
138 atomic_t read_errors; /* number of consecutive read errors that 95 atomic_t read_errors; /* number of consecutive read errors that
139 * we have tried to ignore. 96 * we have tried to ignore.
140 */ 97 */
98 atomic_t corrected_errors; /* number of corrected read errors,
99 * for reporting to userspace and storing
100 * in superblock.
101 */
141}; 102};
142 103
143typedef struct mdk_personality_s mdk_personality_t;
144
145struct mddev_s 104struct mddev_s
146{ 105{
147 void *private; 106 void *private;
148 mdk_personality_t *pers; 107 struct mdk_personality *pers;
149 dev_t unit; 108 dev_t unit;
150 int md_minor; 109 int md_minor;
151 struct list_head disks; 110 struct list_head disks;
@@ -164,6 +123,7 @@ struct mddev_s
164 int chunk_size; 123 int chunk_size;
165 time_t ctime, utime; 124 time_t ctime, utime;
166 int level, layout; 125 int level, layout;
126 char clevel[16];
167 int raid_disks; 127 int raid_disks;
168 int max_disks; 128 int max_disks;
169 sector_t size; /* used size of component devices */ 129 sector_t size; /* used size of component devices */
@@ -183,6 +143,11 @@ struct mddev_s
183 sector_t resync_mismatches; /* count of sectors where 143 sector_t resync_mismatches; /* count of sectors where
184 * parity/replica mismatch found 144 * parity/replica mismatch found
185 */ 145 */
146 /* if zero, use the system-wide default */
147 int sync_speed_min;
148 int sync_speed_max;
149
150 int ok_start_degraded;
186 /* recovery/resync flags 151 /* recovery/resync flags
187 * NEEDED: we might need to start a resync/recover 152 * NEEDED: we might need to start a resync/recover
188 * RUNNING: a thread is running, or about to be started 153 * RUNNING: a thread is running, or about to be started
@@ -265,9 +230,11 @@ static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sect
265 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io); 230 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
266} 231}
267 232
268struct mdk_personality_s 233struct mdk_personality
269{ 234{
270 char *name; 235 char *name;
236 int level;
237 struct list_head list;
271 struct module *owner; 238 struct module *owner;
272 int (*make_request)(request_queue_t *q, struct bio *bio); 239 int (*make_request)(request_queue_t *q, struct bio *bio);
273 int (*run)(mddev_t *mddev); 240 int (*run)(mddev_t *mddev);
@@ -305,8 +272,6 @@ static inline char * mdname (mddev_t * mddev)
305 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; 272 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
306} 273}
307 274
308extern mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr);
309
310/* 275/*
311 * iterates through some rdev ringlist. It's safe to remove the 276 * iterates through some rdev ringlist. It's safe to remove the
312 * current 'rdev'. Dont touch 'tmp' though. 277 * current 'rdev'. Dont touch 'tmp' though.
@@ -366,5 +331,10 @@ do { \
366 __wait_event_lock_irq(wq, condition, lock, cmd); \ 331 __wait_event_lock_irq(wq, condition, lock, cmd); \
367} while (0) 332} while (0)
368 333
334static inline void safe_put_page(struct page *p)
335{
336 if (p) put_page(p);
337}
338
369#endif 339#endif
370 340
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 292b98f2b408..9d5494aaac0f 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -45,6 +45,8 @@ struct r1_private_data_s {
45 45
46 spinlock_t resync_lock; 46 spinlock_t resync_lock;
47 int nr_pending; 47 int nr_pending;
48 int nr_waiting;
49 int nr_queued;
48 int barrier; 50 int barrier;
49 sector_t next_resync; 51 sector_t next_resync;
50 int fullsync; /* set to 1 if a full sync is needed, 52 int fullsync; /* set to 1 if a full sync is needed,
@@ -52,11 +54,12 @@ struct r1_private_data_s {
52 * Cleared when a sync completes. 54 * Cleared when a sync completes.
53 */ 55 */
54 56
55 wait_queue_head_t wait_idle; 57 wait_queue_head_t wait_barrier;
56 wait_queue_head_t wait_resume;
57 58
58 struct pool_info *poolinfo; 59 struct pool_info *poolinfo;
59 60
61 struct page *tmppage;
62
60 mempool_t *r1bio_pool; 63 mempool_t *r1bio_pool;
61 mempool_t *r1buf_pool; 64 mempool_t *r1buf_pool;
62}; 65};
@@ -106,6 +109,13 @@ struct r1bio_s {
106 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/ 109 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/
107}; 110};
108 111
112/* when we get a read error on a read-only array, we redirect to another
113 * device without failing the first device, or trying to over-write to
114 * correct the read error. To keep track of bad blocks on a per-bio
115 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
116 */
117#define IO_BLOCKED ((struct bio*)1)
118
109/* bits for r1bio.state */ 119/* bits for r1bio.state */
110#define R1BIO_Uptodate 0 120#define R1BIO_Uptodate 0
111#define R1BIO_IsSync 1 121#define R1BIO_IsSync 1
diff --git a/include/linux/raid/raid10.h b/include/linux/raid/raid10.h
index 60708789c8f9..b1103298a8c2 100644
--- a/include/linux/raid/raid10.h
+++ b/include/linux/raid/raid10.h
@@ -35,18 +35,26 @@ struct r10_private_data_s {
35 sector_t chunk_mask; 35 sector_t chunk_mask;
36 36
37 struct list_head retry_list; 37 struct list_head retry_list;
38 /* for use when syncing mirrors: */ 38 /* queue pending writes and submit them on unplug */
39 struct bio_list pending_bio_list;
40
39 41
40 spinlock_t resync_lock; 42 spinlock_t resync_lock;
41 int nr_pending; 43 int nr_pending;
44 int nr_waiting;
45 int nr_queued;
42 int barrier; 46 int barrier;
43 sector_t next_resync; 47 sector_t next_resync;
48 int fullsync; /* set to 1 if a full sync is needed,
49 * (fresh device added).
50 * Cleared when a sync completes.
51 */
44 52
45 wait_queue_head_t wait_idle; 53 wait_queue_head_t wait_barrier;
46 wait_queue_head_t wait_resume;
47 54
48 mempool_t *r10bio_pool; 55 mempool_t *r10bio_pool;
49 mempool_t *r10buf_pool; 56 mempool_t *r10buf_pool;
57 struct page *tmppage;
50}; 58};
51 59
52typedef struct r10_private_data_s conf_t; 60typedef struct r10_private_data_s conf_t;
@@ -96,8 +104,16 @@ struct r10bio_s {
96 } devs[0]; 104 } devs[0];
97}; 105};
98 106
107/* when we get a read error on a read-only array, we redirect to another
108 * device without failing the first device, or trying to over-write to
109 * correct the read error. To keep track of bad blocks on a per-bio
110 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
111 */
112#define IO_BLOCKED ((struct bio*)1)
113
99/* bits for r10bio.state */ 114/* bits for r10bio.state */
100#define R10BIO_Uptodate 0 115#define R10BIO_Uptodate 0
101#define R10BIO_IsSync 1 116#define R10BIO_IsSync 1
102#define R10BIO_IsRecover 2 117#define R10BIO_IsRecover 2
118#define R10BIO_Degraded 3
103#endif 119#endif
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index f025ba6fb14c..394da8207b34 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -126,7 +126,7 @@
126 */ 126 */
127 127
128struct stripe_head { 128struct stripe_head {
129 struct stripe_head *hash_next, **hash_pprev; /* hash pointers */ 129 struct hlist_node hash;
130 struct list_head lru; /* inactive_list or handle_list */ 130 struct list_head lru; /* inactive_list or handle_list */
131 struct raid5_private_data *raid_conf; 131 struct raid5_private_data *raid_conf;
132 sector_t sector; /* sector of this row */ 132 sector_t sector; /* sector of this row */
@@ -152,7 +152,6 @@ struct stripe_head {
152#define R5_Insync 3 /* rdev && rdev->in_sync at start */ 152#define R5_Insync 3 /* rdev && rdev->in_sync at start */
153#define R5_Wantread 4 /* want to schedule a read */ 153#define R5_Wantread 4 /* want to schedule a read */
154#define R5_Wantwrite 5 154#define R5_Wantwrite 5
155#define R5_Syncio 6 /* this io need to be accounted as resync io */
156#define R5_Overlap 7 /* There is a pending overlapping request on this block */ 155#define R5_Overlap 7 /* There is a pending overlapping request on this block */
157#define R5_ReadError 8 /* seen a read error here recently */ 156#define R5_ReadError 8 /* seen a read error here recently */
158#define R5_ReWrite 9 /* have tried to over-write the readerror */ 157#define R5_ReWrite 9 /* have tried to over-write the readerror */
@@ -205,7 +204,7 @@ struct disk_info {
205}; 204};
206 205
207struct raid5_private_data { 206struct raid5_private_data {
208 struct stripe_head **stripe_hashtbl; 207 struct hlist_head *stripe_hashtbl;
209 mddev_t *mddev; 208 mddev_t *mddev;
210 struct disk_info *spare; 209 struct disk_info *spare;
211 int chunk_size, level, algorithm; 210 int chunk_size, level, algorithm;
@@ -228,6 +227,8 @@ struct raid5_private_data {
228 * Cleared when a sync completes. 227 * Cleared when a sync completes.
229 */ 228 */
230 229
230 struct page *spare_page; /* Used when checking P/Q in raid6 */
231
231 /* 232 /*
232 * Free stripes pool 233 * Free stripes pool
233 */ 234 */
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
index 48831eac2910..d0dd38b3a2fd 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -31,9 +31,11 @@ enum raid_level {
31 RAID_LEVEL_LINEAR, 31 RAID_LEVEL_LINEAR,
32 RAID_LEVEL_0, 32 RAID_LEVEL_0,
33 RAID_LEVEL_1, 33 RAID_LEVEL_1,
34 RAID_LEVEL_10,
34 RAID_LEVEL_3, 35 RAID_LEVEL_3,
35 RAID_LEVEL_4, 36 RAID_LEVEL_4,
36 RAID_LEVEL_5, 37 RAID_LEVEL_5,
38 RAID_LEVEL_50,
37 RAID_LEVEL_6, 39 RAID_LEVEL_6,
38}; 40};
39 41
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index e0a4faa9610c..953b6df5d037 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -5,6 +5,16 @@ struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev);
5struct super_block *ramfs_get_sb(struct file_system_type *fs_type, 5struct super_block *ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data); 6 int flags, const char *dev_name, void *data);
7 7
8#ifndef CONFIG_MMU
9extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
10 unsigned long addr,
11 unsigned long len,
12 unsigned long pgoff,
13 unsigned long flags);
14
15extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
16#endif
17
8extern struct file_operations ramfs_file_operations; 18extern struct file_operations ramfs_file_operations;
9extern struct vm_operations_struct generic_file_vm_ops; 19extern struct vm_operations_struct generic_file_vm_ops;
10 20
diff --git a/include/linux/random.h b/include/linux/random.h
index 7b2adb3322d5..5d6456bcdeba 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -52,9 +52,9 @@ extern void get_random_bytes(void *buf, int nbytes);
52void generate_random_uuid(unsigned char uuid_out[16]); 52void generate_random_uuid(unsigned char uuid_out[16]);
53 53
54extern __u32 secure_ip_id(__u32 daddr); 54extern __u32 secure_ip_id(__u32 daddr);
55extern u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); 55extern u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport);
56extern u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, 56extern u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr,
57 __u16 dport); 57 __u16 dport);
58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, 58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,
59 __u16 sport, __u16 dport); 59 __u16 sport, __u16 dport);
60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, 60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr,
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index a471f3bb713e..981f9aa43353 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -65,7 +65,11 @@ struct rcu_ctrlblk {
65 long cur; /* Current batch number. */ 65 long cur; /* Current batch number. */
66 long completed; /* Number of the last completed batch */ 66 long completed; /* Number of the last completed batch */
67 int next_pending; /* Is the next batch already waiting? */ 67 int next_pending; /* Is the next batch already waiting? */
68} ____cacheline_maxaligned_in_smp; 68
69 spinlock_t lock ____cacheline_internodealigned_in_smp;
70 cpumask_t cpumask; /* CPUs that need to switch in order */
71 /* for current batch to proceed. */
72} ____cacheline_internodealigned_in_smp;
69 73
70/* Is batch a before batch b ? */ 74/* Is batch a before batch b ? */
71static inline int rcu_batch_before(long a, long b) 75static inline int rcu_batch_before(long a, long b)
@@ -125,36 +129,7 @@ static inline void rcu_bh_qsctr_inc(int cpu)
125 rdp->passed_quiesc = 1; 129 rdp->passed_quiesc = 1;
126} 130}
127 131
128static inline int __rcu_pending(struct rcu_ctrlblk *rcp, 132extern int rcu_pending(int cpu);
129 struct rcu_data *rdp)
130{
131 /* This cpu has pending rcu entries and the grace period
132 * for them has completed.
133 */
134 if (rdp->curlist && !rcu_batch_before(rcp->completed, rdp->batch))
135 return 1;
136
137 /* This cpu has no pending entries, but there are new entries */
138 if (!rdp->curlist && rdp->nxtlist)
139 return 1;
140
141 /* This cpu has finished callbacks to invoke */
142 if (rdp->donelist)
143 return 1;
144
145 /* The rcu core waits for a quiescent state from the cpu */
146 if (rdp->quiescbatch != rcp->cur || rdp->qs_pending)
147 return 1;
148
149 /* nothing to do */
150 return 0;
151}
152
153static inline int rcu_pending(int cpu)
154{
155 return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) ||
156 __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu));
157}
158 133
159/** 134/**
160 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 135 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
diff --git a/include/linux/rcuref.h b/include/linux/rcuref.h
deleted file mode 100644
index e1adbba14b67..000000000000
--- a/include/linux/rcuref.h
+++ /dev/null
@@ -1,220 +0,0 @@
1/*
2 * rcuref.h
3 *
4 * Reference counting for elements of lists/arrays protected by
5 * RCU.
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 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * Copyright (C) IBM Corporation, 2005
22 *
23 * Author: Dipankar Sarma <dipankar@in.ibm.com>
24 * Ravikiran Thirumalai <kiran_th@gmail.com>
25 *
26 * See Documentation/RCU/rcuref.txt for detailed user guide.
27 *
28 */
29
30#ifndef _RCUREF_H_
31#define _RCUREF_H_
32
33#ifdef __KERNEL__
34
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/spinlock.h>
38#include <asm/atomic.h>
39
40/*
41 * These APIs work on traditional atomic_t counters used in the
42 * kernel for reference counting. Under special circumstances
43 * where a lock-free get() operation races with a put() operation
44 * these APIs can be used. See Documentation/RCU/rcuref.txt.
45 */
46
47#ifdef __HAVE_ARCH_CMPXCHG
48
49/**
50 * rcuref_inc - increment refcount for object.
51 * @rcuref: reference counter in the object in question.
52 *
53 * This should be used only for objects where we use RCU and
54 * use the rcuref_inc_lf() api to acquire a reference
55 * in a lock-free reader-side critical section.
56 */
57static inline void rcuref_inc(atomic_t *rcuref)
58{
59 atomic_inc(rcuref);
60}
61
62/**
63 * rcuref_dec - decrement refcount for object.
64 * @rcuref: reference counter in the object in question.
65 *
66 * This should be used only for objects where we use RCU and
67 * use the rcuref_inc_lf() api to acquire a reference
68 * in a lock-free reader-side critical section.
69 */
70static inline void rcuref_dec(atomic_t *rcuref)
71{
72 atomic_dec(rcuref);
73}
74
75/**
76 * rcuref_dec_and_test - decrement refcount for object and test
77 * @rcuref: reference counter in the object.
78 * @release: pointer to the function that will clean up the object
79 * when the last reference to the object is released.
80 * This pointer is required.
81 *
82 * Decrement the refcount, and if 0, return 1. Else return 0.
83 *
84 * This should be used only for objects where we use RCU and
85 * use the rcuref_inc_lf() api to acquire a reference
86 * in a lock-free reader-side critical section.
87 */
88static inline int rcuref_dec_and_test(atomic_t *rcuref)
89{
90 return atomic_dec_and_test(rcuref);
91}
92
93/*
94 * cmpxchg is needed on UP too, if deletions to the list/array can happen
95 * in interrupt context.
96 */
97
98/**
99 * rcuref_inc_lf - Take reference to an object in a read-side
100 * critical section protected by RCU.
101 * @rcuref: reference counter in the object in question.
102 *
103 * Try and increment the refcount by 1. The increment might fail if
104 * the reference counter has been through a 1 to 0 transition and
105 * is no longer part of the lock-free list.
106 * Returns non-zero on successful increment and zero otherwise.
107 */
108static inline int rcuref_inc_lf(atomic_t *rcuref)
109{
110 int c, old;
111 c = atomic_read(rcuref);
112 while (c && (old = cmpxchg(&rcuref->counter, c, c + 1)) != c)
113 c = old;
114 return c;
115}
116
117#else /* !__HAVE_ARCH_CMPXCHG */
118
119extern spinlock_t __rcuref_hash[];
120
121/*
122 * Use a hash table of locks to protect the reference count
123 * since cmpxchg is not available in this arch.
124 */
125#ifdef CONFIG_SMP
126#define RCUREF_HASH_SIZE 4
127#define RCUREF_HASH(k) \
128 (&__rcuref_hash[(((unsigned long)k)>>8) & (RCUREF_HASH_SIZE-1)])
129#else
130#define RCUREF_HASH_SIZE 1
131#define RCUREF_HASH(k) &__rcuref_hash[0]
132#endif /* CONFIG_SMP */
133
134/**
135 * rcuref_inc - increment refcount for object.
136 * @rcuref: reference counter in the object in question.
137 *
138 * This should be used only for objects where we use RCU and
139 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
140 * reader-side critical section.
141 */
142static inline void rcuref_inc(atomic_t *rcuref)
143{
144 unsigned long flags;
145 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
146 rcuref->counter += 1;
147 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
148}
149
150/**
151 * rcuref_dec - decrement refcount for object.
152 * @rcuref: reference counter in the object in question.
153 *
154 * This should be used only for objects where we use RCU and
155 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
156 * reader-side critical section.
157 */
158static inline void rcuref_dec(atomic_t *rcuref)
159{
160 unsigned long flags;
161 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
162 rcuref->counter -= 1;
163 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
164}
165
166/**
167 * rcuref_dec_and_test - decrement refcount for object and test
168 * @rcuref: reference counter in the object.
169 * @release: pointer to the function that will clean up the object
170 * when the last reference to the object is released.
171 * This pointer is required.
172 *
173 * Decrement the refcount, and if 0, return 1. Else return 0.
174 *
175 * This should be used only for objects where we use RCU and
176 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
177 * reader-side critical section.
178 */
179static inline int rcuref_dec_and_test(atomic_t *rcuref)
180{
181 unsigned long flags;
182 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
183 rcuref->counter--;
184 if (!rcuref->counter) {
185 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
186 return 1;
187 } else {
188 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
189 return 0;
190 }
191}
192
193/**
194 * rcuref_inc_lf - Take reference to an object of a lock-free collection
195 * by traversing a lock-free list/array.
196 * @rcuref: reference counter in the object in question.
197 *
198 * Try and increment the refcount by 1. The increment might fail if
199 * the reference counter has been through a 1 to 0 transition and
200 * object is no longer part of the lock-free list.
201 * Returns non-zero on successful increment and zero otherwise.
202 */
203static inline int rcuref_inc_lf(atomic_t *rcuref)
204{
205 int ret;
206 unsigned long flags;
207 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
208 if (rcuref->counter)
209 ret = rcuref->counter++;
210 else
211 ret = 0;
212 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
213 return ret;
214}
215
216
217#endif /* !__HAVE_ARCH_CMPXCHG */
218
219#endif /* __KERNEL__ */
220#endif /* _RCUREF_H_ */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 001ab82df051..e276c5ba2bb7 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1857,7 +1857,7 @@ void padd_item(char *item, int total_length, int length);
1857#define GET_BLOCK_CREATE 1 /* add anything you need to find block */ 1857#define GET_BLOCK_CREATE 1 /* add anything you need to find block */
1858#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ 1858#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */
1859#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ 1859#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */
1860#define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ 1860#define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */
1861#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ 1861#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */
1862 1862
1863int restart_transaction(struct reiserfs_transaction_handle *th, 1863int restart_transaction(struct reiserfs_transaction_handle *th,
diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h
index fb7e80737325..7342e66247fb 100644
--- a/include/linux/relayfs_fs.h
+++ b/include/linux/relayfs_fs.h
@@ -65,20 +65,6 @@ struct rchan
65}; 65};
66 66
67/* 67/*
68 * Relayfs inode
69 */
70struct relayfs_inode_info
71{
72 struct inode vfs_inode;
73 struct rchan_buf *buf;
74};
75
76static inline struct relayfs_inode_info *RELAYFS_I(struct inode *inode)
77{
78 return container_of(inode, struct relayfs_inode_info, vfs_inode);
79}
80
81/*
82 * Relay channel client callbacks 68 * Relay channel client callbacks
83 */ 69 */
84struct rchan_callbacks 70struct rchan_callbacks
@@ -124,6 +110,46 @@ struct rchan_callbacks
124 */ 110 */
125 void (*buf_unmapped)(struct rchan_buf *buf, 111 void (*buf_unmapped)(struct rchan_buf *buf,
126 struct file *filp); 112 struct file *filp);
113 /*
114 * create_buf_file - create file to represent a relayfs channel buffer
115 * @filename: the name of the file to create
116 * @parent: the parent of the file to create
117 * @mode: the mode of the file to create
118 * @buf: the channel buffer
119 * @is_global: outparam - set non-zero if the buffer should be global
120 *
121 * Called during relay_open(), once for each per-cpu buffer,
122 * to allow the client to create a file to be used to
123 * represent the corresponding channel buffer. If the file is
124 * created outside of relayfs, the parent must also exist in
125 * that filesystem.
126 *
127 * The callback should return the dentry of the file created
128 * to represent the relay buffer.
129 *
130 * Setting the is_global outparam to a non-zero value will
131 * cause relay_open() to create a single global buffer rather
132 * than the default set of per-cpu buffers.
133 *
134 * See Documentation/filesystems/relayfs.txt for more info.
135 */
136 struct dentry *(*create_buf_file)(const char *filename,
137 struct dentry *parent,
138 int mode,
139 struct rchan_buf *buf,
140 int *is_global);
141
142 /*
143 * remove_buf_file - remove file representing a relayfs channel buffer
144 * @dentry: the dentry of the file to remove
145 *
146 * Called during relay_close(), once for each per-cpu buffer,
147 * to allow the client to remove a file used to represent a
148 * channel buffer.
149 *
150 * The callback should return 0 if successful, negative if not.
151 */
152 int (*remove_buf_file)(struct dentry *dentry);
127}; 153};
128 154
129/* 155/*
@@ -148,6 +174,12 @@ extern size_t relay_switch_subbuf(struct rchan_buf *buf,
148extern struct dentry *relayfs_create_dir(const char *name, 174extern struct dentry *relayfs_create_dir(const char *name,
149 struct dentry *parent); 175 struct dentry *parent);
150extern int relayfs_remove_dir(struct dentry *dentry); 176extern int relayfs_remove_dir(struct dentry *dentry);
177extern struct dentry *relayfs_create_file(const char *name,
178 struct dentry *parent,
179 int mode,
180 struct file_operations *fops,
181 void *data);
182extern int relayfs_remove_file(struct dentry *dentry);
151 183
152/** 184/**
153 * relay_write - write data into the channel 185 * relay_write - write data into the channel
@@ -247,10 +279,9 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf,
247} 279}
248 280
249/* 281/*
250 * exported relayfs file operations, fs/relayfs/inode.c 282 * exported relay file operations, fs/relayfs/inode.c
251 */ 283 */
252 284extern struct file_operations relay_file_operations;
253extern struct file_operations relayfs_file_operations;
254 285
255#endif /* _LINUX_RELAYFS_FS_H */ 286#endif /* _LINUX_RELAYFS_FS_H */
256 287
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 3bd7cce19e26..f54772d0e7f8 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -21,6 +21,7 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/string.h>
24#include <linux/rio.h> 25#include <linux/rio.h>
25 26
26extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset, 27extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset,
@@ -336,8 +337,8 @@ static inline void rio_init_dbell_res(struct resource *res, u16 start, u16 end)
336 337
337/** 338/**
338 * RIO_DEVICE - macro used to describe a specific RIO device 339 * RIO_DEVICE - macro used to describe a specific RIO device
339 * @vid: the 16 bit RIO vendor ID 340 * @dev: the 16 bit RIO device ID
340 * @did: the 16 bit RIO device ID 341 * @ven: the 16 bit RIO vendor ID
341 * 342 *
342 * This macro is used to create a struct rio_device_id that matches a 343 * This macro is used to create a struct rio_device_id that matches a
343 * specific device. The assembly vendor and assembly device fields 344 * specific device. The assembly vendor and assembly device fields
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 33261f1d2239..9d6fbeef2104 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -71,6 +71,7 @@ void __anon_vma_link(struct vm_area_struct *);
71 * rmap interfaces called when adding or removing pte of page 71 * rmap interfaces called when adding or removing pte of page
72 */ 72 */
73void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 73void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
74void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
74void page_add_file_rmap(struct page *); 75void page_add_file_rmap(struct page *);
75void page_remove_rmap(struct page *); 76void page_remove_rmap(struct page *);
76 77
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index e1aaf1fac8e0..0b2ba67ff13c 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -11,6 +11,8 @@
11#ifndef _LINUX_RTC_H_ 11#ifndef _LINUX_RTC_H_
12#define _LINUX_RTC_H_ 12#define _LINUX_RTC_H_
13 13
14#include <linux/interrupt.h>
15
14/* 16/*
15 * The struct used to pass data via the following ioctl. Similar to the 17 * The struct used to pass data via the following ioctl. Similar to the
16 * struct tm in <time.h>, but it needs to be here so that the kernel 18 * struct tm in <time.h>, but it needs to be here so that the kernel
@@ -102,6 +104,7 @@ int rtc_register(rtc_task_t *task);
102int rtc_unregister(rtc_task_t *task); 104int rtc_unregister(rtc_task_t *task);
103int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 105int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
104void rtc_get_rtc_time(struct rtc_time *rtc_tm); 106void rtc_get_rtc_time(struct rtc_time *rtc_tm);
107irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
105 108
106#endif /* __KERNEL__ */ 109#endif /* __KERNEL__ */
107 110
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b0ad6f30679e..2df1a1a2fee5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -34,6 +34,7 @@
34#include <linux/percpu.h> 34#include <linux/percpu.h>
35#include <linux/topology.h> 35#include <linux/topology.h>
36#include <linux/seccomp.h> 36#include <linux/seccomp.h>
37#include <linux/rcupdate.h>
37 38
38#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ 39#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */
39 40
@@ -104,6 +105,7 @@ extern unsigned long nr_iowait(void);
104#include <linux/param.h> 105#include <linux/param.h>
105#include <linux/resource.h> 106#include <linux/resource.h>
106#include <linux/timer.h> 107#include <linux/timer.h>
108#include <linux/hrtimer.h>
107 109
108#include <asm/processor.h> 110#include <asm/processor.h>
109 111
@@ -158,6 +160,7 @@ extern unsigned long nr_iowait(void);
158#define SCHED_NORMAL 0 160#define SCHED_NORMAL 0
159#define SCHED_FIFO 1 161#define SCHED_FIFO 1
160#define SCHED_RR 2 162#define SCHED_RR 2
163#define SCHED_BATCH 3
161 164
162struct sched_param { 165struct sched_param {
163 int sched_priority; 166 int sched_priority;
@@ -254,25 +257,12 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
254 * The mm counters are not protected by its page_table_lock, 257 * The mm counters are not protected by its page_table_lock,
255 * so must be incremented atomically. 258 * so must be incremented atomically.
256 */ 259 */
257#ifdef ATOMIC64_INIT 260#define set_mm_counter(mm, member, value) atomic_long_set(&(mm)->_##member, value)
258#define set_mm_counter(mm, member, value) atomic64_set(&(mm)->_##member, value) 261#define get_mm_counter(mm, member) ((unsigned long)atomic_long_read(&(mm)->_##member))
259#define get_mm_counter(mm, member) ((unsigned long)atomic64_read(&(mm)->_##member)) 262#define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member)
260#define add_mm_counter(mm, member, value) atomic64_add(value, &(mm)->_##member) 263#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
261#define inc_mm_counter(mm, member) atomic64_inc(&(mm)->_##member) 264#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
262#define dec_mm_counter(mm, member) atomic64_dec(&(mm)->_##member) 265typedef atomic_long_t mm_counter_t;
263typedef atomic64_t mm_counter_t;
264#else /* !ATOMIC64_INIT */
265/*
266 * The counters wrap back to 0 at 2^32 * PAGE_SIZE,
267 * that is, at 16TB if using 4kB page size.
268 */
269#define set_mm_counter(mm, member, value) atomic_set(&(mm)->_##member, value)
270#define get_mm_counter(mm, member) ((unsigned long)atomic_read(&(mm)->_##member))
271#define add_mm_counter(mm, member, value) atomic_add(value, &(mm)->_##member)
272#define inc_mm_counter(mm, member) atomic_inc(&(mm)->_##member)
273#define dec_mm_counter(mm, member) atomic_dec(&(mm)->_##member)
274typedef atomic_t mm_counter_t;
275#endif /* !ATOMIC64_INIT */
276 266
277#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 267#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
278/* 268/*
@@ -363,8 +353,16 @@ struct sighand_struct {
363 atomic_t count; 353 atomic_t count;
364 struct k_sigaction action[_NSIG]; 354 struct k_sigaction action[_NSIG];
365 spinlock_t siglock; 355 spinlock_t siglock;
356 struct rcu_head rcu;
366}; 357};
367 358
359extern void sighand_free_cb(struct rcu_head *rhp);
360
361static inline void sighand_free(struct sighand_struct *sp)
362{
363 call_rcu(&sp->rcu, sighand_free_cb);
364}
365
368/* 366/*
369 * NOTE! "signal_struct" does not have it's own 367 * NOTE! "signal_struct" does not have it's own
370 * locking, because a shared signal_struct always 368 * locking, because a shared signal_struct always
@@ -402,8 +400,8 @@ struct signal_struct {
402 struct list_head posix_timers; 400 struct list_head posix_timers;
403 401
404 /* ITIMER_REAL timer for the process */ 402 /* ITIMER_REAL timer for the process */
405 struct timer_list real_timer; 403 struct hrtimer real_timer;
406 unsigned long it_real_value, it_real_incr; 404 ktime_t it_real_incr;
407 405
408 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 406 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
409 cputime_t it_prof_expires, it_virt_expires; 407 cputime_t it_prof_expires, it_virt_expires;
@@ -473,9 +471,9 @@ struct signal_struct {
473 471
474/* 472/*
475 * Priority of a process goes from 0..MAX_PRIO-1, valid RT 473 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
476 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL tasks are 474 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
477 * in the range MAX_RT_PRIO..MAX_PRIO-1. Priority values 475 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
478 * are inverted: lower p->prio value means higher priority. 476 * values are inverted: lower p->prio value means higher priority.
479 * 477 *
480 * The MAX_USER_RT_PRIO value allows the actual maximum 478 * The MAX_USER_RT_PRIO value allows the actual maximum
481 * RT priority to be separate from the value exported to 479 * RT priority to be separate from the value exported to
@@ -634,7 +632,14 @@ struct sched_domain {
634 632
635extern void partition_sched_domains(cpumask_t *partition1, 633extern void partition_sched_domains(cpumask_t *partition1,
636 cpumask_t *partition2); 634 cpumask_t *partition2);
637#endif /* CONFIG_SMP */ 635
636/*
637 * Maximum cache size the migration-costs auto-tuning code will
638 * search from:
639 */
640extern unsigned int max_cache_size;
641
642#endif /* CONFIG_SMP */
638 643
639 644
640struct io_context; /* See blkdev.h */ 645struct io_context; /* See blkdev.h */
@@ -692,9 +697,12 @@ struct task_struct {
692 697
693 int lock_depth; /* BKL lock depth */ 698 int lock_depth; /* BKL lock depth */
694 699
695#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) 700#if defined(CONFIG_SMP)
701 int last_waker_cpu; /* CPU that last woke this task up */
702#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
696 int oncpu; 703 int oncpu;
697#endif 704#endif
705#endif
698 int prio, static_prio; 706 int prio, static_prio;
699 struct list_head run_list; 707 struct list_head run_list;
700 prio_array_t *array; 708 prio_array_t *array;
@@ -775,6 +783,7 @@ struct task_struct {
775 unsigned keep_capabilities:1; 783 unsigned keep_capabilities:1;
776 struct user_struct *user; 784 struct user_struct *user;
777#ifdef CONFIG_KEYS 785#ifdef CONFIG_KEYS
786 struct key *request_key_auth; /* assumed request_key authority */
778 struct key *thread_keyring; /* keyring private to this thread */ 787 struct key *thread_keyring; /* keyring private to this thread */
779 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 788 unsigned char jit_keyring; /* default keyring to attach requested keys to */
780#endif 789#endif
@@ -820,6 +829,11 @@ struct task_struct {
820/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ 829/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
821 spinlock_t proc_lock; 830 spinlock_t proc_lock;
822 831
832#ifdef CONFIG_DEBUG_MUTEXES
833 /* mutex deadlock detection */
834 struct mutex_waiter *blocked_on;
835#endif
836
823/* journalling filesystem info */ 837/* journalling filesystem info */
824 void *journal_info; 838 void *journal_info;
825 839
@@ -857,6 +871,7 @@ struct task_struct {
857 int cpuset_mems_generation; 871 int cpuset_mems_generation;
858#endif 872#endif
859 atomic_t fs_excl; /* holding fs exclusive resources */ 873 atomic_t fs_excl; /* holding fs exclusive resources */
874 struct rcu_head rcu;
860}; 875};
861 876
862static inline pid_t process_group(struct task_struct *tsk) 877static inline pid_t process_group(struct task_struct *tsk)
@@ -880,8 +895,14 @@ static inline int pid_alive(struct task_struct *p)
880extern void free_task(struct task_struct *tsk); 895extern void free_task(struct task_struct *tsk);
881extern void __put_task_struct(struct task_struct *tsk); 896extern void __put_task_struct(struct task_struct *tsk);
882#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 897#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
883#define put_task_struct(tsk) \ 898
884do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) 899extern void __put_task_struct_cb(struct rcu_head *rhp);
900
901static inline void put_task_struct(struct task_struct *t)
902{
903 if (atomic_dec_and_test(&t->usage))
904 call_rcu(&t->rcu, __put_task_struct_cb);
905}
885 906
886/* 907/*
887 * Per process flags 908 * Per process flags
@@ -908,6 +929,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
908#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ 929#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */
909#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ 930#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */
910#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 931#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */
932#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */
911 933
912/* 934/*
913 * Only the _current_ task can read/write to tsk->flags, but other 935 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1101,21 +1123,6 @@ static inline int sas_ss_flags(unsigned long sp)
1101 : on_sig_stack(sp) ? SS_ONSTACK : 0); 1123 : on_sig_stack(sp) ? SS_ONSTACK : 0);
1102} 1124}
1103 1125
1104
1105#ifdef CONFIG_SECURITY
1106/* code is in security.c */
1107extern int capable(int cap);
1108#else
1109static inline int capable(int cap)
1110{
1111 if (cap_raised(current->cap_effective, cap)) {
1112 current->flags |= PF_SUPERPRIV;
1113 return 1;
1114 }
1115 return 0;
1116}
1117#endif
1118
1119/* 1126/*
1120 * Routines for handling mm_structs 1127 * Routines for handling mm_structs
1121 */ 1128 */
@@ -1234,6 +1241,7 @@ static inline void task_unlock(struct task_struct *p)
1234#ifndef __HAVE_THREAD_FUNCTIONS 1241#ifndef __HAVE_THREAD_FUNCTIONS
1235 1242
1236#define task_thread_info(task) (task)->thread_info 1243#define task_thread_info(task) (task)->thread_info
1244#define task_stack_page(task) ((void*)((task)->thread_info))
1237 1245
1238static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org) 1246static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org)
1239{ 1247{
@@ -1379,12 +1387,8 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm)
1379extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); 1387extern long sched_setaffinity(pid_t pid, cpumask_t new_mask);
1380extern long sched_getaffinity(pid_t pid, cpumask_t *mask); 1388extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
1381 1389
1382#ifdef CONFIG_MAGIC_SYSRQ
1383
1384extern void normalize_rt_tasks(void); 1390extern void normalize_rt_tasks(void);
1385 1391
1386#endif
1387
1388#ifdef CONFIG_PM 1392#ifdef CONFIG_PM
1389/* 1393/*
1390 * Check if a process has been frozen 1394 * Check if a process has been frozen
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
new file mode 100644
index 000000000000..6336987dae62
--- /dev/null
+++ b/include/linux/screen_info.h
@@ -0,0 +1,76 @@
1#ifndef _SCREEN_INFO_H
2#define _SCREEN_INFO_H
3
4#include <linux/types.h>
5
6/*
7 * These are set up by the setup-routine at boot-time:
8 */
9
10struct screen_info {
11 u8 orig_x; /* 0x00 */
12 u8 orig_y; /* 0x01 */
13 u16 dontuse1; /* 0x02 -- EXT_MEM_K sits here */
14 u16 orig_video_page; /* 0x04 */
15 u8 orig_video_mode; /* 0x06 */
16 u8 orig_video_cols; /* 0x07 */
17 u16 unused2; /* 0x08 */
18 u16 orig_video_ega_bx; /* 0x0a */
19 u16 unused3; /* 0x0c */
20 u8 orig_video_lines; /* 0x0e */
21 u8 orig_video_isVGA; /* 0x0f */
22 u16 orig_video_points; /* 0x10 */
23
24 /* VESA graphic mode -- linear frame buffer */
25 u16 lfb_width; /* 0x12 */
26 u16 lfb_height; /* 0x14 */
27 u16 lfb_depth; /* 0x16 */
28 u32 lfb_base; /* 0x18 */
29 u32 lfb_size; /* 0x1c */
30 u16 dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
31 u16 lfb_linelength; /* 0x24 */
32 u8 red_size; /* 0x26 */
33 u8 red_pos; /* 0x27 */
34 u8 green_size; /* 0x28 */
35 u8 green_pos; /* 0x29 */
36 u8 blue_size; /* 0x2a */
37 u8 blue_pos; /* 0x2b */
38 u8 rsvd_size; /* 0x2c */
39 u8 rsvd_pos; /* 0x2d */
40 u16 vesapm_seg; /* 0x2e */
41 u16 vesapm_off; /* 0x30 */
42 u16 pages; /* 0x32 */
43 u16 vesa_attributes; /* 0x34 */
44 /* 0x36 -- 0x3f reserved for future expansion */
45};
46
47extern struct screen_info screen_info;
48
49#define ORIG_X (screen_info.orig_x)
50#define ORIG_Y (screen_info.orig_y)
51#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
52#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
53#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
54#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
55#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
56#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
57
58#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
59#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
60#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
61#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */
62#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */
63#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
64
65#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */
66#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */
67#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */
68
69#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */
70
71#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */
72#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */
73
74#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
75
76#endif /* _SCREEN_INFO_H */
diff --git a/include/linux/sdla.h b/include/linux/sdla.h
index 3b6afb8caa42..564acd3a71c1 100644
--- a/include/linux/sdla.h
+++ b/include/linux/sdla.h
@@ -293,46 +293,46 @@ void sdla(void *cfg_info, char *dev, struct frad_conf *conf, int quiet);
293#define SDLA_S508_INTEN 0x10 293#define SDLA_S508_INTEN 0x10
294 294
295struct sdla_cmd { 295struct sdla_cmd {
296 char opp_flag __attribute__((packed)); 296 char opp_flag;
297 char cmd __attribute__((packed)); 297 char cmd;
298 short length __attribute__((packed)); 298 short length;
299 char retval __attribute__((packed)); 299 char retval;
300 short dlci __attribute__((packed)); 300 short dlci;
301 char flags __attribute__((packed)); 301 char flags;
302 short rxlost_int __attribute__((packed)); 302 short rxlost_int;
303 long rxlost_app __attribute__((packed)); 303 long rxlost_app;
304 char reserve[2] __attribute__((packed)); 304 char reserve[2];
305 char data[SDLA_MAX_DATA] __attribute__((packed)); /* transfer data buffer */ 305 char data[SDLA_MAX_DATA]; /* transfer data buffer */
306}; 306} __attribute__((packed));
307 307
308struct intr_info { 308struct intr_info {
309 char flags __attribute__((packed)); 309 char flags;
310 short txlen __attribute__((packed)); 310 short txlen;
311 char irq __attribute__((packed)); 311 char irq;
312 char flags2 __attribute__((packed)); 312 char flags2;
313 short timeout __attribute__((packed)); 313 short timeout;
314}; 314} __attribute__((packed));
315 315
316/* found in the 508's control window at RXBUF_INFO */ 316/* found in the 508's control window at RXBUF_INFO */
317struct buf_info { 317struct buf_info {
318 unsigned short rse_num __attribute__((packed)); 318 unsigned short rse_num;
319 unsigned long rse_base __attribute__((packed)); 319 unsigned long rse_base;
320 unsigned long rse_next __attribute__((packed)); 320 unsigned long rse_next;
321 unsigned long buf_base __attribute__((packed)); 321 unsigned long buf_base;
322 unsigned short reserved __attribute__((packed)); 322 unsigned short reserved;
323 unsigned long buf_top __attribute__((packed)); 323 unsigned long buf_top;
324}; 324} __attribute__((packed));
325 325
326/* structure pointed to by rse_base in RXBUF_INFO struct */ 326/* structure pointed to by rse_base in RXBUF_INFO struct */
327struct buf_entry { 327struct buf_entry {
328 char opp_flag __attribute__((packed)); 328 char opp_flag;
329 short length __attribute__((packed)); 329 short length;
330 short dlci __attribute__((packed)); 330 short dlci;
331 char flags __attribute__((packed)); 331 char flags;
332 short timestamp __attribute__((packed)); 332 short timestamp;
333 short reserved[2] __attribute__((packed)); 333 short reserved[2];
334 long buf_addr __attribute__((packed)); 334 long buf_addr;
335}; 335} __attribute__((packed));
336 336
337#endif 337#endif
338 338
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index dc89116bb1ca..cd2773b29a64 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -26,11 +26,7 @@ static inline int has_secure_computing(struct thread_info *ti)
26 26
27#else /* CONFIG_SECCOMP */ 27#else /* CONFIG_SECCOMP */
28 28
29#if (__GNUC__ > 2) 29typedef struct { } seccomp_t;
30 typedef struct { } seccomp_t;
31#else
32 typedef struct { int gcc_is_buggy; } seccomp_t;
33#endif
34 30
35#define secure_computing(x) do { } while (0) 31#define secure_computing(x) do { } while (0)
36/* static inline to preserve typechecking */ 32/* static inline to preserve typechecking */
diff --git a/include/linux/security.h b/include/linux/security.h
index f7e0ae018712..ef753654daa5 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -59,6 +59,12 @@ struct sk_buff;
59struct sock; 59struct sock;
60struct sockaddr; 60struct sockaddr;
61struct socket; 61struct socket;
62struct flowi;
63struct dst_entry;
64struct xfrm_selector;
65struct xfrm_policy;
66struct xfrm_state;
67struct xfrm_user_sec_ctx;
62 68
63extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 69extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
64extern int cap_netlink_recv(struct sk_buff *skb); 70extern int cap_netlink_recv(struct sk_buff *skb);
@@ -788,6 +794,52 @@ struct swap_info_struct;
788 * which is used to copy security attributes between local stream sockets. 794 * which is used to copy security attributes between local stream sockets.
789 * @sk_free_security: 795 * @sk_free_security:
790 * Deallocate security structure. 796 * Deallocate security structure.
797 * @sk_getsid:
798 * Retrieve the LSM-specific sid for the sock to enable caching of network
799 * authorizations.
800 *
801 * Security hooks for XFRM operations.
802 *
803 * @xfrm_policy_alloc_security:
804 * @xp contains the xfrm_policy being added to Security Policy Database
805 * used by the XFRM system.
806 * @sec_ctx contains the security context information being provided by
807 * the user-level policy update program (e.g., setkey).
808 * Allocate a security structure to the xp->selector.security field.
809 * The security field is initialized to NULL when the xfrm_policy is
810 * allocated.
811 * Return 0 if operation was successful (memory to allocate, legal context)
812 * @xfrm_policy_clone_security:
813 * @old contains an existing xfrm_policy in the SPD.
814 * @new contains a new xfrm_policy being cloned from old.
815 * Allocate a security structure to the new->selector.security field
816 * that contains the information from the old->selector.security field.
817 * Return 0 if operation was successful (memory to allocate).
818 * @xfrm_policy_free_security:
819 * @xp contains the xfrm_policy
820 * Deallocate xp->selector.security.
821 * @xfrm_state_alloc_security:
822 * @x contains the xfrm_state being added to the Security Association
823 * Database by the XFRM system.
824 * @sec_ctx contains the security context information being provided by
825 * the user-level SA generation program (e.g., setkey or racoon).
826 * Allocate a security structure to the x->sel.security field. The
827 * security field is initialized to NULL when the xfrm_state is
828 * allocated.
829 * Return 0 if operation was successful (memory to allocate, legal context).
830 * @xfrm_state_free_security:
831 * @x contains the xfrm_state.
832 * Deallocate x>sel.security.
833 * @xfrm_policy_lookup:
834 * @xp contains the xfrm_policy for which the access control is being
835 * checked.
836 * @sk_sid contains the sock security label that is used to authorize
837 * access to the policy xp.
838 * @dir contains the direction of the flow (input or output).
839 * Check permission when a sock selects a xfrm_policy for processing
840 * XFRMs on a packet. The hook is called when selecting either a
841 * per-socket policy or a generic xfrm policy.
842 * Return 0 if permission is granted.
791 * 843 *
792 * Security hooks affecting all Key Management operations 844 * Security hooks affecting all Key Management operations
793 * 845 *
@@ -1237,8 +1289,18 @@ struct security_operations {
1237 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1289 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1238 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1290 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1239 void (*sk_free_security) (struct sock *sk); 1291 void (*sk_free_security) (struct sock *sk);
1292 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir);
1240#endif /* CONFIG_SECURITY_NETWORK */ 1293#endif /* CONFIG_SECURITY_NETWORK */
1241 1294
1295#ifdef CONFIG_SECURITY_NETWORK_XFRM
1296 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
1297 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1298 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1299 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
1300 void (*xfrm_state_free_security) (struct xfrm_state *x);
1301 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
1302#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1303
1242 /* key management security hooks */ 1304 /* key management security hooks */
1243#ifdef CONFIG_KEYS 1305#ifdef CONFIG_KEYS
1244 int (*key_alloc)(struct key *key); 1306 int (*key_alloc)(struct key *key);
@@ -2679,6 +2741,11 @@ static inline void security_sk_free(struct sock *sk)
2679{ 2741{
2680 return security_ops->sk_free_security(sk); 2742 return security_ops->sk_free_security(sk);
2681} 2743}
2744
2745static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
2746{
2747 return security_ops->sk_getsid(sk, fl, dir);
2748}
2682#else /* CONFIG_SECURITY_NETWORK */ 2749#else /* CONFIG_SECURITY_NETWORK */
2683static inline int security_unix_stream_connect(struct socket * sock, 2750static inline int security_unix_stream_connect(struct socket * sock,
2684 struct socket * other, 2751 struct socket * other,
@@ -2795,8 +2862,73 @@ static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
2795static inline void security_sk_free(struct sock *sk) 2862static inline void security_sk_free(struct sock *sk)
2796{ 2863{
2797} 2864}
2865
2866static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
2867{
2868 return 0;
2869}
2798#endif /* CONFIG_SECURITY_NETWORK */ 2870#endif /* CONFIG_SECURITY_NETWORK */
2799 2871
2872#ifdef CONFIG_SECURITY_NETWORK_XFRM
2873static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2874{
2875 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
2876}
2877
2878static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
2879{
2880 return security_ops->xfrm_policy_clone_security(old, new);
2881}
2882
2883static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2884{
2885 security_ops->xfrm_policy_free_security(xp);
2886}
2887
2888static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2889{
2890 return security_ops->xfrm_state_alloc_security(x, sec_ctx);
2891}
2892
2893static inline void security_xfrm_state_free(struct xfrm_state *x)
2894{
2895 security_ops->xfrm_state_free_security(x);
2896}
2897
2898static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2899{
2900 return security_ops->xfrm_policy_lookup(xp, sk_sid, dir);
2901}
2902#else /* CONFIG_SECURITY_NETWORK_XFRM */
2903static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2904{
2905 return 0;
2906}
2907
2908static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
2909{
2910 return 0;
2911}
2912
2913static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2914{
2915}
2916
2917static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2918{
2919 return 0;
2920}
2921
2922static inline void security_xfrm_state_free(struct xfrm_state *x)
2923{
2924}
2925
2926static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2927{
2928 return 0;
2929}
2930#endif /* CONFIG_SECURITY_NETWORK_XFRM */
2931
2800#ifdef CONFIG_KEYS 2932#ifdef CONFIG_KEYS
2801#ifdef CONFIG_SECURITY 2933#ifdef CONFIG_SECURITY
2802static inline int security_key_alloc(struct key *key) 2934static inline int security_key_alloc(struct key *key)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index e3710d7e260a..ec351005bf9d 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -67,6 +67,9 @@
67/* Parisc type numbers. */ 67/* Parisc type numbers. */
68#define PORT_MUX 48 68#define PORT_MUX 48
69 69
70/* Atmel AT91RM9200 SoC */
71#define PORT_AT91RM9200 49
72
70/* Macintosh Zilog type numbers */ 73/* Macintosh Zilog type numbers */
71#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ 74#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
72#define PORT_PMAC_ZILOG 51 75#define PORT_PMAC_ZILOG 51
@@ -133,6 +136,7 @@
133#include <linux/spinlock.h> 136#include <linux/spinlock.h>
134#include <linux/sched.h> 137#include <linux/sched.h>
135#include <linux/tty.h> 138#include <linux/tty.h>
139#include <linux/mutex.h>
136 140
137struct uart_port; 141struct uart_port;
138struct uart_info; 142struct uart_info;
@@ -281,7 +285,7 @@ struct uart_state {
281 struct uart_info *info; 285 struct uart_info *info;
282 struct uart_port *port; 286 struct uart_port *port;
283 287
284 struct semaphore sem; 288 struct mutex mutex;
285}; 289};
286 290
287#define UART_XMIT_SIZE PAGE_SIZE 291#define UART_XMIT_SIZE PAGE_SIZE
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index c3e598276e78..c057f0b32318 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -26,6 +26,8 @@ struct shmem_sb_info {
26 unsigned long free_blocks; /* How many are left for allocation */ 26 unsigned long free_blocks; /* How many are left for allocation */
27 unsigned long max_inodes; /* How many inodes are allowed */ 27 unsigned long max_inodes; /* How many inodes are allowed */
28 unsigned long free_inodes; /* How many are left for allocation */ 28 unsigned long free_inodes; /* How many are left for allocation */
29 int policy; /* Default NUMA memory alloc policy */
30 nodemask_t policy_nodes; /* nodemask for preferred and bind */
29 spinlock_t stat_lock; 31 spinlock_t stat_lock;
30}; 32};
31 33
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 5dd5f02c5c5f..b7d093520bb6 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -18,6 +18,19 @@
18#define SA_PROBE SA_ONESHOT 18#define SA_PROBE SA_ONESHOT
19#define SA_SAMPLE_RANDOM SA_RESTART 19#define SA_SAMPLE_RANDOM SA_RESTART
20#define SA_SHIRQ 0x04000000 20#define SA_SHIRQ 0x04000000
21/*
22 * As above, these correspond to the IORESOURCE_IRQ_* defines in
23 * linux/ioport.h to select the interrupt line behaviour. When
24 * requesting an interrupt without specifying a SA_TRIGGER, the
25 * setting should be assumed to be "as already configured", which
26 * may be as per machine or firmware initialisation.
27 */
28#define SA_TRIGGER_LOW 0x00000008
29#define SA_TRIGGER_HIGH 0x00000004
30#define SA_TRIGGER_FALLING 0x00000002
31#define SA_TRIGGER_RISING 0x00000001
32#define SA_TRIGGER_MASK (SA_TRIGGER_HIGH|SA_TRIGGER_LOW|\
33 SA_TRIGGER_RISING|SA_TRIGGER_FALLING)
21 34
22/* 35/*
23 * Real Time signals may be queued. 36 * Real Time signals may be queued.
@@ -81,6 +94,23 @@ static inline int sigfindinword(unsigned long word)
81 94
82#endif /* __HAVE_ARCH_SIG_BITOPS */ 95#endif /* __HAVE_ARCH_SIG_BITOPS */
83 96
97static inline int sigisemptyset(sigset_t *set)
98{
99 extern void _NSIG_WORDS_is_unsupported_size(void);
100 switch (_NSIG_WORDS) {
101 case 4:
102 return (set->sig[3] | set->sig[2] |
103 set->sig[1] | set->sig[0]) == 0;
104 case 2:
105 return (set->sig[1] | set->sig[0]) == 0;
106 case 1:
107 return set->sig[0] == 0;
108 default:
109 _NSIG_WORDS_is_unsupported_size();
110 return 0;
111 }
112}
113
84#define sigmask(sig) (1UL << ((sig) - 1)) 114#define sigmask(sig) (1UL << ((sig) - 1))
85 115
86#ifndef __HAVE_ARCH_SIG_SETOPS 116#ifndef __HAVE_ARCH_SIG_SETOPS
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 8c5d6001a923..e5fd66c5650b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -32,7 +32,6 @@
32 32
33#define HAVE_ALLOC_SKB /* For the drivers to know */ 33#define HAVE_ALLOC_SKB /* For the drivers to know */
34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
35#define SLAB_SKB /* Slabified skbuffs */
36 35
37#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
38#define CHECKSUM_HW 1 37#define CHECKSUM_HW 1
@@ -134,7 +133,7 @@ struct skb_frag_struct {
134 */ 133 */
135struct skb_shared_info { 134struct skb_shared_info {
136 atomic_t dataref; 135 atomic_t dataref;
137 unsigned int nr_frags; 136 unsigned short nr_frags;
138 unsigned short tso_size; 137 unsigned short tso_size;
139 unsigned short tso_segs; 138 unsigned short tso_segs;
140 unsigned short ufo_size; 139 unsigned short ufo_size;
@@ -252,7 +251,7 @@ struct sk_buff {
252 * want to keep them across layers you have to do a skb_clone() 251 * want to keep them across layers you have to do a skb_clone()
253 * first. This is owned by whoever has the skb queued ATM. 252 * first. This is owned by whoever has the skb queued ATM.
254 */ 253 */
255 char cb[40]; 254 char cb[48];
256 255
257 unsigned int len, 256 unsigned int len,
258 data_len, 257 data_len,
@@ -1239,6 +1238,8 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1239 int hlen, 1238 int hlen,
1240 struct iovec *iov); 1239 struct iovec *iov);
1241extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1240extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1241extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1242 unsigned int flags);
1242extern unsigned int skb_checksum(const struct sk_buff *skb, int offset, 1243extern unsigned int skb_checksum(const struct sk_buff *skb, int offset,
1243 int len, unsigned int csum); 1244 int len, unsigned int csum);
1244extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1245extern int skb_copy_bits(const struct sk_buff *skb, int offset,
diff --git a/include/linux/slab.h b/include/linux/slab.h
index d1ea4051b996..1fb77a9cc148 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -53,6 +53,8 @@ typedef struct kmem_cache kmem_cache_t;
53#define SLAB_CTOR_ATOMIC 0x002UL /* tell constructor it can't sleep */ 53#define SLAB_CTOR_ATOMIC 0x002UL /* tell constructor it can't sleep */
54#define SLAB_CTOR_VERIFY 0x004UL /* tell constructor it's a verify call */ 54#define SLAB_CTOR_VERIFY 0x004UL /* tell constructor it's a verify call */
55 55
56#ifndef CONFIG_SLOB
57
56/* prototypes */ 58/* prototypes */
57extern void __init kmem_cache_init(void); 59extern void __init kmem_cache_init(void);
58 60
@@ -134,6 +136,39 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
134extern int FASTCALL(kmem_cache_reap(int)); 136extern int FASTCALL(kmem_cache_reap(int));
135extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr)); 137extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr));
136 138
139#else /* CONFIG_SLOB */
140
141/* SLOB allocator routines */
142
143void kmem_cache_init(void);
144struct kmem_cache *kmem_find_general_cachep(size_t, gfp_t gfpflags);
145struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
146 unsigned long,
147 void (*)(void *, struct kmem_cache *, unsigned long),
148 void (*)(void *, struct kmem_cache *, unsigned long));
149int kmem_cache_destroy(struct kmem_cache *c);
150void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
151void kmem_cache_free(struct kmem_cache *c, void *b);
152const char *kmem_cache_name(struct kmem_cache *);
153void *kmalloc(size_t size, gfp_t flags);
154void *kzalloc(size_t size, gfp_t flags);
155void kfree(const void *m);
156unsigned int ksize(const void *m);
157unsigned int kmem_cache_size(struct kmem_cache *c);
158
159static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
160{
161 return kzalloc(n * size, flags);
162}
163
164#define kmem_cache_shrink(d) (0)
165#define kmem_cache_reap(a)
166#define kmem_ptr_validate(a, b) (0)
167#define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f)
168#define kmalloc_node(s, f, n) kmalloc(s, f)
169
170#endif /* CONFIG_SLOB */
171
137/* System wide caches */ 172/* System wide caches */
138extern kmem_cache_t *vm_area_cachep; 173extern kmem_cache_t *vm_area_cachep;
139extern kmem_cache_t *names_cachep; 174extern kmem_cache_t *names_cachep;
diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h
index c4153120ade6..621a3d3662f3 100644
--- a/include/linux/smb_fs.h
+++ b/include/linux/smb_fs.h
@@ -58,53 +58,6 @@ static inline struct smb_inode_info *SMB_I(struct inode *inode)
58/* where to find the base of the SMB packet proper */ 58/* where to find the base of the SMB packet proper */
59#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) 59#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4))
60 60
61#ifdef DEBUG_SMB_MALLOC
62
63#include <linux/slab.h>
64
65extern int smb_malloced;
66extern int smb_current_vmalloced;
67extern int smb_current_kmalloced;
68
69static inline void *
70smb_vmalloc(unsigned int size)
71{
72 smb_malloced += 1;
73 smb_current_vmalloced += 1;
74 return vmalloc(size);
75}
76
77static inline void
78smb_vfree(void *obj)
79{
80 smb_current_vmalloced -= 1;
81 vfree(obj);
82}
83
84static inline void *
85smb_kmalloc(size_t size, int flags)
86{
87 smb_malloced += 1;
88 smb_current_kmalloced += 1;
89 return kmalloc(size, flags);
90}
91
92static inline void
93smb_kfree(void *obj)
94{
95 smb_current_kmalloced -= 1;
96 kfree(obj);
97}
98
99#else /* DEBUG_SMB_MALLOC */
100
101#define smb_kmalloc(s,p) kmalloc(s,p)
102#define smb_kfree(o) kfree(o)
103#define smb_vmalloc(s) vmalloc(s)
104#define smb_vfree(o) vfree(o)
105
106#endif /* DEBUG_SMB_MALLOC */
107
108/* 61/*
109 * Flags for the in-memory inode 62 * Flags for the in-memory inode
110 */ 63 */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 1739c2d5b95b..b02dda4ee83d 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -27,7 +27,6 @@ struct __kernel_sockaddr_storage {
27#include <linux/compiler.h> /* __user */ 27#include <linux/compiler.h> /* __user */
28 28
29extern int sysctl_somaxconn; 29extern int sysctl_somaxconn;
30extern void sock_init(void);
31#ifdef CONFIG_PROC_FS 30#ifdef CONFIG_PROC_FS
32struct seq_file; 31struct seq_file;
33extern void socket_seq_show(struct seq_file *seq); 32extern void socket_seq_show(struct seq_file *seq);
@@ -187,6 +186,7 @@ struct ucred {
187#define AF_PPPOX 24 /* PPPoX sockets */ 186#define AF_PPPOX 24 /* PPPoX sockets */
188#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 187#define AF_WANPIPE 25 /* Wanpipe API Sockets */
189#define AF_LLC 26 /* Linux LLC */ 188#define AF_LLC 26 /* Linux LLC */
189#define AF_TIPC 30 /* TIPC sockets */
190#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 190#define AF_BLUETOOTH 31 /* Bluetooth sockets */
191#define AF_MAX 32 /* For now.. */ 191#define AF_MAX 32 /* For now.. */
192 192
@@ -219,6 +219,7 @@ struct ucred {
219#define PF_PPPOX AF_PPPOX 219#define PF_PPPOX AF_PPPOX
220#define PF_WANPIPE AF_WANPIPE 220#define PF_WANPIPE AF_WANPIPE
221#define PF_LLC AF_LLC 221#define PF_LLC AF_LLC
222#define PF_TIPC AF_TIPC
222#define PF_BLUETOOTH AF_BLUETOOTH 223#define PF_BLUETOOTH AF_BLUETOOTH
223#define PF_MAX AF_MAX 224#define PF_MAX AF_MAX
224 225
@@ -280,6 +281,7 @@ struct ucred {
280#define SOL_LLC 268 281#define SOL_LLC 268
281#define SOL_DCCP 269 282#define SOL_DCCP 269
282#define SOL_NETLINK 270 283#define SOL_NETLINK 270
284#define SOL_TIPC 271
283 285
284/* IPX options */ 286/* IPX options */
285#define IPX_TYPE 1 287#define IPX_TYPE 1
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
new file mode 100644
index 000000000000..72261e0f2ac1
--- /dev/null
+++ b/include/linux/spi/ads7846.h
@@ -0,0 +1,18 @@
1/* linux/spi/ads7846.h */
2
3/* Touchscreen characteristics vary between boards and models. The
4 * platform_data for the device's "struct device" holds this information.
5 *
6 * It's OK if the min/max values are zero.
7 */
8struct ads7846_platform_data {
9 u16 model; /* 7843, 7845, 7846. */
10 u16 vref_delay_usecs; /* 0 for external vref; etc */
11 u16 x_plate_ohms;
12 u16 y_plate_ohms;
13
14 u16 x_min, x_max;
15 u16 y_min, y_max;
16 u16 pressure_min, pressure_max;
17};
18
diff --git a/include/linux/spi/flash.h b/include/linux/spi/flash.h
new file mode 100644
index 000000000000..3f22932e67a4
--- /dev/null
+++ b/include/linux/spi/flash.h
@@ -0,0 +1,31 @@
1#ifndef LINUX_SPI_FLASH_H
2#define LINUX_SPI_FLASH_H
3
4struct mtd_partition;
5
6/**
7 * struct flash_platform_data: board-specific flash data
8 * @name: optional flash device name (eg, as used with mtdparts=)
9 * @parts: optional array of mtd_partitions for static partitioning
10 * @nr_parts: number of mtd_partitions for static partitoning
11 * @type: optional flash device type (e.g. m25p80 vs m25p64), for use
12 * with chips that can't be queried for JEDEC or other IDs
13 *
14 * Board init code (in arch/.../mach-xxx/board-yyy.c files) can
15 * provide information about SPI flash parts (such as DataFlash) to
16 * help set up the device and its appropriate default partitioning.
17 *
18 * Note that for DataFlash, sizes for pages, blocks, and sectors are
19 * rarely powers of two; and partitions should be sector-aligned.
20 */
21struct flash_platform_data {
22 char *name;
23 struct mtd_partition *parts;
24 unsigned int nr_parts;
25
26 char *type;
27
28 /* we'll likely add more ... use JEDEC IDs, etc */
29};
30
31#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
new file mode 100644
index 000000000000..b05f1463a267
--- /dev/null
+++ b/include/linux/spi/spi.h
@@ -0,0 +1,668 @@
1/*
2 * Copyright (C) 2005 David Brownell
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __LINUX_SPI_H
20#define __LINUX_SPI_H
21
22/*
23 * INTERFACES between SPI master-side drivers and SPI infrastructure.
24 * (There's no SPI slave support for Linux yet...)
25 */
26extern struct bus_type spi_bus_type;
27
28/**
29 * struct spi_device - Master side proxy for an SPI slave device
30 * @dev: Driver model representation of the device.
31 * @master: SPI controller used with the device.
32 * @max_speed_hz: Maximum clock rate to be used with this chip
33 * (on this board); may be changed by the device's driver.
34 * @chip-select: Chipselect, distinguishing chips handled by "master".
35 * @mode: The spi mode defines how data is clocked out and in.
36 * This may be changed by the device's driver.
37 * @bits_per_word: Data transfers involve one or more words; word sizes
38 * like eight or 12 bits are common. In-memory wordsizes are
39 * powers of two bytes (e.g. 20 bit samples use 32 bits).
40 * This may be changed by the device's driver.
41 * @irq: Negative, or the number passed to request_irq() to receive
42 * interrupts from this device.
43 * @controller_state: Controller's runtime state
44 * @controller_data: Board-specific definitions for controller, such as
45 * FIFO initialization parameters; from board_info.controller_data
46 *
47 * An spi_device is used to interchange data between an SPI slave
48 * (usually a discrete chip) and CPU memory.
49 *
50 * In "dev", the platform_data is used to hold information about this
51 * device that's meaningful to the device's protocol driver, but not
52 * to its controller. One example might be an identifier for a chip
53 * variant with slightly different functionality.
54 */
55struct spi_device {
56 struct device dev;
57 struct spi_master *master;
58 u32 max_speed_hz;
59 u8 chip_select;
60 u8 mode;
61#define SPI_CPHA 0x01 /* clock phase */
62#define SPI_CPOL 0x02 /* clock polarity */
63#define SPI_MODE_0 (0|0) /* (original MicroWire) */
64#define SPI_MODE_1 (0|SPI_CPHA)
65#define SPI_MODE_2 (SPI_CPOL|0)
66#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
67#define SPI_CS_HIGH 0x04 /* chipselect active high? */
68 u8 bits_per_word;
69 int irq;
70 void *controller_state;
71 void *controller_data;
72 const char *modalias;
73
74 // likely need more hooks for more protocol options affecting how
75 // the controller talks to each chip, like:
76 // - bit order (default is wordwise msb-first)
77 // - memory packing (12 bit samples into low bits, others zeroed)
78 // - priority
79 // - drop chipselect after each word
80 // - chipselect delays
81 // - ...
82};
83
84static inline struct spi_device *to_spi_device(struct device *dev)
85{
86 return dev ? container_of(dev, struct spi_device, dev) : NULL;
87}
88
89/* most drivers won't need to care about device refcounting */
90static inline struct spi_device *spi_dev_get(struct spi_device *spi)
91{
92 return (spi && get_device(&spi->dev)) ? spi : NULL;
93}
94
95static inline void spi_dev_put(struct spi_device *spi)
96{
97 if (spi)
98 put_device(&spi->dev);
99}
100
101/* ctldata is for the bus_master driver's runtime state */
102static inline void *spi_get_ctldata(struct spi_device *spi)
103{
104 return spi->controller_state;
105}
106
107static inline void spi_set_ctldata(struct spi_device *spi, void *state)
108{
109 spi->controller_state = state;
110}
111
112
113struct spi_message;
114
115
116
117struct spi_driver {
118 int (*probe)(struct spi_device *spi);
119 int (*remove)(struct spi_device *spi);
120 void (*shutdown)(struct spi_device *spi);
121 int (*suspend)(struct spi_device *spi, pm_message_t mesg);
122 int (*resume)(struct spi_device *spi);
123 struct device_driver driver;
124};
125
126static inline struct spi_driver *to_spi_driver(struct device_driver *drv)
127{
128 return drv ? container_of(drv, struct spi_driver, driver) : NULL;
129}
130
131extern int spi_register_driver(struct spi_driver *sdrv);
132
133static inline void spi_unregister_driver(struct spi_driver *sdrv)
134{
135 if (!sdrv)
136 return;
137 driver_unregister(&sdrv->driver);
138}
139
140
141
142/**
143 * struct spi_master - interface to SPI master controller
144 * @cdev: class interface to this driver
145 * @bus_num: board-specific (and often SOC-specific) identifier for a
146 * given SPI controller.
147 * @num_chipselect: chipselects are used to distinguish individual
148 * SPI slaves, and are numbered from zero to num_chipselects.
149 * each slave has a chipselect signal, but it's common that not
150 * every chipselect is connected to a slave.
151 * @setup: updates the device mode and clocking records used by a
152 * device's SPI controller; protocol code may call this.
153 * @transfer: adds a message to the controller's transfer queue.
154 * @cleanup: frees controller-specific state
155 *
156 * Each SPI master controller can communicate with one or more spi_device
157 * children. These make a small bus, sharing MOSI, MISO and SCK signals
158 * but not chip select signals. Each device may be configured to use a
159 * different clock rate, since those shared signals are ignored unless
160 * the chip is selected.
161 *
162 * The driver for an SPI controller manages access to those devices through
163 * a queue of spi_message transactions, copyin data between CPU memory and
164 * an SPI slave device). For each such message it queues, it calls the
165 * message's completion function when the transaction completes.
166 */
167struct spi_master {
168 struct class_device cdev;
169
170 /* other than zero (== assign one dynamically), bus_num is fully
171 * board-specific. usually that simplifies to being SOC-specific.
172 * example: one SOC has three SPI controllers, numbered 1..3,
173 * and one board's schematics might show it using SPI-2. software
174 * would normally use bus_num=2 for that controller.
175 */
176 u16 bus_num;
177
178 /* chipselects will be integral to many controllers; some others
179 * might use board-specific GPIOs.
180 */
181 u16 num_chipselect;
182
183 /* setup mode and clock, etc (spi driver may call many times) */
184 int (*setup)(struct spi_device *spi);
185
186 /* bidirectional bulk transfers
187 *
188 * + The transfer() method may not sleep; its main role is
189 * just to add the message to the queue.
190 * + For now there's no remove-from-queue operation, or
191 * any other request management
192 * + To a given spi_device, message queueing is pure fifo
193 *
194 * + The master's main job is to process its message queue,
195 * selecting a chip then transferring data
196 * + If there are multiple spi_device children, the i/o queue
197 * arbitration algorithm is unspecified (round robin, fifo,
198 * priority, reservations, preemption, etc)
199 *
200 * + Chipselect stays active during the entire message
201 * (unless modified by spi_transfer.cs_change != 0).
202 * + The message transfers use clock and SPI mode parameters
203 * previously established by setup() for this device
204 */
205 int (*transfer)(struct spi_device *spi,
206 struct spi_message *mesg);
207
208 /* called on release() to free memory provided by spi_master */
209 void (*cleanup)(const struct spi_device *spi);
210};
211
212static inline void *spi_master_get_devdata(struct spi_master *master)
213{
214 return class_get_devdata(&master->cdev);
215}
216
217static inline void spi_master_set_devdata(struct spi_master *master, void *data)
218{
219 class_set_devdata(&master->cdev, data);
220}
221
222static inline struct spi_master *spi_master_get(struct spi_master *master)
223{
224 if (!master || !class_device_get(&master->cdev))
225 return NULL;
226 return master;
227}
228
229static inline void spi_master_put(struct spi_master *master)
230{
231 if (master)
232 class_device_put(&master->cdev);
233}
234
235
236/* the spi driver core manages memory for the spi_master classdev */
237extern struct spi_master *
238spi_alloc_master(struct device *host, unsigned size);
239
240extern int spi_register_master(struct spi_master *master);
241extern void spi_unregister_master(struct spi_master *master);
242
243extern struct spi_master *spi_busnum_to_master(u16 busnum);
244
245/*---------------------------------------------------------------------------*/
246
247/*
248 * I/O INTERFACE between SPI controller and protocol drivers
249 *
250 * Protocol drivers use a queue of spi_messages, each transferring data
251 * between the controller and memory buffers.
252 *
253 * The spi_messages themselves consist of a series of read+write transfer
254 * segments. Those segments always read the same number of bits as they
255 * write; but one or the other is easily ignored by passing a null buffer
256 * pointer. (This is unlike most types of I/O API, because SPI hardware
257 * is full duplex.)
258 *
259 * NOTE: Allocation of spi_transfer and spi_message memory is entirely
260 * up to the protocol driver, which guarantees the integrity of both (as
261 * well as the data buffers) for as long as the message is queued.
262 */
263
264/**
265 * struct spi_transfer - a read/write buffer pair
266 * @tx_buf: data to be written (dma-safe memory), or NULL
267 * @rx_buf: data to be read (dma-safe memory), or NULL
268 * @tx_dma: DMA address of tx_buf, if spi_message.is_dma_mapped
269 * @rx_dma: DMA address of rx_buf, if spi_message.is_dma_mapped
270 * @len: size of rx and tx buffers (in bytes)
271 * @cs_change: affects chipselect after this transfer completes
272 * @delay_usecs: microseconds to delay after this transfer before
273 * (optionally) changing the chipselect status, then starting
274 * the next transfer or completing this spi_message.
275 * @transfer_list: transfers are sequenced through spi_message.transfers
276 *
277 * SPI transfers always write the same number of bytes as they read.
278 * Protocol drivers should always provide rx_buf and/or tx_buf.
279 * In some cases, they may also want to provide DMA addresses for
280 * the data being transferred; that may reduce overhead, when the
281 * underlying driver uses dma.
282 *
283 * If the transmit buffer is null, undefined data will be shifted out
284 * while filling rx_buf. If the receive buffer is null, the data
285 * shifted in will be discarded. Only "len" bytes shift out (or in).
286 * It's an error to try to shift out a partial word. (For example, by
287 * shifting out three bytes with word size of sixteen or twenty bits;
288 * the former uses two bytes per word, the latter uses four bytes.)
289 *
290 * All SPI transfers start with the relevant chipselect active. Normally
291 * it stays selected until after the last transfer in a message. Drivers
292 * can affect the chipselect signal using cs_change:
293 *
294 * (i) If the transfer isn't the last one in the message, this flag is
295 * used to make the chipselect briefly go inactive in the middle of the
296 * message. Toggling chipselect in this way may be needed to terminate
297 * a chip command, letting a single spi_message perform all of group of
298 * chip transactions together.
299 *
300 * (ii) When the transfer is the last one in the message, the chip may
301 * stay selected until the next transfer. This is purely a performance
302 * hint; the controller driver may need to select a different device
303 * for the next message.
304 *
305 * The code that submits an spi_message (and its spi_transfers)
306 * to the lower layers is responsible for managing its memory.
307 * Zero-initialize every field you don't set up explicitly, to
308 * insulate against future API updates. After you submit a message
309 * and its transfers, ignore them until its completion callback.
310 */
311struct spi_transfer {
312 /* it's ok if tx_buf == rx_buf (right?)
313 * for MicroWire, one buffer must be null
314 * buffers must work with dma_*map_single() calls, unless
315 * spi_message.is_dma_mapped reports a pre-existing mapping
316 */
317 const void *tx_buf;
318 void *rx_buf;
319 unsigned len;
320
321 dma_addr_t tx_dma;
322 dma_addr_t rx_dma;
323
324 unsigned cs_change:1;
325 u16 delay_usecs;
326
327 struct list_head transfer_list;
328};
329
330/**
331 * struct spi_message - one multi-segment SPI transaction
332 * @transfers: list of transfer segments in this transaction
333 * @spi: SPI device to which the transaction is queued
334 * @is_dma_mapped: if true, the caller provided both dma and cpu virtual
335 * addresses for each transfer buffer
336 * @complete: called to report transaction completions
337 * @context: the argument to complete() when it's called
338 * @actual_length: the total number of bytes that were transferred in all
339 * successful segments
340 * @status: zero for success, else negative errno
341 * @queue: for use by whichever driver currently owns the message
342 * @state: for use by whichever driver currently owns the message
343 *
344 * An spi_message is used to execute an atomic sequence of data transfers,
345 * each represented by a struct spi_transfer. The sequence is "atomic"
346 * in the sense that no other spi_message may use that SPI bus until that
347 * sequence completes. On some systems, many such sequences can execute as
348 * as single programmed DMA transfer. On all systems, these messages are
349 * queued, and might complete after transactions to other devices. Messages
350 * sent to a given spi_device are alway executed in FIFO order.
351 *
352 * The code that submits an spi_message (and its spi_transfers)
353 * to the lower layers is responsible for managing its memory.
354 * Zero-initialize every field you don't set up explicitly, to
355 * insulate against future API updates. After you submit a message
356 * and its transfers, ignore them until its completion callback.
357 */
358struct spi_message {
359 struct list_head transfers;
360
361 struct spi_device *spi;
362
363 unsigned is_dma_mapped:1;
364
365 /* REVISIT: we might want a flag affecting the behavior of the
366 * last transfer ... allowing things like "read 16 bit length L"
367 * immediately followed by "read L bytes". Basically imposing
368 * a specific message scheduling algorithm.
369 *
370 * Some controller drivers (message-at-a-time queue processing)
371 * could provide that as their default scheduling algorithm. But
372 * others (with multi-message pipelines) could need a flag to
373 * tell them about such special cases.
374 */
375
376 /* completion is reported through a callback */
377 void (*complete)(void *context);
378 void *context;
379 unsigned actual_length;
380 int status;
381
382 /* for optional use by whatever driver currently owns the
383 * spi_message ... between calls to spi_async and then later
384 * complete(), that's the spi_master controller driver.
385 */
386 struct list_head queue;
387 void *state;
388};
389
390static inline void spi_message_init(struct spi_message *m)
391{
392 memset(m, 0, sizeof *m);
393 INIT_LIST_HEAD(&m->transfers);
394}
395
396static inline void
397spi_message_add_tail(struct spi_transfer *t, struct spi_message *m)
398{
399 list_add_tail(&t->transfer_list, &m->transfers);
400}
401
402static inline void
403spi_transfer_del(struct spi_transfer *t)
404{
405 list_del(&t->transfer_list);
406}
407
408/* It's fine to embed message and transaction structures in other data
409 * structures so long as you don't free them while they're in use.
410 */
411
412static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags)
413{
414 struct spi_message *m;
415
416 m = kzalloc(sizeof(struct spi_message)
417 + ntrans * sizeof(struct spi_transfer),
418 flags);
419 if (m) {
420 int i;
421 struct spi_transfer *t = (struct spi_transfer *)(m + 1);
422
423 INIT_LIST_HEAD(&m->transfers);
424 for (i = 0; i < ntrans; i++, t++)
425 spi_message_add_tail(t, m);
426 }
427 return m;
428}
429
430static inline void spi_message_free(struct spi_message *m)
431{
432 kfree(m);
433}
434
435/**
436 * spi_setup -- setup SPI mode and clock rate
437 * @spi: the device whose settings are being modified
438 *
439 * SPI protocol drivers may need to update the transfer mode if the
440 * device doesn't work with the mode 0 default. They may likewise need
441 * to update clock rates or word sizes from initial values. This function
442 * changes those settings, and must be called from a context that can sleep.
443 * The changes take effect the next time the device is selected and data
444 * is transferred to or from it.
445 */
446static inline int
447spi_setup(struct spi_device *spi)
448{
449 return spi->master->setup(spi);
450}
451
452
453/**
454 * spi_async -- asynchronous SPI transfer
455 * @spi: device with which data will be exchanged
456 * @message: describes the data transfers, including completion callback
457 *
458 * This call may be used in_irq and other contexts which can't sleep,
459 * as well as from task contexts which can sleep.
460 *
461 * The completion callback is invoked in a context which can't sleep.
462 * Before that invocation, the value of message->status is undefined.
463 * When the callback is issued, message->status holds either zero (to
464 * indicate complete success) or a negative error code. After that
465 * callback returns, the driver which issued the transfer request may
466 * deallocate the associated memory; it's no longer in use by any SPI
467 * core or controller driver code.
468 *
469 * Note that although all messages to a spi_device are handled in
470 * FIFO order, messages may go to different devices in other orders.
471 * Some device might be higher priority, or have various "hard" access
472 * time requirements, for example.
473 *
474 * On detection of any fault during the transfer, processing of
475 * the entire message is aborted, and the device is deselected.
476 * Until returning from the associated message completion callback,
477 * no other spi_message queued to that device will be processed.
478 * (This rule applies equally to all the synchronous transfer calls,
479 * which are wrappers around this core asynchronous primitive.)
480 */
481static inline int
482spi_async(struct spi_device *spi, struct spi_message *message)
483{
484 message->spi = spi;
485 return spi->master->transfer(spi, message);
486}
487
488/*---------------------------------------------------------------------------*/
489
490/* All these synchronous SPI transfer routines are utilities layered
491 * over the core async transfer primitive. Here, "synchronous" means
492 * they will sleep uninterruptibly until the async transfer completes.
493 */
494
495extern int spi_sync(struct spi_device *spi, struct spi_message *message);
496
497/**
498 * spi_write - SPI synchronous write
499 * @spi: device to which data will be written
500 * @buf: data buffer
501 * @len: data buffer size
502 *
503 * This writes the buffer and returns zero or a negative error code.
504 * Callable only from contexts that can sleep.
505 */
506static inline int
507spi_write(struct spi_device *spi, const u8 *buf, size_t len)
508{
509 struct spi_transfer t = {
510 .tx_buf = buf,
511 .len = len,
512 };
513 struct spi_message m;
514
515 spi_message_init(&m);
516 spi_message_add_tail(&t, &m);
517 return spi_sync(spi, &m);
518}
519
520/**
521 * spi_read - SPI synchronous read
522 * @spi: device from which data will be read
523 * @buf: data buffer
524 * @len: data buffer size
525 *
526 * This writes the buffer and returns zero or a negative error code.
527 * Callable only from contexts that can sleep.
528 */
529static inline int
530spi_read(struct spi_device *spi, u8 *buf, size_t len)
531{
532 struct spi_transfer t = {
533 .rx_buf = buf,
534 .len = len,
535 };
536 struct spi_message m;
537
538 spi_message_init(&m);
539 spi_message_add_tail(&t, &m);
540 return spi_sync(spi, &m);
541}
542
543/* this copies txbuf and rxbuf data; for small transfers only! */
544extern int spi_write_then_read(struct spi_device *spi,
545 const u8 *txbuf, unsigned n_tx,
546 u8 *rxbuf, unsigned n_rx);
547
548/**
549 * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read
550 * @spi: device with which data will be exchanged
551 * @cmd: command to be written before data is read back
552 *
553 * This returns the (unsigned) eight bit number returned by the
554 * device, or else a negative error code. Callable only from
555 * contexts that can sleep.
556 */
557static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)
558{
559 ssize_t status;
560 u8 result;
561
562 status = spi_write_then_read(spi, &cmd, 1, &result, 1);
563
564 /* return negative errno or unsigned value */
565 return (status < 0) ? status : result;
566}
567
568/**
569 * spi_w8r16 - SPI synchronous 8 bit write followed by 16 bit read
570 * @spi: device with which data will be exchanged
571 * @cmd: command to be written before data is read back
572 *
573 * This returns the (unsigned) sixteen bit number returned by the
574 * device, or else a negative error code. Callable only from
575 * contexts that can sleep.
576 *
577 * The number is returned in wire-order, which is at least sometimes
578 * big-endian.
579 */
580static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
581{
582 ssize_t status;
583 u16 result;
584
585 status = spi_write_then_read(spi, &cmd, 1, (u8 *) &result, 2);
586
587 /* return negative errno or unsigned value */
588 return (status < 0) ? status : result;
589}
590
591/*---------------------------------------------------------------------------*/
592
593/*
594 * INTERFACE between board init code and SPI infrastructure.
595 *
596 * No SPI driver ever sees these SPI device table segments, but
597 * it's how the SPI core (or adapters that get hotplugged) grows
598 * the driver model tree.
599 *
600 * As a rule, SPI devices can't be probed. Instead, board init code
601 * provides a table listing the devices which are present, with enough
602 * information to bind and set up the device's driver. There's basic
603 * support for nonstatic configurations too; enough to handle adding
604 * parport adapters, or microcontrollers acting as USB-to-SPI bridges.
605 */
606
607/* board-specific information about each SPI device */
608struct spi_board_info {
609 /* the device name and module name are coupled, like platform_bus;
610 * "modalias" is normally the driver name.
611 *
612 * platform_data goes to spi_device.dev.platform_data,
613 * controller_data goes to spi_device.controller_data,
614 * irq is copied too
615 */
616 char modalias[KOBJ_NAME_LEN];
617 const void *platform_data;
618 void *controller_data;
619 int irq;
620
621 /* slower signaling on noisy or low voltage boards */
622 u32 max_speed_hz;
623
624
625 /* bus_num is board specific and matches the bus_num of some
626 * spi_master that will probably be registered later.
627 *
628 * chip_select reflects how this chip is wired to that master;
629 * it's less than num_chipselect.
630 */
631 u16 bus_num;
632 u16 chip_select;
633
634 /* ... may need additional spi_device chip config data here.
635 * avoid stuff protocol drivers can set; but include stuff
636 * needed to behave without being bound to a driver:
637 * - chipselect polarity
638 * - quirks like clock rate mattering when not selected
639 */
640};
641
642#ifdef CONFIG_SPI
643extern int
644spi_register_board_info(struct spi_board_info const *info, unsigned n);
645#else
646/* board init code may ignore whether SPI is configured or not */
647static inline int
648spi_register_board_info(struct spi_board_info const *info, unsigned n)
649 { return 0; }
650#endif
651
652
653/* If you're hotplugging an adapter with devices (parport, usb, etc)
654 * use spi_new_device() to describe each device. You can also call
655 * spi_unregister_device() to start making that device vanish, but
656 * normally that would be handled by spi_unregister_master().
657 */
658extern struct spi_device *
659spi_new_device(struct spi_master *, struct spi_board_info *);
660
661static inline void
662spi_unregister_device(struct spi_device *spi)
663{
664 if (spi)
665 device_unregister(&spi->dev);
666}
667
668#endif /* __LINUX_SPI_H */
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
new file mode 100644
index 000000000000..c961fe9bf3eb
--- /dev/null
+++ b/include/linux/spi/spi_bitbang.h
@@ -0,0 +1,135 @@
1#ifndef __SPI_BITBANG_H
2#define __SPI_BITBANG_H
3
4/*
5 * Mix this utility code with some glue code to get one of several types of
6 * simple SPI master driver. Two do polled word-at-a-time I/O:
7 *
8 * - GPIO/parport bitbangers. Provide chipselect() and txrx_word[](),
9 * expanding the per-word routines from the inline templates below.
10 *
11 * - Drivers for controllers resembling bare shift registers. Provide
12 * chipselect() and txrx_word[](), with custom setup()/cleanup() methods
13 * that use your controller's clock and chipselect registers.
14 *
15 * Some hardware works well with requests at spi_transfer scope:
16 *
17 * - Drivers leveraging smarter hardware, with fifos or DMA; or for half
18 * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(),
19 * and custom setup()/cleanup() methods.
20 */
21struct spi_bitbang {
22 struct workqueue_struct *workqueue;
23 struct work_struct work;
24
25 spinlock_t lock;
26 struct list_head queue;
27 u8 busy;
28 u8 shutdown;
29 u8 use_dma;
30
31 struct spi_master *master;
32
33 void (*chipselect)(struct spi_device *spi, int is_on);
34#define BITBANG_CS_ACTIVE 1 /* normally nCS, active low */
35#define BITBANG_CS_INACTIVE 0
36
37 /* txrx_bufs() may handle dma mapping for transfers that don't
38 * already have one (transfer.{tx,rx}_dma is zero), or use PIO
39 */
40 int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
41
42 /* txrx_word[SPI_MODE_*]() just looks like a shift register */
43 u32 (*txrx_word[4])(struct spi_device *spi,
44 unsigned nsecs,
45 u32 word, u8 bits);
46};
47
48/* you can call these default bitbang->master methods from your custom
49 * methods, if you like.
50 */
51extern int spi_bitbang_setup(struct spi_device *spi);
52extern void spi_bitbang_cleanup(const struct spi_device *spi);
53extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m);
54
55/* start or stop queue processing */
56extern int spi_bitbang_start(struct spi_bitbang *spi);
57extern int spi_bitbang_stop(struct spi_bitbang *spi);
58
59#endif /* __SPI_BITBANG_H */
60
61/*-------------------------------------------------------------------------*/
62
63#ifdef EXPAND_BITBANG_TXRX
64
65/*
66 * The code that knows what GPIO pins do what should have declared four
67 * functions, ideally as inlines, before #defining EXPAND_BITBANG_TXRX
68 * and including this header:
69 *
70 * void setsck(struct spi_device *, int is_on);
71 * void setmosi(struct spi_device *, int is_on);
72 * int getmiso(struct spi_device *);
73 * void spidelay(unsigned);
74 *
75 * A non-inlined routine would call bitbang_txrx_*() routines. The
76 * main loop could easily compile down to a handful of instructions,
77 * especially if the delay is a NOP (to run at peak speed).
78 *
79 * Since this is software, the timings may not be exactly what your board's
80 * chips need ... there may be several reasons you'd need to tweak timings
81 * in these routines, not just make to make it faster or slower to match a
82 * particular CPU clock rate.
83 */
84
85static inline u32
86bitbang_txrx_be_cpha0(struct spi_device *spi,
87 unsigned nsecs, unsigned cpol,
88 u32 word, u8 bits)
89{
90 /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
91
92 /* clock starts at inactive polarity */
93 for (word <<= (32 - bits); likely(bits); bits--) {
94
95 /* setup MSB (to slave) on trailing edge */
96 setmosi(spi, word & (1 << 31));
97 spidelay(nsecs); /* T(setup) */
98
99 setsck(spi, !cpol);
100 spidelay(nsecs);
101
102 /* sample MSB (from slave) on leading edge */
103 word <<= 1;
104 word |= getmiso(spi);
105 setsck(spi, cpol);
106 }
107 return word;
108}
109
110static inline u32
111bitbang_txrx_be_cpha1(struct spi_device *spi,
112 unsigned nsecs, unsigned cpol,
113 u32 word, u8 bits)
114{
115 /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */
116
117 /* clock starts at inactive polarity */
118 for (word <<= (32 - bits); likely(bits); bits--) {
119
120 /* setup MSB (to slave) on leading edge */
121 setsck(spi, !cpol);
122 setmosi(spi, word & (1 << 31));
123 spidelay(nsecs); /* T(setup) */
124
125 setsck(spi, cpol);
126 spidelay(nsecs);
127
128 /* sample MSB (from slave) on trailing edge */
129 word <<= 1;
130 word |= getmiso(spi);
131 }
132 return word;
133}
134
135#endif /* EXPAND_BITBANG_TXRX */
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 0e9682c9def5..799be6747944 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -59,8 +59,7 @@
59/* 59/*
60 * Must define these before including other files, inline functions need them 60 * Must define these before including other files, inline functions need them
61 */ 61 */
62#define LOCK_SECTION_NAME \ 62#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME
63 ".text.lock." __stringify(KBUILD_BASENAME)
64 63
65#define LOCK_SECTION_START(extra) \ 64#define LOCK_SECTION_START(extra) \
66 ".subsection 1\n\t" \ 65 ".subsection 1\n\t" \
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h
index def2d173a8db..04135b0e198e 100644
--- a/include/linux/spinlock_types_up.h
+++ b/include/linux/spinlock_types_up.h
@@ -22,30 +22,16 @@ typedef struct {
22 22
23#else 23#else
24 24
25/*
26 * All gcc 2.95 versions and early versions of 2.96 have a nasty bug
27 * with empty initializers.
28 */
29#if (__GNUC__ > 2)
30typedef struct { } raw_spinlock_t; 25typedef struct { } raw_spinlock_t;
31 26
32#define __RAW_SPIN_LOCK_UNLOCKED { } 27#define __RAW_SPIN_LOCK_UNLOCKED { }
33#else
34typedef struct { int gcc_is_buggy; } raw_spinlock_t;
35#define __RAW_SPIN_LOCK_UNLOCKED (raw_spinlock_t) { 0 }
36#endif
37 28
38#endif 29#endif
39 30
40#if (__GNUC__ > 2)
41typedef struct { 31typedef struct {
42 /* no debug version on UP */ 32 /* no debug version on UP */
43} raw_rwlock_t; 33} raw_rwlock_t;
44 34
45#define __RAW_RW_LOCK_UNLOCKED { } 35#define __RAW_RW_LOCK_UNLOCKED { }
46#else
47typedef struct { int gcc_is_buggy; } raw_rwlock_t;
48#define __RAW_RW_LOCK_UNLOCKED (raw_rwlock_t) { 0 }
49#endif
50 36
51#endif /* __LINUX_SPINLOCK_TYPES_UP_H */ 37#endif /* __LINUX_SPINLOCK_TYPES_UP_H */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index ab151bbb66df..f147e6b84332 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -49,7 +49,6 @@ struct rpc_clnt {
49 49
50 unsigned int cl_softrtry : 1,/* soft timeouts */ 50 unsigned int cl_softrtry : 1,/* soft timeouts */
51 cl_intr : 1,/* interruptible */ 51 cl_intr : 1,/* interruptible */
52 cl_chatty : 1,/* be verbose */
53 cl_autobind : 1,/* use getport() */ 52 cl_autobind : 1,/* use getport() */
54 cl_oneshot : 1,/* dispose after use */ 53 cl_oneshot : 1,/* dispose after use */
55 cl_dead : 1;/* abandoned */ 54 cl_dead : 1;/* abandoned */
@@ -126,7 +125,8 @@ int rpc_register(u32, u32, int, unsigned short, int *);
126void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 125void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
127 126
128int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 127int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
129 int flags, rpc_action callback, void *clntdata); 128 int flags, const struct rpc_call_ops *tk_ops,
129 void *calldata);
130int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, 130int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
131 int flags); 131 int flags);
132void rpc_restart_call(struct rpc_task *); 132void rpc_restart_call(struct rpc_task *);
@@ -134,6 +134,7 @@ void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset);
134void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset); 134void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset);
135void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 135void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
136size_t rpc_max_payload(struct rpc_clnt *); 136size_t rpc_max_payload(struct rpc_clnt *);
137void rpc_force_rebind(struct rpc_clnt *);
137int rpc_ping(struct rpc_clnt *clnt, int flags); 138int rpc_ping(struct rpc_clnt *clnt, int flags);
138 139
139static __inline__ 140static __inline__
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h
index 0beb2cf00a84..336e218c2782 100644
--- a/include/linux/sunrpc/gss_spkm3.h
+++ b/include/linux/sunrpc/gss_spkm3.h
@@ -48,7 +48,7 @@ u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struc
48#define CKSUMTYPE_RSA_MD5 0x0007 48#define CKSUMTYPE_RSA_MD5 0x0007
49 49
50s32 make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, 50s32 make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
51 struct xdr_netobj *cksum); 51 int body_offset, struct xdr_netobj *cksum);
52void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits); 52void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits);
53int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, 53int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen,
54 int explen); 54 int explen);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 4d77e90d0b30..8b25629accd8 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -27,6 +27,7 @@ struct rpc_message {
27 struct rpc_cred * rpc_cred; /* Credentials */ 27 struct rpc_cred * rpc_cred; /* Credentials */
28}; 28};
29 29
30struct rpc_call_ops;
30struct rpc_wait_queue; 31struct rpc_wait_queue;
31struct rpc_wait { 32struct rpc_wait {
32 struct list_head list; /* wait queue links */ 33 struct list_head list; /* wait queue links */
@@ -41,6 +42,7 @@ struct rpc_task {
41#ifdef RPC_DEBUG 42#ifdef RPC_DEBUG
42 unsigned long tk_magic; /* 0xf00baa */ 43 unsigned long tk_magic; /* 0xf00baa */
43#endif 44#endif
45 atomic_t tk_count; /* Reference count */
44 struct list_head tk_task; /* global list of tasks */ 46 struct list_head tk_task; /* global list of tasks */
45 struct rpc_clnt * tk_client; /* RPC client */ 47 struct rpc_clnt * tk_client; /* RPC client */
46 struct rpc_rqst * tk_rqstp; /* RPC request */ 48 struct rpc_rqst * tk_rqstp; /* RPC request */
@@ -50,8 +52,6 @@ struct rpc_task {
50 * RPC call state 52 * RPC call state
51 */ 53 */
52 struct rpc_message tk_msg; /* RPC call info */ 54 struct rpc_message tk_msg; /* RPC call info */
53 __u32 * tk_buffer; /* XDR buffer */
54 size_t tk_bufsize;
55 __u8 tk_garb_retry; 55 __u8 tk_garb_retry;
56 __u8 tk_cred_retry; 56 __u8 tk_cred_retry;
57 57
@@ -61,13 +61,12 @@ struct rpc_task {
61 * timeout_fn to be executed by timer bottom half 61 * timeout_fn to be executed by timer bottom half
62 * callback to be executed after waking up 62 * callback to be executed after waking up
63 * action next procedure for async tasks 63 * action next procedure for async tasks
64 * exit exit async task and report to caller 64 * tk_ops caller callbacks
65 */ 65 */
66 void (*tk_timeout_fn)(struct rpc_task *); 66 void (*tk_timeout_fn)(struct rpc_task *);
67 void (*tk_callback)(struct rpc_task *); 67 void (*tk_callback)(struct rpc_task *);
68 void (*tk_action)(struct rpc_task *); 68 void (*tk_action)(struct rpc_task *);
69 void (*tk_exit)(struct rpc_task *); 69 const struct rpc_call_ops *tk_ops;
70 void (*tk_release)(struct rpc_task *);
71 void * tk_calldata; 70 void * tk_calldata;
72 71
73 /* 72 /*
@@ -78,7 +77,6 @@ struct rpc_task {
78 struct timer_list tk_timer; /* kernel timer */ 77 struct timer_list tk_timer; /* kernel timer */
79 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 78 unsigned long tk_timeout; /* timeout for rpc_sleep() */
80 unsigned short tk_flags; /* misc flags */ 79 unsigned short tk_flags; /* misc flags */
81 unsigned char tk_active : 1;/* Task has been activated */
82 unsigned char tk_priority : 2;/* Task priority */ 80 unsigned char tk_priority : 2;/* Task priority */
83 unsigned long tk_runstate; /* Task run status */ 81 unsigned long tk_runstate; /* Task run status */
84 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 82 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
@@ -111,6 +109,13 @@ struct rpc_task {
111 109
112typedef void (*rpc_action)(struct rpc_task *); 110typedef void (*rpc_action)(struct rpc_task *);
113 111
112struct rpc_call_ops {
113 void (*rpc_call_prepare)(struct rpc_task *, void *);
114 void (*rpc_call_done)(struct rpc_task *, void *);
115 void (*rpc_release)(void *);
116};
117
118
114/* 119/*
115 * RPC task flags 120 * RPC task flags
116 */ 121 */
@@ -129,7 +134,6 @@ typedef void (*rpc_action)(struct rpc_task *);
129#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 134#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
130#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) 135#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
131#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 136#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
132#define RPC_IS_ACTIVATED(t) ((t)->tk_active)
133#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL) 137#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL)
134#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) 138#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT)
135#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR) 139#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR)
@@ -138,6 +142,7 @@ typedef void (*rpc_action)(struct rpc_task *);
138#define RPC_TASK_QUEUED 1 142#define RPC_TASK_QUEUED 1
139#define RPC_TASK_WAKEUP 2 143#define RPC_TASK_WAKEUP 2
140#define RPC_TASK_HAS_TIMER 3 144#define RPC_TASK_HAS_TIMER 3
145#define RPC_TASK_ACTIVE 4
141 146
142#define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) 147#define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
143#define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) 148#define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
@@ -168,6 +173,15 @@ typedef void (*rpc_action)(struct rpc_task *);
168 smp_mb__after_clear_bit(); \ 173 smp_mb__after_clear_bit(); \
169 } while (0) 174 } while (0)
170 175
176#define RPC_IS_ACTIVATED(t) (test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate))
177#define rpc_set_active(t) (set_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate))
178#define rpc_clear_active(t) \
179 do { \
180 smp_mb__before_clear_bit(); \
181 clear_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate); \
182 smp_mb__after_clear_bit(); \
183 } while(0)
184
171/* 185/*
172 * Task priorities. 186 * Task priorities.
173 * Note: if you change these, you must also change 187 * Note: if you change these, you must also change
@@ -228,11 +242,16 @@ struct rpc_wait_queue {
228/* 242/*
229 * Function prototypes 243 * Function prototypes
230 */ 244 */
231struct rpc_task *rpc_new_task(struct rpc_clnt *, rpc_action, int flags); 245struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags,
246 const struct rpc_call_ops *ops, void *data);
247struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
248 const struct rpc_call_ops *ops, void *data);
232struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); 249struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent);
233void rpc_init_task(struct rpc_task *, struct rpc_clnt *, 250void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
234 rpc_action exitfunc, int flags); 251 int flags, const struct rpc_call_ops *ops,
252 void *data);
235void rpc_release_task(struct rpc_task *); 253void rpc_release_task(struct rpc_task *);
254void rpc_exit_task(struct rpc_task *);
236void rpc_killall_tasks(struct rpc_clnt *); 255void rpc_killall_tasks(struct rpc_clnt *);
237int rpc_execute(struct rpc_task *); 256int rpc_execute(struct rpc_task *);
238void rpc_run_child(struct rpc_task *parent, struct rpc_task *child, 257void rpc_run_child(struct rpc_task *parent, struct rpc_task *child,
@@ -247,9 +266,11 @@ struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
247void rpc_wake_up_status(struct rpc_wait_queue *, int); 266void rpc_wake_up_status(struct rpc_wait_queue *, int);
248void rpc_delay(struct rpc_task *, unsigned long); 267void rpc_delay(struct rpc_task *, unsigned long);
249void * rpc_malloc(struct rpc_task *, size_t); 268void * rpc_malloc(struct rpc_task *, size_t);
269void rpc_free(struct rpc_task *);
250int rpciod_up(void); 270int rpciod_up(void);
251void rpciod_down(void); 271void rpciod_down(void);
252void rpciod_wake_up(void); 272void rpciod_wake_up(void);
273int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
253#ifdef RPC_DEBUG 274#ifdef RPC_DEBUG
254void rpc_show_tasks(void); 275void rpc_show_tasks(void);
255#endif 276#endif
@@ -259,7 +280,12 @@ void rpc_destroy_mempool(void);
259static inline void rpc_exit(struct rpc_task *task, int status) 280static inline void rpc_exit(struct rpc_task *task, int status)
260{ 281{
261 task->tk_status = status; 282 task->tk_status = status;
262 task->tk_action = NULL; 283 task->tk_action = rpc_exit_task;
284}
285
286static inline int rpc_wait_for_completion_task(struct rpc_task *task)
287{
288 return __rpc_wait_for_completion_task(task, NULL);
263} 289}
264 290
265#ifdef RPC_DEBUG 291#ifdef RPC_DEBUG
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 5da968729cf8..84c35d42d250 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -91,7 +91,6 @@ struct xdr_buf {
91u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len); 91u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len);
92u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len); 92u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len);
93u32 * xdr_encode_string(u32 *p, const char *s); 93u32 * xdr_encode_string(u32 *p, const char *s);
94u32 * xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen);
95u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen); 94u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen);
96u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *); 95u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *);
97u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *); 96u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *);
@@ -135,11 +134,6 @@ xdr_adjust_iovec(struct kvec *iov, u32 *p)
135} 134}
136 135
137/* 136/*
138 * Maximum number of iov's we use.
139 */
140#define MAX_IOVEC (12)
141
142/*
143 * XDR buffer helper functions 137 * XDR buffer helper functions
144 */ 138 */
145extern void xdr_shift_buf(struct xdr_buf *, size_t); 139extern void xdr_shift_buf(struct xdr_buf *, size_t);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 3b8b6e823c70..6ef99b14ff09 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -79,21 +79,19 @@ struct rpc_rqst {
79 void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */ 79 void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */
80 struct list_head rq_list; 80 struct list_head rq_list;
81 81
82 __u32 * rq_buffer; /* XDR encode buffer */
83 size_t rq_bufsize;
84
82 struct xdr_buf rq_private_buf; /* The receive buffer 85 struct xdr_buf rq_private_buf; /* The receive buffer
83 * used in the softirq. 86 * used in the softirq.
84 */ 87 */
85 unsigned long rq_majortimeo; /* major timeout alarm */ 88 unsigned long rq_majortimeo; /* major timeout alarm */
86 unsigned long rq_timeout; /* Current timeout value */ 89 unsigned long rq_timeout; /* Current timeout value */
87 unsigned int rq_retries; /* # of retries */ 90 unsigned int rq_retries; /* # of retries */
88 /*
89 * For authentication (e.g. auth_des)
90 */
91 u32 rq_creddata[2];
92 91
93 /* 92 /*
94 * Partial send handling 93 * Partial send handling
95 */ 94 */
96
97 u32 rq_bytes_sent; /* Bytes we have sent */ 95 u32 rq_bytes_sent; /* Bytes we have sent */
98 96
99 unsigned long rq_xtime; /* when transmitted */ 97 unsigned long rq_xtime; /* when transmitted */
@@ -106,7 +104,10 @@ struct rpc_xprt_ops {
106 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 104 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
107 int (*reserve_xprt)(struct rpc_task *task); 105 int (*reserve_xprt)(struct rpc_task *task);
108 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 106 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
107 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
109 void (*connect)(struct rpc_task *task); 108 void (*connect)(struct rpc_task *task);
109 void * (*buf_alloc)(struct rpc_task *task, size_t size);
110 void (*buf_free)(struct rpc_task *task);
110 int (*send_request)(struct rpc_task *task); 111 int (*send_request)(struct rpc_task *task);
111 void (*set_retrans_timeout)(struct rpc_task *task); 112 void (*set_retrans_timeout)(struct rpc_task *task);
112 void (*timer)(struct rpc_task *task); 113 void (*timer)(struct rpc_task *task);
@@ -253,6 +254,7 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to);
253#define XPRT_LOCKED (0) 254#define XPRT_LOCKED (0)
254#define XPRT_CONNECTED (1) 255#define XPRT_CONNECTED (1)
255#define XPRT_CONNECTING (2) 256#define XPRT_CONNECTING (2)
257#define XPRT_CLOSE_WAIT (3)
256 258
257static inline void xprt_set_connected(struct rpc_xprt *xprt) 259static inline void xprt_set_connected(struct rpc_xprt *xprt)
258{ 260{
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index a61c04f804b2..5dc94e777fab 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -14,11 +14,7 @@
14typedef struct pbe { 14typedef struct pbe {
15 unsigned long address; /* address of the copy */ 15 unsigned long address; /* address of the copy */
16 unsigned long orig_address; /* original address of page */ 16 unsigned long orig_address; /* original address of page */
17 swp_entry_t swap_address; 17 struct pbe *next;
18
19 struct pbe *next; /* also used as scratch space at
20 * end of page (see link, diskpage)
21 */
22} suspend_pagedir_t; 18} suspend_pagedir_t;
23 19
24#define for_each_pbe(pbe, pblist) \ 20#define for_each_pbe(pbe, pblist) \
@@ -77,6 +73,6 @@ unsigned long get_safe_page(gfp_t gfp_mask);
77 * XXX: We try to keep some more pages free so that I/O operations succeed 73 * XXX: We try to keep some more pages free so that I/O operations succeed
78 * without paging. Might this be more? 74 * without paging. Might this be more?
79 */ 75 */
80#define PAGES_FOR_IO 512 76#define PAGES_FOR_IO 1024
81 77
82#endif /* _LINUX_SWSUSP_H */ 78#endif /* _LINUX_SWSUSP_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 508668f840b6..e92054d6530b 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -172,10 +172,21 @@ extern void swap_setup(void);
172 172
173/* linux/mm/vmscan.c */ 173/* linux/mm/vmscan.c */
174extern int try_to_free_pages(struct zone **, gfp_t); 174extern int try_to_free_pages(struct zone **, gfp_t);
175extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
176extern int shrink_all_memory(int); 175extern int shrink_all_memory(int);
177extern int vm_swappiness; 176extern int vm_swappiness;
178 177
178#ifdef CONFIG_MIGRATION
179extern int isolate_lru_page(struct page *p);
180extern int putback_lru_pages(struct list_head *l);
181extern int migrate_pages(struct list_head *l, struct list_head *t,
182 struct list_head *moved, struct list_head *failed);
183#else
184static inline int isolate_lru_page(struct page *p) { return -ENOSYS; }
185static inline int putback_lru_pages(struct list_head *l) { return 0; }
186static inline int migrate_pages(struct list_head *l, struct list_head *t,
187 struct list_head *moved, struct list_head *failed) { return -ENOSYS; }
188#endif
189
179#ifdef CONFIG_MMU 190#ifdef CONFIG_MMU
180/* linux/mm/shmem.c */ 191/* linux/mm/shmem.c */
181extern int shmem_unuse(swp_entry_t entry, struct page *page); 192extern int shmem_unuse(swp_entry_t entry, struct page *page);
@@ -193,7 +204,7 @@ extern int rw_swap_page_sync(int, swp_entry_t, struct page *);
193extern struct address_space swapper_space; 204extern struct address_space swapper_space;
194#define total_swapcache_pages swapper_space.nrpages 205#define total_swapcache_pages swapper_space.nrpages
195extern void show_swap_cache_info(void); 206extern void show_swap_cache_info(void);
196extern int add_to_swap(struct page *); 207extern int add_to_swap(struct page *, gfp_t);
197extern void __delete_from_swap_cache(struct page *); 208extern void __delete_from_swap_cache(struct page *);
198extern void delete_from_swap_cache(struct page *); 209extern void delete_from_swap_cache(struct page *);
199extern int move_to_swap_cache(struct page *, swp_entry_t); 210extern int move_to_swap_cache(struct page *, swp_entry_t);
@@ -210,6 +221,7 @@ extern unsigned int nr_swapfiles;
210extern struct swap_info_struct swap_info[]; 221extern struct swap_info_struct swap_info[];
211extern void si_swapinfo(struct sysinfo *); 222extern void si_swapinfo(struct sysinfo *);
212extern swp_entry_t get_swap_page(void); 223extern swp_entry_t get_swap_page(void);
224extern swp_entry_t get_swap_page_of_type(int type);
213extern int swap_duplicate(swp_entry_t); 225extern int swap_duplicate(swp_entry_t);
214extern int valid_swaphandles(swp_entry_t, unsigned long *); 226extern int valid_swaphandles(swp_entry_t, unsigned long *);
215extern void swap_free(swp_entry_t); 227extern void swap_free(swp_entry_t);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 763bd290f28d..1b7cd8d1a71b 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * SyncLink Multiprotocol Serial Adapter Driver 2 * SyncLink Multiprotocol Serial Adapter Driver
3 * 3 *
4 * $Id: synclink.h,v 3.6 2002/02/20 21:58:20 paulkf Exp $ 4 * $Id: synclink.h,v 3.10 2005/11/08 19:50:54 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -128,10 +128,14 @@
128#define MGSL_BUS_TYPE_EISA 2 128#define MGSL_BUS_TYPE_EISA 2
129#define MGSL_BUS_TYPE_PCI 5 129#define MGSL_BUS_TYPE_PCI 5
130 130
131#define MGSL_INTERFACE_MASK 0xf
131#define MGSL_INTERFACE_DISABLE 0 132#define MGSL_INTERFACE_DISABLE 0
132#define MGSL_INTERFACE_RS232 1 133#define MGSL_INTERFACE_RS232 1
133#define MGSL_INTERFACE_V35 2 134#define MGSL_INTERFACE_V35 2
134#define MGSL_INTERFACE_RS422 3 135#define MGSL_INTERFACE_RS422 3
136#define MGSL_INTERFACE_RTS_EN 0x10
137#define MGSL_INTERFACE_LL 0x20
138#define MGSL_INTERFACE_RL 0x40
135 139
136typedef struct _MGSL_PARAMS 140typedef struct _MGSL_PARAMS
137{ 141{
@@ -163,6 +167,9 @@ typedef struct _MGSL_PARAMS
163#define SYNCLINK_DEVICE_ID 0x0010 167#define SYNCLINK_DEVICE_ID 0x0010
164#define MGSCC_DEVICE_ID 0x0020 168#define MGSCC_DEVICE_ID 0x0020
165#define SYNCLINK_SCA_DEVICE_ID 0x0030 169#define SYNCLINK_SCA_DEVICE_ID 0x0030
170#define SYNCLINK_GT_DEVICE_ID 0x0070
171#define SYNCLINK_GT4_DEVICE_ID 0x0080
172#define SYNCLINK_AC_DEVICE_ID 0x0090
166#define MGSL_MAX_SERIAL_NUMBER 30 173#define MGSL_MAX_SERIAL_NUMBER 30
167 174
168/* 175/*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c7007b1db91d..3eed47347013 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -511,5 +511,12 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
511asmlinkage long sys_ioprio_get(int which, int who); 511asmlinkage long sys_ioprio_get(int which, int who);
512asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask, 512asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
513 unsigned long maxnode); 513 unsigned long maxnode);
514asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
515 const unsigned long __user *from, const unsigned long __user *to);
516
517asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
518 __u32 __user *ustatus);
519asmlinkage long sys_spu_create(const char __user *name,
520 unsigned int flags, mode_t mode);
514 521
515#endif 522#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 4be34ef8c2f7..7f472127b7b5 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -124,7 +124,7 @@ enum
124 KERN_OVERFLOWUID=46, /* int: overflow UID */ 124 KERN_OVERFLOWUID=46, /* int: overflow UID */
125 KERN_OVERFLOWGID=47, /* int: overflow GID */ 125 KERN_OVERFLOWGID=47, /* int: overflow GID */
126 KERN_SHMPATH=48, /* string: path to shm fs */ 126 KERN_SHMPATH=48, /* string: path to shm fs */
127 KERN_HOTPLUG=49, /* string: path to hotplug policy agent */ 127 KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */
128 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */ 128 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
129 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */ 129 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */
130 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ 130 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
@@ -180,6 +180,8 @@ enum
180 VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */ 180 VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */
181 VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */ 181 VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */
182 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */ 182 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */
183 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */
184 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
183}; 185};
184 186
185 187
@@ -390,6 +392,7 @@ enum
390 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, 392 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
391 NET_TCP_CONG_CONTROL=110, 393 NET_TCP_CONG_CONTROL=110,
392 NET_TCP_ABC=111, 394 NET_TCP_ABC=111,
395 NET_IPV4_IPFRAG_MAX_DIST=112,
393}; 396};
394 397
395enum { 398enum {
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0e1da6602e05..f2bb2396853f 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -55,22 +55,6 @@ struct tcphdr {
55 __u16 urg_ptr; 55 __u16 urg_ptr;
56}; 56};
57 57
58#define TCP_ACTION_FIN (1 << 7)
59
60enum {
61 TCPF_ESTABLISHED = (1 << 1),
62 TCPF_SYN_SENT = (1 << 2),
63 TCPF_SYN_RECV = (1 << 3),
64 TCPF_FIN_WAIT1 = (1 << 4),
65 TCPF_FIN_WAIT2 = (1 << 5),
66 TCPF_TIME_WAIT = (1 << 6),
67 TCPF_CLOSE = (1 << 7),
68 TCPF_CLOSE_WAIT = (1 << 8),
69 TCPF_LAST_ACK = (1 << 9),
70 TCPF_LISTEN = (1 << 10),
71 TCPF_CLOSING = (1 << 11)
72};
73
74/* 58/*
75 * The union cast uses a gcc extension to avoid aliasing problems 59 * The union cast uses a gcc extension to avoid aliasing problems
76 * (union is compatible to any of its members) 60 * (union is compatible to any of its members)
@@ -254,10 +238,9 @@ struct tcp_sock {
254 __u32 snd_wl1; /* Sequence for window update */ 238 __u32 snd_wl1; /* Sequence for window update */
255 __u32 snd_wnd; /* The window we expect to receive */ 239 __u32 snd_wnd; /* The window we expect to receive */
256 __u32 max_window; /* Maximal window ever seen from peer */ 240 __u32 max_window; /* Maximal window ever seen from peer */
257 __u32 pmtu_cookie; /* Last pmtu seen by socket */
258 __u32 mss_cache; /* Cached effective mss, not including SACKS */ 241 __u32 mss_cache; /* Cached effective mss, not including SACKS */
259 __u16 xmit_size_goal; /* Goal for segmenting output packets */ 242 __u16 xmit_size_goal; /* Goal for segmenting output packets */
260 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ 243 /* XXX Two bytes hole, try to pack */
261 244
262 __u32 window_clamp; /* Maximal window to advertise */ 245 __u32 window_clamp; /* Maximal window to advertise */
263 __u32 rcv_ssthresh; /* Current window clamp */ 246 __u32 rcv_ssthresh; /* Current window clamp */
@@ -295,8 +278,6 @@ struct tcp_sock {
295 278
296 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 279 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
297 280
298 struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */
299
300 __u32 rcv_wnd; /* Current receiver window */ 281 __u32 rcv_wnd; /* Current receiver window */
301 __u32 rcv_wup; /* rcv_nxt on last window update sent */ 282 __u32 rcv_wup; /* rcv_nxt on last window update sent */
302 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 283 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
diff --git a/include/linux/time.h b/include/linux/time.h
index 797ccd813bb0..f2aca7ec6325 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -4,7 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7#include <linux/seqlock.h> 7# include <linux/seqlock.h>
8#endif 8#endif
9 9
10#ifndef _STRUCT_TIMESPEC 10#ifndef _STRUCT_TIMESPEC
@@ -13,7 +13,7 @@ struct timespec {
13 time_t tv_sec; /* seconds */ 13 time_t tv_sec; /* seconds */
14 long tv_nsec; /* nanoseconds */ 14 long tv_nsec; /* nanoseconds */
15}; 15};
16#endif /* _STRUCT_TIMESPEC */ 16#endif
17 17
18struct timeval { 18struct timeval {
19 time_t tv_sec; /* seconds */ 19 time_t tv_sec; /* seconds */
@@ -27,93 +27,103 @@ struct timezone {
27 27
28#ifdef __KERNEL__ 28#ifdef __KERNEL__
29 29
30/* Parameters used to convert the timespec values */ 30/* Parameters used to convert the timespec values: */
31#define MSEC_PER_SEC (1000L) 31#define MSEC_PER_SEC 1000L
32#define USEC_PER_SEC (1000000L) 32#define USEC_PER_SEC 1000000L
33#define NSEC_PER_SEC (1000000000L) 33#define NSEC_PER_SEC 1000000000L
34#define NSEC_PER_USEC (1000L) 34#define NSEC_PER_USEC 1000L
35 35
36static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) 36static __inline__ int timespec_equal(struct timespec *a, struct timespec *b)
37{ 37{
38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); 38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
39} 39}
40 40
41/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. 41extern unsigned long mktime(const unsigned int year, const unsigned int mon,
42 * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 42 const unsigned int day, const unsigned int hour,
43 * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. 43 const unsigned int min, const unsigned int sec);
44 * 44
45 * [For the Julian calendar (which was used in Russia before 1917, 45extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
46 * Britain & colonies before 1752, anywhere else before 1582, 46
47 * and is still in use by some communities) leave out the 47/*
48 * -year/100+year/400 terms, and add 10.] 48 * Returns true if the timespec is norm, false if denorm:
49 *
50 * This algorithm was first published by Gauss (I think).
51 *
52 * WARNING: this function will overflow on 2106-02-07 06:28:16 on
53 * machines were long is 32-bit! (However, as time_t is signed, we
54 * will already get problems at other places on 2038-01-19 03:14:08)
55 */ 49 */
56static inline unsigned long 50#define timespec_valid(ts) \
57mktime (unsigned int year, unsigned int mon, 51 (((ts)->tv_sec >= 0) && (((unsigned) (ts)->tv_nsec) < NSEC_PER_SEC))
58 unsigned int day, unsigned int hour, 52
59 unsigned int min, unsigned int sec) 53/*
60{ 54 * 64-bit nanosec type. Large enough to span 292+ years in nanosecond
61 if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ 55 * resolution. Ought to be enough for a while.
62 mon += 12; /* Puts Feb last since it has leap day */ 56 */
63 year -= 1; 57typedef s64 nsec_t;
64 }
65
66 return (((
67 (unsigned long) (year/4 - year/100 + year/400 + 367*mon/12 + day) +
68 year*365 - 719499
69 )*24 + hour /* now have hours */
70 )*60 + min /* now have minutes */
71 )*60 + sec; /* finally seconds */
72}
73 58
74extern struct timespec xtime; 59extern struct timespec xtime;
75extern struct timespec wall_to_monotonic; 60extern struct timespec wall_to_monotonic;
76extern seqlock_t xtime_lock; 61extern seqlock_t xtime_lock;
77 62
78static inline unsigned long get_seconds(void) 63static inline unsigned long get_seconds(void)
79{ 64{
80 return xtime.tv_sec; 65 return xtime.tv_sec;
81} 66}
82 67
83struct timespec current_kernel_time(void); 68struct timespec current_kernel_time(void);
84 69
85#define CURRENT_TIME (current_kernel_time()) 70#define CURRENT_TIME (current_kernel_time())
86#define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 }) 71#define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 })
87 72
88extern void do_gettimeofday(struct timeval *tv); 73extern void do_gettimeofday(struct timeval *tv);
89extern int do_settimeofday(struct timespec *tv); 74extern int do_settimeofday(struct timespec *tv);
90extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 75extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz);
91extern void clock_was_set(void); // call when ever the clock is set 76#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
92extern int do_posix_clock_monotonic_gettime(struct timespec *tp); 77extern long do_utimes(char __user *filename, struct timeval *times);
93extern long do_utimes(char __user * filename, struct timeval * times);
94struct itimerval; 78struct itimerval;
95extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue); 79extern int do_setitimer(int which, struct itimerval *value,
80 struct itimerval *ovalue);
96extern int do_getitimer(int which, struct itimerval *value); 81extern int do_getitimer(int which, struct itimerval *value);
97extern void getnstimeofday (struct timespec *tv); 82extern void getnstimeofday(struct timespec *tv);
98extern void getnstimestamp(struct timespec *ts);
99 83
100extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 84extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
101 85
102static inline void 86/**
103set_normalized_timespec (struct timespec *ts, time_t sec, long nsec) 87 * timespec_to_ns - Convert timespec to nanoseconds
88 * @ts: pointer to the timespec variable to be converted
89 *
90 * Returns the scalar nanosecond representation of the timespec
91 * parameter.
92 */
93static inline nsec_t timespec_to_ns(const struct timespec *ts)
104{ 94{
105 while (nsec >= NSEC_PER_SEC) { 95 return ((nsec_t) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
106 nsec -= NSEC_PER_SEC;
107 ++sec;
108 }
109 while (nsec < 0) {
110 nsec += NSEC_PER_SEC;
111 --sec;
112 }
113 ts->tv_sec = sec;
114 ts->tv_nsec = nsec;
115} 96}
116 97
98/**
99 * timeval_to_ns - Convert timeval to nanoseconds
100 * @ts: pointer to the timeval variable to be converted
101 *
102 * Returns the scalar nanosecond representation of the timeval
103 * parameter.
104 */
105static inline nsec_t timeval_to_ns(const struct timeval *tv)
106{
107 return ((nsec_t) tv->tv_sec * NSEC_PER_SEC) +
108 tv->tv_usec * NSEC_PER_USEC;
109}
110
111/**
112 * ns_to_timespec - Convert nanoseconds to timespec
113 * @nsec: the nanoseconds value to be converted
114 *
115 * Returns the timespec representation of the nsec parameter.
116 */
117extern struct timespec ns_to_timespec(const nsec_t nsec);
118
119/**
120 * ns_to_timeval - Convert nanoseconds to timeval
121 * @nsec: the nanoseconds value to be converted
122 *
123 * Returns the timeval representation of the nsec parameter.
124 */
125extern struct timeval ns_to_timeval(const nsec_t nsec);
126
117#endif /* __KERNEL__ */ 127#endif /* __KERNEL__ */
118 128
119#define NFDBITS __NFDBITS 129#define NFDBITS __NFDBITS
@@ -126,49 +136,41 @@ set_normalized_timespec (struct timespec *ts, time_t sec, long nsec)
126 136
127/* 137/*
128 * Names of the interval timers, and structure 138 * Names of the interval timers, and structure
129 * defining a timer setting. 139 * defining a timer setting:
130 */ 140 */
131#define ITIMER_REAL 0 141#define ITIMER_REAL 0
132#define ITIMER_VIRTUAL 1 142#define ITIMER_VIRTUAL 1
133#define ITIMER_PROF 2 143#define ITIMER_PROF 2
134 144
135struct itimerspec { 145struct itimerspec {
136 struct timespec it_interval; /* timer period */ 146 struct timespec it_interval; /* timer period */
137 struct timespec it_value; /* timer expiration */ 147 struct timespec it_value; /* timer expiration */
138}; 148};
139 149
140struct itimerval { 150struct itimerval {
141 struct timeval it_interval; /* timer interval */ 151 struct timeval it_interval; /* timer interval */
142 struct timeval it_value; /* current value */ 152 struct timeval it_value; /* current value */
143}; 153};
144 154
145
146/* 155/*
147 * The IDs of the various system clocks (for POSIX.1b interval timers). 156 * The IDs of the various system clocks (for POSIX.1b interval timers):
148 */ 157 */
149#define CLOCK_REALTIME 0 158#define CLOCK_REALTIME 0
150#define CLOCK_MONOTONIC 1 159#define CLOCK_MONOTONIC 1
151#define CLOCK_PROCESS_CPUTIME_ID 2 160#define CLOCK_PROCESS_CPUTIME_ID 2
152#define CLOCK_THREAD_CPUTIME_ID 3 161#define CLOCK_THREAD_CPUTIME_ID 3
153#define CLOCK_REALTIME_HR 4
154#define CLOCK_MONOTONIC_HR 5
155 162
156/* 163/*
157 * The IDs of various hardware clocks 164 * The IDs of various hardware clocks:
158 */ 165 */
159 166#define CLOCK_SGI_CYCLE 10
160 167#define MAX_CLOCKS 16
161#define CLOCK_SGI_CYCLE 10 168#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
162#define MAX_CLOCKS 16 169#define CLOCKS_MONO CLOCK_MONOTONIC
163#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC | \
164 CLOCK_REALTIME_HR | CLOCK_MONOTONIC_HR)
165#define CLOCKS_MONO (CLOCK_MONOTONIC & CLOCK_MONOTONIC_HR)
166 170
167/* 171/*
168 * The various flags for setting POSIX.1b interval timers. 172 * The various flags for setting POSIX.1b interval timers:
169 */ 173 */
170 174#define TIMER_ABSTIME 0x01
171#define TIMER_ABSTIME 0x01
172
173 175
174#endif 176#endif
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 72f3a7781106..9b9877fd2505 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -96,6 +96,6 @@ static inline void add_timer(struct timer_list *timer)
96 96
97extern void init_timers(void); 97extern void init_timers(void);
98extern void run_local_timers(void); 98extern void run_local_timers(void);
99extern void it_real_fn(unsigned long); 99extern int it_real_fn(void *);
100 100
101#endif 101#endif
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
new file mode 100644
index 000000000000..243a15f54002
--- /dev/null
+++ b/include/linux/tipc.h
@@ -0,0 +1,212 @@
1/*
2 * include/linux/tipc.h: Include file for TIPC socket interface
3 *
4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _LINUX_TIPC_H_
38#define _LINUX_TIPC_H_
39
40#include <linux/types.h>
41
42/*
43 * TIPC addressing primitives
44 */
45
46struct tipc_portid {
47 __u32 ref;
48 __u32 node;
49};
50
51struct tipc_name {
52 __u32 type;
53 __u32 instance;
54};
55
56struct tipc_name_seq {
57 __u32 type;
58 __u32 lower;
59 __u32 upper;
60};
61
62static inline __u32 tipc_addr(unsigned int zone,
63 unsigned int cluster,
64 unsigned int node)
65{
66 return (zone << 24) | (cluster << 12) | node;
67}
68
69static inline unsigned int tipc_zone(__u32 addr)
70{
71 return addr >> 24;
72}
73
74static inline unsigned int tipc_cluster(__u32 addr)
75{
76 return (addr >> 12) & 0xfff;
77}
78
79static inline unsigned int tipc_node(__u32 addr)
80{
81 return addr & 0xfff;
82}
83
84/*
85 * Application-accessible port name types
86 */
87
88#define TIPC_CFG_SRV 0 /* configuration service name type */
89#define TIPC_TOP_SRV 1 /* topology service name type */
90#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */
91
92/*
93 * Publication scopes when binding port names and port name sequences
94 */
95
96#define TIPC_ZONE_SCOPE 1
97#define TIPC_CLUSTER_SCOPE 2
98#define TIPC_NODE_SCOPE 3
99
100/*
101 * Limiting values for messages
102 */
103
104#define TIPC_MAX_USER_MSG_SIZE 66000
105
106/*
107 * Message importance levels
108 */
109
110#define TIPC_LOW_IMPORTANCE 0 /* default */
111#define TIPC_MEDIUM_IMPORTANCE 1
112#define TIPC_HIGH_IMPORTANCE 2
113#define TIPC_CRITICAL_IMPORTANCE 3
114
115/*
116 * Msg rejection/connection shutdown reasons
117 */
118
119#define TIPC_OK 0
120#define TIPC_ERR_NO_NAME 1
121#define TIPC_ERR_NO_PORT 2
122#define TIPC_ERR_NO_NODE 3
123#define TIPC_ERR_OVERLOAD 4
124#define TIPC_CONN_SHUTDOWN 5
125
126/*
127 * TIPC topology subscription service definitions
128 */
129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
132#if 0
133/* The following filter options are not currently implemented */
134#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
135#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */
136#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */
137#endif
138
139#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */
140
141struct tipc_subscr {
142 struct tipc_name_seq seq; /* name sequence of interest */
143 __u32 timeout; /* subscription duration (in ms) */
144 __u32 filter; /* bitmask of filter options */
145 char usr_handle[8]; /* available for subscriber use */
146};
147
148#define TIPC_PUBLISHED 1 /* publication event */
149#define TIPC_WITHDRAWN 2 /* withdraw event */
150#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */
151
152struct tipc_event {
153 __u32 event; /* event type */
154 __u32 found_lower; /* matching name seq instances */
155 __u32 found_upper; /* " " " " */
156 struct tipc_portid port; /* associated port */
157 struct tipc_subscr s; /* associated subscription */
158};
159
160/*
161 * Socket API
162 */
163
164#ifndef AF_TIPC
165#define AF_TIPC 30
166#endif
167
168#ifndef PF_TIPC
169#define PF_TIPC AF_TIPC
170#endif
171
172#ifndef SOL_TIPC
173#define SOL_TIPC 271
174#endif
175
176#define TIPC_ADDR_NAMESEQ 1
177#define TIPC_ADDR_MCAST 1
178#define TIPC_ADDR_NAME 2
179#define TIPC_ADDR_ID 3
180
181struct sockaddr_tipc {
182 unsigned short family;
183 unsigned char addrtype;
184 signed char scope;
185 union {
186 struct tipc_portid id;
187 struct tipc_name_seq nameseq;
188 struct {
189 struct tipc_name name;
190 __u32 domain; /* 0: own zone */
191 } name;
192 } addr;
193};
194
195/*
196 * Ancillary data objects supported by recvmsg()
197 */
198
199#define TIPC_ERRINFO 1 /* error info */
200#define TIPC_RETDATA 2 /* returned data */
201#define TIPC_DESTNAME 3 /* destination name */
202
203/*
204 * TIPC-specific socket option values
205 */
206
207#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */
208#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */
209#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */
210#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */
211
212#endif
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
new file mode 100644
index 000000000000..a52c8c64a5a3
--- /dev/null
+++ b/include/linux/tipc_config.h
@@ -0,0 +1,407 @@
1/*
2 * include/linux/tipc_config.h: Include file for TIPC configuration interface
3 *
4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _LINUX_TIPC_CONFIG_H_
38#define _LINUX_TIPC_CONFIG_H_
39
40#include <linux/types.h>
41#include <linux/string.h>
42#include <asm/byteorder.h>
43
44/*
45 * Configuration
46 *
47 * All configuration management messaging involves sending a request message
48 * to the TIPC configuration service on a node, which sends a reply message
49 * back. (In the future multi-message replies may be supported.)
50 *
51 * Both request and reply messages consist of a transport header and payload.
52 * The transport header contains info about the desired operation;
53 * the payload consists of zero or more type/length/value (TLV) items
54 * which specify parameters or results for the operation.
55 *
56 * For many operations, the request and reply messages have a fixed number
57 * of TLVs (usually zero or one); however, some reply messages may return
58 * a variable number of TLVs. A failed request is denoted by the presence
59 * of an "error string" TLV in the reply message instead of the TLV(s) the
60 * reply should contain if the request succeeds.
61 */
62
63/*
64 * Public commands:
65 * May be issued by any process.
66 * Accepted by own node, or by remote node only if remote management enabled.
67 */
68
69#define TIPC_CMD_NOOP 0x0000 /* tx none, rx none */
70#define TIPC_CMD_GET_NODES 0x0001 /* tx net_addr, rx node_info(s) */
71#define TIPC_CMD_GET_MEDIA_NAMES 0x0002 /* tx none, rx media_name(s) */
72#define TIPC_CMD_GET_BEARER_NAMES 0x0003 /* tx none, rx bearer_name(s) */
73#define TIPC_CMD_GET_LINKS 0x0004 /* tx net_addr, rx link_info(s) */
74#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */
75#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */
76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */
77
78#if 0
79#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */
80#define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */
81#define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */
82#define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */
83#endif
84
85/*
86 * Protected commands:
87 * May only be issued by "network administration capable" process.
88 * Accepted by own node, or by remote node only if remote management enabled
89 * and this node is zone manager.
90 */
91
92#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */
93#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
94#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */
95#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
96#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* tx none, rx unsigned */
97#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* tx none, rx unsigned */
98#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */
99#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* tx none, rx unsigned */
100#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */
101
102#define TIPC_CMD_ENABLE_BEARER 0x4101 /* tx bearer_config, rx none */
103#define TIPC_CMD_DISABLE_BEARER 0x4102 /* tx bearer_name, rx none */
104#define TIPC_CMD_SET_LINK_TOL 0x4107 /* tx link_config, rx none */
105#define TIPC_CMD_SET_LINK_PRI 0x4108 /* tx link_config, rx none */
106#define TIPC_CMD_SET_LINK_WINDOW 0x4109 /* tx link_config, rx none */
107#define TIPC_CMD_SET_LOG_SIZE 0x410A /* tx unsigned, rx none */
108#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */
109#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */
110
111#if 0
112#define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */
113#define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */
114#define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */
115#define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */
116#endif
117
118/*
119 * Private commands:
120 * May only be issued by "network administration capable" process.
121 * Accepted by own node only; cannot be used on a remote node.
122 */
123
124#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
125#if 0
126#define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */
127#endif
128#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
129#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
130#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
131#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
132#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* tx unsigned, rx none */
133#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* tx unsigned, rx none */
134#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */
135#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* tx unsigned, rx none */
136#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */
137
138/*
139 * TLV types defined for TIPC
140 */
141
142#define TIPC_TLV_NONE 0 /* no TLV present */
143#define TIPC_TLV_VOID 1 /* empty TLV (0 data bytes)*/
144#define TIPC_TLV_UNSIGNED 2 /* 32-bit integer */
145#define TIPC_TLV_STRING 3 /* char[128] (max) */
146#define TIPC_TLV_LARGE_STRING 4 /* char[2048] (max) */
147#define TIPC_TLV_ULTRA_STRING 5 /* char[32768] (max) */
148
149#define TIPC_TLV_ERROR_STRING 16 /* char[128] containing "error code" */
150#define TIPC_TLV_NET_ADDR 17 /* 32-bit integer denoting <Z.C.N> */
151#define TIPC_TLV_MEDIA_NAME 18 /* char[TIPC_MAX_MEDIA_NAME] */
152#define TIPC_TLV_BEARER_NAME 19 /* char[TIPC_MAX_BEARER_NAME] */
153#define TIPC_TLV_LINK_NAME 20 /* char[TIPC_MAX_LINK_NAME] */
154#define TIPC_TLV_NODE_INFO 21 /* struct tipc_node_info */
155#define TIPC_TLV_LINK_INFO 22 /* struct tipc_link_info */
156#define TIPC_TLV_BEARER_CONFIG 23 /* struct tipc_bearer_config */
157#define TIPC_TLV_LINK_CONFIG 24 /* struct tipc_link_config */
158#define TIPC_TLV_NAME_TBL_QUERY 25 /* struct tipc_name_table_query */
159#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */
160
161/*
162 * Maximum sizes of TIPC bearer-related names (including terminating NUL)
163 */
164
165#define TIPC_MAX_MEDIA_NAME 16 /* format = media */
166#define TIPC_MAX_IF_NAME 16 /* format = interface */
167#define TIPC_MAX_BEARER_NAME 32 /* format = media:interface */
168#define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */
169
170/*
171 * Link priority limits (range from 0 to # priorities - 1)
172 */
173
174#define TIPC_NUM_LINK_PRI 32
175
176/*
177 * Link tolerance limits (min, default, max), in ms
178 */
179
180#define TIPC_MIN_LINK_TOL 50
181#define TIPC_DEF_LINK_TOL 1500
182#define TIPC_MAX_LINK_TOL 30000
183
184/*
185 * Link window limits (min, default, max), in packets
186 */
187
188#define TIPC_MIN_LINK_WIN 16
189#define TIPC_DEF_LINK_WIN 50
190#define TIPC_MAX_LINK_WIN 150
191
192
193struct tipc_node_info {
194 __u32 addr; /* network address of node */
195 __u32 up; /* 0=down, 1= up */
196};
197
198struct tipc_link_info {
199 __u32 dest; /* network address of peer node */
200 __u32 up; /* 0=down, 1=up */
201 char str[TIPC_MAX_LINK_NAME]; /* link name */
202};
203
204struct tipc_bearer_config {
205 __u32 priority; /* Range [1,31]. Override per link */
206 __u32 detect_scope;
207 char name[TIPC_MAX_BEARER_NAME];
208};
209
210struct tipc_link_config {
211 __u32 value;
212 char name[TIPC_MAX_LINK_NAME];
213};
214
215#define TIPC_NTQ_ALLTYPES 0x80000000
216
217struct tipc_name_table_query {
218 __u32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */
219 __u32 type; /* {t,l,u} info ignored if high bit of "depth" is set */
220 __u32 lowbound; /* (i.e. displays all entries of name table) */
221 __u32 upbound;
222};
223
224/*
225 * The error string TLV is a null-terminated string describing the cause
226 * of the request failure. To simplify error processing (and to save space)
227 * the first character of the string can be a special error code character
228 * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason.
229 */
230
231#define TIPC_CFG_TLV_ERROR "\x80" /* request contains incorrect TLV(s) */
232#define TIPC_CFG_NOT_NET_ADMIN "\x81" /* must be network administrator */
233#define TIPC_CFG_NOT_ZONE_MSTR "\x82" /* must be zone master */
234#define TIPC_CFG_NO_REMOTE "\x83" /* remote management not enabled */
235#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */
236#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */
237
238#if 0
239/* prototypes TLV structures for proposed commands */
240struct tipc_link_create {
241 __u32 domain;
242 struct tipc_media_addr peer_addr;
243 char bearer_name[TIPC_MAX_BEARER_NAME];
244};
245
246struct tipc_route_info {
247 __u32 dest;
248 __u32 router;
249};
250#endif
251
252/*
253 * A TLV consists of a descriptor, followed by the TLV value.
254 * TLV descriptor fields are stored in network byte order;
255 * TLV values must also be stored in network byte order (where applicable).
256 * TLV descriptors must be aligned to addresses which are multiple of 4,
257 * so up to 3 bytes of padding may exist at the end of the TLV value area.
258 * There must not be any padding between the TLV descriptor and its value.
259 */
260
261struct tlv_desc {
262 __u16 tlv_len; /* TLV length (descriptor + value) */
263 __u16 tlv_type; /* TLV identifier */
264};
265
266#define TLV_ALIGNTO 4
267
268#define TLV_ALIGN(datalen) (((datalen)+(TLV_ALIGNTO-1)) & ~(TLV_ALIGNTO-1))
269#define TLV_LENGTH(datalen) (sizeof(struct tlv_desc) + (datalen))
270#define TLV_SPACE(datalen) (TLV_ALIGN(TLV_LENGTH(datalen)))
271#define TLV_DATA(tlv) ((void *)((char *)(tlv) + TLV_LENGTH(0)))
272
273static inline int TLV_OK(const void *tlv, __u16 space)
274{
275 /*
276 * Would also like to check that "tlv" is a multiple of 4,
277 * but don't know how to do this in a portable way.
278 * - Tried doing (!(tlv & (TLV_ALIGNTO-1))), but GCC compiler
279 * won't allow binary "&" with a pointer.
280 * - Tried casting "tlv" to integer type, but causes warning about size
281 * mismatch when pointer is bigger than chosen type (int, long, ...).
282 */
283
284 return (space >= TLV_SPACE(0)) &&
285 (ntohs(((struct tlv_desc *)tlv)->tlv_len) <= space);
286}
287
288static inline int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type)
289{
290 return TLV_OK(tlv, space) &&
291 (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type);
292}
293
294static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len)
295{
296 struct tlv_desc *tlv_ptr;
297 int tlv_len;
298
299 tlv_len = TLV_LENGTH(len);
300 tlv_ptr = (struct tlv_desc *)tlv;
301 tlv_ptr->tlv_type = htons(type);
302 tlv_ptr->tlv_len = htons(tlv_len);
303 if (len && data)
304 memcpy(TLV_DATA(tlv_ptr), data, tlv_len);
305 return TLV_SPACE(len);
306}
307
308/*
309 * A TLV list descriptor simplifies processing of messages
310 * containing multiple TLVs.
311 */
312
313struct tlv_list_desc {
314 struct tlv_desc *tlv_ptr; /* ptr to current TLV */
315 __u32 tlv_space; /* # bytes from curr TLV to list end */
316};
317
318static inline void TLV_LIST_INIT(struct tlv_list_desc *list,
319 void *data, __u32 space)
320{
321 list->tlv_ptr = (struct tlv_desc *)data;
322 list->tlv_space = space;
323}
324
325static inline int TLV_LIST_EMPTY(struct tlv_list_desc *list)
326{
327 return (list->tlv_space == 0);
328}
329
330static inline int TLV_LIST_CHECK(struct tlv_list_desc *list, __u16 exp_type)
331{
332 return TLV_CHECK(list->tlv_ptr, list->tlv_space, exp_type);
333}
334
335static inline void *TLV_LIST_DATA(struct tlv_list_desc *list)
336{
337 return TLV_DATA(list->tlv_ptr);
338}
339
340static inline void TLV_LIST_STEP(struct tlv_list_desc *list)
341{
342 __u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len));
343
344 list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space);
345 list->tlv_space -= tlv_space;
346}
347
348/*
349 * Configuration messages exchanged via NETLINK_GENERIC use the following
350 * family id, name, version and command.
351 */
352#define TIPC_GENL_NAME "TIPC"
353#define TIPC_GENL_VERSION 0x1
354#define TIPC_GENL_CMD 0x1
355
356/*
357 * TIPC specific header used in NETLINK_GENERIC requests.
358 */
359struct tipc_genlmsghdr {
360 __u32 dest; /* Destination address */
361 __u16 cmd; /* Command */
362 __u16 reserved; /* Unused */
363};
364
365#define TIPC_GENL_HDRLEN NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr))
366
367/*
368 * Configuration messages exchanged via TIPC sockets use the TIPC configuration
369 * message header, which is defined below. This structure is analogous
370 * to the Netlink message header, but fields are stored in network byte order
371 * and no padding is permitted between the header and the message data
372 * that follows.
373 */
374
375struct tipc_cfg_msg_hdr
376{
377 __u32 tcm_len; /* Message length (including header) */
378 __u16 tcm_type; /* Command type */
379 __u16 tcm_flags; /* Additional flags */
380 char tcm_reserved[8]; /* Unused */
381};
382
383#define TCM_F_REQUEST 0x1 /* Flag: Request message */
384#define TCM_F_MORE 0x2 /* Flag: Message to be continued */
385
386#define TCM_ALIGN(datalen) (((datalen)+3) & ~3)
387#define TCM_LENGTH(datalen) (sizeof(struct tipc_cfg_msg_hdr) + datalen)
388#define TCM_SPACE(datalen) (TCM_ALIGN(TCM_LENGTH(datalen)))
389#define TCM_DATA(tcm_hdr) ((void *)((char *)(tcm_hdr) + TCM_LENGTH(0)))
390
391static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags,
392 void *data, __u16 data_len)
393{
394 struct tipc_cfg_msg_hdr *tcm_hdr;
395 int msg_len;
396
397 msg_len = TCM_LENGTH(data_len);
398 tcm_hdr = (struct tipc_cfg_msg_hdr *)msg;
399 tcm_hdr->tcm_len = htonl(msg_len);
400 tcm_hdr->tcm_type = htons(cmd);
401 tcm_hdr->tcm_flags = htons(flags);
402 if (data_len && data)
403 memcpy(TCM_DATA(msg), data, data_len);
404 return TCM_SPACE(data_len);
405}
406
407#endif
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 3df1d474e5c5..315a5163d6a0 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -86,7 +86,6 @@
86 .max_interval = 2, \ 86 .max_interval = 2, \
87 .busy_factor = 8, \ 87 .busy_factor = 8, \
88 .imbalance_pct = 110, \ 88 .imbalance_pct = 110, \
89 .cache_hot_time = 0, \
90 .cache_nice_tries = 0, \ 89 .cache_nice_tries = 0, \
91 .per_cpu_gain = 25, \ 90 .per_cpu_gain = 25, \
92 .busy_idx = 0, \ 91 .busy_idx = 0, \
@@ -117,7 +116,6 @@
117 .max_interval = 4, \ 116 .max_interval = 4, \
118 .busy_factor = 64, \ 117 .busy_factor = 64, \
119 .imbalance_pct = 125, \ 118 .imbalance_pct = 125, \
120 .cache_hot_time = (5*1000000/2), \
121 .cache_nice_tries = 1, \ 119 .cache_nice_tries = 1, \
122 .per_cpu_gain = 100, \ 120 .per_cpu_gain = 100, \
123 .busy_idx = 2, \ 121 .busy_idx = 2, \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1267f88ece6e..3787102e4b12 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,6 +23,7 @@
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <linux/tty_driver.h> 24#include <linux/tty_driver.h>
25#include <linux/tty_ldisc.h> 25#include <linux/tty_ldisc.h>
26#include <linux/screen_info.h>
26 27
27#include <asm/system.h> 28#include <asm/system.h>
28 29
@@ -37,77 +38,6 @@
37#define NR_LDISCS 16 38#define NR_LDISCS 16
38 39
39/* 40/*
40 * These are set up by the setup-routine at boot-time:
41 */
42
43struct screen_info {
44 u8 orig_x; /* 0x00 */
45 u8 orig_y; /* 0x01 */
46 u16 dontuse1; /* 0x02 -- EXT_MEM_K sits here */
47 u16 orig_video_page; /* 0x04 */
48 u8 orig_video_mode; /* 0x06 */
49 u8 orig_video_cols; /* 0x07 */
50 u16 unused2; /* 0x08 */
51 u16 orig_video_ega_bx; /* 0x0a */
52 u16 unused3; /* 0x0c */
53 u8 orig_video_lines; /* 0x0e */
54 u8 orig_video_isVGA; /* 0x0f */
55 u16 orig_video_points; /* 0x10 */
56
57 /* VESA graphic mode -- linear frame buffer */
58 u16 lfb_width; /* 0x12 */
59 u16 lfb_height; /* 0x14 */
60 u16 lfb_depth; /* 0x16 */
61 u32 lfb_base; /* 0x18 */
62 u32 lfb_size; /* 0x1c */
63 u16 dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
64 u16 lfb_linelength; /* 0x24 */
65 u8 red_size; /* 0x26 */
66 u8 red_pos; /* 0x27 */
67 u8 green_size; /* 0x28 */
68 u8 green_pos; /* 0x29 */
69 u8 blue_size; /* 0x2a */
70 u8 blue_pos; /* 0x2b */
71 u8 rsvd_size; /* 0x2c */
72 u8 rsvd_pos; /* 0x2d */
73 u16 vesapm_seg; /* 0x2e */
74 u16 vesapm_off; /* 0x30 */
75 u16 pages; /* 0x32 */
76 u16 vesa_attributes; /* 0x34 */
77 u32 capabilities; /* 0x36 */
78 /* 0x3a -- 0x3f reserved for future expansion */
79};
80
81extern struct screen_info screen_info;
82
83#define ORIG_X (screen_info.orig_x)
84#define ORIG_Y (screen_info.orig_y)
85#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
86#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
87#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
88#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
89#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
90#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
91
92#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
93#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
94#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
95#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */
96#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */
97#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
98
99#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */
100#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */
101#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */
102
103#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */
104
105#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */
106#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */
107
108#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
109
110/*
111 * This character is the same as _POSIX_VDISABLE: it cannot be used as 41 * This character is the same as _POSIX_VDISABLE: it cannot be used as
112 * a c_cc[] character, but indicates that a particular special character 42 * a c_cc[] character, but indicates that a particular special character
113 * isn't in use (eg VINTR has no character etc) 43 * isn't in use (eg VINTR has no character etc)
@@ -121,16 +51,22 @@ extern struct screen_info screen_info;
121 */ 51 */
122#define TTY_FLIPBUF_SIZE 512 52#define TTY_FLIPBUF_SIZE 512
123 53
124struct tty_flip_buffer { 54struct tty_buffer {
55 struct tty_buffer *next;
56 char *char_buf_ptr;
57 unsigned char *flag_buf_ptr;
58 int used;
59 int size;
60 /* Data points here */
61 unsigned long data[0];
62};
63
64struct tty_bufhead {
125 struct work_struct work; 65 struct work_struct work;
126 struct semaphore pty_sem; 66 struct semaphore pty_sem;
127 char *char_buf_ptr; 67 struct tty_buffer *head; /* Queue head */
128 unsigned char *flag_buf_ptr; 68 struct tty_buffer *tail; /* Active buffer */
129 int count; 69 struct tty_buffer *free; /* Free queue head */
130 int buf_num;
131 unsigned char char_buf[2*TTY_FLIPBUF_SIZE];
132 char flag_buf[2*TTY_FLIPBUF_SIZE];
133 unsigned char slop[4]; /* N.B. bug overwrites buffer by 1 */
134}; 70};
135/* 71/*
136 * The pty uses char_buf and flag_buf as a contiguous buffer 72 * The pty uses char_buf and flag_buf as a contiguous buffer
@@ -256,10 +192,11 @@ struct tty_struct {
256 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 192 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
257 unsigned char low_latency:1, warned:1; 193 unsigned char low_latency:1, warned:1;
258 unsigned char ctrl_status; 194 unsigned char ctrl_status;
195 unsigned int receive_room; /* Bytes free for queue */
259 196
260 struct tty_struct *link; 197 struct tty_struct *link;
261 struct fasync_struct *fasync; 198 struct fasync_struct *fasync;
262 struct tty_flip_buffer flip; 199 struct tty_bufhead buf;
263 int max_flip_cnt; 200 int max_flip_cnt;
264 int alt_speed; /* For magic substitution of 38400 bps */ 201 int alt_speed; /* For magic substitution of 38400 bps */
265 wait_queue_head_t write_wait; 202 wait_queue_head_t write_wait;
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index abe9bfcf226c..be1400e82482 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -1,25 +1,33 @@
1#ifndef _LINUX_TTY_FLIP_H 1#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_request_room(struct tty_struct *tty, size_t size);
5extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size);
6extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size);
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
9
4#ifdef INCLUDE_INLINE_FUNCS 10#ifdef INCLUDE_INLINE_FUNCS
5#define _INLINE_ extern 11#define _INLINE_ extern
6#else 12#else
7#define _INLINE_ static __inline__ 13#define _INLINE_ static __inline__
8#endif 14#endif
9 15
10_INLINE_ void tty_insert_flip_char(struct tty_struct *tty, 16_INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
11 unsigned char ch, char flag) 17 unsigned char ch, char flag)
12{ 18{
13 if (tty->flip.count < TTY_FLIPBUF_SIZE) { 19 struct tty_buffer *tb = tty->buf.tail;
14 tty->flip.count++; 20 if (tb && tb->used < tb->size) {
15 *tty->flip.flag_buf_ptr++ = flag; 21 tb->flag_buf_ptr[tb->used] = flag;
16 *tty->flip.char_buf_ptr++ = ch; 22 tb->char_buf_ptr[tb->used++] = ch;
23 return 1;
17 } 24 }
25 return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
18} 26}
19 27
20_INLINE_ void tty_schedule_flip(struct tty_struct *tty) 28_INLINE_ void tty_schedule_flip(struct tty_struct *tty)
21{ 29{
22 schedule_delayed_work(&tty->flip.work, 1); 30 schedule_delayed_work(&tty->buf.work, 1);
23} 31}
24 32
25#undef _INLINE_ 33#undef _INLINE_
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 6066afde5ce4..83c6e6c10ebb 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -81,14 +81,6 @@
81 * pointer of flag bytes which indicate whether a character was 81 * pointer of flag bytes which indicate whether a character was
82 * received with a parity error, etc. 82 * received with a parity error, etc.
83 * 83 *
84 * int (*receive_room)(struct tty_struct *);
85 *
86 * This function is called by the low-level tty driver to
87 * determine how many characters the line discpline can accept.
88 * The low-level driver must not send more characters than was
89 * indicated by receive_room, or the line discpline may drop
90 * those characters.
91 *
92 * void (*write_wakeup)(struct tty_struct *); 84 * void (*write_wakeup)(struct tty_struct *);
93 * 85 *
94 * This function is called by the low-level tty driver to signal 86 * This function is called by the low-level tty driver to signal
@@ -136,7 +128,6 @@ struct tty_ldisc {
136 */ 128 */
137 void (*receive_buf)(struct tty_struct *, const unsigned char *cp, 129 void (*receive_buf)(struct tty_struct *, const unsigned char *cp,
138 char *fp, int count); 130 char *fp, int count);
139 int (*receive_room)(struct tty_struct *);
140 void (*write_wakeup)(struct tty_struct *); 131 void (*write_wakeup)(struct tty_struct *);
141 132
142 struct module *owner; 133 struct module *owner;
diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h
index 46e2bb945353..36c684e1b110 100644
--- a/include/linux/udf_fs.h
+++ b/include/linux/udf_fs.h
@@ -13,11 +13,6 @@
13 * http://www.osta.org/ * http://www.ecma.ch/ 13 * http://www.osta.org/ * http://www.ecma.ch/
14 * http://www.iso.org/ 14 * http://www.iso.org/
15 * 15 *
16 * CONTACTS
17 * E-mail regarding any portion of the Linux UDF file system should be
18 * directed to the development team mailing list (run by majordomo):
19 * linux_udf@hpesjro.fc.hp.com
20 *
21 * COPYRIGHT 16 * COPYRIGHT
22 * This file is distributed under the terms of the GNU General Public 17 * This file is distributed under the terms of the GNU General Public
23 * License (GPL). Copies of the GPL can be obtained from: 18 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index 62b15a4214e6..1e7508420fcf 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -3,11 +3,6 @@
3 * 3 *
4 * This file is intended for the Linux kernel/module. 4 * This file is intended for the Linux kernel/module.
5 * 5 *
6 * CONTACTS
7 * E-mail regarding any portion of the Linux UDF file system should be
8 * directed to the development team mailing list (run by majordomo):
9 * linux_udf@hpesjro.fc.hp.com
10 *
11 * COPYRIGHT 6 * COPYRIGHT
12 * This file is distributed under the terms of the GNU General Public 7 * This file is distributed under the terms of the GNU General Public
13 * License (GPL). Copies of the GPL can be obtained from: 8 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
index 1966a6dbb4b6..b15ff2e99c91 100644
--- a/include/linux/udf_fs_sb.h
+++ b/include/linux/udf_fs_sb.h
@@ -3,11 +3,6 @@
3 * 3 *
4 * This include file is for the Linux kernel/module. 4 * This include file is for the Linux kernel/module.
5 * 5 *
6 * CONTACTS
7 * E-mail regarding any portion of the Linux UDF file system should be
8 * directed to the development team mailing list (run by majordomo):
9 * linux_udf@hpesjro.fc.hp.com
10 *
11 * COPYRIGHT 6 * COPYRIGHT
12 * This file is distributed under the terms of the GNU General Public 7 * This file is distributed under the terms of the GNU General Public
13 * License (GPL). Copies of the GPL can be obtained from: 8 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udp.h b/include/linux/udp.h
index b60e0b4a25c4..85a55658831c 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -35,10 +35,10 @@ struct udphdr {
35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ 35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
36 36
37#ifdef __KERNEL__ 37#ifdef __KERNEL__
38
39#include <linux/config.h> 38#include <linux/config.h>
40#include <net/sock.h> 39#include <linux/types.h>
41#include <linux/ip.h> 40
41#include <net/inet_sock.h>
42 42
43struct udp_sock { 43struct udp_sock {
44 /* inet_sock has to be the first member */ 44 /* inet_sock has to be the first member */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d81b050e5955..827cc6de5f5c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -225,7 +225,7 @@ struct usb_interface_cache {
225 * Device drivers should not attempt to activate configurations. The choice 225 * Device drivers should not attempt to activate configurations. The choice
226 * of which configuration to install is a policy decision based on such 226 * of which configuration to install is a policy decision based on such
227 * considerations as available power, functionality provided, and the user's 227 * considerations as available power, functionality provided, and the user's
228 * desires (expressed through hotplug scripts). However, drivers can call 228 * desires (expressed through userspace tools). However, drivers can call
229 * usb_reset_configuration() to reinitialize the current configuration and 229 * usb_reset_configuration() to reinitialize the current configuration and
230 * all its interfaces. 230 * all its interfaces.
231 */ 231 */
@@ -329,8 +329,6 @@ struct usb_device {
329 struct usb_tt *tt; /* low/full speed dev, highspeed hub */ 329 struct usb_tt *tt; /* low/full speed dev, highspeed hub */
330 int ttport; /* device port on that tt hub */ 330 int ttport; /* device port on that tt hub */
331 331
332 struct semaphore serialize;
333
334 unsigned int toggle[2]; /* one bit for each endpoint 332 unsigned int toggle[2]; /* one bit for each endpoint
335 * ([0] = IN, [1] = OUT) */ 333 * ([0] = IN, [1] = OUT) */
336 334
@@ -349,6 +347,9 @@ struct usb_device {
349 347
350 char **rawdescriptors; /* Raw descriptors for each config */ 348 char **rawdescriptors; /* Raw descriptors for each config */
351 349
350 unsigned short bus_mA; /* Current available from the bus */
351 u8 portnum; /* Parent port number (origin 1) */
352
352 int have_langid; /* whether string_langid is valid */ 353 int have_langid; /* whether string_langid is valid */
353 int string_langid; /* language ID for strings */ 354 int string_langid; /* language ID for strings */
354 355
@@ -377,11 +378,12 @@ struct usb_device {
377extern struct usb_device *usb_get_dev(struct usb_device *dev); 378extern struct usb_device *usb_get_dev(struct usb_device *dev);
378extern void usb_put_dev(struct usb_device *dev); 379extern void usb_put_dev(struct usb_device *dev);
379 380
380extern void usb_lock_device(struct usb_device *udev); 381/* USB device locking */
381extern int usb_trylock_device(struct usb_device *udev); 382#define usb_lock_device(udev) down(&(udev)->dev.sem)
383#define usb_unlock_device(udev) up(&(udev)->dev.sem)
384#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem)
382extern int usb_lock_device_for_reset(struct usb_device *udev, 385extern int usb_lock_device_for_reset(struct usb_device *udev,
383 struct usb_interface *iface); 386 struct usb_interface *iface);
384extern void usb_unlock_device(struct usb_device *udev);
385 387
386/* USB port reset for device reinitialization */ 388/* USB port reset for device reinitialization */
387extern int usb_reset_device(struct usb_device *dev); 389extern int usb_reset_device(struct usb_device *dev);
@@ -529,10 +531,13 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
529 531
530/* ----------------------------------------------------------------------- */ 532/* ----------------------------------------------------------------------- */
531 533
534struct usb_dynids {
535 spinlock_t lock;
536 struct list_head list;
537};
538
532/** 539/**
533 * struct usb_driver - identifies USB driver to usbcore 540 * struct usb_driver - identifies USB driver to usbcore
534 * @owner: Pointer to the module owner of this driver; initialize
535 * it using THIS_MODULE.
536 * @name: The driver name should be unique among USB drivers, 541 * @name: The driver name should be unique among USB drivers,
537 * and should normally be the same as the module name. 542 * and should normally be the same as the module name.
538 * @probe: Called to see if the driver is willing to manage a particular 543 * @probe: Called to see if the driver is willing to manage a particular
@@ -553,7 +558,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
553 * @id_table: USB drivers use ID table to support hotplugging. 558 * @id_table: USB drivers use ID table to support hotplugging.
554 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 559 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
555 * or your driver's probe function will never get called. 560 * or your driver's probe function will never get called.
561 * @dynids: used internally to hold the list of dynamically added device
562 * ids for this driver.
556 * @driver: the driver model core driver structure. 563 * @driver: the driver model core driver structure.
564 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be
565 * added to this driver by preventing the sysfs file from being created.
557 * 566 *
558 * USB drivers must provide a name, probe() and disconnect() methods, 567 * USB drivers must provide a name, probe() and disconnect() methods,
559 * and an id_table. Other driver fields are optional. 568 * and an id_table. Other driver fields are optional.
@@ -571,8 +580,6 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
571 * them as necessary, and blocking until the unlinks complete). 580 * them as necessary, and blocking until the unlinks complete).
572 */ 581 */
573struct usb_driver { 582struct usb_driver {
574 struct module *owner;
575
576 const char *name; 583 const char *name;
577 584
578 int (*probe) (struct usb_interface *intf, 585 int (*probe) (struct usb_interface *intf,
@@ -588,7 +595,9 @@ struct usb_driver {
588 595
589 const struct usb_device_id *id_table; 596 const struct usb_device_id *id_table;
590 597
598 struct usb_dynids dynids;
591 struct device_driver driver; 599 struct device_driver driver;
600 unsigned int no_dynamic_id:1;
592}; 601};
593#define to_usb_driver(d) container_of(d, struct usb_driver, driver) 602#define to_usb_driver(d) container_of(d, struct usb_driver, driver)
594 603
@@ -614,7 +623,11 @@ struct usb_class_driver {
614 * use these in module_init()/module_exit() 623 * use these in module_init()/module_exit()
615 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 624 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
616 */ 625 */
617extern int usb_register(struct usb_driver *); 626int usb_register_driver(struct usb_driver *, struct module *);
627static inline int usb_register(struct usb_driver *driver)
628{
629 return usb_register_driver(driver, THIS_MODULE);
630}
618extern void usb_deregister(struct usb_driver *); 631extern void usb_deregister(struct usb_driver *);
619 632
620extern int usb_register_dev(struct usb_interface *intf, 633extern int usb_register_dev(struct usb_interface *intf,
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
new file mode 100644
index 000000000000..b2d08984a9f7
--- /dev/null
+++ b/include/linux/usb_usual.h
@@ -0,0 +1,126 @@
1/*
2 * Interface to the libusual.
3 *
4 * Copyright (c) 2005 Pete Zaitcev <zaitcev@redhat.com>
5 * Copyright (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
6 * Copyright (c) 1999 Michael Gee (michael@linuxspecific.com)
7 */
8
9#ifndef __LINUX_USB_USUAL_H
10#define __LINUX_USB_USUAL_H
11
12#include <linux/config.h>
13
14/* We should do this for cleanliness... But other usb_foo.h do not do this. */
15/* #include <linux/usb.h> */
16
17/*
18 * The flags field, which we store in usb_device_id.driver_info.
19 * It is compatible with the old usb-storage flags in lower 24 bits.
20 */
21
22/*
23 * Static flag definitions. We use this roundabout technique so that the
24 * proc_info() routine can automatically display a message for each flag.
25 */
26#define US_DO_ALL_FLAGS \
27 US_FLAG(SINGLE_LUN, 0x00000001) \
28 /* allow access to only LUN 0 */ \
29 US_FLAG(NEED_OVERRIDE, 0x00000002) \
30 /* unusual_devs entry is necessary */ \
31 US_FLAG(SCM_MULT_TARG, 0x00000004) \
32 /* supports multiple targets */ \
33 US_FLAG(FIX_INQUIRY, 0x00000008) \
34 /* INQUIRY response needs faking */ \
35 US_FLAG(FIX_CAPACITY, 0x00000010) \
36 /* READ CAPACITY response too big */ \
37 US_FLAG(IGNORE_RESIDUE, 0x00000020) \
38 /* reported residue is wrong */ \
39 US_FLAG(BULK32, 0x00000040) \
40 /* Uses 32-byte CBW length */ \
41 US_FLAG(NOT_LOCKABLE, 0x00000080) \
42 /* PREVENT/ALLOW not supported */ \
43 US_FLAG(GO_SLOW, 0x00000100) \
44 /* Need delay after Command phase */ \
45 US_FLAG(NO_WP_DETECT, 0x00000200) \
46 /* Don't check for write-protect */ \
47
48#define US_FLAG(name, value) US_FL_##name = value ,
49enum { US_DO_ALL_FLAGS };
50#undef US_FLAG
51
52/*
53 * The bias field for libusual and friends.
54 */
55#define USB_US_TYPE_NONE 0
56#define USB_US_TYPE_STOR 1 /* usb-storage */
57#define USB_US_TYPE_UB 2 /* ub */
58
59#define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF)
60#define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF)
61
62/*
63 * This is probably not the best place to keep these constants, conceptually.
64 * But it's the only header included into all places which need them.
65 */
66
67/* Sub Classes */
68
69#define US_SC_RBC 0x01 /* Typically, flash devices */
70#define US_SC_8020 0x02 /* CD-ROM */
71#define US_SC_QIC 0x03 /* QIC-157 Tapes */
72#define US_SC_UFI 0x04 /* Floppy */
73#define US_SC_8070 0x05 /* Removable media */
74#define US_SC_SCSI 0x06 /* Transparent */
75#define US_SC_ISD200 0x07 /* ISD200 ATA */
76#define US_SC_MIN US_SC_RBC
77#define US_SC_MAX US_SC_ISD200
78
79#define US_SC_DEVICE 0xff /* Use device's value */
80
81/* Protocols */
82
83#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
84#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
85#define US_PR_BULK 0x50 /* bulk only */
86#ifdef CONFIG_USB_STORAGE_USBAT
87#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
88#endif
89#ifdef CONFIG_USB_STORAGE_SDDR09
90#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
91#endif
92#ifdef CONFIG_USB_STORAGE_SDDR55
93#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
94#endif
95#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
96#ifdef CONFIG_USB_STORAGE_FREECOM
97#define US_PR_FREECOM 0xf1 /* Freecom */
98#endif
99#ifdef CONFIG_USB_STORAGE_DATAFAB
100#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
101#endif
102#ifdef CONFIG_USB_STORAGE_JUMPSHOT
103#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
104#endif
105#ifdef CONFIG_USB_STORAGE_ALAUDA
106#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
107#endif
108
109#define US_PR_DEVICE 0xff /* Use device's value */
110
111/*
112 */
113#ifdef CONFIG_USB_LIBUSUAL
114
115extern struct usb_device_id storage_usb_ids[];
116extern void usb_usual_set_present(int type);
117extern void usb_usual_clear_present(int type);
118extern int usb_usual_check_type(const struct usb_device_id *, int type);
119#else
120
121#define usb_usual_set_present(t) do { } while(0)
122#define usb_usual_clear_present(t) do { } while(0)
123#define usb_usual_check_type(id, t) (0)
124#endif /* CONFIG_USB_LIBUSUAL */
125
126#endif /* __LINUX_USB_USUAL_H */
diff --git a/include/linux/video_decoder.h b/include/linux/video_decoder.h
index 0e9e48b83e3b..121e26da2c18 100644
--- a/include/linux/video_decoder.h
+++ b/include/linux/video_decoder.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_VIDEO_DECODER_H 1#ifndef _LINUX_VIDEO_DECODER_H
2#define _LINUX_VIDEO_DECODER_H 2#define _LINUX_VIDEO_DECODER_H
3 3
4#define HAVE_VIDEO_DECODER 1
5
4struct video_decoder_capability { /* this name is too long */ 6struct video_decoder_capability { /* this name is too long */
5 __u32 flags; 7 __u32 flags;
6#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */ 8#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 1cded681eb6d..ce40675324bd 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -642,6 +642,12 @@ typedef __u64 v4l2_std_id;
642#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) 642#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
643#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) 643#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
644 644
645/* some merged standards */
646#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
647#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
648#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
649#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
650
645/* some common needed stuff */ 651/* some common needed stuff */
646#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ 652#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
647 V4L2_STD_PAL_B1 |\ 653 V4L2_STD_PAL_B1 |\
@@ -662,7 +668,8 @@ typedef __u64 v4l2_std_id;
662 V4L2_STD_SECAM_G |\ 668 V4L2_STD_SECAM_G |\
663 V4L2_STD_SECAM_H |\ 669 V4L2_STD_SECAM_H |\
664 V4L2_STD_SECAM_DK |\ 670 V4L2_STD_SECAM_DK |\
665 V4L2_STD_SECAM_L) 671 V4L2_STD_SECAM_L |\
672 V4L2_STD_SECAM_LC)
666 673
667#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ 674#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
668 V4L2_STD_PAL_60 |\ 675 V4L2_STD_PAL_60 |\
@@ -888,7 +895,6 @@ struct v4l2_audio
888 895
889/* Flags for the 'mode' field */ 896/* Flags for the 'mode' field */
890#define V4L2_AUDMODE_AVL 0x00001 897#define V4L2_AUDMODE_AVL 0x00001
891#define V4L2_AUDMODE_32BITS 0x00002
892 898
893struct v4l2_audioout 899struct v4l2_audioout
894{ 900{
@@ -1110,7 +1116,6 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
1110/* names for fancy debug output */ 1116/* names for fancy debug output */
1111extern char *v4l2_field_names[]; 1117extern char *v4l2_field_names[];
1112extern char *v4l2_type_names[]; 1118extern char *v4l2_type_names[];
1113extern char *v4l2_ioctl_names[];
1114 1119
1115/* Compatibility layer interface -- v4l1-compat module */ 1120/* Compatibility layer interface -- v4l1-compat module */
1116typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, 1121typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
@@ -1118,6 +1123,11 @@ typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
1118int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, 1123int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
1119 int cmd, void *arg, v4l2_kioctl driver_ioctl); 1124 int cmd, void *arg, v4l2_kioctl driver_ioctl);
1120 1125
1126/* 32 Bits compatibility layer for 64 bits processors */
1127extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
1128 unsigned long arg);
1129
1130
1121#endif /* __KERNEL__ */ 1131#endif /* __KERNEL__ */
1122#endif /* __LINUX_VIDEODEV2_H */ 1132#endif /* __LINUX_VIDEODEV2_H */
1123 1133
diff --git a/include/linux/wavefront.h b/include/linux/wavefront.h
index 61bd0fd35240..51ab3c933acd 100644
--- a/include/linux/wavefront.h
+++ b/include/linux/wavefront.h
@@ -434,22 +434,22 @@ typedef struct wf_multisample {
434} wavefront_multisample; 434} wavefront_multisample;
435 435
436typedef struct wf_alias { 436typedef struct wf_alias {
437 INT16 OriginalSample __attribute__ ((packed)); 437 INT16 OriginalSample;
438 438
439 struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); 439 struct wf_sample_offset sampleStartOffset;
440 struct wf_sample_offset loopStartOffset __attribute__ ((packed)); 440 struct wf_sample_offset loopStartOffset;
441 struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); 441 struct wf_sample_offset sampleEndOffset;
442 struct wf_sample_offset loopEndOffset __attribute__ ((packed)); 442 struct wf_sample_offset loopEndOffset;
443 443
444 INT16 FrequencyBias __attribute__ ((packed)); 444 INT16 FrequencyBias;
445 445
446 UCHAR8 SampleResolution:2 __attribute__ ((packed)); 446 UCHAR8 SampleResolution:2;
447 UCHAR8 Unused1:1 __attribute__ ((packed)); 447 UCHAR8 Unused1:1;
448 UCHAR8 Loop:1 __attribute__ ((packed)); 448 UCHAR8 Loop:1;
449 UCHAR8 Bidirectional:1 __attribute__ ((packed)); 449 UCHAR8 Bidirectional:1;
450 UCHAR8 Unused2:1 __attribute__ ((packed)); 450 UCHAR8 Unused2:1;
451 UCHAR8 Reverse:1 __attribute__ ((packed)); 451 UCHAR8 Reverse:1;
452 UCHAR8 Unused3:1 __attribute__ ((packed)); 452 UCHAR8 Unused3:1;
453 453
454 /* This structure is meant to be padded only to 16 bits on their 454 /* This structure is meant to be padded only to 16 bits on their
455 original. Of course, whoever wrote their documentation didn't 455 original. Of course, whoever wrote their documentation didn't
@@ -460,8 +460,8 @@ typedef struct wf_alias {
460 standard 16->32 bit issues. 460 standard 16->32 bit issues.
461 */ 461 */
462 462
463 UCHAR8 sixteen_bit_padding __attribute__ ((packed)); 463 UCHAR8 sixteen_bit_padding;
464} wavefront_alias; 464} __attribute__((packed)) wavefront_alias;
465 465
466typedef struct wf_drum { 466typedef struct wf_drum {
467 UCHAR8 PatchNumber; 467 UCHAR8 PatchNumber;
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index ac39d04d027c..86b111300231 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -65,6 +65,7 @@ extern int FASTCALL(schedule_work(struct work_struct *work));
65extern int FASTCALL(schedule_delayed_work(struct work_struct *work, unsigned long delay)); 65extern int FASTCALL(schedule_delayed_work(struct work_struct *work, unsigned long delay));
66 66
67extern int schedule_delayed_work_on(int cpu, struct work_struct *work, unsigned long delay); 67extern int schedule_delayed_work_on(int cpu, struct work_struct *work, unsigned long delay);
68extern int schedule_on_each_cpu(void (*func)(void *info), void *info);
68extern void flush_scheduled_work(void); 69extern void flush_scheduled_work(void);
69extern int current_is_keventd(void); 70extern int current_is_keventd(void);
70extern int keventd_up(void); 71extern int keventd_up(void);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 343d883d69c5..beaef5c7a0ea 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -53,19 +53,14 @@ struct writeback_control {
53 loff_t start; 53 loff_t start;
54 loff_t end; 54 loff_t end;
55 55
56 unsigned nonblocking:1; /* Don't get stuck on request queues */ 56 unsigned nonblocking:1; /* Don't get stuck on request queues */
57 unsigned encountered_congestion:1; /* An output: a queue is full */ 57 unsigned encountered_congestion:1; /* An output: a queue is full */
58 unsigned for_kupdate:1; /* A kupdate writeback */ 58 unsigned for_kupdate:1; /* A kupdate writeback */
59 unsigned for_reclaim:1; /* Invoked from the page allocator */ 59 unsigned for_reclaim:1; /* Invoked from the page allocator */
60 unsigned for_writepages:1; /* This is a writepages() call */
60}; 61};
61 62
62/* 63/*
63 * ->writepage() return values (make these much larger than a pagesize, in
64 * case some fs is returning number-of-bytes-written from writepage)
65 */
66#define WRITEPAGE_ACTIVATE 0x80000 /* IO was not started: activate page */
67
68/*
69 * fs/fs-writeback.c 64 * fs/fs-writeback.c
70 */ 65 */
71void writeback_inodes(struct writeback_control *wbc); 66void writeback_inodes(struct writeback_control *wbc);
@@ -108,7 +103,9 @@ void balance_dirty_pages_ratelimited(struct address_space *mapping);
108int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); 103int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
109int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 104int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
110int sync_page_range(struct inode *inode, struct address_space *mapping, 105int sync_page_range(struct inode *inode, struct address_space *mapping,
111 loff_t pos, size_t count); 106 loff_t pos, loff_t count);
107int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
108 loff_t pos, loff_t count);
112 109
113/* pdflush.c */ 110/* pdflush.c */
114extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 111extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index 23f9c61d9546..cda8a96e2fa0 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -13,7 +13,22 @@
13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ 13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ 14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
15 15
16/* Namespaces */
17#define XATTR_OS2_PREFIX "os2."
18#define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1)
19
16#define XATTR_SECURITY_PREFIX "security." 20#define XATTR_SECURITY_PREFIX "security."
21#define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1)
22
23#define XATTR_SYSTEM_PREFIX "system."
24#define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1)
25
26#define XATTR_TRUSTED_PREFIX "trusted."
27#define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1)
28
29#define XATTR_USER_PREFIX "user."
30#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
31
17 32
18struct xattr_handler { 33struct xattr_handler {
19 char *prefix; 34 char *prefix;
@@ -25,6 +40,10 @@ struct xattr_handler {
25 size_t size, int flags); 40 size_t size, int flags);
26}; 41};
27 42
43ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t);
44int vfs_setxattr(struct dentry *, char *, void *, size_t, int);
45int vfs_removexattr(struct dentry *, char *);
46
28ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); 47ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
29ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); 48ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
30int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags); 49int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 0fb077d68441..82fbb758e28f 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -27,6 +27,22 @@ struct xfrm_id
27 __u8 proto; 27 __u8 proto;
28}; 28};
29 29
30struct xfrm_sec_ctx {
31 __u8 ctx_doi;
32 __u8 ctx_alg;
33 __u16 ctx_len;
34 __u32 ctx_sid;
35 char ctx_str[0];
36};
37
38/* Security Context Domains of Interpretation */
39#define XFRM_SC_DOI_RESERVED 0
40#define XFRM_SC_DOI_LSM 1
41
42/* Security Context Algorithms */
43#define XFRM_SC_ALG_RESERVED 0
44#define XFRM_SC_ALG_SELINUX 1
45
30/* Selector, used as selector both on policy rules (SPD) and SAs. */ 46/* Selector, used as selector both on policy rules (SPD) and SAs. */
31 47
32struct xfrm_selector 48struct xfrm_selector
@@ -146,6 +162,18 @@ enum {
146 162
147#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) 163#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)
148 164
165/*
166 * Generic LSM security context for comunicating to user space
167 * NOTE: Same format as sadb_x_sec_ctx
168 */
169struct xfrm_user_sec_ctx {
170 __u16 len;
171 __u16 exttype;
172 __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */
173 __u8 ctx_doi;
174 __u16 ctx_len;
175};
176
149struct xfrm_user_tmpl { 177struct xfrm_user_tmpl {
150 struct xfrm_id id; 178 struct xfrm_id id;
151 __u16 family; 179 __u16 family;
@@ -176,6 +204,7 @@ enum xfrm_attr_type_t {
176 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ 204 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */
177 XFRMA_SA, 205 XFRMA_SA,
178 XFRMA_POLICY, 206 XFRMA_POLICY,
207 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */
179 __XFRMA_MAX 208 __XFRMA_MAX
180 209
181#define XFRMA_MAX (__XFRMA_MAX - 1) 210#define XFRMA_MAX (__XFRMA_MAX - 1)
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 74f7b78c22d2..4fa32f0d4df8 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -442,9 +442,11 @@ extern int deflateInit2 (z_streamp strm,
442 not perform any compression: this will be done by deflate(). 442 not perform any compression: this will be done by deflate().
443*/ 443*/
444 444
445#if 0
445extern int zlib_deflateSetDictionary (z_streamp strm, 446extern int zlib_deflateSetDictionary (z_streamp strm,
446 const Byte *dictionary, 447 const Byte *dictionary,
447 uInt dictLength); 448 uInt dictLength);
449#endif
448/* 450/*
449 Initializes the compression dictionary from the given byte sequence 451 Initializes the compression dictionary from the given byte sequence
450 without producing any compressed output. This function must be called 452 without producing any compressed output. This function must be called
@@ -478,7 +480,10 @@ extern int zlib_deflateSetDictionary (z_streamp strm,
478 perform any compression: this will be done by deflate(). 480 perform any compression: this will be done by deflate().
479*/ 481*/
480 482
483#if 0
481extern int zlib_deflateCopy (z_streamp dest, z_streamp source); 484extern int zlib_deflateCopy (z_streamp dest, z_streamp source);
485#endif
486
482/* 487/*
483 Sets the destination stream as a complete copy of the source stream. 488 Sets the destination stream as a complete copy of the source stream.
484 489
@@ -511,7 +516,9 @@ static inline unsigned long deflateBound(unsigned long s)
511 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; 516 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
512} 517}
513 518
519#if 0
514extern int zlib_deflateParams (z_streamp strm, int level, int strategy); 520extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
521#endif
515/* 522/*
516 Dynamically update the compression level and compression strategy. The 523 Dynamically update the compression level and compression strategy. The
517 interpretation of level and strategy is as in deflateInit2. This can be 524 interpretation of level and strategy is as in deflateInit2. This can be
@@ -571,7 +578,9 @@ extern int zlib_inflateSetDictionary (z_streamp strm,
571 inflate(). 578 inflate().
572*/ 579*/
573 580
581#if 0
574extern int zlib_inflateSync (z_streamp strm); 582extern int zlib_inflateSync (z_streamp strm);
583#endif
575/* 584/*
576 Skips invalid compressed data until a full flush point (see above the 585 Skips invalid compressed data until a full flush point (see above the
577 description of deflate with Z_FULL_FLUSH) can be found, or until all 586 description of deflate with Z_FULL_FLUSH) can be found, or until all
@@ -636,7 +645,9 @@ extern int zlib_inflateInit2_ (z_streamp strm, int windowBits,
636#endif 645#endif
637 646
638extern const char * zlib_zError (int err); 647extern const char * zlib_zError (int err);
648#if 0
639extern int zlib_inflateSyncPoint (z_streamp z); 649extern int zlib_inflateSyncPoint (z_streamp z);
650#endif
640extern const uLong * zlib_get_crc_table (void); 651extern const uLong * zlib_get_crc_table (void);
641 652
642#endif /* _ZLIB_H */ 653#endif /* _ZLIB_H */