aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@tglx.tec.linutronix.de>2005-06-26 17:20:36 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-06-26 17:20:36 -0400
commit7ca6448dbfb398bba36eda3c01bc14b86c3675be (patch)
tree82d934ebf07f22a2c64c3b6d82ec24082878b43a /include/linux
parentf1f67a9874f1a4bba1adff6d694aa52e5f52ff1a (diff)
parent7d681b23d6cc14a8c026ea6756242cb522cbbcae (diff)
Merge with rsync://fileserver/linux
Update to Linus latest
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/a.out.h2
-rw-r--r--include/linux/acpi.h7
-rw-r--r--include/linux/arcfb.h8
-rw-r--r--include/linux/ata.h1
-rw-r--r--include/linux/atalk.h26
-rw-r--r--include/linux/audit.h94
-rw-r--r--include/linux/auto_fs4.h2
-rw-r--r--include/linux/binfmts.h5
-rw-r--r--include/linux/blkdev.h18
-rw-r--r--include/linux/bootmem.h13
-rw-r--r--include/linux/chio.h168
-rw-r--r--include/linux/cpu.h1
-rw-r--r--include/linux/cpufreq.h2
-rw-r--r--include/linux/crash_dump.h18
-rw-r--r--include/linux/device.h64
-rw-r--r--include/linux/dm9000.h36
-rw-r--r--include/linux/dma-mapping.h5
-rw-r--r--include/linux/dmi.h1
-rw-r--r--include/linux/dqblk_v1.h6
-rw-r--r--include/linux/dqblk_v2.h6
-rw-r--r--include/linux/efi.h2
-rw-r--r--include/linux/etherdevice.h22
-rw-r--r--include/linux/ethtool.h1
-rw-r--r--include/linux/ext2_fs.h25
-rw-r--r--include/linux/ext3_fs.h1
-rw-r--r--include/linux/ext3_jbd.h19
-rw-r--r--include/linux/fb.h19
-rw-r--r--include/linux/fcntl.h4
-rw-r--r--include/linux/font.h26
-rw-r--r--include/linux/fs.h74
-rw-r--r--include/linux/fsl_devices.h8
-rw-r--r--include/linux/gameport.h28
-rw-r--r--include/linux/genalloc.h40
-rw-r--r--include/linux/genhd.h3
-rw-r--r--include/linux/gfp.h8
-rw-r--r--include/linux/hardirq.h6
-rw-r--r--include/linux/hdlc.h4
-rw-r--r--include/linux/highmem.h1
-rw-r--r--include/linux/hugetlb.h40
-rw-r--r--include/linux/hwmon-sysfs.h36
-rw-r--r--include/linux/i2c-id.h1
-rw-r--r--include/linux/i2c-vid.h12
-rw-r--r--include/linux/i2c.h12
-rw-r--r--include/linux/i2o-dev.h43
-rw-r--r--include/linux/i2o.h497
-rw-r--r--include/linux/ide.h22
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/if_shaper.h3
-rw-r--r--include/linux/if_tr.h45
-rw-r--r--include/linux/inetdevice.h2
-rw-r--r--include/linux/init.h12
-rw-r--r--include/linux/init_task.h1
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/ioc4.h179
-rw-r--r--include/linux/ioc4_common.h21
-rw-r--r--include/linux/ip.h21
-rw-r--r--include/linux/ipmi.h5
-rw-r--r--include/linux/ipv6.h13
-rw-r--r--include/linux/irq.h5
-rw-r--r--include/linux/kernel.h18
-rw-r--r--include/linux/kexec.h135
-rw-r--r--include/linux/key-ui.h47
-rw-r--r--include/linux/key.h44
-rw-r--r--include/linux/keyctl.h11
-rw-r--r--include/linux/klist.h55
-rw-r--r--include/linux/kmod.h13
-rw-r--r--include/linux/kobject.h8
-rw-r--r--include/linux/kprobes.h100
-rw-r--r--include/linux/libata.h60
-rw-r--r--include/linux/list.h2
-rw-r--r--include/linux/lockd/lockd.h7
-rw-r--r--include/linux/loop.h2
-rw-r--r--include/linux/major.h1
-rw-r--r--include/linux/mempool.h11
-rw-r--r--include/linux/mii.h8
-rw-r--r--include/linux/mm.h125
-rw-r--r--include/linux/mmzone.h192
-rw-r--r--include/linux/module.h5
-rw-r--r--include/linux/namespace.h1
-rw-r--r--include/linux/net.h1
-rw-r--r--include/linux/netdevice.h26
-rw-r--r--include/linux/netfilter_ipv4.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_core.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h3
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLUSTERIP.h3
-rw-r--r--include/linux/netfilter_ipv4/listhelp.h1
-rw-r--r--include/linux/netfilter_ipv4/lockhelp.h129
-rw-r--r--include/linux/netlink.h27
-rw-r--r--include/linux/netpoll.h34
-rw-r--r--include/linux/nfs4.h4
-rw-r--r--include/linux/nfs_fs.h306
-rw-r--r--include/linux/nfs_fs_i.h5
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_mount.h1
-rw-r--r--include/linux/nfs_page.h30
-rw-r--r--include/linux/nfs_xdr.h43
-rw-r--r--include/linux/nfsacl.h58
-rw-r--r--include/linux/nfsd/nfsd.h24
-rw-r--r--include/linux/nfsd/state.h47
-rw-r--r--include/linux/nfsd/xdr.h4
-rw-r--r--include/linux/nfsd/xdr3.h26
-rw-r--r--include/linux/nfsd/xdr4.h1
-rw-r--r--include/linux/nfsd_idmap.h5
-rw-r--r--include/linux/node.h1
-rw-r--r--include/linux/notifier.h1
-rw-r--r--include/linux/numa.h2
-rw-r--r--include/linux/nvram.h2
-rw-r--r--include/linux/page-flags.h35
-rw-r--r--include/linux/pagemap.h4
-rw-r--r--include/linux/pci_ids.h14
-rw-r--r--include/linux/pfkeyv2.h1
-rw-r--r--include/linux/pkt_cls.h1
-rw-r--r--include/linux/pkt_sched.h9
-rw-r--r--include/linux/pktcdvd.h2
-rw-r--r--include/linux/pm.h33
-rw-r--r--include/linux/posix_acl_xattr.h11
-rw-r--r--include/linux/proc_fs.h7
-rw-r--r--include/linux/qnx4_fs.h18
-rw-r--r--include/linux/qnxtypes.h16
-rw-r--r--include/linux/quota.h7
-rw-r--r--include/linux/quotaops.h3
-rw-r--r--include/linux/raid/bitmap.h273
-rw-r--r--include/linux/raid/md.h17
-rw-r--r--include/linux/raid/md_k.h22
-rw-r--r--include/linux/raid/md_p.h9
-rw-r--r--include/linux/raid/md_u.h7
-rw-r--r--include/linux/raid/raid1.h16
-rw-r--r--include/linux/reboot.h4
-rw-r--r--include/linux/reiserfs_acl.h1
-rw-r--r--include/linux/reiserfs_fs.h15
-rw-r--r--include/linux/reiserfs_fs_sb.h2
-rw-r--r--include/linux/rmap.h6
-rw-r--r--include/linux/rtnetlink.h183
-rw-r--r--include/linux/sched.h132
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/skbuff.h36
-rw-r--r--include/linux/slab.h1
-rw-r--r--include/linux/smp.h40
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/sunrpc/clnt.h6
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/svc.h14
-rw-r--r--include/linux/sunrpc/xdr.h21
-rw-r--r--include/linux/suspend.h2
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/syscalls.h5
-rw-r--r--include/linux/sysctl.h13
-rw-r--r--include/linux/sysfs.h15
-rw-r--r--include/linux/tc_ematch/tc_em_meta.h30
-rw-r--r--include/linux/tc_ematch/tc_em_text.h19
-rw-r--r--include/linux/tcp.h78
-rw-r--r--include/linux/tcp_diag.h4
-rw-r--r--include/linux/textsearch.h180
-rw-r--r--include/linux/textsearch_fsm.h48
-rw-r--r--include/linux/timer.h34
-rw-r--r--include/linux/topology.h14
-rw-r--r--include/linux/tty.h1
-rw-r--r--include/linux/usb.h13
-rw-r--r--include/linux/wait.h20
-rw-r--r--include/linux/wireless.h283
-rw-r--r--include/linux/x25.h12
-rw-r--r--include/linux/xfrm.h5
162 files changed, 3923 insertions, 1214 deletions
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index af8a1dfa5c32..f913cc3e1b0d 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -138,7 +138,7 @@ enum machine_type {
138#endif 138#endif
139#endif 139#endif
140 140
141#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1)) 141#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
142 142
143#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) 143#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
144 144
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index aefe6d051ace..b123cc08773d 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -25,6 +25,10 @@
25#ifndef _LINUX_ACPI_H 25#ifndef _LINUX_ACPI_H
26#define _LINUX_ACPI_H 26#define _LINUX_ACPI_H
27 27
28#include <linux/config.h>
29
30#ifdef CONFIG_ACPI
31
28#ifndef _LINUX 32#ifndef _LINUX
29#define _LINUX 33#define _LINUX
30#endif 34#endif
@@ -533,4 +537,5 @@ static inline int acpi_get_pxm(acpi_handle handle)
533 537
534extern int pnpacpi_disabled; 538extern int pnpacpi_disabled;
535 539
536#endif /*_LINUX_ACPI_H*/ 540#endif /* CONFIG_ACPI */
541#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/arcfb.h b/include/linux/arcfb.h
new file mode 100644
index 000000000000..721e7654daeb
--- /dev/null
+++ b/include/linux/arcfb.h
@@ -0,0 +1,8 @@
1#ifndef __LINUX_ARCFB_H__
2#define __LINUX_ARCFB_H__
3
4#define FBIO_WAITEVENT _IO('F', 0x88)
5#define FBIO_GETCONTROL2 _IOR('F', 0x89, size_t)
6
7#endif
8
diff --git a/include/linux/ata.h b/include/linux/ata.h
index f178894edd04..ca5fcadf9981 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -224,6 +224,7 @@ struct ata_taskfile {
224}; 224};
225 225
226#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 226#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
227#define ata_id_is_sata(id) ((id)[93] == 0)
227#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 228#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
228#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 229#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
229#define ata_id_has_flush(id) ((id)[83] & (1 << 12)) 230#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index 31d3fc25ccbd..09a1451c1159 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -20,7 +20,7 @@
20#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) 20#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
21 21
22struct atalk_addr { 22struct atalk_addr {
23 __u16 s_net; 23 __be16 s_net;
24 __u8 s_node; 24 __u8 s_node;
25}; 25};
26 26
@@ -33,8 +33,8 @@ struct sockaddr_at {
33 33
34struct atalk_netrange { 34struct atalk_netrange {
35 __u8 nr_phase; 35 __u8 nr_phase;
36 __u16 nr_firstnet; 36 __be16 nr_firstnet;
37 __u16 nr_lastnet; 37 __be16 nr_lastnet;
38}; 38};
39 39
40#ifdef __KERNEL__ 40#ifdef __KERNEL__
@@ -70,8 +70,8 @@ struct atalk_iface {
70struct atalk_sock { 70struct atalk_sock {
71 /* struct sock has to be the first member of atalk_sock */ 71 /* struct sock has to be the first member of atalk_sock */
72 struct sock sk; 72 struct sock sk;
73 unsigned short dest_net; 73 __be16 dest_net;
74 unsigned short src_net; 74 __be16 src_net;
75 unsigned char dest_node; 75 unsigned char dest_node;
76 unsigned char src_node; 76 unsigned char src_node;
77 unsigned char dest_port; 77 unsigned char dest_port;
@@ -95,9 +95,9 @@ struct ddpehdr {
95 deh_hops:4, 95 deh_hops:4,
96 deh_len:10; 96 deh_len:10;
97#endif 97#endif
98 __u16 deh_sum; 98 __be16 deh_sum;
99 __u16 deh_dnet; 99 __be16 deh_dnet;
100 __u16 deh_snet; 100 __be16 deh_snet;
101 __u8 deh_dnode; 101 __u8 deh_dnode;
102 __u8 deh_snode; 102 __u8 deh_snode;
103 __u8 deh_dport; 103 __u8 deh_dport;
@@ -142,24 +142,24 @@ struct ddpshdr {
142 142
143/* AppleTalk AARP headers */ 143/* AppleTalk AARP headers */
144struct elapaarp { 144struct elapaarp {
145 __u16 hw_type; 145 __be16 hw_type;
146#define AARP_HW_TYPE_ETHERNET 1 146#define AARP_HW_TYPE_ETHERNET 1
147#define AARP_HW_TYPE_TOKENRING 2 147#define AARP_HW_TYPE_TOKENRING 2
148 __u16 pa_type; 148 __be16 pa_type;
149 __u8 hw_len; 149 __u8 hw_len;
150 __u8 pa_len; 150 __u8 pa_len;
151#define AARP_PA_ALEN 4 151#define AARP_PA_ALEN 4
152 __u16 function; 152 __be16 function;
153#define AARP_REQUEST 1 153#define AARP_REQUEST 1
154#define AARP_REPLY 2 154#define AARP_REPLY 2
155#define AARP_PROBE 3 155#define AARP_PROBE 3
156 __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); 156 __u8 hw_src[ETH_ALEN] __attribute__ ((packed));
157 __u8 pa_src_zero __attribute__ ((packed)); 157 __u8 pa_src_zero __attribute__ ((packed));
158 __u16 pa_src_net __attribute__ ((packed)); 158 __be16 pa_src_net __attribute__ ((packed));
159 __u8 pa_src_node __attribute__ ((packed)); 159 __u8 pa_src_node __attribute__ ((packed));
160 __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); 160 __u8 hw_dst[ETH_ALEN] __attribute__ ((packed));
161 __u8 pa_dst_zero __attribute__ ((packed)); 161 __u8 pa_dst_zero __attribute__ ((packed));
162 __u16 pa_dst_net __attribute__ ((packed)); 162 __be16 pa_dst_net __attribute__ ((packed));
163 __u8 pa_dst_node __attribute__ ((packed)); 163 __u8 pa_dst_node __attribute__ ((packed));
164}; 164};
165 165
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 19f04b049798..bf2ad3ba72eb 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -27,15 +27,52 @@
27#include <linux/sched.h> 27#include <linux/sched.h>
28#include <linux/elf.h> 28#include <linux/elf.h>
29 29
30/* Request and reply types */ 30/* The netlink messages for the audit system is divided into blocks:
31#define AUDIT_GET 1000 /* Get status */ 31 * 1000 - 1099 are for commanding the audit system
32#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ 32 * 1100 - 1199 user space trusted application messages
33#define AUDIT_LIST 1002 /* List filtering rules */ 33 * 1200 - 1299 messages internal to the audit daemon
34#define AUDIT_ADD 1003 /* Add filtering rule */ 34 * 1300 - 1399 audit event messages
35#define AUDIT_DEL 1004 /* Delete filtering rule */ 35 * 1400 - 1499 SE Linux use
36#define AUDIT_USER 1005 /* Send a message from user-space */ 36 * 1500 - 1999 future use
37#define AUDIT_LOGIN 1006 /* Define the login id and informaiton */ 37 * 2000 is for otherwise unclassified kernel audit messages
38#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ 38 *
39 * Messages from 1000-1199 are bi-directional. 1200-1299 are exclusively user
40 * space. Anything over that is kernel --> user space communication.
41 */
42#define AUDIT_GET 1000 /* Get status */
43#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */
44#define AUDIT_LIST 1002 /* List syscall filtering rules */
45#define AUDIT_ADD 1003 /* Add syscall filtering rule */
46#define AUDIT_DEL 1004 /* Delete syscall filtering rule */
47#define AUDIT_USER 1005 /* Message from userspace -- deprecated */
48#define AUDIT_LOGIN 1006 /* Define the login id and information */
49#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */
50#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */
51#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */
52#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */
53
54#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages uninteresting to kernel */
55#define AUDIT_LAST_USER_MSG 1199
56
57#define AUDIT_DAEMON_START 1200 /* Daemon startup record */
58#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */
59#define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */
60#define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */
61
62#define AUDIT_SYSCALL 1300 /* Syscall event */
63#define AUDIT_FS_WATCH 1301 /* Filesystem watch event */
64#define AUDIT_PATH 1302 /* Filename path information */
65#define AUDIT_IPC 1303 /* IPC record */
66#define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */
67#define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */
68#define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */
69#define AUDIT_CWD 1307 /* Current working directory */
70
71#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
72#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
73#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */
74
75#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
39 76
40/* Rule flags */ 77/* Rule flags */
41#define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */ 78#define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */
@@ -132,16 +169,9 @@
132#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) 169#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE)
133#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 170#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
134 171
135#ifndef __KERNEL__
136struct audit_message {
137 struct nlmsghdr nlh;
138 char data[1200];
139};
140#endif
141
142struct audit_status { 172struct audit_status {
143 __u32 mask; /* Bit mask for valid entries */ 173 __u32 mask; /* Bit mask for valid entries */
144 __u32 enabled; /* 1 = enabled, 0 = disbaled */ 174 __u32 enabled; /* 1 = enabled, 0 = disabled */
145 __u32 failure; /* Failure-to-log action */ 175 __u32 failure; /* Failure-to-log action */
146 __u32 pid; /* pid of auditd process */ 176 __u32 pid; /* pid of auditd process */
147 __u32 rate_limit; /* messages rate limit (per second) */ 177 __u32 rate_limit; /* messages rate limit (per second) */
@@ -161,6 +191,11 @@ struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
161 191
162#ifdef __KERNEL__ 192#ifdef __KERNEL__
163 193
194struct audit_sig_info {
195 uid_t uid;
196 pid_t pid;
197};
198
164struct audit_buffer; 199struct audit_buffer;
165struct audit_context; 200struct audit_context;
166struct inode; 201struct inode;
@@ -185,11 +220,16 @@ extern void audit_inode(const char *name, const struct inode *inode);
185 /* Private API (for audit.c only) */ 220 /* Private API (for audit.c only) */
186extern int audit_receive_filter(int type, int pid, int uid, int seq, 221extern int audit_receive_filter(int type, int pid, int uid, int seq,
187 void *data, uid_t loginuid); 222 void *data, uid_t loginuid);
188extern void audit_get_stamp(struct audit_context *ctx, 223extern unsigned int audit_serial(void);
189 struct timespec *t, unsigned int *serial); 224extern void auditsc_get_stamp(struct audit_context *ctx,
225 struct timespec *t, unsigned int *serial);
190extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 226extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
191extern uid_t audit_get_loginuid(struct audit_context *ctx); 227extern uid_t audit_get_loginuid(struct audit_context *ctx);
192extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 228extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
229extern int audit_socketcall(int nargs, unsigned long *args);
230extern int audit_sockaddr(int len, void *addr);
231extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
232extern void audit_signal_info(int sig, struct task_struct *t);
193#else 233#else
194#define audit_alloc(t) ({ 0; }) 234#define audit_alloc(t) ({ 0; })
195#define audit_free(t) do { ; } while (0) 235#define audit_free(t) do { ; } while (0)
@@ -198,18 +238,24 @@ extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mo
198#define audit_getname(n) do { ; } while (0) 238#define audit_getname(n) do { ; } while (0)
199#define audit_putname(n) do { ; } while (0) 239#define audit_putname(n) do { ; } while (0)
200#define audit_inode(n,i) do { ; } while (0) 240#define audit_inode(n,i) do { ; } while (0)
241#define audit_receive_filter(t,p,u,s,d,l) ({ -EOPNOTSUPP; })
242#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
201#define audit_get_loginuid(c) ({ -1; }) 243#define audit_get_loginuid(c) ({ -1; })
202#define audit_ipc_perms(q,u,g,m) ({ 0; }) 244#define audit_ipc_perms(q,u,g,m) ({ 0; })
245#define audit_socketcall(n,a) ({ 0; })
246#define audit_sockaddr(len, addr) ({ 0; })
247#define audit_avc_path(dentry, mnt) ({ 0; })
248#define audit_signal_info(s,t) do { ; } while (0)
203#endif 249#endif
204 250
205#ifdef CONFIG_AUDIT 251#ifdef CONFIG_AUDIT
206/* These are defined in audit.c */ 252/* These are defined in audit.c */
207 /* Public API */ 253 /* Public API */
208extern void audit_log(struct audit_context *ctx, 254extern void audit_log(struct audit_context *ctx, int type,
209 const char *fmt, ...) 255 const char *fmt, ...)
210 __attribute__((format(printf,2,3))); 256 __attribute__((format(printf,3,4)));
211 257
212extern struct audit_buffer *audit_log_start(struct audit_context *ctx); 258extern struct audit_buffer *audit_log_start(struct audit_context *ctx,int type);
213extern void audit_log_format(struct audit_buffer *ab, 259extern void audit_log_format(struct audit_buffer *ab,
214 const char *fmt, ...) 260 const char *fmt, ...)
215 __attribute__((format(printf,2,3))); 261 __attribute__((format(printf,2,3)));
@@ -229,8 +275,8 @@ extern void audit_send_reply(int pid, int seq, int type,
229 void *payload, int size); 275 void *payload, int size);
230extern void audit_log_lost(const char *message); 276extern void audit_log_lost(const char *message);
231#else 277#else
232#define audit_log(t,f,...) do { ; } while (0) 278#define audit_log(c,t,f,...) do { ; } while (0)
233#define audit_log_start(t) ({ NULL; }) 279#define audit_log_start(c,t) ({ NULL; })
234#define audit_log_vformat(b,f,a) do { ; } while (0) 280#define audit_log_vformat(b,f,a) do { ; } while (0)
235#define audit_log_format(b,f,...) do { ; } while (0) 281#define audit_log_format(b,f,...) do { ; } while (0)
236#define audit_log_end(b) do { ; } while (0) 282#define audit_log_end(b) do { ; } while (0)
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index a1657fb99516..9343c89d843c 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -23,7 +23,7 @@
23#define AUTOFS_MIN_PROTO_VERSION 3 23#define AUTOFS_MIN_PROTO_VERSION 3
24#define AUTOFS_MAX_PROTO_VERSION 4 24#define AUTOFS_MAX_PROTO_VERSION 4
25 25
26#define AUTOFS_PROTO_SUBVERSION 6 26#define AUTOFS_PROTO_SUBVERSION 7
27 27
28/* Mask for expire behaviour */ 28/* Mask for expire behaviour */
29#define AUTOFS_EXP_IMMEDIATE 1 29#define AUTOFS_EXP_IMMEDIATE 1
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 7e736e201c46..c1e82c514443 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -69,6 +69,11 @@ extern void remove_arg_zero(struct linux_binprm *);
69extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); 69extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
70extern int flush_old_exec(struct linux_binprm * bprm); 70extern int flush_old_exec(struct linux_binprm * bprm);
71 71
72extern int suid_dumpable;
73#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
74#define SUID_DUMP_USER 1 /* Dump as user of process */
75#define SUID_DUMP_ROOT 2 /* Dump as root */
76
72/* Stack area protections */ 77/* Stack area protections */
73#define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */ 78#define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */
74#define EXSTACK_DISABLE_X 1 /* Disable executable stacks */ 79#define EXSTACK_DISABLE_X 1 /* Disable executable stacks */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ef1afc178c0a..b54a0348a890 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -285,16 +285,12 @@ enum blk_queue_state {
285 Queue_up, 285 Queue_up,
286}; 286};
287 287
288#define BLK_TAGS_PER_LONG (sizeof(unsigned long) * 8)
289#define BLK_TAGS_MASK (BLK_TAGS_PER_LONG - 1)
290
291struct blk_queue_tag { 288struct blk_queue_tag {
292 struct request **tag_index; /* map of busy tags */ 289 struct request **tag_index; /* map of busy tags */
293 unsigned long *tag_map; /* bit map of free/busy tags */ 290 unsigned long *tag_map; /* bit map of free/busy tags */
294 struct list_head busy_list; /* fifo list of busy tags */ 291 struct list_head busy_list; /* fifo list of busy tags */
295 int busy; /* current depth */ 292 int busy; /* current depth */
296 int max_depth; /* what we will send to device */ 293 int max_depth; /* what we will send to device */
297 int real_max_depth; /* what the array can hold */
298 atomic_t refcnt; /* map can be shared */ 294 atomic_t refcnt; /* map can be shared */
299}; 295};
300 296
@@ -396,6 +392,7 @@ struct request_queue
396 */ 392 */
397 unsigned int sg_timeout; 393 unsigned int sg_timeout;
398 unsigned int sg_reserved_size; 394 unsigned int sg_reserved_size;
395 int node;
399 396
400 struct list_head drain_list; 397 struct list_head drain_list;
401 398
@@ -542,15 +539,12 @@ extern void generic_make_request(struct bio *bio);
542extern void blk_put_request(struct request *); 539extern void blk_put_request(struct request *);
543extern void blk_end_sync_rq(struct request *rq); 540extern void blk_end_sync_rq(struct request *rq);
544extern void blk_attempt_remerge(request_queue_t *, struct request *); 541extern void blk_attempt_remerge(request_queue_t *, struct request *);
545extern void __blk_attempt_remerge(request_queue_t *, struct request *);
546extern struct request *blk_get_request(request_queue_t *, int, int); 542extern struct request *blk_get_request(request_queue_t *, int, int);
547extern void blk_insert_request(request_queue_t *, struct request *, int, void *, int); 543extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
548extern void blk_requeue_request(request_queue_t *, struct request *); 544extern void blk_requeue_request(request_queue_t *, struct request *);
549extern void blk_plug_device(request_queue_t *); 545extern void blk_plug_device(request_queue_t *);
550extern int blk_remove_plug(request_queue_t *); 546extern int blk_remove_plug(request_queue_t *);
551extern void blk_recount_segments(request_queue_t *, struct bio *); 547extern void blk_recount_segments(request_queue_t *, struct bio *);
552extern int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *);
553extern int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *);
554extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *); 548extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
555extern void blk_start_queue(request_queue_t *q); 549extern void blk_start_queue(request_queue_t *q);
556extern void blk_stop_queue(request_queue_t *q); 550extern void blk_stop_queue(request_queue_t *q);
@@ -615,6 +609,8 @@ static inline void blkdev_dequeue_request(struct request *req)
615/* 609/*
616 * Access functions for manipulating queue properties 610 * Access functions for manipulating queue properties
617 */ 611 */
612extern request_queue_t *blk_init_queue_node(request_fn_proc *rfn,
613 spinlock_t *lock, int node_id);
618extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *); 614extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *);
619extern void blk_cleanup_queue(request_queue_t *); 615extern void blk_cleanup_queue(request_queue_t *);
620extern void blk_queue_make_request(request_queue_t *, make_request_fn *); 616extern void blk_queue_make_request(request_queue_t *, make_request_fn *);
@@ -632,7 +628,6 @@ extern void blk_queue_dma_alignment(request_queue_t *, int);
632extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 628extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
633extern void blk_queue_ordered(request_queue_t *, int); 629extern void blk_queue_ordered(request_queue_t *, int);
634extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); 630extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *);
635extern int blkdev_scsi_issue_flush_fn(request_queue_t *, struct gendisk *, sector_t *);
636extern struct request *blk_start_pre_flush(request_queue_t *,struct request *); 631extern struct request *blk_start_pre_flush(request_queue_t *,struct request *);
637extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int); 632extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int);
638extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int); 633extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int);
@@ -646,7 +641,8 @@ extern void blk_wait_queue_drained(request_queue_t *, int);
646extern void blk_finish_queue_drain(request_queue_t *); 641extern void blk_finish_queue_drain(request_queue_t *);
647 642
648int blk_get_queue(request_queue_t *); 643int blk_get_queue(request_queue_t *);
649request_queue_t *blk_alloc_queue(int); 644request_queue_t *blk_alloc_queue(int gfp_mask);
645request_queue_t *blk_alloc_queue_node(int,int);
650#define blk_put_queue(q) blk_cleanup_queue((q)) 646#define blk_put_queue(q) blk_cleanup_queue((q))
651 647
652/* 648/*
@@ -675,8 +671,6 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *);
675 671
676#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) 672#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
677 673
678extern void drive_stat_acct(struct request *, int, int);
679
680static inline int queue_hardsect_size(request_queue_t *q) 674static inline int queue_hardsect_size(request_queue_t *q)
681{ 675{
682 int retval = 512; 676 int retval = 512;
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 0dd8ca1a3d5a..82bd8842d11c 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -22,6 +22,10 @@ extern unsigned long min_low_pfn;
22 */ 22 */
23extern unsigned long max_pfn; 23extern unsigned long max_pfn;
24 24
25#ifdef CONFIG_CRASH_DUMP
26extern unsigned long saved_max_pfn;
27#endif
28
25/* 29/*
26 * node_bootmem_map is a map pointer - the bits represent all physical 30 * node_bootmem_map is a map pointer - the bits represent all physical
27 * memory pages (including holes) on the node. 31 * memory pages (including holes) on the node.
@@ -67,6 +71,15 @@ extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size,
67 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) 71 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0)
68#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 72#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
69 73
74#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
75extern void *alloc_remap(int nid, unsigned long size);
76#else
77static inline void *alloc_remap(int nid, unsigned long size)
78{
79 return NULL;
80}
81#endif
82
70extern unsigned long __initdata nr_kernel_pages; 83extern unsigned long __initdata nr_kernel_pages;
71extern unsigned long __initdata nr_all_pages; 84extern unsigned long __initdata nr_all_pages;
72 85
diff --git a/include/linux/chio.h b/include/linux/chio.h
new file mode 100644
index 000000000000..63035ae67e63
--- /dev/null
+++ b/include/linux/chio.h
@@ -0,0 +1,168 @@
1/*
2 * ioctl interface for the scsi media changer driver
3 */
4
5/* changer element types */
6#define CHET_MT 0 /* media transport element (robot) */
7#define CHET_ST 1 /* storage element (media slots) */
8#define CHET_IE 2 /* import/export element */
9#define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */
10#define CHET_V1 4 /* vendor specific #1 */
11#define CHET_V2 5 /* vendor specific #2 */
12#define CHET_V3 6 /* vendor specific #3 */
13#define CHET_V4 7 /* vendor specific #4 */
14
15
16/*
17 * CHIOGPARAMS
18 * query changer properties
19 *
20 * CHIOVGPARAMS
21 * query vendor-specific element types
22 *
23 * accessing elements works by specifing type and unit of the element.
24 * for eample, storage elements are addressed with type = CHET_ST and
25 * unit = 0 .. cp_nslots-1
26 *
27 */
28struct changer_params {
29 int cp_curpicker; /* current transport element */
30 int cp_npickers; /* number of transport elements (CHET_MT) */
31 int cp_nslots; /* number of storage elements (CHET_ST) */
32 int cp_nportals; /* number of import/export elements (CHET_IE) */
33 int cp_ndrives; /* number of data transfer elements (CHET_DT) */
34};
35struct changer_vendor_params {
36 int cvp_n1; /* number of vendor specific elems (CHET_V1) */
37 char cvp_label1[16];
38 int cvp_n2; /* number of vendor specific elems (CHET_V2) */
39 char cvp_label2[16];
40 int cvp_n3; /* number of vendor specific elems (CHET_V3) */
41 char cvp_label3[16];
42 int cvp_n4; /* number of vendor specific elems (CHET_V4) */
43 char cvp_label4[16];
44 int reserved[8];
45};
46
47
48/*
49 * CHIOMOVE
50 * move a medium from one element to another
51 */
52struct changer_move {
53 int cm_fromtype; /* type/unit of source element */
54 int cm_fromunit;
55 int cm_totype; /* type/unit of destination element */
56 int cm_tounit;
57 int cm_flags;
58};
59#define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */
60
61
62/*
63 * CHIOEXCHANGE
64 * move one medium from element #1 to element #2,
65 * and another one from element #2 to element #3.
66 * element #1 and #3 are allowed to be identical.
67 */
68struct changer_exchange {
69 int ce_srctype; /* type/unit of element #1 */
70 int ce_srcunit;
71 int ce_fdsttype; /* type/unit of element #2 */
72 int ce_fdstunit;
73 int ce_sdsttype; /* type/unit of element #3 */
74 int ce_sdstunit;
75 int ce_flags;
76};
77#define CE_INVERT1 1
78#define CE_INVERT2 2
79
80
81/*
82 * CHIOPOSITION
83 * move the transport element (robot arm) to a specific element.
84 */
85struct changer_position {
86 int cp_type;
87 int cp_unit;
88 int cp_flags;
89};
90#define CP_INVERT 1
91
92
93/*
94 * CHIOGSTATUS
95 * get element status for all elements of a specific type
96 */
97struct changer_element_status {
98 int ces_type;
99 unsigned char *ces_data;
100};
101#define CESTATUS_FULL 0x01 /* full */
102#define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */
103#define CESTATUS_EXCEPT 0x04 /* error condition */
104#define CESTATUS_ACCESS 0x08 /* access allowed */
105#define CESTATUS_EXENAB 0x10 /* element can export media */
106#define CESTATUS_INENAB 0x20 /* element can import media */
107
108
109/*
110 * CHIOGELEM
111 * get more detailed status informtion for a single element
112 */
113struct changer_get_element {
114 int cge_type; /* type/unit */
115 int cge_unit;
116 int cge_status; /* status */
117 int cge_errno; /* errno */
118 int cge_srctype; /* source element of the last move/exchange */
119 int cge_srcunit;
120 int cge_id; /* scsi id (for data transfer elements) */
121 int cge_lun; /* scsi lun (for data transfer elements) */
122 char cge_pvoltag[36]; /* primary volume tag */
123 char cge_avoltag[36]; /* alternate volume tag */
124 int cge_flags;
125};
126/* flags */
127#define CGE_ERRNO 0x01 /* errno available */
128#define CGE_INVERT 0x02 /* media inverted */
129#define CGE_SRC 0x04 /* media src available */
130#define CGE_IDLUN 0x08 /* ID+LUN available */
131#define CGE_PVOLTAG 0x10 /* primary volume tag available */
132#define CGE_AVOLTAG 0x20 /* alternate volume tag available */
133
134
135/*
136 * CHIOSVOLTAG
137 * set volume tag
138 */
139struct changer_set_voltag {
140 int csv_type; /* type/unit */
141 int csv_unit;
142 char csv_voltag[36]; /* volume tag */
143 int csv_flags;
144};
145#define CSV_PVOLTAG 0x01 /* primary volume tag */
146#define CSV_AVOLTAG 0x02 /* alternate volume tag */
147#define CSV_CLEARTAG 0x04 /* clear volume tag */
148
149/* ioctls */
150#define CHIOMOVE _IOW('c', 1,struct changer_move)
151#define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange)
152#define CHIOPOSITION _IOW('c', 3,struct changer_position)
153#define CHIOGPICKER _IOR('c', 4,int) /* not impl. */
154#define CHIOSPICKER _IOW('c', 5,int) /* not impl. */
155#define CHIOGPARAMS _IOR('c', 6,struct changer_params)
156#define CHIOGSTATUS _IOW('c', 8,struct changer_element_status)
157#define CHIOGELEM _IOW('c',16,struct changer_get_element)
158#define CHIOINITELEM _IO('c',17)
159#define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag)
160#define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params)
161
162/* ---------------------------------------------------------------------- */
163
164/*
165 * Local variables:
166 * c-basic-offset: 8
167 * End:
168 */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index fe0298e5dae1..e8904c0da686 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -69,6 +69,7 @@ extern struct semaphore cpucontrol;
69 register_cpu_notifier(&fn##_nb); \ 69 register_cpu_notifier(&fn##_nb); \
70} 70}
71int cpu_down(unsigned int cpu); 71int cpu_down(unsigned int cpu);
72extern int __attribute__((weak)) smp_prepare_cpu(int cpu);
72#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 73#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
73#else 74#else
74#define lock_cpu_hotplug() do { } while (0) 75#define lock_cpu_hotplug() do { } while (0)
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index f21af067d015..927daa86c9b3 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -49,7 +49,7 @@ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
49/* Frequency values here are CPU kHz so that hardware which doesn't run 49/* Frequency values here are CPU kHz so that hardware which doesn't run
50 * with some frequencies can complain without having to guess what per 50 * with some frequencies can complain without having to guess what per
51 * cent / per mille means. 51 * cent / per mille means.
52 * Maximum transition latency is in microseconds - if it's unknown, 52 * Maximum transition latency is in nanoseconds - if it's unknown,
53 * CPUFREQ_ETERNAL shall be used. 53 * CPUFREQ_ETERNAL shall be used.
54 */ 54 */
55 55
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
new file mode 100644
index 000000000000..534d750d922d
--- /dev/null
+++ b/include/linux/crash_dump.h
@@ -0,0 +1,18 @@
1#ifndef LINUX_CRASH_DUMP_H
2#define LINUX_CRASH_DUMP_H
3
4#ifdef CONFIG_CRASH_DUMP
5#include <linux/kexec.h>
6#include <linux/smp_lock.h>
7#include <linux/device.h>
8#include <linux/proc_fs.h>
9
10#define ELFCORE_ADDR_MAX (-1ULL)
11extern unsigned long long elfcorehdr_addr;
12extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
13 unsigned long, int);
14extern struct file_operations proc_vmcore_operations;
15extern struct proc_dir_entry *proc_vmcore;
16
17#endif /* CONFIG_CRASH_DUMP */
18#endif /* LINUX_CRASHDUMP_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index df94c0de53f2..7b781a72b293 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -14,6 +14,7 @@
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/ioport.h> 15#include <linux/ioport.h>
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/klist.h>
17#include <linux/list.h> 18#include <linux/list.h>
18#include <linux/types.h> 19#include <linux/types.h>
19#include <linux/module.h> 20#include <linux/module.h>
@@ -44,14 +45,15 @@ struct device;
44struct device_driver; 45struct device_driver;
45struct class; 46struct class;
46struct class_device; 47struct class_device;
47struct class_simple;
48 48
49struct bus_type { 49struct bus_type {
50 char * name; 50 const char * name;
51 51
52 struct subsystem subsys; 52 struct subsystem subsys;
53 struct kset drivers; 53 struct kset drivers;
54 struct kset devices; 54 struct kset devices;
55 struct klist klist_devices;
56 struct klist klist_drivers;
55 57
56 struct bus_attribute * bus_attrs; 58 struct bus_attribute * bus_attrs;
57 struct device_attribute * dev_attrs; 59 struct device_attribute * dev_attrs;
@@ -98,17 +100,18 @@ extern int bus_create_file(struct bus_type *, struct bus_attribute *);
98extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 100extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
99 101
100struct device_driver { 102struct device_driver {
101 char * name; 103 const char * name;
102 struct bus_type * bus; 104 struct bus_type * bus;
103 105
104 struct completion unloaded; 106 struct completion unloaded;
105 struct kobject kobj; 107 struct kobject kobj;
106 struct list_head devices; 108 struct klist klist_devices;
109 struct klist_node knode_bus;
107 110
108 struct module * owner; 111 struct module * owner;
109 112
110 int (*probe) (struct device * dev); 113 int (*probe) (struct device * dev);
111 int (*remove) (struct device * dev); 114 int (*remove) (struct device * dev);
112 void (*shutdown) (struct device * dev); 115 void (*shutdown) (struct device * dev);
113 int (*suspend) (struct device * dev, pm_message_t state, u32 level); 116 int (*suspend) (struct device * dev, pm_message_t state, u32 level);
114 int (*resume) (struct device * dev, u32 level); 117 int (*resume) (struct device * dev, u32 level);
@@ -137,12 +140,16 @@ struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store)
137extern int driver_create_file(struct device_driver *, struct driver_attribute *); 140extern int driver_create_file(struct device_driver *, struct driver_attribute *);
138extern void driver_remove_file(struct device_driver *, struct driver_attribute *); 141extern void driver_remove_file(struct device_driver *, struct driver_attribute *);
139 142
143extern int driver_for_each_device(struct device_driver * drv, struct device * start,
144 void * data, int (*fn)(struct device *, void *));
145
140 146
141/* 147/*
142 * device classes 148 * device classes
143 */ 149 */
144struct class { 150struct class {
145 char * name; 151 const char * name;
152 struct module * owner;
146 153
147 struct subsystem subsys; 154 struct subsystem subsys;
148 struct list_head children; 155 struct list_head children;
@@ -185,6 +192,7 @@ struct class_device {
185 struct kobject kobj; 192 struct kobject kobj;
186 struct class * class; /* required */ 193 struct class * class; /* required */
187 dev_t devt; /* dev_t, creates the sysfs "dev" */ 194 dev_t devt; /* dev_t, creates the sysfs "dev" */
195 struct class_device_attribute *devt_attr;
188 struct device * dev; /* not necessary, but nice to have */ 196 struct device * dev; /* not necessary, but nice to have */
189 void * class_data; /* class-specific data */ 197 void * class_data; /* class-specific data */
190 198
@@ -245,26 +253,28 @@ struct class_interface {
245extern int class_interface_register(struct class_interface *); 253extern int class_interface_register(struct class_interface *);
246extern void class_interface_unregister(struct class_interface *); 254extern void class_interface_unregister(struct class_interface *);
247 255
248/* interface for class simple stuff */ 256extern struct class *class_create(struct module *owner, char *name);
249extern struct class_simple *class_simple_create(struct module *owner, char *name); 257extern void class_destroy(struct class *cls);
250extern void class_simple_destroy(struct class_simple *cs); 258extern struct class_device *class_device_create(struct class *cls, dev_t devt,
251extern struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...) 259 struct device *device, char *fmt, ...)
252 __attribute__((format(printf,4,5))); 260 __attribute__((format(printf,4,5)));
253extern int class_simple_set_hotplug(struct class_simple *, 261extern void class_device_destroy(struct class *cls, dev_t devt);
254 int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size));
255extern void class_simple_device_remove(dev_t dev);
256 262
257 263
258struct device { 264struct device {
259 struct list_head node; /* node in sibling list */ 265 struct klist klist_children;
260 struct list_head bus_list; /* node in bus's list */ 266 struct klist_node knode_parent; /* node in sibling list */
261 struct list_head driver_list; 267 struct klist_node knode_driver;
262 struct list_head children; 268 struct klist_node knode_bus;
263 struct device * parent; 269 struct device * parent;
264 270
265 struct kobject kobj; 271 struct kobject kobj;
266 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 272 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
267 273
274 struct semaphore sem; /* semaphore to synchronize calls to
275 * its driver.
276 */
277
268 struct bus_type * bus; /* type of bus device is on */ 278 struct bus_type * bus; /* type of bus device is on */
269 struct device_driver *driver; /* which driver has allocated this 279 struct device_driver *driver; /* which driver has allocated this
270 device */ 280 device */
@@ -288,12 +298,6 @@ struct device {
288 void (*release)(struct device * dev); 298 void (*release)(struct device * dev);
289}; 299};
290 300
291static inline struct device *
292list_to_dev(struct list_head *node)
293{
294 return list_entry(node, struct device, node);
295}
296
297static inline void * 301static inline void *
298dev_get_drvdata (struct device *dev) 302dev_get_drvdata (struct device *dev)
299{ 303{
@@ -321,7 +325,6 @@ extern int device_for_each_child(struct device *, void *,
321 * Manual binding of a device to driver. See drivers/base/bus.c 325 * Manual binding of a device to driver. See drivers/base/bus.c
322 * for information on use. 326 * for information on use.
323 */ 327 */
324extern int driver_probe_device(struct device_driver * drv, struct device * dev);
325extern void device_bind_driver(struct device * dev); 328extern void device_bind_driver(struct device * dev);
326extern void device_release_driver(struct device * dev); 329extern void device_release_driver(struct device * dev);
327extern int device_attach(struct device * dev); 330extern int device_attach(struct device * dev);
@@ -332,8 +335,10 @@ extern void driver_attach(struct device_driver * drv);
332 335
333struct device_attribute { 336struct device_attribute {
334 struct attribute attr; 337 struct attribute attr;
335 ssize_t (*show)(struct device * dev, char * buf); 338 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
336 ssize_t (*store)(struct device * dev, const char * buf, size_t count); 339 char *buf);
340 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
341 const char *buf, size_t count);
337}; 342};
338 343
339#define DEVICE_ATTR(_name,_mode,_show,_store) \ 344#define DEVICE_ATTR(_name,_mode,_show,_store) \
@@ -360,13 +365,12 @@ extern int (*platform_notify_remove)(struct device * dev);
360 */ 365 */
361extern struct device * get_device(struct device * dev); 366extern struct device * get_device(struct device * dev);
362extern void put_device(struct device * dev); 367extern void put_device(struct device * dev);
363extern struct device *device_find(const char *name, struct bus_type *bus);
364 368
365 369
366/* drivers/base/platform.c */ 370/* drivers/base/platform.c */
367 371
368struct platform_device { 372struct platform_device {
369 char * name; 373 const char * name;
370 u32 id; 374 u32 id;
371 struct device dev; 375 struct device dev;
372 u32 num_resources; 376 u32 num_resources;
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
new file mode 100644
index 000000000000..0008e2ad0c9f
--- /dev/null
+++ b/include/linux/dm9000.h
@@ -0,0 +1,36 @@
1/* include/linux/dm9000.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for dm9000 platform data
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 version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#ifndef __DM9000_PLATFORM_DATA
15#define __DM9000_PLATFORM_DATA __FILE__
16
17/* IO control flags */
18
19#define DM9000_PLATF_8BITONLY (0x0001)
20#define DM9000_PLATF_16BITONLY (0x0002)
21#define DM9000_PLATF_32BITONLY (0x0004)
22
23/* platfrom data for platfrom device structure's platfrom_data field */
24
25struct dm9000_plat_data {
26 unsigned int flags;
27
28 /* allow replacement IO routines */
29
30 void (*inblk)(void __iomem *reg, void *data, int len);
31 void (*outblk)(void __iomem *reg, void *data, int len);
32 void (*dumpblk)(void __iomem *reg, int len);
33};
34
35#endif /* __DM9000_PLATFORM_DATA */
36
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 806c305332c1..2d80cc761a15 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -14,7 +14,12 @@ enum dma_data_direction {
14}; 14};
15 15
16#define DMA_64BIT_MASK 0xffffffffffffffffULL 16#define DMA_64BIT_MASK 0xffffffffffffffffULL
17#define DMA_40BIT_MASK 0x000000ffffffffffULL
18#define DMA_39BIT_MASK 0x0000007fffffffffULL
17#define DMA_32BIT_MASK 0x00000000ffffffffULL 19#define DMA_32BIT_MASK 0x00000000ffffffffULL
20#define DMA_31BIT_MASK 0x000000007fffffffULL
21#define DMA_30BIT_MASK 0x000000003fffffffULL
22#define DMA_29BIT_MASK 0x000000001fffffffULL
18 23
19#include <asm/dma-mapping.h> 24#include <asm/dma-mapping.h>
20 25
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index d2bcf556088b..5e93e6dce9a4 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -9,6 +9,7 @@ enum dmi_field {
9 DMI_SYS_VENDOR, 9 DMI_SYS_VENDOR,
10 DMI_PRODUCT_NAME, 10 DMI_PRODUCT_NAME,
11 DMI_PRODUCT_VERSION, 11 DMI_PRODUCT_VERSION,
12 DMI_PRODUCT_SERIAL,
12 DMI_BOARD_VENDOR, 13 DMI_BOARD_VENDOR,
13 DMI_BOARD_NAME, 14 DMI_BOARD_NAME,
14 DMI_BOARD_VERSION, 15 DMI_BOARD_VERSION,
diff --git a/include/linux/dqblk_v1.h b/include/linux/dqblk_v1.h
index 42fbf4797156..57f1250d5a52 100644
--- a/include/linux/dqblk_v1.h
+++ b/include/linux/dqblk_v1.h
@@ -11,6 +11,12 @@
11/* Root squash turned on */ 11/* Root squash turned on */
12#define V1_DQF_RSQUASH 1 12#define V1_DQF_RSQUASH 1
13 13
14/* Numbers of blocks needed for updates */
15#define V1_INIT_ALLOC 1
16#define V1_INIT_REWRITE 1
17#define V1_DEL_ALLOC 0
18#define V1_DEL_REWRITE 2
19
14/* Special information about quotafile */ 20/* Special information about quotafile */
15struct v1_mem_dqinfo { 21struct v1_mem_dqinfo {
16}; 22};
diff --git a/include/linux/dqblk_v2.h b/include/linux/dqblk_v2.h
index 4a6c5f6867bb..4f853322cb7f 100644
--- a/include/linux/dqblk_v2.h
+++ b/include/linux/dqblk_v2.h
@@ -10,6 +10,12 @@
10/* id numbers of quota format */ 10/* id numbers of quota format */
11#define QFMT_VFS_V0 2 11#define QFMT_VFS_V0 2
12 12
13/* Numbers of blocks needed for updates */
14#define V2_INIT_ALLOC 4
15#define V2_INIT_REWRITE 2
16#define V2_DEL_ALLOC 0
17#define V2_DEL_REWRITE 6
18
13/* Inmemory copy of version specific information */ 19/* Inmemory copy of version specific information */
14struct v2_mem_dqinfo { 20struct v2_mem_dqinfo {
15 unsigned int dqi_blocks; 21 unsigned int dqi_blocks;
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 047e7222df7a..73781ec165b4 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -315,7 +315,7 @@ extern struct efi_memory_map memmap;
315 */ 315 */
316static inline int efi_range_is_wc(unsigned long start, unsigned long len) 316static inline int efi_range_is_wc(unsigned long start, unsigned long len)
317{ 317{
318 int i; 318 unsigned long i;
319 319
320 for (i = 0; i < len; i += (1UL << EFI_PAGE_SHIFT)) { 320 for (i = 0; i < len; i += (1UL << EFI_PAGE_SHIFT)) {
321 unsigned long paddr = __pa(start + i); 321 unsigned long paddr = __pa(start + i);
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 220748b7abea..a1478258d002 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -56,18 +56,32 @@ static inline int is_zero_ether_addr(const u8 *addr)
56} 56}
57 57
58/** 58/**
59 * is_multicast_ether_addr - Determine if the given Ethernet address is a
60 * multicast address.
61 *
62 * @addr: Pointer to a six-byte array containing the Ethernet address
63 *
64 * Return true if the address is a multicast address.
65 */
66static inline int is_multicast_ether_addr(const u8 *addr)
67{
68 return addr[0] & 0x01;
69}
70
71/**
59 * is_valid_ether_addr - Determine if the given Ethernet address is valid 72 * is_valid_ether_addr - Determine if the given Ethernet address is valid
60 * @addr: Pointer to a six-byte array containing the Ethernet address 73 * @addr: Pointer to a six-byte array containing the Ethernet address
61 * 74 *
62 * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not 75 * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
63 * a multicast address, and is not FF:FF:FF:FF:FF:FF. The multicast 76 * a multicast address, and is not FF:FF:FF:FF:FF:FF.
64 * and FF:FF:... tests are combined into the single test "!(addr[0]&1)".
65 * 77 *
66 * Return true if the address is valid. 78 * Return true if the address is valid.
67 */ 79 */
68static inline int is_valid_ether_addr(const u8 *addr) 80static inline int is_valid_ether_addr(const u8 *addr)
69{ 81{
70 return !(addr[0]&1) && !is_zero_ether_addr(addr); 82 /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
83 * explicitly check for it here. */
84 return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
71} 85}
72 86
73/** 87/**
@@ -83,6 +97,6 @@ static inline void random_ether_addr(u8 *addr)
83 addr [0] &= 0xfe; /* clear multicast bit */ 97 addr [0] &= 0xfe; /* clear multicast bit */
84 addr [0] |= 0x02; /* set local assignment bit (IEEE802) */ 98 addr [0] |= 0x02; /* set local assignment bit (IEEE802) */
85} 99}
86#endif 100#endif /* __KERNEL__ */
87 101
88#endif /* _LINUX_ETHERDEVICE_H */ 102#endif /* _LINUX_ETHERDEVICE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c85b210490ea..a0ab26aab450 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -256,6 +256,7 @@ struct net_device;
256u32 ethtool_op_get_link(struct net_device *dev); 256u32 ethtool_op_get_link(struct net_device *dev);
257u32 ethtool_op_get_tx_csum(struct net_device *dev); 257u32 ethtool_op_get_tx_csum(struct net_device *dev);
258int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 258int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
259int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
259u32 ethtool_op_get_sg(struct net_device *dev); 260u32 ethtool_op_get_sg(struct net_device *dev);
260int ethtool_op_set_sg(struct net_device *dev, u32 data); 261int ethtool_op_set_sg(struct net_device *dev, u32 data);
261u32 ethtool_op_get_tso(struct net_device *dev); 262u32 ethtool_op_get_tso(struct net_device *dev);
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index fab43527e597..a657130ba03a 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -300,18 +300,19 @@ struct ext2_inode {
300/* 300/*
301 * Mount flags 301 * Mount flags
302 */ 302 */
303#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */ 303#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */
304#define EXT2_MOUNT_OLDALLOC 0x0002 /* Don't use the new Orlov allocator */ 304#define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */
305#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */ 305#define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */
306#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */ 306#define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */
307#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ 307#define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */
308#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ 308#define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */
309#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ 309#define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */
310#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */ 310#define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */
311#define EXT2_MOUNT_NOBH 0x0100 /* No buffer_heads */ 311#define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */
312#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */ 312#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */
313#define EXT2_MOUNT_XATTR_USER 0x4000 /* Extended user attributes */ 313#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
314#define EXT2_MOUNT_POSIX_ACL 0x8000 /* POSIX Access Control Lists */ 314#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
315#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */
315 316
316#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt 317#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
317#define set_opt(o, opt) o |= EXT2_MOUNT_##opt 318#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 74ad31781e3e..4b6e1ab216a5 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -358,6 +358,7 @@ struct ext3_inode {
358#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ 358#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */
359#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ 359#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
360#define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */ 360#define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */
361#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
361 362
362/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ 363/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
363#ifndef _LINUX_EXT2_FS_H 364#ifndef _LINUX_EXT2_FS_H
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index e8292af9033b..c8307c02dd07 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -42,15 +42,15 @@
42 * superblock only gets updated once, of course, so don't bother 42 * superblock only gets updated once, of course, so don't bother
43 * counting that again for the quota updates. */ 43 * counting that again for the quota updates. */
44 44
45#define EXT3_DATA_TRANS_BLOCKS (EXT3_SINGLEDATA_TRANS_BLOCKS + \ 45#define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \
46 EXT3_XATTR_TRANS_BLOCKS - 2 + \ 46 EXT3_XATTR_TRANS_BLOCKS - 2 + \
47 2*EXT3_QUOTA_TRANS_BLOCKS) 47 2*EXT3_QUOTA_TRANS_BLOCKS(sb))
48 48
49/* Delete operations potentially hit one directory's namespace plus an 49/* Delete operations potentially hit one directory's namespace plus an
50 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be 50 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
51 * generous. We can grow the delete transaction later if necessary. */ 51 * generous. We can grow the delete transaction later if necessary. */
52 52
53#define EXT3_DELETE_TRANS_BLOCKS (2 * EXT3_DATA_TRANS_BLOCKS + 64) 53#define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64)
54 54
55/* Define an arbitrary limit for the amount of data we will anticipate 55/* Define an arbitrary limit for the amount of data we will anticipate
56 * writing to any given transaction. For unbounded transactions such as 56 * writing to any given transaction. For unbounded transactions such as
@@ -74,14 +74,17 @@
74#ifdef CONFIG_QUOTA 74#ifdef CONFIG_QUOTA
75/* Amount of blocks needed for quota update - we know that the structure was 75/* Amount of blocks needed for quota update - we know that the structure was
76 * allocated so we need to update only inode+data */ 76 * allocated so we need to update only inode+data */
77#define EXT3_QUOTA_TRANS_BLOCKS 2 77#define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0)
78/* Amount of blocks needed for quota insert/delete - we do some block writes 78/* Amount of blocks needed for quota insert/delete - we do some block writes
79 * but inode, sb and group updates are done only once */ 79 * but inode, sb and group updates are done only once */
80#define EXT3_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*\ 80#define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
81 (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3) 81 (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0)
82#define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
83 (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0)
82#else 84#else
83#define EXT3_QUOTA_TRANS_BLOCKS 0 85#define EXT3_QUOTA_TRANS_BLOCKS(sb) 0
84#define EXT3_QUOTA_INIT_BLOCKS 0 86#define EXT3_QUOTA_INIT_BLOCKS(sb) 0
87#define EXT3_QUOTA_DEL_BLOCKS(sb) 0
85#endif 88#endif
86 89
87int 90int
diff --git a/include/linux/fb.h b/include/linux/fb.h
index b468bf496547..bc24beeed971 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -524,11 +524,11 @@ struct fb_pixmap {
524 u32 offset; /* current offset to buffer */ 524 u32 offset; /* current offset to buffer */
525 u32 buf_align; /* byte alignment of each bitmap */ 525 u32 buf_align; /* byte alignment of each bitmap */
526 u32 scan_align; /* alignment per scanline */ 526 u32 scan_align; /* alignment per scanline */
527 u32 access_align; /* alignment per read/write */ 527 u32 access_align; /* alignment per read/write (bits) */
528 u32 flags; /* see FB_PIXMAP_* */ 528 u32 flags; /* see FB_PIXMAP_* */
529 /* access methods */ 529 /* access methods */
530 void (*outbuf)(struct fb_info *info, u8 *addr, u8 *src, unsigned int size); 530 void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);
531 u8 (*inbuf) (struct fb_info *info, u8 *addr); 531 void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);
532}; 532};
533 533
534 534
@@ -816,18 +816,9 @@ extern int unregister_framebuffer(struct fb_info *fb_info);
816extern int fb_prepare_logo(struct fb_info *fb_info); 816extern int fb_prepare_logo(struct fb_info *fb_info);
817extern int fb_show_logo(struct fb_info *fb_info); 817extern int fb_show_logo(struct fb_info *fb_info);
818extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); 818extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
819extern void fb_iomove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf, 819extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
820 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
821 u32 height, u32 shift_high, u32 shift_low, u32 mod); 820 u32 height, u32 shift_high, u32 shift_low, u32 mod);
822extern void fb_iomove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, 821extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height);
823 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
824 u32 height);
825extern void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
826 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
827 u32 height, u32 shift_high, u32 shift_low, u32 mod);
828extern void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
829 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
830 u32 height);
831extern void fb_set_suspend(struct fb_info *info, int state); 822extern void fb_set_suspend(struct fb_info *info, int state);
832extern int fb_get_color_depth(struct fb_var_screeninfo *var); 823extern int fb_get_color_depth(struct fb_var_screeninfo *var);
833extern int fb_get_options(char *name, char **option); 824extern int fb_get_options(char *name, char **option);
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 704fb76b6334..8a7c82151de9 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -25,6 +25,10 @@
25 25
26#ifdef __KERNEL__ 26#ifdef __KERNEL__
27 27
28#ifndef force_o_largefile
29#define force_o_largefile() (BITS_PER_LONG != 32)
30#endif
31
28#if BITS_PER_LONG == 32 32#if BITS_PER_LONG == 32
29#define IS_GETLK32(cmd) ((cmd) == F_GETLK) 33#define IS_GETLK32(cmd) ((cmd) == F_GETLK)
30#define IS_SETLK32(cmd) ((cmd) == F_SETLK) 34#define IS_SETLK32(cmd) ((cmd) == F_SETLK)
diff --git a/include/linux/font.h b/include/linux/font.h
index fc2d690c9d5f..8fc80a7d78ac 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -25,19 +25,23 @@ struct font_desc {
25#define VGA8x16_IDX 1 25#define VGA8x16_IDX 1
26#define PEARL8x8_IDX 2 26#define PEARL8x8_IDX 2
27#define VGA6x11_IDX 3 27#define VGA6x11_IDX 3
28#define SUN8x16_IDX 4 28#define FONT7x14_IDX 4
29#define SUN12x22_IDX 5 29#define FONT10x18_IDX 5
30#define ACORN8x8_IDX 6 30#define SUN8x16_IDX 6
31#define MINI4x6_IDX 7 31#define SUN12x22_IDX 7
32#define ACORN8x8_IDX 8
33#define MINI4x6_IDX 9
32 34
33extern struct font_desc font_vga_8x8, 35extern struct font_desc font_vga_8x8,
34 font_vga_8x16, 36 font_vga_8x16,
35 font_pearl_8x8, 37 font_pearl_8x8,
36 font_vga_6x11, 38 font_vga_6x11,
37 font_sun_8x16, 39 font_7x14,
38 font_sun_12x22, 40 font_10x18,
39 font_acorn_8x8, 41 font_sun_8x16,
40 font_mini_4x6; 42 font_sun_12x22,
43 font_acorn_8x8,
44 font_mini_4x6;
41 45
42/* Find a font with a specific name */ 46/* Find a font with a specific name */
43 47
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0180102dace1..3ae8e37bdfc8 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -220,6 +220,7 @@ extern int dir_notify_enable;
220 220
221struct iovec; 221struct iovec;
222struct nameidata; 222struct nameidata;
223struct kiocb;
223struct pipe_inode_info; 224struct pipe_inode_info;
224struct poll_table_struct; 225struct poll_table_struct;
225struct kstatfs; 226struct kstatfs;
@@ -240,7 +241,7 @@ typedef int (get_block_t)(struct inode *inode, sector_t iblock,
240typedef int (get_blocks_t)(struct inode *inode, sector_t iblock, 241typedef int (get_blocks_t)(struct inode *inode, sector_t iblock,
241 unsigned long max_blocks, 242 unsigned long max_blocks,
242 struct buffer_head *bh_result, int create); 243 struct buffer_head *bh_result, int create);
243typedef void (dio_iodone_t)(struct inode *inode, loff_t offset, 244typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
244 ssize_t bytes, void *private); 245 ssize_t bytes, void *private);
245 246
246/* 247/*
@@ -302,7 +303,6 @@ struct iattr {
302struct page; 303struct page;
303struct address_space; 304struct address_space;
304struct writeback_control; 305struct writeback_control;
305struct kiocb;
306 306
307struct address_space_operations { 307struct address_space_operations {
308 int (*writepage)(struct page *page, struct writeback_control *wbc); 308 int (*writepage)(struct page *page, struct writeback_control *wbc);
@@ -330,6 +330,8 @@ struct address_space_operations {
330 int (*releasepage) (struct page *, int); 330 int (*releasepage) (struct page *, int);
331 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 331 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
332 loff_t offset, unsigned long nr_segs); 332 loff_t offset, unsigned long nr_segs);
333 struct page* (*get_xip_page)(struct address_space *, sector_t,
334 int);
333}; 335};
334 336
335struct backing_dev_info; 337struct backing_dev_info;
@@ -581,7 +583,6 @@ struct file {
581 atomic_t f_count; 583 atomic_t f_count;
582 unsigned int f_flags; 584 unsigned int f_flags;
583 mode_t f_mode; 585 mode_t f_mode;
584 int f_error;
585 loff_t f_pos; 586 loff_t f_pos;
586 struct fown_struct f_owner; 587 struct fown_struct f_owner;
587 unsigned int f_uid, f_gid; 588 unsigned int f_uid, f_gid;
@@ -674,6 +675,7 @@ struct file_lock {
674 struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ 675 struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */
675 union { 676 union {
676 struct nfs_lock_info nfs_fl; 677 struct nfs_lock_info nfs_fl;
678 struct nfs4_lock_info nfs4_fl;
677 } fl_u; 679 } fl_u;
678}; 680};
679 681
@@ -883,7 +885,9 @@ struct block_device_operations {
883 int (*open) (struct inode *, struct file *); 885 int (*open) (struct inode *, struct file *);
884 int (*release) (struct inode *, struct file *); 886 int (*release) (struct inode *, struct file *);
885 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); 887 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
888 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
886 long (*compat_ioctl) (struct file *, unsigned, unsigned long); 889 long (*compat_ioctl) (struct file *, unsigned, unsigned long);
890 int (*direct_access) (struct block_device *, sector_t, unsigned long *);
887 int (*media_changed) (struct gendisk *); 891 int (*media_changed) (struct gendisk *);
888 int (*revalidate_disk) (struct gendisk *); 892 int (*revalidate_disk) (struct gendisk *);
889 struct module *owner; 893 struct module *owner;
@@ -1024,6 +1028,7 @@ struct super_operations {
1024#define I_FREEING 16 1028#define I_FREEING 16
1025#define I_CLEAR 32 1029#define I_CLEAR 32
1026#define I_NEW 64 1030#define I_NEW 64
1031#define I_WILL_FREE 128
1027 1032
1028#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1033#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1029 1034
@@ -1494,6 +1499,23 @@ extern loff_t remote_llseek(struct file *file, loff_t offset, int origin);
1494extern int generic_file_open(struct inode * inode, struct file * filp); 1499extern int generic_file_open(struct inode * inode, struct file * filp);
1495extern int nonseekable_open(struct inode * inode, struct file * filp); 1500extern int nonseekable_open(struct inode * inode, struct file * filp);
1496 1501
1502#ifdef CONFIG_FS_XIP
1503extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len,
1504 loff_t *ppos);
1505extern ssize_t xip_file_sendfile(struct file *in_file, loff_t *ppos,
1506 size_t count, read_actor_t actor,
1507 void *target);
1508extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma);
1509extern ssize_t xip_file_write(struct file *filp, const char __user *buf,
1510 size_t len, loff_t *ppos);
1511extern int xip_truncate_page(struct address_space *mapping, loff_t from);
1512#else
1513static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
1514{
1515 return 0;
1516}
1517#endif
1518
1497static inline void do_generic_file_read(struct file * filp, loff_t *ppos, 1519static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
1498 read_descriptor_t * desc, 1520 read_descriptor_t * desc,
1499 read_actor_t actor) 1521 read_actor_t actor)
@@ -1657,6 +1679,52 @@ static inline void simple_transaction_set(struct file *file, size_t n)
1657 ar->size = n; 1679 ar->size = n;
1658} 1680}
1659 1681
1682/*
1683 * simple attribute files
1684 *
1685 * These attributes behave similar to those in sysfs:
1686 *
1687 * Writing to an attribute immediately sets a value, an open file can be
1688 * written to multiple times.
1689 *
1690 * Reading from an attribute creates a buffer from the value that might get
1691 * read with multiple read calls. When the attribute has been read
1692 * completely, no further read calls are possible until the file is opened
1693 * again.
1694 *
1695 * All attributes contain a text representation of a numeric value
1696 * that are accessed with the get() and set() functions.
1697 */
1698#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \
1699static int __fops ## _open(struct inode *inode, struct file *file) \
1700{ \
1701 __simple_attr_check_format(__fmt, 0ull); \
1702 return simple_attr_open(inode, file, __get, __set, __fmt); \
1703} \
1704static struct file_operations __fops = { \
1705 .owner = THIS_MODULE, \
1706 .open = __fops ## _open, \
1707 .release = simple_attr_close, \
1708 .read = simple_attr_read, \
1709 .write = simple_attr_write, \
1710};
1711
1712static inline void __attribute__((format(printf, 1, 2)))
1713__simple_attr_check_format(const char *fmt, ...)
1714{
1715 /* don't do anything, just let the compiler check the arguments; */
1716}
1717
1718int simple_attr_open(struct inode *inode, struct file *file,
1719 u64 (*get)(void *), void (*set)(void *, u64),
1720 const char *fmt);
1721int simple_attr_close(struct inode *inode, struct file *file);
1722ssize_t simple_attr_read(struct file *file, char __user *buf,
1723 size_t len, loff_t *ppos);
1724ssize_t simple_attr_write(struct file *file, const char __user *buf,
1725 size_t len, loff_t *ppos);
1726
1727
1660#ifdef CONFIG_SECURITY 1728#ifdef CONFIG_SECURITY
1661static inline char *alloc_secdata(void) 1729static inline char *alloc_secdata(void)
1662{ 1730{
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index faaff4c64559..70f54af87b9f 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -51,6 +51,7 @@ struct gianfar_platform_data {
51 51
52 /* board specific information */ 52 /* board specific information */
53 u32 board_flags; 53 u32 board_flags;
54 u32 phy_flags;
54 u32 phyid; 55 u32 phyid;
55 u32 interruptPHY; 56 u32 interruptPHY;
56 u8 mac_addr[6]; 57 u8 mac_addr[6];
@@ -61,9 +62,14 @@ struct gianfar_platform_data {
61#define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002 62#define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002
62#define FSL_GIANFAR_DEV_HAS_RMON 0x00000004 63#define FSL_GIANFAR_DEV_HAS_RMON 0x00000004
63#define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008 64#define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008
65#define FSL_GIANFAR_DEV_HAS_CSUM 0x00000010
66#define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020
67#define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040
68#define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080
64 69
65/* Flags in gianfar_platform_data */ 70/* Flags in gianfar_platform_data */
66#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* if not set use a timer */ 71#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */
72#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */
67 73
68struct fsl_i2c_platform_data { 74struct fsl_i2c_platform_data {
69 /* device specific information */ 75 /* device specific information */
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index b1272f822cfa..cd623eccdbea 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -67,6 +67,8 @@ int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mo
67void gameport_close(struct gameport *gameport); 67void gameport_close(struct gameport *gameport);
68void gameport_rescan(struct gameport *gameport); 68void gameport_rescan(struct gameport *gameport);
69 69
70#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
71
70void __gameport_register_port(struct gameport *gameport, struct module *owner); 72void __gameport_register_port(struct gameport *gameport, struct module *owner);
71static inline void gameport_register_port(struct gameport *gameport) 73static inline void gameport_register_port(struct gameport *gameport)
72{ 74{
@@ -75,6 +77,29 @@ static inline void gameport_register_port(struct gameport *gameport)
75 77
76void gameport_unregister_port(struct gameport *gameport); 78void gameport_unregister_port(struct gameport *gameport);
77 79
80void gameport_set_phys(struct gameport *gameport, const char *fmt, ...)
81 __attribute__ ((format (printf, 2, 3)));
82
83#else
84
85static inline void gameport_register_port(struct gameport *gameport)
86{
87 return;
88}
89
90static inline void gameport_unregister_port(struct gameport *gameport)
91{
92 return;
93}
94
95static inline void gameport_set_phys(struct gameport *gameport,
96 const char *fmt, ...)
97{
98 return;
99}
100
101#endif
102
78static inline struct gameport *gameport_allocate_port(void) 103static inline struct gameport *gameport_allocate_port(void)
79{ 104{
80 struct gameport *gameport = kcalloc(1, sizeof(struct gameport), GFP_KERNEL); 105 struct gameport *gameport = kcalloc(1, sizeof(struct gameport), GFP_KERNEL);
@@ -92,9 +117,6 @@ static inline void gameport_set_name(struct gameport *gameport, const char *name
92 strlcpy(gameport->name, name, sizeof(gameport->name)); 117 strlcpy(gameport->name, name, sizeof(gameport->name));
93} 118}
94 119
95void gameport_set_phys(struct gameport *gameport, const char *fmt, ...)
96 __attribute__ ((format (printf, 2, 3)));
97
98/* 120/*
99 * Use the following fucntions to manipulate gameport's per-port 121 * Use the following fucntions to manipulate gameport's per-port
100 * driver-specific data. 122 * driver-specific data.
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
new file mode 100644
index 000000000000..7fd0576a4454
--- /dev/null
+++ b/include/linux/genalloc.h
@@ -0,0 +1,40 @@
1/*
2 * Basic general purpose allocator for managing special purpose memory
3 * not managed by the regular kmalloc/kfree interface.
4 * Uses for this includes on-device special memory, uncached memory
5 * etc.
6 *
7 * This code is based on the buddy allocator found in the sym53c8xx_2
8 * driver, adapted for general purpose use.
9 *
10 * This source code is licensed under the GNU General Public License,
11 * Version 2. See the file COPYING for more details.
12 */
13
14#include <linux/spinlock.h>
15
16#define ALLOC_MIN_SHIFT 5 /* 32 bytes minimum */
17/*
18 * Link between free memory chunks of a given size.
19 */
20struct gen_pool_link {
21 struct gen_pool_link *next;
22};
23
24/*
25 * Memory pool descriptor.
26 */
27struct gen_pool {
28 spinlock_t lock;
29 unsigned long (*get_new_chunk)(struct gen_pool *);
30 struct gen_pool *next;
31 struct gen_pool_link *h;
32 unsigned long private;
33 int max_chunk_shift;
34};
35
36unsigned long gen_pool_alloc(struct gen_pool *poolp, int size);
37void gen_pool_free(struct gen_pool *mp, unsigned long ptr, int size);
38struct gen_pool *gen_pool_create(int nr_chunks, int max_chunk_shift,
39 unsigned long (*fp)(struct gen_pool *),
40 unsigned long data);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 47dedaf971d6..01796c41c951 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -224,7 +224,7 @@ static inline void free_disk_stats(struct gendisk *disk)
224extern void disk_round_stats(struct gendisk *disk); 224extern void disk_round_stats(struct gendisk *disk);
225 225
226/* drivers/block/genhd.c */ 226/* drivers/block/genhd.c */
227extern int get_blkdev_list(char *); 227extern int get_blkdev_list(char *, int);
228extern void add_disk(struct gendisk *disk); 228extern void add_disk(struct gendisk *disk);
229extern void del_gendisk(struct gendisk *gp); 229extern void del_gendisk(struct gendisk *gp);
230extern void unlink_gendisk(struct gendisk *gp); 230extern void unlink_gendisk(struct gendisk *gp);
@@ -403,6 +403,7 @@ extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
403extern void add_partition(struct gendisk *, int, sector_t, sector_t); 403extern void add_partition(struct gendisk *, int, sector_t, sector_t);
404extern void delete_partition(struct gendisk *, int); 404extern void delete_partition(struct gendisk *, int);
405 405
406extern struct gendisk *alloc_disk_node(int minors, int node_id);
406extern struct gendisk *alloc_disk(int minors); 407extern struct gendisk *alloc_disk(int minors);
407extern struct kobject *get_disk(struct gendisk *disk); 408extern struct kobject *get_disk(struct gendisk *disk);
408extern void put_disk(struct gendisk *disk); 409extern void put_disk(struct gendisk *disk);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index af7407e8cfc5..8d6bf608b199 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -39,6 +39,7 @@ struct vm_area_struct;
39#define __GFP_COMP 0x4000u /* Add compound page metadata */ 39#define __GFP_COMP 0x4000u /* Add compound page metadata */
40#define __GFP_ZERO 0x8000u /* Return zeroed page on success */ 40#define __GFP_ZERO 0x8000u /* Return zeroed page on success */
41#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */ 41#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */
42#define __GFP_NORECLAIM 0x20000u /* No realy zone reclaim during allocation */
42 43
43#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ 44#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
44#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) 45#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
@@ -47,7 +48,7 @@ struct vm_area_struct;
47#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ 48#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
48 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ 49 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
49 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 50 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
50 __GFP_NOMEMALLOC) 51 __GFP_NOMEMALLOC|__GFP_NORECLAIM)
51 52
52#define GFP_ATOMIC (__GFP_HIGH) 53#define GFP_ATOMIC (__GFP_HIGH)
53#define GFP_NOIO (__GFP_WAIT) 54#define GFP_NOIO (__GFP_WAIT)
@@ -132,5 +133,10 @@ extern void FASTCALL(free_cold_page(struct page *page));
132#define free_page(addr) free_pages((addr),0) 133#define free_page(addr) free_pages((addr),0)
133 134
134void page_alloc_init(void); 135void page_alloc_init(void);
136#ifdef CONFIG_NUMA
137void drain_remote_pages(void);
138#else
139static inline void drain_remote_pages(void) { };
140#endif
135 141
136#endif /* __LINUX_GFP_H */ 142#endif /* __LINUX_GFP_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index ebc712e91066..8336dba18971 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -43,13 +43,17 @@
43#define __IRQ_MASK(x) ((1UL << (x))-1) 43#define __IRQ_MASK(x) ((1UL << (x))-1)
44 44
45#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) 45#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
46#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
47#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) 46#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
47#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
48 48
49#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) 49#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT)
50#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) 50#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
51#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) 51#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
52 52
53#if PREEMPT_ACTIVE < (1 << (HARDIRQ_SHIFT + HARDIRQ_BITS))
54#error PREEMPT_ACTIVE is too low!
55#endif
56
53#define hardirq_count() (preempt_count() & HARDIRQ_MASK) 57#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
54#define softirq_count() (preempt_count() & SOFTIRQ_MASK) 58#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
55#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) 59#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK))
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 503194e62fe1..ed2927ef1ff7 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Generic HDLC support routines for Linux 2 * Generic HDLC support routines for Linux
3 * 3 *
4 * Copyright (C) 1999-2003 Krzysztof Halasa <khc@pm.waw.pl> 4 * Copyright (C) 1999-2005 Krzysztof Halasa <khc@pm.waw.pl>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License 7 * under the terms of version 2 of the GNU General Public License
@@ -41,6 +41,7 @@
41#define LMI_NONE 1 /* No LMI, all PVCs are static */ 41#define LMI_NONE 1 /* No LMI, all PVCs are static */
42#define LMI_ANSI 2 /* ANSI Annex D */ 42#define LMI_ANSI 2 /* ANSI Annex D */
43#define LMI_CCITT 3 /* ITU-T Annex A */ 43#define LMI_CCITT 3 /* ITU-T Annex A */
44#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
44 45
45#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ 46#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */
46#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ 47#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */
@@ -89,6 +90,7 @@ typedef struct pvc_device_struct {
89 unsigned int deleted: 1; 90 unsigned int deleted: 1;
90 unsigned int fecn: 1; 91 unsigned int fecn: 1;
91 unsigned int becn: 1; 92 unsigned int becn: 1;
93 unsigned int bandwidth; /* Cisco LMI reporting only */
92 }state; 94 }state;
93}pvc_device; 95}pvc_device;
94 96
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 2a7e6c65c882..6bece9280eb7 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -28,6 +28,7 @@ static inline void *kmap(struct page *page)
28 28
29#define kmap_atomic(page, idx) page_address(page) 29#define kmap_atomic(page, idx) page_address(page)
30#define kunmap_atomic(addr, idx) do { } while (0) 30#define kunmap_atomic(addr, idx) do { } while (0)
31#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
31#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 32#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
32 33
33#endif /* CONFIG_HIGHMEM */ 34#endif /* CONFIG_HIGHMEM */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 6af1ae4a8211..f529d1442815 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -4,6 +4,7 @@
4#ifdef CONFIG_HUGETLB_PAGE 4#ifdef CONFIG_HUGETLB_PAGE
5 5
6#include <linux/mempolicy.h> 6#include <linux/mempolicy.h>
7#include <asm/tlbflush.h>
7 8
8struct ctl_table; 9struct ctl_table;
9 10
@@ -22,12 +23,6 @@ int hugetlb_report_meminfo(char *);
22int hugetlb_report_node_meminfo(int, char *); 23int hugetlb_report_node_meminfo(int, char *);
23int is_hugepage_mem_enough(size_t); 24int is_hugepage_mem_enough(size_t);
24unsigned long hugetlb_total_pages(void); 25unsigned long hugetlb_total_pages(void);
25struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
26 int write);
27struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
28 pmd_t *pmd, int write);
29int is_aligned_hugepage_range(unsigned long addr, unsigned long len);
30int pmd_huge(pmd_t pmd);
31struct page *alloc_huge_page(void); 26struct page *alloc_huge_page(void);
32void free_huge_page(struct page *); 27void free_huge_page(struct page *);
33 28
@@ -35,6 +30,17 @@ extern unsigned long max_huge_pages;
35extern const unsigned long hugetlb_zero, hugetlb_infinity; 30extern const unsigned long hugetlb_zero, hugetlb_infinity;
36extern int sysctl_hugetlb_shm_group; 31extern int sysctl_hugetlb_shm_group;
37 32
33/* arch callbacks */
34
35pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr);
36pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr);
37struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
38 int write);
39struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
40 pmd_t *pmd, int write);
41int is_aligned_hugepage_range(unsigned long addr, unsigned long len);
42int pmd_huge(pmd_t pmd);
43
38#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE 44#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
39#define is_hugepage_only_range(mm, addr, len) 0 45#define is_hugepage_only_range(mm, addr, len) 0
40#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 46#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \
@@ -48,6 +54,28 @@ extern int sysctl_hugetlb_shm_group;
48int prepare_hugepage_range(unsigned long addr, unsigned long len); 54int prepare_hugepage_range(unsigned long addr, unsigned long len);
49#endif 55#endif
50 56
57#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE
58#define set_huge_pte_at(mm, addr, ptep, pte) set_pte_at(mm, addr, ptep, pte)
59#define huge_ptep_get_and_clear(mm, addr, ptep) ptep_get_and_clear(mm, addr, ptep)
60#else
61void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
62 pte_t *ptep, pte_t pte);
63pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
64 pte_t *ptep);
65#endif
66
67#ifndef ARCH_HAS_HUGETLB_PREFAULT_HOOK
68#define hugetlb_prefault_arch_hook(mm) do { } while (0)
69#else
70void hugetlb_prefault_arch_hook(struct mm_struct *mm);
71#endif
72
73#ifndef ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
74#define hugetlb_clean_stale_pgtable(pte) BUG()
75#else
76void hugetlb_clean_stale_pgtable(pte_t *pte);
77#endif
78
51#else /* !CONFIG_HUGETLB_PAGE */ 79#else /* !CONFIG_HUGETLB_PAGE */
52 80
53static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 81static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h
new file mode 100644
index 000000000000..1b5018a965f5
--- /dev/null
+++ b/include/linux/hwmon-sysfs.h
@@ -0,0 +1,36 @@
1/*
2 * hwmon-sysfs.h - hardware monitoring chip driver sysfs defines
3 *
4 * Copyright (C) 2005 Yani Ioannou <yani.ioannou@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20#ifndef _LINUX_HWMON_SYSFS_H
21#define _LINUX_HWMON_SYSFS_H
22
23struct sensor_device_attribute{
24 struct device_attribute dev_attr;
25 int index;
26};
27#define to_sensor_dev_attr(_dev_attr) \
28 container_of(_dev_attr, struct sensor_device_attribute, dev_attr)
29
30#define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index) \
31struct sensor_device_attribute sensor_dev_attr_##_name = { \
32 .dev_attr = __ATTR(_name,_mode,_show,_store), \
33 .index = _index, \
34}
35
36#endif /* _LINUX_HWMON_SYSFS_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 89270ce51470..33f08258f22b 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -108,6 +108,7 @@
108#define I2C_DRIVERID_TDA7313 62 /* TDA7313 audio processor */ 108#define I2C_DRIVERID_TDA7313 62 /* TDA7313 audio processor */
109#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ 109#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */
110#define I2C_DRIVERID_SAA7114H 64 /* video decoder */ 110#define I2C_DRIVERID_SAA7114H 64 /* video decoder */
111#define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */
111 112
112 113
113#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ 114#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */
diff --git a/include/linux/i2c-vid.h b/include/linux/i2c-vid.h
index 974835e3530f..41d0635e0ba9 100644
--- a/include/linux/i2c-vid.h
+++ b/include/linux/i2c-vid.h
@@ -97,3 +97,15 @@ static inline int vid_from_reg(int val, int vrm)
97 2050 - (val) * 50); 97 2050 - (val) * 50);
98 } 98 }
99} 99}
100
101static inline int vid_to_reg(int val, int vrm)
102{
103 switch (vrm) {
104 case 91: /* VRM 9.1 */
105 case 90: /* VRM 9.0 */
106 return ((val >= 1100) && (val <= 1850) ?
107 ((18499 - val * 10) / 25 + 5) / 10 : -1);
108 default:
109 return -1;
110 }
111}
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index ebcd745f4cd6..be837b13f297 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -290,11 +290,8 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
290 */ 290 */
291struct i2c_client_address_data { 291struct i2c_client_address_data {
292 unsigned short *normal_i2c; 292 unsigned short *normal_i2c;
293 unsigned short *normal_i2c_range;
294 unsigned short *probe; 293 unsigned short *probe;
295 unsigned short *probe_range;
296 unsigned short *ignore; 294 unsigned short *ignore;
297 unsigned short *ignore_range;
298 unsigned short *force; 295 unsigned short *force;
299}; 296};
300 297
@@ -563,24 +560,15 @@ union i2c_smbus_data {
563#define I2C_CLIENT_INSMOD \ 560#define I2C_CLIENT_INSMOD \
564 I2C_CLIENT_MODULE_PARM(probe, \ 561 I2C_CLIENT_MODULE_PARM(probe, \
565 "List of adapter,address pairs to scan additionally"); \ 562 "List of adapter,address pairs to scan additionally"); \
566 I2C_CLIENT_MODULE_PARM(probe_range, \
567 "List of adapter,start-addr,end-addr triples to scan " \
568 "additionally"); \
569 I2C_CLIENT_MODULE_PARM(ignore, \ 563 I2C_CLIENT_MODULE_PARM(ignore, \
570 "List of adapter,address pairs not to scan"); \ 564 "List of adapter,address pairs not to scan"); \
571 I2C_CLIENT_MODULE_PARM(ignore_range, \
572 "List of adapter,start-addr,end-addr triples not to " \
573 "scan"); \
574 I2C_CLIENT_MODULE_PARM(force, \ 565 I2C_CLIENT_MODULE_PARM(force, \
575 "List of adapter,address pairs to boldly assume " \ 566 "List of adapter,address pairs to boldly assume " \
576 "to be present"); \ 567 "to be present"); \
577 static struct i2c_client_address_data addr_data = { \ 568 static struct i2c_client_address_data addr_data = { \
578 .normal_i2c = normal_i2c, \ 569 .normal_i2c = normal_i2c, \
579 .normal_i2c_range = normal_i2c_range, \
580 .probe = probe, \ 570 .probe = probe, \
581 .probe_range = probe_range, \
582 .ignore = ignore, \ 571 .ignore = ignore, \
583 .ignore_range = ignore_range, \
584 .force = force, \ 572 .force = force, \
585 } 573 }
586 574
diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h
index ef7f644dd873..36fd18cdad28 100644
--- a/include/linux/i2o-dev.h
+++ b/include/linux/i2o-dev.h
@@ -24,6 +24,13 @@
24#define MAX_I2O_CONTROLLERS 32 24#define MAX_I2O_CONTROLLERS 32
25 25
26//#include <linux/ioctl.h> 26//#include <linux/ioctl.h>
27#ifndef __KERNEL__
28
29typedef unsigned char u8;
30typedef unsigned short u16;
31typedef unsigned int u32;
32
33#endif /* __KERNEL__ */
27 34
28/* 35/*
29 * I2O Control IOCTLs and structures 36 * I2O Control IOCTLs and structures
@@ -113,6 +120,10 @@ struct i2o_evt_get {
113 int lost; 120 int lost;
114}; 121};
115 122
123typedef struct i2o_sg_io_hdr {
124 unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */
125} i2o_sg_io_hdr_t;
126
116/************************************************************************** 127/**************************************************************************
117 * HRT related constants and structures 128 * HRT related constants and structures
118 **************************************************************************/ 129 **************************************************************************/
@@ -126,14 +137,6 @@ struct i2o_evt_get {
126#define I2O_BUS_CARDBUS 7 137#define I2O_BUS_CARDBUS 7
127#define I2O_BUS_UNKNOWN 0x80 138#define I2O_BUS_UNKNOWN 0x80
128 139
129#ifndef __KERNEL__
130
131typedef unsigned char u8;
132typedef unsigned short u16;
133typedef unsigned int u32;
134
135#endif /* __KERNEL__ */
136
137typedef struct _i2o_pci_bus { 140typedef struct _i2o_pci_bus {
138 u8 PciFunctionNumber; 141 u8 PciFunctionNumber;
139 u8 PciDeviceNumber; 142 u8 PciDeviceNumber;
@@ -333,7 +336,7 @@ typedef struct _i2o_status_block {
333#define I2O_CLASS_ATE_PERIPHERAL 0x061 336#define I2O_CLASS_ATE_PERIPHERAL 0x061
334#define I2O_CLASS_FLOPPY_CONTROLLER 0x070 337#define I2O_CLASS_FLOPPY_CONTROLLER 0x070
335#define I2O_CLASS_FLOPPY_DEVICE 0x071 338#define I2O_CLASS_FLOPPY_DEVICE 0x071
336#define I2O_CLASS_BUS_ADAPTER_PORT 0x080 339#define I2O_CLASS_BUS_ADAPTER 0x080
337#define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 340#define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090
338#define I2O_CLASS_PEER_TRANSPORT 0x091 341#define I2O_CLASS_PEER_TRANSPORT 0x091
339#define I2O_CLASS_END 0xfff 342#define I2O_CLASS_END 0xfff
@@ -399,4 +402,26 @@ typedef struct _i2o_status_block {
399#define ADAPTER_STATE_FAILED 0x10 402#define ADAPTER_STATE_FAILED 0x10
400#define ADAPTER_STATE_FAULTED 0x11 403#define ADAPTER_STATE_FAULTED 0x11
401 404
405/*
406 * Software module types
407 */
408#define I2O_SOFTWARE_MODULE_IRTOS 0x11
409#define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22
410#define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23
411
412/*
413 * Vendors
414 */
415#define I2O_VENDOR_DPT 0x001b
416
417/*
418 * DPT / Adaptec specific values for i2o_sg_io_hdr flags.
419 */
420#define I2O_DPT_SG_FLAG_INTERPRET 0x00010000
421#define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000
422
423#define I2O_DPT_FLASH_FRAG_SIZE 0x10000
424#define I2O_DPT_FLASH_READ 0x0101
425#define I2O_DPT_FLASH_WRITE 0x0102
426
402#endif /* _I2O_DEV_H */ 427#endif /* _I2O_DEV_H */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index ea9a3ad4b67f..bdc286ec947c 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -119,12 +119,21 @@ struct i2o_driver {
119}; 119};
120 120
121/* 121/*
122 * Contains all information which are necessary for DMA operations 122 * Contains DMA mapped address information
123 */ 123 */
124struct i2o_dma { 124struct i2o_dma {
125 void *virt; 125 void *virt;
126 dma_addr_t phys; 126 dma_addr_t phys;
127 u32 len; 127 size_t len;
128};
129
130/*
131 * Contains IO mapped address information
132 */
133struct i2o_io {
134 void __iomem *virt;
135 unsigned long phys;
136 unsigned long len;
128}; 137};
129 138
130/* 139/*
@@ -147,28 +156,25 @@ struct i2o_controller {
147 156
148 struct pci_dev *pdev; /* PCI device */ 157 struct pci_dev *pdev; /* PCI device */
149 158
150 unsigned int short_req:1; /* use small block sizes */ 159 unsigned int promise:1; /* Promise controller */
160 unsigned int adaptec:1; /* DPT / Adaptec controller */
161 unsigned int raptor:1; /* split bar */
151 unsigned int no_quiesce:1; /* dont quiesce before reset */ 162 unsigned int no_quiesce:1; /* dont quiesce before reset */
152 unsigned int raptor:1; /* split bar */ 163 unsigned int short_req:1; /* use small block sizes */
153 unsigned int promise:1; /* Promise controller */ 164 unsigned int limit_sectors:1; /* limit number of sectors / request */
154 165 unsigned int pae_support:1; /* controller has 64-bit SGL support */
155#ifdef CONFIG_MTRR
156 int mtrr_reg0;
157 int mtrr_reg1;
158#endif
159 166
160 struct list_head devices; /* list of I2O devices */ 167 struct list_head devices; /* list of I2O devices */
161
162 struct notifier_block *event_notifer; /* Events */
163 atomic_t users;
164 struct list_head list; /* Controller list */ 168 struct list_head list; /* Controller list */
165 void __iomem *post_port; /* Inbout port address */ 169
166 void __iomem *reply_port; /* Outbound port address */ 170 void __iomem *in_port; /* Inbout port address */
167 void __iomem *irq_mask; /* Interrupt register address */ 171 void __iomem *out_port; /* Outbound port address */
172 void __iomem *irq_status; /* Interrupt status register address */
173 void __iomem *irq_mask; /* Interrupt mask register address */
168 174
169 /* Dynamic LCT related data */ 175 /* Dynamic LCT related data */
170 176
171 struct i2o_dma status; /* status of IOP */ 177 struct i2o_dma status; /* IOP status block */
172 178
173 struct i2o_dma hrt; /* HW Resource Table */ 179 struct i2o_dma hrt; /* HW Resource Table */
174 i2o_lct *lct; /* Logical Config Table */ 180 i2o_lct *lct; /* Logical Config Table */
@@ -176,21 +182,19 @@ struct i2o_controller {
176 struct semaphore lct_lock; /* Lock for LCT updates */ 182 struct semaphore lct_lock; /* Lock for LCT updates */
177 struct i2o_dma status_block; /* IOP status block */ 183 struct i2o_dma status_block; /* IOP status block */
178 184
179 struct i2o_dma base; /* controller messaging unit */ 185 struct i2o_io base; /* controller messaging unit */
180 struct i2o_dma in_queue; /* inbound message queue Host->IOP */ 186 struct i2o_io in_queue; /* inbound message queue Host->IOP */
181 struct i2o_dma out_queue; /* outbound message queue IOP->Host */ 187 struct i2o_dma out_queue; /* outbound message queue IOP->Host */
182 188
183 unsigned int battery:1; /* Has a battery backup */ 189 unsigned int battery:1; /* Has a battery backup */
184 unsigned int io_alloc:1; /* An I/O resource was allocated */ 190 unsigned int io_alloc:1; /* An I/O resource was allocated */
185 unsigned int mem_alloc:1; /* A memory resource was allocated */ 191 unsigned int mem_alloc:1; /* A memory resource was allocated */
186 192
187 struct resource io_resource; /* I/O resource allocated to the IOP */ 193 struct resource io_resource; /* I/O resource allocated to the IOP */
188 struct resource mem_resource; /* Mem resource allocated to the IOP */ 194 struct resource mem_resource; /* Mem resource allocated to the IOP */
189 195
190 struct proc_dir_entry *proc_entry; /* /proc dir */
191
192 struct list_head bus_list; /* list of busses on IOP */
193 struct device device; 196 struct device device;
197 struct class_device classdev; /* I2O controller class */
194 struct i2o_device *exec; /* Executive */ 198 struct i2o_device *exec; /* Executive */
195#if BITS_PER_LONG == 64 199#if BITS_PER_LONG == 64
196 spinlock_t context_list_lock; /* lock for context_list */ 200 spinlock_t context_list_lock; /* lock for context_list */
@@ -241,9 +245,10 @@ struct i2o_sys_tbl {
241extern struct list_head i2o_controllers; 245extern struct list_head i2o_controllers;
242 246
243/* Message functions */ 247/* Message functions */
244static inline u32 i2o_msg_get(struct i2o_controller *, struct i2o_message __iomem **); 248static inline u32 i2o_msg_get(struct i2o_controller *,
245extern u32 i2o_msg_get_wait(struct i2o_controller *, struct i2o_message __iomem **, 249 struct i2o_message __iomem **);
246 int); 250extern u32 i2o_msg_get_wait(struct i2o_controller *,
251 struct i2o_message __iomem **, int);
247static inline void i2o_msg_post(struct i2o_controller *, u32); 252static inline void i2o_msg_post(struct i2o_controller *, u32);
248static inline int i2o_msg_post_wait(struct i2o_controller *, u32, 253static inline int i2o_msg_post_wait(struct i2o_controller *, u32,
249 unsigned long); 254 unsigned long);
@@ -252,15 +257,6 @@ extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long,
252extern void i2o_msg_nop(struct i2o_controller *, u32); 257extern void i2o_msg_nop(struct i2o_controller *, u32);
253static inline void i2o_flush_reply(struct i2o_controller *, u32); 258static inline void i2o_flush_reply(struct i2o_controller *, u32);
254 259
255/* DMA handling functions */
256static inline int i2o_dma_alloc(struct device *, struct i2o_dma *, size_t,
257 unsigned int);
258static inline void i2o_dma_free(struct device *, struct i2o_dma *);
259int i2o_dma_realloc(struct device *, struct i2o_dma *, size_t, unsigned int);
260
261static inline int i2o_dma_map(struct device *, struct i2o_dma *);
262static inline void i2o_dma_unmap(struct device *, struct i2o_dma *);
263
264/* IOP functions */ 260/* IOP functions */
265extern int i2o_status_get(struct i2o_controller *); 261extern int i2o_status_get(struct i2o_controller *);
266 262
@@ -285,6 +281,16 @@ static inline u32 i2o_ptr_high(void *ptr)
285{ 281{
286 return (u32) ((u64) ptr >> 32); 282 return (u32) ((u64) ptr >> 32);
287}; 283};
284
285static inline u32 i2o_dma_low(dma_addr_t dma_addr)
286{
287 return (u32) (u64) dma_addr;
288};
289
290static inline u32 i2o_dma_high(dma_addr_t dma_addr)
291{
292 return (u32) ((u64) dma_addr >> 32);
293};
288#else 294#else
289static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr) 295static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr)
290{ 296{
@@ -315,8 +321,246 @@ static inline u32 i2o_ptr_high(void *ptr)
315{ 321{
316 return 0; 322 return 0;
317}; 323};
324
325static inline u32 i2o_dma_low(dma_addr_t dma_addr)
326{
327 return (u32) dma_addr;
328};
329
330static inline u32 i2o_dma_high(dma_addr_t dma_addr)
331{
332 return 0;
333};
318#endif 334#endif
319 335
336/**
337 * i2o_sg_tablesize - Calculate the maximum number of elements in a SGL
338 * @c: I2O controller for which the calculation should be done
339 * @body_size: maximum body size used for message in 32-bit words.
340 *
341 * Return the maximum number of SG elements in a SG list.
342 */
343static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
344{
345 i2o_status_block *sb = c->status_block.virt;
346 u16 sg_count =
347 (sb->inbound_frame_size - sizeof(struct i2o_message) / 4) -
348 body_size;
349
350 if (c->pae_support) {
351 /*
352 * for 64-bit a SG attribute element must be added and each
353 * SG element needs 12 bytes instead of 8.
354 */
355 sg_count -= 2;
356 sg_count /= 3;
357 } else
358 sg_count /= 2;
359
360 if (c->short_req && (sg_count > 8))
361 sg_count = 8;
362
363 return sg_count;
364};
365
366/**
367 * i2o_dma_map_single - Map pointer to controller and fill in I2O message.
368 * @c: I2O controller
369 * @ptr: pointer to the data which should be mapped
370 * @size: size of data in bytes
371 * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
372 * @sg_ptr: pointer to the SG list inside the I2O message
373 *
374 * This function does all necessary DMA handling and also writes the I2O
375 * SGL elements into the I2O message. For details on DMA handling see also
376 * dma_map_single(). The pointer sg_ptr will only be set to the end of the
377 * SG list if the allocation was successful.
378 *
379 * Returns DMA address which must be checked for failures using
380 * dma_mapping_error().
381 */
382static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
383 size_t size,
384 enum dma_data_direction direction,
385 u32 __iomem ** sg_ptr)
386{
387 u32 sg_flags;
388 u32 __iomem *mptr = *sg_ptr;
389 dma_addr_t dma_addr;
390
391 switch (direction) {
392 case DMA_TO_DEVICE:
393 sg_flags = 0xd4000000;
394 break;
395 case DMA_FROM_DEVICE:
396 sg_flags = 0xd0000000;
397 break;
398 default:
399 return 0;
400 }
401
402 dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction);
403 if (!dma_mapping_error(dma_addr)) {
404#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
405 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
406 writel(0x7C020002, mptr++);
407 writel(PAGE_SIZE, mptr++);
408 }
409#endif
410
411 writel(sg_flags | size, mptr++);
412 writel(i2o_dma_low(dma_addr), mptr++);
413#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
414 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
415 writel(i2o_dma_high(dma_addr), mptr++);
416#endif
417 *sg_ptr = mptr;
418 }
419 return dma_addr;
420};
421
422/**
423 * i2o_dma_map_sg - Map a SG List to controller and fill in I2O message.
424 * @c: I2O controller
425 * @sg: SG list to be mapped
426 * @sg_count: number of elements in the SG list
427 * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
428 * @sg_ptr: pointer to the SG list inside the I2O message
429 *
430 * This function does all necessary DMA handling and also writes the I2O
431 * SGL elements into the I2O message. For details on DMA handling see also
432 * dma_map_sg(). The pointer sg_ptr will only be set to the end of the SG
433 * list if the allocation was successful.
434 *
435 * Returns 0 on failure or 1 on success.
436 */
437static inline int i2o_dma_map_sg(struct i2o_controller *c,
438 struct scatterlist *sg, int sg_count,
439 enum dma_data_direction direction,
440 u32 __iomem ** sg_ptr)
441{
442 u32 sg_flags;
443 u32 __iomem *mptr = *sg_ptr;
444
445 switch (direction) {
446 case DMA_TO_DEVICE:
447 sg_flags = 0x14000000;
448 break;
449 case DMA_FROM_DEVICE:
450 sg_flags = 0x10000000;
451 break;
452 default:
453 return 0;
454 }
455
456 sg_count = dma_map_sg(&c->pdev->dev, sg, sg_count, direction);
457 if (!sg_count)
458 return 0;
459
460#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
461 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
462 writel(0x7C020002, mptr++);
463 writel(PAGE_SIZE, mptr++);
464 }
465#endif
466
467 while (sg_count-- > 0) {
468 if (!sg_count)
469 sg_flags |= 0xC0000000;
470 writel(sg_flags | sg_dma_len(sg), mptr++);
471 writel(i2o_dma_low(sg_dma_address(sg)), mptr++);
472#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
473 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
474 writel(i2o_dma_high(sg_dma_address(sg)), mptr++);
475#endif
476 sg++;
477 }
478 *sg_ptr = mptr;
479
480 return 1;
481};
482
483/**
484 * i2o_dma_alloc - Allocate DMA memory
485 * @dev: struct device pointer to the PCI device of the I2O controller
486 * @addr: i2o_dma struct which should get the DMA buffer
487 * @len: length of the new DMA memory
488 * @gfp_mask: GFP mask
489 *
490 * Allocate a coherent DMA memory and write the pointers into addr.
491 *
492 * Returns 0 on success or -ENOMEM on failure.
493 */
494static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
495 size_t len, unsigned int gfp_mask)
496{
497 struct pci_dev *pdev = to_pci_dev(dev);
498 int dma_64 = 0;
499
500 if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) {
501 dma_64 = 1;
502 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK))
503 return -ENOMEM;
504 }
505
506 addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask);
507
508 if ((sizeof(dma_addr_t) > 4) && dma_64)
509 if (pci_set_dma_mask(pdev, DMA_64BIT_MASK))
510 printk(KERN_WARNING "i2o: unable to set 64-bit DMA");
511
512 if (!addr->virt)
513 return -ENOMEM;
514
515 memset(addr->virt, 0, len);
516 addr->len = len;
517
518 return 0;
519};
520
521/**
522 * i2o_dma_free - Free DMA memory
523 * @dev: struct device pointer to the PCI device of the I2O controller
524 * @addr: i2o_dma struct which contains the DMA buffer
525 *
526 * Free a coherent DMA memory and set virtual address of addr to NULL.
527 */
528static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr)
529{
530 if (addr->virt) {
531 if (addr->phys)
532 dma_free_coherent(dev, addr->len, addr->virt,
533 addr->phys);
534 else
535 kfree(addr->virt);
536 addr->virt = NULL;
537 }
538};
539
540/**
541 * i2o_dma_realloc - Realloc DMA memory
542 * @dev: struct device pointer to the PCI device of the I2O controller
543 * @addr: pointer to a i2o_dma struct DMA buffer
544 * @len: new length of memory
545 * @gfp_mask: GFP mask
546 *
547 * If there was something allocated in the addr, free it first. If len > 0
548 * than try to allocate it and write the addresses back to the addr
549 * structure. If len == 0 set the virtual address to NULL.
550 *
551 * Returns the 0 on success or negative error code on failure.
552 */
553static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
554 size_t len, unsigned int gfp_mask)
555{
556 i2o_dma_free(dev, addr);
557
558 if (len)
559 return i2o_dma_alloc(dev, addr, len, gfp_mask);
560
561 return 0;
562};
563
320/* I2O driver (OSM) functions */ 564/* I2O driver (OSM) functions */
321extern int i2o_driver_register(struct i2o_driver *); 565extern int i2o_driver_register(struct i2o_driver *);
322extern void i2o_driver_unregister(struct i2o_driver *); 566extern void i2o_driver_unregister(struct i2o_driver *);
@@ -385,49 +629,11 @@ extern int i2o_device_claim_release(struct i2o_device *);
385/* Exec OSM functions */ 629/* Exec OSM functions */
386extern int i2o_exec_lct_get(struct i2o_controller *); 630extern int i2o_exec_lct_get(struct i2o_controller *);
387 631
388/* device to i2o_device and driver to i2o_driver convertion functions */ 632/* device / driver / kobject conversion functions */
389#define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) 633#define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver)
390#define to_i2o_device(dev) container_of(dev, struct i2o_device, device) 634#define to_i2o_device(dev) container_of(dev, struct i2o_device, device)
391 635#define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device)
392/* 636#define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj))
393 * Messenger inlines
394 */
395static inline u32 I2O_POST_READ32(struct i2o_controller *c)
396{
397 rmb();
398 return readl(c->post_port);
399};
400
401static inline void I2O_POST_WRITE32(struct i2o_controller *c, u32 val)
402{
403 wmb();
404 writel(val, c->post_port);
405};
406
407static inline u32 I2O_REPLY_READ32(struct i2o_controller *c)
408{
409 rmb();
410 return readl(c->reply_port);
411};
412
413static inline void I2O_REPLY_WRITE32(struct i2o_controller *c, u32 val)
414{
415 wmb();
416 writel(val, c->reply_port);
417};
418
419static inline u32 I2O_IRQ_READ32(struct i2o_controller *c)
420{
421 rmb();
422 return readl(c->irq_mask);
423};
424
425static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val)
426{
427 wmb();
428 writel(val, c->irq_mask);
429 wmb();
430};
431 637
432/** 638/**
433 * i2o_msg_get - obtain an I2O message from the IOP 639 * i2o_msg_get - obtain an I2O message from the IOP
@@ -443,11 +649,11 @@ static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val)
443 * available returns I2O_QUEUE_EMPTY and msg is leaved untouched. 649 * available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
444 */ 650 */
445static inline u32 i2o_msg_get(struct i2o_controller *c, 651static inline u32 i2o_msg_get(struct i2o_controller *c,
446 struct i2o_message __iomem **msg) 652 struct i2o_message __iomem ** msg)
447{ 653{
448 u32 m; 654 u32 m = readl(c->in_port);
449 655
450 if ((m = I2O_POST_READ32(c)) != I2O_QUEUE_EMPTY) 656 if (m != I2O_QUEUE_EMPTY)
451 *msg = c->in_queue.virt + m; 657 *msg = c->in_queue.virt + m;
452 658
453 return m; 659 return m;
@@ -462,7 +668,7 @@ static inline u32 i2o_msg_get(struct i2o_controller *c,
462 */ 668 */
463static inline void i2o_msg_post(struct i2o_controller *c, u32 m) 669static inline void i2o_msg_post(struct i2o_controller *c, u32 m)
464{ 670{
465 I2O_POST_WRITE32(c, m); 671 writel(m, c->in_port);
466}; 672};
467 673
468/** 674/**
@@ -491,12 +697,10 @@ static inline int i2o_msg_post_wait(struct i2o_controller *c, u32 m,
491 * The I2O controller must be informed that the reply message is not needed 697 * The I2O controller must be informed that the reply message is not needed
492 * anymore. If you forget to flush the reply, the message frame can't be 698 * anymore. If you forget to flush the reply, the message frame can't be
493 * used by the controller anymore and is therefore lost. 699 * used by the controller anymore and is therefore lost.
494 *
495 * FIXME: is there a timeout after which the controller reuse the message?
496 */ 700 */
497static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) 701static inline void i2o_flush_reply(struct i2o_controller *c, u32 m)
498{ 702{
499 I2O_REPLY_WRITE32(c, m); 703 writel(m, c->out_port);
500}; 704};
501 705
502/** 706/**
@@ -530,97 +734,13 @@ static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c,
530 * work for receive side messages as they are kmalloc objects 734 * work for receive side messages as they are kmalloc objects
531 * in a different pool. 735 * in a different pool.
532 */ 736 */
533static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct i2o_controller *c, 737static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct
534 u32 m) 738 i2o_controller *c,
739 u32 m)
535{ 740{
536 return c->in_queue.virt + m; 741 return c->in_queue.virt + m;
537}; 742};
538 743
539/**
540 * i2o_dma_alloc - Allocate DMA memory
541 * @dev: struct device pointer to the PCI device of the I2O controller
542 * @addr: i2o_dma struct which should get the DMA buffer
543 * @len: length of the new DMA memory
544 * @gfp_mask: GFP mask
545 *
546 * Allocate a coherent DMA memory and write the pointers into addr.
547 *
548 * Returns 0 on success or -ENOMEM on failure.
549 */
550static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
551 size_t len, unsigned int gfp_mask)
552{
553 addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask);
554 if (!addr->virt)
555 return -ENOMEM;
556
557 memset(addr->virt, 0, len);
558 addr->len = len;
559
560 return 0;
561};
562
563/**
564 * i2o_dma_free - Free DMA memory
565 * @dev: struct device pointer to the PCI device of the I2O controller
566 * @addr: i2o_dma struct which contains the DMA buffer
567 *
568 * Free a coherent DMA memory and set virtual address of addr to NULL.
569 */
570static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr)
571{
572 if (addr->virt) {
573 if (addr->phys)
574 dma_free_coherent(dev, addr->len, addr->virt,
575 addr->phys);
576 else
577 kfree(addr->virt);
578 addr->virt = NULL;
579 }
580};
581
582/**
583 * i2o_dma_map - Map the memory to DMA
584 * @dev: struct device pointer to the PCI device of the I2O controller
585 * @addr: i2o_dma struct which should be mapped
586 *
587 * Map the memory in addr->virt to coherent DMA memory and write the
588 * physical address into addr->phys.
589 *
590 * Returns 0 on success or -ENOMEM on failure.
591 */
592static inline int i2o_dma_map(struct device *dev, struct i2o_dma *addr)
593{
594 if (!addr->virt)
595 return -EFAULT;
596
597 if (!addr->phys)
598 addr->phys = dma_map_single(dev, addr->virt, addr->len,
599 DMA_BIDIRECTIONAL);
600 if (!addr->phys)
601 return -ENOMEM;
602
603 return 0;
604};
605
606/**
607 * i2o_dma_unmap - Unmap the DMA memory
608 * @dev: struct device pointer to the PCI device of the I2O controller
609 * @addr: i2o_dma struct which should be unmapped
610 *
611 * Unmap the memory in addr->virt from DMA memory.
612 */
613static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr)
614{
615 if (!addr->virt)
616 return;
617
618 if (addr->phys) {
619 dma_unmap_single(dev, addr->phys, addr->len, DMA_BIDIRECTIONAL);
620 addr->phys = 0;
621 }
622};
623
624/* 744/*
625 * Endian handling wrapped into the macro - keeps the core code 745 * Endian handling wrapped into the macro - keeps the core code
626 * cleaner. 746 * cleaner.
@@ -773,6 +893,14 @@ extern void i2o_debug_state(struct i2o_controller *c);
773#define I2O_CMD_SCSI_BUSRESET 0x27 893#define I2O_CMD_SCSI_BUSRESET 0x27
774 894
775/* 895/*
896 * Bus Adapter Class
897 */
898#define I2O_CMD_BUS_ADAPTER_RESET 0x85
899#define I2O_CMD_BUS_RESET 0x87
900#define I2O_CMD_BUS_SCAN 0x89
901#define I2O_CMD_BUS_QUIESCE 0x8b
902
903/*
776 * Random Block Storage Class 904 * Random Block Storage Class
777 */ 905 */
778#define I2O_CMD_BLOCK_READ 0x30 906#define I2O_CMD_BLOCK_READ 0x30
@@ -784,7 +912,7 @@ extern void i2o_debug_state(struct i2o_controller *c);
784#define I2O_CMD_BLOCK_MEJECT 0x43 912#define I2O_CMD_BLOCK_MEJECT 0x43
785#define I2O_CMD_BLOCK_POWER 0x70 913#define I2O_CMD_BLOCK_POWER 0x70
786 914
787#define I2O_PRIVATE_MSG 0xFF 915#define I2O_CMD_PRIVATE 0xFF
788 916
789/* Command status values */ 917/* Command status values */
790 918
@@ -922,7 +1050,7 @@ extern void i2o_debug_state(struct i2o_controller *c);
922#define I2OVER15 0x0001 1050#define I2OVER15 0x0001
923#define I2OVER20 0x0002 1051#define I2OVER20 0x0002
924 1052
925/* Default is 1.5, FIXME: Need support for both 1.5 and 2.0 */ 1053/* Default is 1.5 */
926#define I2OVERSION I2OVER15 1054#define I2OVERSION I2OVER15
927 1055
928#define SGL_OFFSET_0 I2OVERSION 1056#define SGL_OFFSET_0 I2OVERSION
@@ -933,9 +1061,9 @@ extern void i2o_debug_state(struct i2o_controller *c);
933#define SGL_OFFSET_8 (0x0080 | I2OVERSION) 1061#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
934#define SGL_OFFSET_9 (0x0090 | I2OVERSION) 1062#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
935#define SGL_OFFSET_10 (0x00A0 | I2OVERSION) 1063#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
936 1064#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
937#define TRL_OFFSET_5 (0x0050 | I2OVERSION) 1065#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
938#define TRL_OFFSET_6 (0x0060 | I2OVERSION) 1066#define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
939 1067
940/* Transaction Reply Lists (TRL) Control Word structure */ 1068/* Transaction Reply Lists (TRL) Control Word structure */
941#define TRL_SINGLE_FIXED_LENGTH 0x00 1069#define TRL_SINGLE_FIXED_LENGTH 0x00
@@ -962,17 +1090,13 @@ extern void i2o_debug_state(struct i2o_controller *c);
962#define ELEVEN_WORD_MSG_SIZE 0x000B0000 1090#define ELEVEN_WORD_MSG_SIZE 0x000B0000
963#define I2O_MESSAGE_SIZE(x) ((x)<<16) 1091#define I2O_MESSAGE_SIZE(x) ((x)<<16)
964 1092
965/* Special TID Assignments */ 1093/* special TID assignments */
966
967#define ADAPTER_TID 0 1094#define ADAPTER_TID 0
968#define HOST_TID 1 1095#define HOST_TID 1
969 1096
970#define MSG_FRAME_SIZE 128 /* i2o_scsi assumes >= 32 */ 1097/* outbound queue defines */
971#define REPLY_FRAME_SIZE 17 1098#define I2O_MAX_OUTBOUND_MSG_FRAMES 128
972#define SG_TABLESIZE 30 1099#define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
973#define NMBR_MSG_FRAMES 128
974
975#define MSG_POOL_SIZE (MSG_FRAME_SIZE*NMBR_MSG_FRAMES*sizeof(u32))
976 1100
977#define I2O_POST_WAIT_OK 0 1101#define I2O_POST_WAIT_OK 0
978#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT 1102#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
@@ -993,11 +1117,10 @@ extern void i2o_debug_state(struct i2o_controller *c);
993#define I2O_HRT_GET_TRIES 3 1117#define I2O_HRT_GET_TRIES 3
994#define I2O_LCT_GET_TRIES 3 1118#define I2O_LCT_GET_TRIES 3
995 1119
996/* request queue sizes */ 1120/* defines for max_sectors and max_phys_segments */
997#define I2O_MAX_SECTORS 1024 1121#define I2O_MAX_SECTORS 1024
998#define I2O_MAX_SEGMENTS 128 1122#define I2O_MAX_SECTORS_LIMITED 256
999 1123#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
1000#define I2O_REQ_MEMPOOL_SIZE 32
1001 1124
1002#endif /* __KERNEL__ */ 1125#endif /* __KERNEL__ */
1003#endif /* _I2O_H */ 1126#endif /* _I2O_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 9cfc0999becb..92129078d4f3 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -664,7 +664,6 @@ typedef struct ide_drive_s {
664 664
665 struct request *rq; /* current request */ 665 struct request *rq; /* current request */
666 struct ide_drive_s *next; /* circular list of hwgroup drives */ 666 struct ide_drive_s *next; /* circular list of hwgroup drives */
667 struct ide_driver_s *driver;/* (ide_driver_t *) */
668 void *driver_data; /* extra driver data */ 667 void *driver_data; /* extra driver data */
669 struct hd_driveid *id; /* drive model identification info */ 668 struct hd_driveid *id; /* drive model identification info */
670 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 669 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
@@ -758,6 +757,8 @@ typedef struct ide_drive_s {
758 struct semaphore gendev_rel_sem; /* to deal with device release() */ 757 struct semaphore gendev_rel_sem; /* to deal with device release() */
759} ide_drive_t; 758} ide_drive_t;
760 759
760#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev)
761
761#define IDE_CHIPSET_PCI_MASK \ 762#define IDE_CHIPSET_PCI_MASK \
762 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) 763 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx))
763#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) 764#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1)
@@ -916,7 +917,7 @@ typedef struct hwif_s {
916 unsigned dma; 917 unsigned dma;
917 918
918 void (*led_act)(void *data, int rw); 919 void (*led_act)(void *data, int rw);
919} ide_hwif_t; 920} ____cacheline_maxaligned_in_smp ide_hwif_t;
920 921
921/* 922/*
922 * internal ide interrupt handler type 923 * internal ide interrupt handler type
@@ -1086,28 +1087,20 @@ enum {
1086 */ 1087 */
1087typedef struct ide_driver_s { 1088typedef struct ide_driver_s {
1088 struct module *owner; 1089 struct module *owner;
1089 const char *name;
1090 const char *version; 1090 const char *version;
1091 u8 media; 1091 u8 media;
1092 unsigned busy : 1;
1093 unsigned supports_dsc_overlap : 1; 1092 unsigned supports_dsc_overlap : 1;
1094 int (*cleanup)(ide_drive_t *);
1095 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 1093 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
1096 int (*end_request)(ide_drive_t *, int, int); 1094 int (*end_request)(ide_drive_t *, int, int);
1097 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); 1095 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
1098 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); 1096 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
1099 int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); 1097 int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long);
1100 ide_proc_entry_t *proc; 1098 ide_proc_entry_t *proc;
1101 int (*attach)(ide_drive_t *);
1102 void (*ata_prebuilder)(ide_drive_t *); 1099 void (*ata_prebuilder)(ide_drive_t *);
1103 void (*atapi_prebuilder)(ide_drive_t *); 1100 void (*atapi_prebuilder)(ide_drive_t *);
1104 struct device_driver gen_driver; 1101 struct device_driver gen_driver;
1105 struct list_head drives;
1106 struct list_head drivers;
1107} ide_driver_t; 1102} ide_driver_t;
1108 1103
1109#define DRIVER(drive) ((drive)->driver)
1110
1111int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 1104int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
1112 1105
1113/* 1106/*
@@ -1328,8 +1321,6 @@ extern void ide_init_subdrivers(void);
1328 1321
1329void ide_init_disk(struct gendisk *, ide_drive_t *); 1322void ide_init_disk(struct gendisk *, ide_drive_t *);
1330 1323
1331extern int ata_attach(ide_drive_t *);
1332
1333extern int ideprobe_init(void); 1324extern int ideprobe_init(void);
1334 1325
1335extern void ide_scan_pcibus(int scan_direction) __init; 1326extern void ide_scan_pcibus(int scan_direction) __init;
@@ -1342,11 +1333,8 @@ extern void default_hwif_iops(ide_hwif_t *);
1342extern void default_hwif_mmiops(ide_hwif_t *); 1333extern void default_hwif_mmiops(ide_hwif_t *);
1343extern void default_hwif_transport(ide_hwif_t *); 1334extern void default_hwif_transport(ide_hwif_t *);
1344 1335
1345int ide_register_driver(ide_driver_t *driver); 1336void ide_register_subdriver(ide_drive_t *, ide_driver_t *);
1346void ide_unregister_driver(ide_driver_t *driver); 1337void ide_unregister_subdriver(ide_drive_t *, ide_driver_t *);
1347int ide_register_subdriver(ide_drive_t *, ide_driver_t *);
1348int ide_unregister_subdriver (ide_drive_t *drive);
1349int ide_replace_subdriver(ide_drive_t *drive, const char *driver);
1350 1338
1351#define ON_BOARD 1 1339#define ON_BOARD 1
1352#define NEVER_BOARD 0 1340#define NEVER_BOARD 0
diff --git a/include/linux/if.h b/include/linux/if.h
index d73a9d62f208..ce627d9092ef 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -33,7 +33,7 @@
33#define IFF_LOOPBACK 0x8 /* is a loopback net */ 33#define IFF_LOOPBACK 0x8 /* is a loopback net */
34#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ 34#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */
35#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 35#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
36#define IFF_RUNNING 0x40 /* resources allocated */ 36#define IFF_RUNNING 0x40 /* interface running and carrier ok */
37#define IFF_NOARP 0x80 /* no ARP protocol */ 37#define IFF_NOARP 0x80 /* no ARP protocol */
38#define IFF_PROMISC 0x100 /* receive all packets */ 38#define IFF_PROMISC 0x100 /* receive all packets */
39#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ 39#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h
index 0485b256d043..004e6f09a6e2 100644
--- a/include/linux/if_shaper.h
+++ b/include/linux/if_shaper.h
@@ -23,7 +23,7 @@ struct shaper
23 __u32 shapeclock; 23 __u32 shapeclock;
24 unsigned long recovery; /* Time we can next clock a packet out on 24 unsigned long recovery; /* Time we can next clock a packet out on
25 an empty queue */ 25 an empty queue */
26 unsigned long locked; 26 struct semaphore sem;
27 struct net_device_stats stats; 27 struct net_device_stats stats;
28 struct net_device *dev; 28 struct net_device *dev;
29 int (*hard_start_xmit) (struct sk_buff *skb, 29 int (*hard_start_xmit) (struct sk_buff *skb,
@@ -38,7 +38,6 @@ struct shaper
38 int (*hard_header_cache)(struct neighbour *neigh, struct hh_cache *hh); 38 int (*hard_header_cache)(struct neighbour *neigh, struct hh_cache *hh);
39 void (*header_cache_update)(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr); 39 void (*header_cache_update)(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr);
40 struct net_device_stats* (*get_stats)(struct net_device *dev); 40 struct net_device_stats* (*get_stats)(struct net_device *dev);
41 wait_queue_head_t wait_queue;
42 struct timer_list timer; 41 struct timer_list timer;
43}; 42};
44 43
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
index 4fd451f81ccb..3fba9e2f5427 100644
--- a/include/linux/if_tr.h
+++ b/include/linux/if_tr.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org> 11 * Donald Becker, <becker@super.org>
12 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> 12 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License 15 * modify it under the terms of the GNU General Public License
@@ -19,24 +19,18 @@
19#ifndef _LINUX_IF_TR_H 19#ifndef _LINUX_IF_TR_H
20#define _LINUX_IF_TR_H 20#define _LINUX_IF_TR_H
21 21
22#include <asm/byteorder.h> /* For __be16 */
22 23
23/* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble 24/* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble
24 and FCS/CRC (frame check sequence). */ 25 and FCS/CRC (frame check sequence). */
25#define TR_ALEN 6 /* Octets in one ethernet addr */ 26#define TR_ALEN 6 /* Octets in one token-ring addr */
26#define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc)) 27#define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc))
27#define AC 0x10 28#define AC 0x10
28#define LLC_FRAME 0x40 29#define LLC_FRAME 0x40
29#if 0
30#define ETH_HLEN 14 /* Total octets in header. */
31#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */
32#define ETH_DATA_LEN 1500 /* Max. octets in payload */
33#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
34#endif
35
36 30
37/* LLC and SNAP constants */ 31/* LLC and SNAP constants */
38#define EXTENDED_SAP 0xAA 32#define EXTENDED_SAP 0xAA
39#define UI_CMD 0x03 33#define UI_CMD 0x03
40 34
41/* This is an Token-Ring frame header. */ 35/* This is an Token-Ring frame header. */
42struct trh_hdr { 36struct trh_hdr {
@@ -44,8 +38,8 @@ struct trh_hdr {
44 __u8 fc; /* frame control field */ 38 __u8 fc; /* frame control field */
45 __u8 daddr[TR_ALEN]; /* destination address */ 39 __u8 daddr[TR_ALEN]; /* destination address */
46 __u8 saddr[TR_ALEN]; /* source address */ 40 __u8 saddr[TR_ALEN]; /* source address */
47 __u16 rcf; /* route control field */ 41 __be16 rcf; /* route control field */
48 __u16 rseg[8]; /* routing registers */ 42 __be16 rseg[8]; /* routing registers */
49}; 43};
50 44
51#ifdef __KERNEL__ 45#ifdef __KERNEL__
@@ -63,7 +57,7 @@ struct trllc {
63 __u8 ssap; /* source SAP */ 57 __u8 ssap; /* source SAP */
64 __u8 llc; /* LLC control field */ 58 __u8 llc; /* LLC control field */
65 __u8 protid[3]; /* protocol id */ 59 __u8 protid[3]; /* protocol id */
66 __u16 ethertype; /* ether type field */ 60 __be16 ethertype; /* ether type field */
67}; 61};
68 62
69/* Token-Ring statistics collection data. */ 63/* Token-Ring statistics collection data. */
@@ -96,14 +90,13 @@ struct tr_statistics {
96}; 90};
97 91
98/* source routing stuff */ 92/* source routing stuff */
99 93#define TR_RII 0x80
100#define TR_RII 0x80 94#define TR_RCF_DIR_BIT 0x80
101#define TR_RCF_DIR_BIT 0x80 95#define TR_RCF_LEN_MASK 0x1f00
102#define TR_RCF_LEN_MASK 0x1f00 96#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */
103#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ 97#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */
104#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ 98#define TR_RCF_FRAME2K 0x20
105#define TR_RCF_FRAME2K 0x20 99#define TR_RCF_BROADCAST_MASK 0xC000
106#define TR_RCF_BROADCAST_MASK 0xC000 100#define TR_MAXRIFLEN 18
107#define TR_MAXRIFLEN 18
108 101
109#endif /* _LINUX_IF_TR_H */ 102#endif /* _LINUX_IF_TR_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 6fafb27877a7..7e1e15f934f3 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -29,6 +29,7 @@ struct ipv4_devconf
29 int no_xfrm; 29 int no_xfrm;
30 int no_policy; 30 int no_policy;
31 int force_igmp_version; 31 int force_igmp_version;
32 int promote_secondaries;
32 void *sysctl; 33 void *sysctl;
33}; 34};
34 35
@@ -71,6 +72,7 @@ struct in_device
71#define IN_DEV_SEC_REDIRECTS(in_dev) (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects) 72#define IN_DEV_SEC_REDIRECTS(in_dev) (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects)
72#define IN_DEV_IDTAG(in_dev) ((in_dev)->cnf.tag) 73#define IN_DEV_IDTAG(in_dev) ((in_dev)->cnf.tag)
73#define IN_DEV_MEDIUM_ID(in_dev) ((in_dev)->cnf.medium_id) 74#define IN_DEV_MEDIUM_ID(in_dev) ((in_dev)->cnf.medium_id)
75#define IN_DEV_PROMOTE_SECONDARIES(in_dev) (ipv4_devconf.promote_secondaries || (in_dev)->cnf.promote_secondaries)
74 76
75#define IN_DEV_RX_REDIRECTS(in_dev) \ 77#define IN_DEV_RX_REDIRECTS(in_dev) \
76 ((IN_DEV_FORWARD(in_dev) && \ 78 ((IN_DEV_FORWARD(in_dev) && \
diff --git a/include/linux/init.h b/include/linux/init.h
index 05c83e0521ca..59008c3826cf 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -229,6 +229,18 @@ void __init parse_early_param(void);
229#define __devexitdata __exitdata 229#define __devexitdata __exitdata
230#endif 230#endif
231 231
232#ifdef CONFIG_HOTPLUG_CPU
233#define __cpuinit
234#define __cpuinitdata
235#define __cpuexit
236#define __cpuexitdata
237#else
238#define __cpuinit __init
239#define __cpuinitdata __initdata
240#define __cpuexit __exit
241#define __cpuexitdata __exitdata
242#endif
243
232/* Functions marked as __devexit may be discarded at kernel link time, depending 244/* Functions marked as __devexit may be discarded at kernel link time, depending
233 on config options. Newer versions of binutils detect references from 245 on config options. Newer versions of binutils detect references from
234 retained sections to discarded sections and flag an error. Pointers to 246 retained sections to discarded sections and flag an error. Pointers to
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index a6a8c1a38d5e..03206a425d7a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -108,7 +108,6 @@ extern struct group_info init_groups;
108 .blocked = {{0}}, \ 108 .blocked = {{0}}, \
109 .alloc_lock = SPIN_LOCK_UNLOCKED, \ 109 .alloc_lock = SPIN_LOCK_UNLOCKED, \
110 .proc_lock = SPIN_LOCK_UNLOCKED, \ 110 .proc_lock = SPIN_LOCK_UNLOCKED, \
111 .switch_lock = SPIN_LOCK_UNLOCKED, \
112 .journal_info = NULL, \ 111 .journal_info = NULL, \
113 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 112 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
114} 113}
diff --git a/include/linux/input.h b/include/linux/input.h
index 72731d7d189e..9d9598ed760d 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1015,7 +1015,7 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
1015 dev->absbit[LONG(axis)] |= BIT(axis); 1015 dev->absbit[LONG(axis)] |= BIT(axis);
1016} 1016}
1017 1017
1018extern struct class_simple *input_class; 1018extern struct class *input_class;
1019 1019
1020#endif 1020#endif
1021#endif 1021#endif
diff --git a/include/linux/ioc4.h b/include/linux/ioc4.h
new file mode 100644
index 000000000000..3dd18b785ebd
--- /dev/null
+++ b/include/linux/ioc4.h
@@ -0,0 +1,179 @@
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 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9#ifndef _LINUX_IOC4_H
10#define _LINUX_IOC4_H
11
12#include <linux/interrupt.h>
13
14/***************
15 * Definitions *
16 ***************/
17
18/* Miscellaneous values inherent to hardware */
19
20#define IOC4_EXTINT_COUNT_DIVISOR 520 /* PCI clocks per COUNT tick */
21
22/***********************************
23 * Structures needed by subdrivers *
24 ***********************************/
25
26/* This structure fully describes the IOC4 miscellaneous registers which
27 * appear at bar[0]+0x00000 through bar[0]+0x0005c. The corresponding
28 * PCI resource is managed by the main IOC4 driver because it contains
29 * registers of interest to many different IOC4 subdrivers.
30 */
31struct ioc4_misc_regs {
32 /* Miscellaneous IOC4 registers */
33 union ioc4_pci_err_addr_l {
34 uint32_t raw;
35 struct {
36 uint32_t valid:1; /* Address captured */
37 uint32_t master_id:4; /* Unit causing error
38 * 0/1: Serial port 0 TX/RX
39 * 2/3: Serial port 1 TX/RX
40 * 4/5: Serial port 2 TX/RX
41 * 6/7: Serial port 3 TX/RX
42 * 8: ATA/ATAPI
43 * 9-15: Undefined
44 */
45 uint32_t mul_err:1; /* Multiple errors occurred */
46 uint32_t addr:26; /* Bits 31-6 of error addr */
47 } fields;
48 } pci_err_addr_l;
49 uint32_t pci_err_addr_h; /* Bits 63-32 of error addr */
50 union ioc4_sio_int {
51 uint32_t raw;
52 struct {
53 uint8_t tx_mt:1; /* TX ring buffer empty */
54 uint8_t rx_full:1; /* RX ring buffer full */
55 uint8_t rx_high:1; /* RX high-water exceeded */
56 uint8_t rx_timer:1; /* RX timer has triggered */
57 uint8_t delta_dcd:1; /* DELTA_DCD seen */
58 uint8_t delta_cts:1; /* DELTA_CTS seen */
59 uint8_t intr_pass:1; /* Interrupt pass-through */
60 uint8_t tx_explicit:1; /* TX, MCW, or delay complete */
61 } fields[4];
62 } sio_ir; /* Serial interrupt state */
63 union ioc4_other_int {
64 uint32_t raw;
65 struct {
66 uint32_t ata_int:1; /* ATA port passthru */
67 uint32_t ata_memerr:1; /* ATA halted by mem error */
68 uint32_t memerr:4; /* Serial halted by mem err */
69 uint32_t kbd_int:1; /* kbd/mouse intr asserted */
70 uint32_t reserved:16; /* zero */
71 uint32_t rt_int:1; /* INT_OUT section latch */
72 uint32_t gen_int:8; /* Intr. from generic pins */
73 } fields;
74 } other_ir; /* Other interrupt state */
75 union ioc4_sio_int sio_ies; /* Serial interrupt enable set */
76 union ioc4_other_int other_ies; /* Other interrupt enable set */
77 union ioc4_sio_int sio_iec; /* Serial interrupt enable clear */
78 union ioc4_other_int other_iec; /* Other interrupt enable clear */
79 union ioc4_sio_cr {
80 uint32_t raw;
81 struct {
82 uint32_t cmd_pulse:4; /* Bytebus strobe width */
83 uint32_t arb_diag:3; /* PCI bus requester */
84 uint32_t sio_diag_idle:1; /* Active ser req? */
85 uint32_t ata_diag_idle:1; /* Active ATA req? */
86 uint32_t ata_diag_active:1; /* ATA req is winner */
87 uint32_t reserved:22; /* zero */
88 } fields;
89 } sio_cr;
90 uint32_t unused1;
91 union ioc4_int_out {
92 uint32_t raw;
93 struct {
94 uint32_t count:16; /* Period control */
95 uint32_t mode:3; /* Output signal shape */
96 uint32_t reserved:11; /* zero */
97 uint32_t diag:1; /* Timebase control */
98 uint32_t int_out:1; /* Current value */
99 } fields;
100 } int_out; /* External interrupt output control */
101 uint32_t unused2;
102 union ioc4_gpcr {
103 uint32_t raw;
104 struct {
105 uint32_t dir:8; /* Pin direction */
106 uint32_t edge:8; /* Edge/level mode */
107 uint32_t reserved1:4; /* zero */
108 uint32_t int_out_en:1; /* INT_OUT enable */
109 uint32_t reserved2:11; /* zero */
110 } fields;
111 } gpcr_s; /* Generic PIO control set */
112 union ioc4_gpcr gpcr_c; /* Generic PIO control clear */
113 union ioc4_gpdr {
114 uint32_t raw;
115 struct {
116 uint32_t gen_pin:8; /* State of pins */
117 uint32_t reserved:24;
118 } fields;
119 } gpdr; /* Generic PIO data */
120 uint32_t unused3;
121 union ioc4_gppr {
122 uint32_t raw;
123 struct {
124 uint32_t gen_pin:1; /* Single pin state */
125 uint32_t reserved:31;
126 } fields;
127 } gppr[8]; /* Generic PIO pins */
128};
129
130/* Masks for GPCR DIR pins */
131#define IOC4_GPCR_DIR_0 0x01 /* External interrupt output */
132#define IOC4_GPCR_DIR_1 0x02 /* External interrupt input */
133#define IOC4_GPCR_DIR_2 0x04
134#define IOC4_GPCR_DIR_3 0x08 /* Keyboard/mouse presence */
135#define IOC4_GPCR_DIR_4 0x10 /* Ser. port 0 xcvr select (0=232, 1=422) */
136#define IOC4_GPCR_DIR_5 0x20 /* Ser. port 1 xcvr select (0=232, 1=422) */
137#define IOC4_GPCR_DIR_6 0x40 /* Ser. port 2 xcvr select (0=232, 1=422) */
138#define IOC4_GPCR_DIR_7 0x80 /* Ser. port 3 xcvr select (0=232, 1=422) */
139
140/* Masks for GPCR EDGE pins */
141#define IOC4_GPCR_EDGE_0 0x01
142#define IOC4_GPCR_EDGE_1 0x02 /* External interrupt input */
143#define IOC4_GPCR_EDGE_2 0x04
144#define IOC4_GPCR_EDGE_3 0x08
145#define IOC4_GPCR_EDGE_4 0x10
146#define IOC4_GPCR_EDGE_5 0x20
147#define IOC4_GPCR_EDGE_6 0x40
148#define IOC4_GPCR_EDGE_7 0x80
149
150/* One of these per IOC4 */
151struct ioc4_driver_data {
152 struct list_head idd_list;
153 unsigned long idd_bar0;
154 struct pci_dev *idd_pdev;
155 const struct pci_device_id *idd_pci_id;
156 struct __iomem ioc4_misc_regs *idd_misc_regs;
157 unsigned long count_period;
158 void *idd_serial_data;
159};
160
161/* One per submodule */
162struct ioc4_submodule {
163 struct list_head is_list;
164 char *is_name;
165 struct module *is_owner;
166 int (*is_probe) (struct ioc4_driver_data *);
167 int (*is_remove) (struct ioc4_driver_data *);
168};
169
170#define IOC4_NUM_CARDS 8 /* max cards per partition */
171
172/**********************************
173 * Functions needed by submodules *
174 **********************************/
175
176extern int ioc4_register_submodule(struct ioc4_submodule *);
177extern void ioc4_unregister_submodule(struct ioc4_submodule *);
178
179#endif /* _LINUX_IOC4_H */
diff --git a/include/linux/ioc4_common.h b/include/linux/ioc4_common.h
deleted file mode 100644
index b03bcc46df55..000000000000
--- a/include/linux/ioc4_common.h
+++ /dev/null
@@ -1,21 +0,0 @@
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 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9#ifndef _LINUX_IOC4_COMMON_H
10#define _LINUX_IOC4_COMMON_H
11
12/* prototypes */
13
14int ioc4_serial_init(void);
15
16int ioc4_serial_attach_one(struct pci_dev *pdev, const struct
17 pci_device_id *pci_id);
18int ioc4_ide_attach_one(struct pci_dev *pdev, const struct
19 pci_device_id *pci_id);
20
21#endif /* _LINUX_IOC4_COMMON_H */
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 8438c68591f9..31e7cedd9f84 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -81,6 +81,7 @@
81#ifdef __KERNEL__ 81#ifdef __KERNEL__
82#include <linux/config.h> 82#include <linux/config.h>
83#include <linux/types.h> 83#include <linux/types.h>
84#include <net/request_sock.h>
84#include <net/sock.h> 85#include <net/sock.h>
85#include <linux/igmp.h> 86#include <linux/igmp.h>
86#include <net/flow.h> 87#include <net/flow.h>
@@ -107,6 +108,26 @@ struct ip_options {
107 108
108#define optlength(opt) (sizeof(struct ip_options) + opt->optlen) 109#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
109 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
110struct ipv6_pinfo; 131struct ipv6_pinfo;
111 132
112struct inet_sock { 133struct inet_sock {
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 2ec265e1045f..596ca6130159 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -209,6 +209,11 @@ struct kernel_ipmi_msg
209#include <linux/list.h> 209#include <linux/list.h>
210#include <linux/module.h> 210#include <linux/module.h>
211 211
212#ifdef CONFIG_PROC_FS
213#include <linux/proc_fs.h>
214extern struct proc_dir_entry *proc_ipmi_root;
215#endif /* CONFIG_PROC_FS */
216
212/* Opaque type for a IPMI message user. One of these is needed to 217/* Opaque type for a IPMI message user. One of these is needed to
213 send and receive messages. */ 218 send and receive messages. */
214typedef struct ipmi_user *ipmi_user_t; 219typedef struct ipmi_user *ipmi_user_t;
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index ab0d0efbf240..6fcd6a0ade24 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -193,6 +193,19 @@ struct inet6_skb_parm {
193 193
194#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 194#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
195 195
196struct tcp6_request_sock {
197 struct tcp_request_sock req;
198 struct in6_addr loc_addr;
199 struct in6_addr rmt_addr;
200 struct sk_buff *pktopts;
201 int iif;
202};
203
204static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk)
205{
206 return (struct tcp6_request_sock *)sk;
207}
208
196/** 209/**
197 * struct ipv6_pinfo - ipv6 private area 210 * struct ipv6_pinfo - ipv6 private area
198 * 211 *
diff --git a/include/linux/irq.h b/include/linux/irq.h
index c3ff4d101667..12277799c007 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -47,6 +47,10 @@ struct hw_interrupt_type {
47 void (*ack)(unsigned int irq); 47 void (*ack)(unsigned int irq);
48 void (*end)(unsigned int irq); 48 void (*end)(unsigned int irq);
49 void (*set_affinity)(unsigned int irq, cpumask_t dest); 49 void (*set_affinity)(unsigned int irq, cpumask_t dest);
50 /* Currently used only by UML, might disappear one day.*/
51#ifdef CONFIG_IRQ_RELEASE_METHOD
52 void (*release)(unsigned int irq, void *dev_id);
53#endif
50}; 54};
51 55
52typedef struct hw_interrupt_type hw_irq_controller; 56typedef struct hw_interrupt_type hw_irq_controller;
@@ -84,7 +88,6 @@ extern fastcall int handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
84 struct irqaction *action); 88 struct irqaction *action);
85extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); 89extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
86extern void note_interrupt(unsigned int irq, irq_desc_t *desc, int action_ret); 90extern void note_interrupt(unsigned int irq, irq_desc_t *desc, int action_ret);
87extern void report_bad_irq(unsigned int irq, irq_desc_t *desc, int action_ret);
88extern int can_request_irq(unsigned int irq, unsigned long irqflags); 91extern int can_request_irq(unsigned int irq, unsigned long irqflags);
89 92
90extern void init_irq_proc(void); 93extern void init_irq_proc(void);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e25b97062ce1..687ba8c9973d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -58,15 +58,23 @@ struct completion;
58 * be biten later when the calling function happens to sleep when it is not 58 * be biten later when the calling function happens to sleep when it is not
59 * supposed to. 59 * supposed to.
60 */ 60 */
61#ifdef CONFIG_PREEMPT_VOLUNTARY
62extern int cond_resched(void);
63# define might_resched() cond_resched()
64#else
65# define might_resched() do { } while (0)
66#endif
67
61#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 68#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
62#define might_sleep() __might_sleep(__FILE__, __LINE__) 69 void __might_sleep(char *file, int line);
63#define might_sleep_if(cond) do { if (unlikely(cond)) might_sleep(); } while (0) 70# define might_sleep() \
64void __might_sleep(char *file, int line); 71 do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0)
65#else 72#else
66#define might_sleep() do {} while(0) 73# define might_sleep() do { might_resched(); } while (0)
67#define might_sleep_if(cond) do {} while (0)
68#endif 74#endif
69 75
76#define might_sleep_if(cond) do { if (unlikely(cond)) might_sleep(); } while (0)
77
70#define abs(x) ({ \ 78#define abs(x) ({ \
71 int __x = (x); \ 79 int __x = (x); \
72 (__x < 0) ? -__x : __x; \ 80 (__x < 0) ? -__x : __x; \
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
new file mode 100644
index 000000000000..c8468472aec0
--- /dev/null
+++ b/include/linux/kexec.h
@@ -0,0 +1,135 @@
1#ifndef LINUX_KEXEC_H
2#define LINUX_KEXEC_H
3
4#ifdef CONFIG_KEXEC
5#include <linux/types.h>
6#include <linux/list.h>
7#include <linux/linkage.h>
8#include <linux/compat.h>
9#include <asm/kexec.h>
10
11/* Verify architecture specific macros are defined */
12
13#ifndef KEXEC_SOURCE_MEMORY_LIMIT
14#error KEXEC_SOURCE_MEMORY_LIMIT not defined
15#endif
16
17#ifndef KEXEC_DESTINATION_MEMORY_LIMIT
18#error KEXEC_DESTINATION_MEMORY_LIMIT not defined
19#endif
20
21#ifndef KEXEC_CONTROL_MEMORY_LIMIT
22#error KEXEC_CONTROL_MEMORY_LIMIT not defined
23#endif
24
25#ifndef KEXEC_CONTROL_CODE_SIZE
26#error KEXEC_CONTROL_CODE_SIZE not defined
27#endif
28
29#ifndef KEXEC_ARCH
30#error KEXEC_ARCH not defined
31#endif
32
33/*
34 * This structure is used to hold the arguments that are used when loading
35 * kernel binaries.
36 */
37
38typedef unsigned long kimage_entry_t;
39#define IND_DESTINATION 0x1
40#define IND_INDIRECTION 0x2
41#define IND_DONE 0x4
42#define IND_SOURCE 0x8
43
44#define KEXEC_SEGMENT_MAX 8
45struct kexec_segment {
46 void __user *buf;
47 size_t bufsz;
48 unsigned long mem; /* User space sees this as a (void *) ... */
49 size_t memsz;
50};
51
52#ifdef CONFIG_COMPAT
53struct compat_kexec_segment {
54 compat_uptr_t buf;
55 compat_size_t bufsz;
56 compat_ulong_t mem; /* User space sees this as a (void *) ... */
57 compat_size_t memsz;
58};
59#endif
60
61struct kimage {
62 kimage_entry_t head;
63 kimage_entry_t *entry;
64 kimage_entry_t *last_entry;
65
66 unsigned long destination;
67
68 unsigned long start;
69 struct page *control_code_page;
70
71 unsigned long nr_segments;
72 struct kexec_segment segment[KEXEC_SEGMENT_MAX];
73
74 struct list_head control_pages;
75 struct list_head dest_pages;
76 struct list_head unuseable_pages;
77
78 /* Address of next control page to allocate for crash kernels. */
79 unsigned long control_page;
80
81 /* Flags to indicate special processing */
82 unsigned int type : 1;
83#define KEXEC_TYPE_DEFAULT 0
84#define KEXEC_TYPE_CRASH 1
85};
86
87
88
89/* kexec interface functions */
90extern NORET_TYPE void machine_kexec(struct kimage *image) ATTRIB_NORET;
91extern int machine_kexec_prepare(struct kimage *image);
92extern void machine_kexec_cleanup(struct kimage *image);
93extern asmlinkage long sys_kexec_load(unsigned long entry,
94 unsigned long nr_segments,
95 struct kexec_segment __user *segments,
96 unsigned long flags);
97#ifdef CONFIG_COMPAT
98extern asmlinkage long compat_sys_kexec_load(unsigned long entry,
99 unsigned long nr_segments,
100 struct compat_kexec_segment __user *segments,
101 unsigned long flags);
102#endif
103extern struct page *kimage_alloc_control_pages(struct kimage *image,
104 unsigned int order);
105extern void crash_kexec(struct pt_regs *);
106int kexec_should_crash(struct task_struct *);
107extern struct kimage *kexec_image;
108
109#define KEXEC_ON_CRASH 0x00000001
110#define KEXEC_ARCH_MASK 0xffff0000
111
112/* These values match the ELF architecture values.
113 * Unless there is a good reason that should continue to be the case.
114 */
115#define KEXEC_ARCH_DEFAULT ( 0 << 16)
116#define KEXEC_ARCH_386 ( 3 << 16)
117#define KEXEC_ARCH_X86_64 (62 << 16)
118#define KEXEC_ARCH_PPC (20 << 16)
119#define KEXEC_ARCH_PPC64 (21 << 16)
120#define KEXEC_ARCH_IA_64 (50 << 16)
121#define KEXEC_ARCH_S390 (22 << 16)
122
123#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */
124
125/* Location of a reserved region to hold the crash kernel.
126 */
127extern struct resource crashk_res;
128
129#else /* !CONFIG_KEXEC */
130struct pt_regs;
131struct task_struct;
132static inline void crash_kexec(struct pt_regs *regs) { }
133static inline int kexec_should_crash(struct task_struct *p) { return 0; }
134#endif /* CONFIG_KEXEC */
135#endif /* LINUX_KEXEC_H */
diff --git a/include/linux/key-ui.h b/include/linux/key-ui.h
index 60cc7b762e78..cc326174a808 100644
--- a/include/linux/key-ui.h
+++ b/include/linux/key-ui.h
@@ -1,4 +1,4 @@
1/* key-ui.h: key userspace interface stuff for use by keyfs 1/* key-ui.h: key userspace interface stuff
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -31,8 +31,10 @@ extern spinlock_t key_serial_lock;
31 * subscribed 31 * subscribed
32 */ 32 */
33struct keyring_list { 33struct keyring_list {
34 unsigned maxkeys; /* max keys this list can hold */ 34 struct rcu_head rcu; /* RCU deletion hook */
35 unsigned nkeys; /* number of keys currently held */ 35 unsigned short maxkeys; /* max keys this list can hold */
36 unsigned short nkeys; /* number of keys currently held */
37 unsigned short delkey; /* key to be unlinked by RCU */
36 struct key *keys[0]; 38 struct key *keys[0];
37}; 39};
38 40
@@ -82,8 +84,45 @@ static inline int key_any_permission(const struct key *key, key_perm_t perm)
82 return kperm != 0; 84 return kperm != 0;
83} 85}
84 86
87static inline int key_task_groups_search(struct task_struct *tsk, gid_t gid)
88{
89 int ret;
90
91 task_lock(tsk);
92 ret = groups_search(tsk->group_info, gid);
93 task_unlock(tsk);
94 return ret;
95}
96
97static inline int key_task_permission(const struct key *key,
98 struct task_struct *context,
99 key_perm_t perm)
100{
101 key_perm_t kperm;
102
103 if (key->uid == context->fsuid) {
104 kperm = key->perm >> 16;
105 }
106 else if (key->gid != -1 &&
107 key->perm & KEY_GRP_ALL && (
108 key->gid == context->fsgid ||
109 key_task_groups_search(context, key->gid)
110 )
111 ) {
112 kperm = key->perm >> 8;
113 }
114 else {
115 kperm = key->perm;
116 }
117
118 kperm = kperm & perm & KEY_ALL;
119
120 return kperm == perm;
121
122}
85 123
86extern struct key *lookup_user_key(key_serial_t id, int create, int part, 124extern struct key *lookup_user_key(struct task_struct *context,
125 key_serial_t id, int create, int partial,
87 key_perm_t perm); 126 key_perm_t perm);
88 127
89extern long join_session_keyring(const char *name); 128extern long join_session_keyring(const char *name);
diff --git a/include/linux/key.h b/include/linux/key.h
index 6aa46d0e812f..970bbd916cf4 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -18,7 +18,7 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/list.h> 19#include <linux/list.h>
20#include <linux/rbtree.h> 20#include <linux/rbtree.h>
21#include <linux/spinlock.h> 21#include <linux/rcupdate.h>
22#include <asm/atomic.h> 22#include <asm/atomic.h>
23 23
24#ifdef __KERNEL__ 24#ifdef __KERNEL__
@@ -78,7 +78,6 @@ struct key {
78 key_serial_t serial; /* key serial number */ 78 key_serial_t serial; /* key serial number */
79 struct rb_node serial_node; 79 struct rb_node serial_node;
80 struct key_type *type; /* type of key */ 80 struct key_type *type; /* type of key */
81 rwlock_t lock; /* examination vs change lock */
82 struct rw_semaphore sem; /* change vs change sem */ 81 struct rw_semaphore sem; /* change vs change sem */
83 struct key_user *user; /* owner of this key */ 82 struct key_user *user; /* owner of this key */
84 time_t expiry; /* time at which key expires (or 0) */ 83 time_t expiry; /* time at which key expires (or 0) */
@@ -86,14 +85,10 @@ struct key {
86 gid_t gid; 85 gid_t gid;
87 key_perm_t perm; /* access permissions */ 86 key_perm_t perm; /* access permissions */
88 unsigned short quotalen; /* length added to quota */ 87 unsigned short quotalen; /* length added to quota */
89 unsigned short datalen; /* payload data length */ 88 unsigned short datalen; /* payload data length
90 unsigned short flags; /* status flags (change with lock writelocked) */ 89 * - may not match RCU dereferenced payload
91#define KEY_FLAG_INSTANTIATED 0x00000001 /* set if key has been instantiated */ 90 * - payload should contain own length
92#define KEY_FLAG_DEAD 0x00000002 /* set if key type has been deleted */ 91 */
93#define KEY_FLAG_REVOKED 0x00000004 /* set if key had been revoked */
94#define KEY_FLAG_IN_QUOTA 0x00000008 /* set if key consumes quota */
95#define KEY_FLAG_USER_CONSTRUCT 0x00000010 /* set if key is being constructed in userspace */
96#define KEY_FLAG_NEGATIVE 0x00000020 /* set if key is negative */
97 92
98#ifdef KEY_DEBUGGING 93#ifdef KEY_DEBUGGING
99 unsigned magic; 94 unsigned magic;
@@ -101,6 +96,14 @@ struct key {
101#define KEY_DEBUG_MAGIC_X 0xf8e9dacbu 96#define KEY_DEBUG_MAGIC_X 0xf8e9dacbu
102#endif 97#endif
103 98
99 unsigned long flags; /* status flags (change with bitops) */
100#define KEY_FLAG_INSTANTIATED 0 /* set if key has been instantiated */
101#define KEY_FLAG_DEAD 1 /* set if key type has been deleted */
102#define KEY_FLAG_REVOKED 2 /* set if key had been revoked */
103#define KEY_FLAG_IN_QUOTA 3 /* set if key consumes quota */
104#define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */
105#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */
106
104 /* the description string 107 /* the description string
105 * - this is used to match a key against search criteria 108 * - this is used to match a key against search criteria
106 * - this should be a printable string 109 * - this should be a printable string
@@ -196,10 +199,12 @@ extern int key_payload_reserve(struct key *key, size_t datalen);
196extern int key_instantiate_and_link(struct key *key, 199extern int key_instantiate_and_link(struct key *key,
197 const void *data, 200 const void *data,
198 size_t datalen, 201 size_t datalen,
199 struct key *keyring); 202 struct key *keyring,
203 struct key *instkey);
200extern int key_negate_and_link(struct key *key, 204extern int key_negate_and_link(struct key *key,
201 unsigned timeout, 205 unsigned timeout,
202 struct key *keyring); 206 struct key *keyring,
207 struct key *instkey);
203extern void key_revoke(struct key *key); 208extern void key_revoke(struct key *key);
204extern void key_put(struct key *key); 209extern void key_put(struct key *key);
205 210
@@ -242,14 +247,13 @@ extern struct key *keyring_search(struct key *keyring,
242 struct key_type *type, 247 struct key_type *type,
243 const char *description); 248 const char *description);
244 249
245extern struct key *search_process_keyrings(struct key_type *type,
246 const char *description);
247
248extern int keyring_add_key(struct key *keyring, 250extern int keyring_add_key(struct key *keyring,
249 struct key *key); 251 struct key *key);
250 252
251extern struct key *key_lookup(key_serial_t id); 253extern struct key *key_lookup(key_serial_t id);
252 254
255extern void keyring_replace_payload(struct key *key, void *replacement);
256
253#define key_serial(key) ((key) ? (key)->serial : 0) 257#define key_serial(key) ((key) ? (key)->serial : 0)
254 258
255/* 259/*
@@ -268,14 +272,22 @@ extern void key_fsuid_changed(struct task_struct *tsk);
268extern void key_fsgid_changed(struct task_struct *tsk); 272extern void key_fsgid_changed(struct task_struct *tsk);
269extern void key_init(void); 273extern void key_init(void);
270 274
275#define __install_session_keyring(tsk, keyring) \
276({ \
277 struct key *old_session = tsk->signal->session_keyring; \
278 tsk->signal->session_keyring = keyring; \
279 old_session; \
280})
281
271#else /* CONFIG_KEYS */ 282#else /* CONFIG_KEYS */
272 283
273#define key_validate(k) 0 284#define key_validate(k) 0
274#define key_serial(k) 0 285#define key_serial(k) 0
275#define key_get(k) NULL 286#define key_get(k) ({ NULL; })
276#define key_put(k) do { } while(0) 287#define key_put(k) do { } while(0)
277#define alloc_uid_keyring(u) 0 288#define alloc_uid_keyring(u) 0
278#define switch_uid_keyring(u) do { } while(0) 289#define switch_uid_keyring(u) do { } while(0)
290#define __install_session_keyring(t, k) ({ NULL; })
279#define copy_keys(f,t) 0 291#define copy_keys(f,t) 0
280#define copy_thread_group_keys(t) 0 292#define copy_thread_group_keys(t) 0
281#define exit_keys(t) do { } while(0) 293#define exit_keys(t) do { } while(0)
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 381dedc370a3..8d7c59a29e09 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -20,6 +20,16 @@
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 22
23/* request-key default keyrings */
24#define KEY_REQKEY_DEFL_NO_CHANGE -1
25#define KEY_REQKEY_DEFL_DEFAULT 0
26#define KEY_REQKEY_DEFL_THREAD_KEYRING 1
27#define KEY_REQKEY_DEFL_PROCESS_KEYRING 2
28#define KEY_REQKEY_DEFL_SESSION_KEYRING 3
29#define KEY_REQKEY_DEFL_USER_KEYRING 4
30#define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5
31#define KEY_REQKEY_DEFL_GROUP_KEYRING 6
32
23/* keyctl commands */ 33/* keyctl commands */
24#define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ 34#define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */
25#define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ 35#define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */
@@ -35,5 +45,6 @@
35#define KEYCTL_READ 11 /* read a key or keyring's contents */ 45#define KEYCTL_READ 11 /* read a key or keyring's contents */
36#define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ 46#define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */
37#define KEYCTL_NEGATE 13 /* negate a partially constructed key */ 47#define KEYCTL_NEGATE 13 /* negate a partially constructed key */
48#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */
38 49
39#endif /* _LINUX_KEYCTL_H */ 50#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/klist.h b/include/linux/klist.h
new file mode 100644
index 000000000000..eebf5e5696ec
--- /dev/null
+++ b/include/linux/klist.h
@@ -0,0 +1,55 @@
1/*
2 * klist.h - Some generic list helpers, extending struct list_head a bit.
3 *
4 * Implementations are found in lib/klist.c
5 *
6 *
7 * Copyright (C) 2005 Patrick Mochel
8 *
9 * This file is rleased under the GPL v2.
10 */
11
12#include <linux/spinlock.h>
13#include <linux/completion.h>
14#include <linux/kref.h>
15#include <linux/list.h>
16
17
18struct klist {
19 spinlock_t k_lock;
20 struct list_head k_list;
21};
22
23
24extern void klist_init(struct klist * k);
25
26
27struct klist_node {
28 struct klist * n_klist;
29 struct list_head n_node;
30 struct kref n_ref;
31 struct completion n_removed;
32};
33
34extern void klist_add_tail(struct klist * k, struct klist_node * n);
35extern void klist_add_head(struct klist * k, struct klist_node * n);
36
37extern void klist_del(struct klist_node * n);
38extern void klist_remove(struct klist_node * n);
39
40extern int klist_node_attached(struct klist_node * n);
41
42
43struct klist_iter {
44 struct klist * i_klist;
45 struct list_head * i_head;
46 struct klist_node * i_cur;
47};
48
49
50extern void klist_iter_init(struct klist * k, struct klist_iter * i);
51extern void klist_iter_init_node(struct klist * k, struct klist_iter * i,
52 struct klist_node * n);
53extern void klist_iter_exit(struct klist_iter * i);
54extern struct klist_node * klist_next(struct klist_iter * i);
55
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 95d0e4b0814d..e4a231549407 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -19,6 +19,7 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#include <linux/stddef.h>
22#include <linux/config.h> 23#include <linux/config.h>
23#include <linux/errno.h> 24#include <linux/errno.h>
24#include <linux/compiler.h> 25#include <linux/compiler.h>
@@ -34,7 +35,17 @@ static inline int request_module(const char * name, ...) { return -ENOSYS; }
34#endif 35#endif
35 36
36#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) 37#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
37extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait); 38
39struct key;
40extern int call_usermodehelper_keys(char *path, char *argv[], char *envp[],
41 struct key *session_keyring, int wait);
42
43static inline int
44call_usermodehelper(char *path, char **argv, char **envp, int wait)
45{
46 return call_usermodehelper_keys(path, argv, envp, NULL, wait);
47}
48
38extern void usermodehelper_init(void); 49extern void usermodehelper_init(void);
39 50
40#endif /* __LINUX_KMOD_H__ */ 51#endif /* __LINUX_KMOD_H__ */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 765d660d3bea..3b22304f12fd 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -33,7 +33,7 @@
33extern u64 hotplug_seqnum; 33extern u64 hotplug_seqnum;
34 34
35struct kobject { 35struct kobject {
36 char * k_name; 36 const char * k_name;
37 char name[KOBJ_NAME_LEN]; 37 char name[KOBJ_NAME_LEN];
38 struct kref kref; 38 struct kref kref;
39 struct list_head entry; 39 struct list_head entry;
@@ -46,7 +46,7 @@ struct kobject {
46extern int kobject_set_name(struct kobject *, const char *, ...) 46extern int kobject_set_name(struct kobject *, const char *, ...)
47 __attribute__((format(printf,2,3))); 47 __attribute__((format(printf,2,3)));
48 48
49static inline char * kobject_name(struct kobject * kobj) 49static inline const char * kobject_name(const struct kobject * kobj)
50{ 50{
51 return kobj->k_name; 51 return kobj->k_name;
52} 52}
@@ -57,7 +57,7 @@ extern void kobject_cleanup(struct kobject *);
57extern int kobject_add(struct kobject *); 57extern int kobject_add(struct kobject *);
58extern void kobject_del(struct kobject *); 58extern void kobject_del(struct kobject *);
59 59
60extern int kobject_rename(struct kobject *, char *new_name); 60extern int kobject_rename(struct kobject *, const char *new_name);
61 61
62extern int kobject_register(struct kobject *); 62extern int kobject_register(struct kobject *);
63extern void kobject_unregister(struct kobject *); 63extern void kobject_unregister(struct kobject *);
@@ -94,7 +94,7 @@ struct kobj_type {
94 */ 94 */
95struct kset_hotplug_ops { 95struct kset_hotplug_ops {
96 int (*filter)(struct kset *kset, struct kobject *kobj); 96 int (*filter)(struct kset *kset, struct kobject *kobj);
97 char *(*name)(struct kset *kset, struct kobject *kobj); 97 const char *(*name)(struct kset *kset, struct kobject *kobj);
98 int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, 98 int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp,
99 int num_envp, char *buffer, int buffer_size); 99 int num_envp, char *buffer, int buffer_size);
100}; 100};
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 99ddba5a4e00..5e1a7b0d7b3f 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -25,27 +25,45 @@
25 * Rusty Russell). 25 * Rusty Russell).
26 * 2004-July Suparna Bhattacharya <suparna@in.ibm.com> added jumper probes 26 * 2004-July Suparna Bhattacharya <suparna@in.ibm.com> added jumper probes
27 * interface to access function arguments. 27 * interface to access function arguments.
28 * 2005-May Hien Nguyen <hien@us.ibm.com> and Jim Keniston
29 * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi
30 * <prasanna@in.ibm.com> added function-return probes.
28 */ 31 */
29#include <linux/config.h> 32#include <linux/config.h>
30#include <linux/list.h> 33#include <linux/list.h>
31#include <linux/notifier.h> 34#include <linux/notifier.h>
32#include <linux/smp.h> 35#include <linux/smp.h>
36
33#include <asm/kprobes.h> 37#include <asm/kprobes.h>
34 38
39/* kprobe_status settings */
40#define KPROBE_HIT_ACTIVE 0x00000001
41#define KPROBE_HIT_SS 0x00000002
42#define KPROBE_REENTER 0x00000004
43#define KPROBE_HIT_SSDONE 0x00000008
44
35struct kprobe; 45struct kprobe;
36struct pt_regs; 46struct pt_regs;
47struct kretprobe;
48struct kretprobe_instance;
37typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *); 49typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *);
38typedef int (*kprobe_break_handler_t) (struct kprobe *, struct pt_regs *); 50typedef int (*kprobe_break_handler_t) (struct kprobe *, struct pt_regs *);
39typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *, 51typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *,
40 unsigned long flags); 52 unsigned long flags);
41typedef int (*kprobe_fault_handler_t) (struct kprobe *, struct pt_regs *, 53typedef int (*kprobe_fault_handler_t) (struct kprobe *, struct pt_regs *,
42 int trapnr); 54 int trapnr);
55typedef int (*kretprobe_handler_t) (struct kretprobe_instance *,
56 struct pt_regs *);
57
43struct kprobe { 58struct kprobe {
44 struct hlist_node hlist; 59 struct hlist_node hlist;
45 60
46 /* list of kprobes for multi-handler support */ 61 /* list of kprobes for multi-handler support */
47 struct list_head list; 62 struct list_head list;
48 63
64 /*count the number of times this probe was temporarily disarmed */
65 unsigned long nmissed;
66
49 /* location of the probe point */ 67 /* location of the probe point */
50 kprobe_opcode_t *addr; 68 kprobe_opcode_t *addr;
51 69
@@ -85,6 +103,62 @@ struct jprobe {
85 kprobe_opcode_t *entry; /* probe handling code to jump to */ 103 kprobe_opcode_t *entry; /* probe handling code to jump to */
86}; 104};
87 105
106#ifdef ARCH_SUPPORTS_KRETPROBES
107extern int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs);
108extern void trampoline_post_handler(struct kprobe *p, struct pt_regs *regs,
109 unsigned long flags);
110extern struct task_struct *arch_get_kprobe_task(void *ptr);
111extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs);
112extern void arch_kprobe_flush_task(struct task_struct *tk);
113#else /* ARCH_SUPPORTS_KRETPROBES */
114static inline void kretprobe_trampoline(void)
115{
116}
117static inline int trampoline_probe_handler(struct kprobe *p,
118 struct pt_regs *regs)
119{
120 return 0;
121}
122static inline void trampoline_post_handler(struct kprobe *p,
123 struct pt_regs *regs, unsigned long flags)
124{
125}
126static inline void arch_prepare_kretprobe(struct kretprobe *rp,
127 struct pt_regs *regs)
128{
129}
130static inline void arch_kprobe_flush_task(struct task_struct *tk)
131{
132}
133#define arch_get_kprobe_task(ptr) ((struct task_struct *)NULL)
134#endif /* ARCH_SUPPORTS_KRETPROBES */
135/*
136 * Function-return probe -
137 * Note:
138 * User needs to provide a handler function, and initialize maxactive.
139 * maxactive - The maximum number of instances of the probed function that
140 * can be active concurrently.
141 * nmissed - tracks the number of times the probed function's return was
142 * ignored, due to maxactive being too low.
143 *
144 */
145struct kretprobe {
146 struct kprobe kp;
147 kretprobe_handler_t handler;
148 int maxactive;
149 int nmissed;
150 struct hlist_head free_instances;
151 struct hlist_head used_instances;
152};
153
154struct kretprobe_instance {
155 struct hlist_node uflist; /* either on free list or used list */
156 struct hlist_node hlist;
157 struct kretprobe *rp;
158 void *ret_addr;
159 void *stack_addr;
160};
161
88#ifdef CONFIG_KPROBES 162#ifdef CONFIG_KPROBES
89/* Locks kprobe: irq must be disabled */ 163/* Locks kprobe: irq must be disabled */
90void lock_kprobes(void); 164void lock_kprobes(void);
@@ -99,11 +173,14 @@ static inline int kprobe_running(void)
99 173
100extern int arch_prepare_kprobe(struct kprobe *p); 174extern int arch_prepare_kprobe(struct kprobe *p);
101extern void arch_copy_kprobe(struct kprobe *p); 175extern void arch_copy_kprobe(struct kprobe *p);
176extern void arch_arm_kprobe(struct kprobe *p);
177extern void arch_disarm_kprobe(struct kprobe *p);
102extern void arch_remove_kprobe(struct kprobe *p); 178extern void arch_remove_kprobe(struct kprobe *p);
103extern void show_registers(struct pt_regs *regs); 179extern void show_registers(struct pt_regs *regs);
104 180
105/* Get the kprobe at this addr (if any). Must have called lock_kprobes */ 181/* Get the kprobe at this addr (if any). Must have called lock_kprobes */
106struct kprobe *get_kprobe(void *addr); 182struct kprobe *get_kprobe(void *addr);
183struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk);
107 184
108int register_kprobe(struct kprobe *p); 185int register_kprobe(struct kprobe *p);
109void unregister_kprobe(struct kprobe *p); 186void unregister_kprobe(struct kprobe *p);
@@ -113,7 +190,16 @@ int register_jprobe(struct jprobe *p);
113void unregister_jprobe(struct jprobe *p); 190void unregister_jprobe(struct jprobe *p);
114void jprobe_return(void); 191void jprobe_return(void);
115 192
116#else 193int register_kretprobe(struct kretprobe *rp);
194void unregister_kretprobe(struct kretprobe *rp);
195
196struct kretprobe_instance *get_free_rp_inst(struct kretprobe *rp);
197struct kretprobe_instance *get_rp_inst(void *sara);
198struct kretprobe_instance *get_rp_inst_tsk(struct task_struct *tk);
199void add_rp_inst(struct kretprobe_instance *ri);
200void kprobe_flush_task(struct task_struct *tk);
201void recycle_rp_inst(struct kretprobe_instance *ri);
202#else /* CONFIG_KPROBES */
117static inline int kprobe_running(void) 203static inline int kprobe_running(void)
118{ 204{
119 return 0; 205 return 0;
@@ -135,5 +221,15 @@ static inline void unregister_jprobe(struct jprobe *p)
135static inline void jprobe_return(void) 221static inline void jprobe_return(void)
136{ 222{
137} 223}
138#endif 224static inline int register_kretprobe(struct kretprobe *rp)
225{
226 return -ENOSYS;
227}
228static inline void unregister_kretprobe(struct kretprobe *rp)
229{
230}
231static inline void kprobe_flush_task(struct task_struct *tk)
232{
233}
234#endif /* CONFIG_KPROBES */
139#endif /* _LINUX_KPROBES_H */ 235#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 1f7e2039a04e..6cd9ba63563b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -410,6 +410,7 @@ extern u8 ata_chk_err(struct ata_port *ap);
410extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); 410extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf);
411extern int ata_port_start (struct ata_port *ap); 411extern int ata_port_start (struct ata_port *ap);
412extern void ata_port_stop (struct ata_port *ap); 412extern void ata_port_stop (struct ata_port *ap);
413extern void ata_host_stop (struct ata_host_set *host_set);
413extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 414extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
414extern void ata_qc_prep(struct ata_queued_cmd *qc); 415extern void ata_qc_prep(struct ata_queued_cmd *qc);
415extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); 416extern int ata_qc_issue_prot(struct ata_queued_cmd *qc);
@@ -420,6 +421,7 @@ extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
420extern unsigned int ata_dev_classify(struct ata_taskfile *tf); 421extern unsigned int ata_dev_classify(struct ata_taskfile *tf);
421extern void ata_dev_id_string(u16 *id, unsigned char *s, 422extern void ata_dev_id_string(u16 *id, unsigned char *s,
422 unsigned int ofs, unsigned int len); 423 unsigned int ofs, unsigned int len);
424extern void ata_dev_config(struct ata_port *ap, unsigned int i);
423extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 425extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
424extern void ata_bmdma_start (struct ata_queued_cmd *qc); 426extern void ata_bmdma_start (struct ata_queued_cmd *qc);
425extern void ata_bmdma_stop(struct ata_port *ap); 427extern void ata_bmdma_stop(struct ata_port *ap);
@@ -466,12 +468,34 @@ static inline u8 ata_chk_status(struct ata_port *ap)
466 return ap->ops->check_status(ap); 468 return ap->ops->check_status(ap);
467} 469}
468 470
471
472/**
473 * ata_pause - Flush writes and pause 400 nanoseconds.
474 * @ap: Port to wait for.
475 *
476 * LOCKING:
477 * Inherited from caller.
478 */
479
469static inline void ata_pause(struct ata_port *ap) 480static inline void ata_pause(struct ata_port *ap)
470{ 481{
471 ata_altstatus(ap); 482 ata_altstatus(ap);
472 ndelay(400); 483 ndelay(400);
473} 484}
474 485
486
487/**
488 * ata_busy_wait - Wait for a port status register
489 * @ap: Port to wait for.
490 *
491 * Waits up to max*10 microseconds for the selected bits in the port's
492 * status register to be cleared.
493 * Returns final value of status register.
494 *
495 * LOCKING:
496 * Inherited from caller.
497 */
498
475static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, 499static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
476 unsigned int max) 500 unsigned int max)
477{ 501{
@@ -486,6 +510,18 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
486 return status; 510 return status;
487} 511}
488 512
513
514/**
515 * ata_wait_idle - Wait for a port to be idle.
516 * @ap: Port to wait for.
517 *
518 * Waits up to 10ms for port's BUSY and DRQ signals to clear.
519 * Returns final value of status register.
520 *
521 * LOCKING:
522 * Inherited from caller.
523 */
524
489static inline u8 ata_wait_idle(struct ata_port *ap) 525static inline u8 ata_wait_idle(struct ata_port *ap)
490{ 526{
491 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 527 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
@@ -524,6 +560,18 @@ static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, uns
524 tf->device = ATA_DEVICE_OBS | ATA_DEV1; 560 tf->device = ATA_DEVICE_OBS | ATA_DEV1;
525} 561}
526 562
563
564/**
565 * ata_irq_on - Enable interrupts on a port.
566 * @ap: Port on which interrupts are enabled.
567 *
568 * Enable interrupts on a legacy IDE device using MMIO or PIO,
569 * wait for idle, clear any pending interrupts.
570 *
571 * LOCKING:
572 * Inherited from caller.
573 */
574
527static inline u8 ata_irq_on(struct ata_port *ap) 575static inline u8 ata_irq_on(struct ata_port *ap)
528{ 576{
529 struct ata_ioports *ioaddr = &ap->ioaddr; 577 struct ata_ioports *ioaddr = &ap->ioaddr;
@@ -543,6 +591,18 @@ static inline u8 ata_irq_on(struct ata_port *ap)
543 return tmp; 591 return tmp;
544} 592}
545 593
594
595/**
596 * ata_irq_ack - Acknowledge a device interrupt.
597 * @ap: Port on which interrupts are enabled.
598 *
599 * Wait up to 10 ms for legacy IDE device to become idle (BUSY
600 * or BUSY+DRQ clear). Obtain dma status and port status from
601 * device. Clear the interrupt. Return port status.
602 *
603 * LOCKING:
604 */
605
546static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) 606static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
547{ 607{
548 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; 608 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
diff --git a/include/linux/list.h b/include/linux/list.h
index 399b51d17218..aab2db21b013 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -185,7 +185,7 @@ static inline void list_del(struct list_head *entry)
185 * list_for_each_entry_rcu(). 185 * list_for_each_entry_rcu().
186 * 186 *
187 * Note that the caller is not permitted to immediately free 187 * Note that the caller is not permitted to immediately free
188 * the newly deleted entry. Instead, either synchronize_kernel() 188 * the newly deleted entry. Instead, either synchronize_rcu()
189 * or call_rcu() must be used to defer freeing until an RCU 189 * or call_rcu() must be used to defer freeing until an RCU
190 * grace period has elapsed. 190 * grace period has elapsed.
191 */ 191 */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 0d9d22578212..16d4e5a08e1d 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -72,6 +72,8 @@ struct nlm_lockowner {
72 uint32_t pid; 72 uint32_t pid;
73}; 73};
74 74
75struct nlm_wait;
76
75/* 77/*
76 * Memory chunk for NLM client RPC request. 78 * Memory chunk for NLM client RPC request.
77 */ 79 */
@@ -81,6 +83,7 @@ struct nlm_rqst {
81 struct nlm_host * a_host; /* host handle */ 83 struct nlm_host * a_host; /* host handle */
82 struct nlm_args a_args; /* arguments */ 84 struct nlm_args a_args; /* arguments */
83 struct nlm_res a_res; /* result */ 85 struct nlm_res a_res; /* result */
86 struct nlm_wait * a_block;
84 char a_owner[NLMCLNT_OHSIZE]; 87 char a_owner[NLMCLNT_OHSIZE];
85}; 88};
86 89
@@ -142,7 +145,9 @@ extern unsigned long nlmsvc_timeout;
142 * Lockd client functions 145 * Lockd client functions
143 */ 146 */
144struct nlm_rqst * nlmclnt_alloc_call(void); 147struct nlm_rqst * nlmclnt_alloc_call(void);
145int nlmclnt_block(struct nlm_host *, struct file_lock *, u32 *); 148int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl);
149void nlmclnt_finish_block(struct nlm_rqst *req);
150long nlmclnt_block(struct nlm_rqst *req, long timeout);
146int nlmclnt_cancel(struct nlm_host *, struct file_lock *); 151int nlmclnt_cancel(struct nlm_host *, struct file_lock *);
147u32 nlmclnt_grant(struct nlm_lock *); 152u32 nlmclnt_grant(struct nlm_lock *);
148void nlmclnt_recovery(struct nlm_host *, u32); 153void nlmclnt_recovery(struct nlm_host *, u32);
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 8220d9c9da00..53fa51595443 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -61,7 +61,7 @@ struct loop_device {
61 struct semaphore lo_sem; 61 struct semaphore lo_sem;
62 struct semaphore lo_ctl_mutex; 62 struct semaphore lo_ctl_mutex;
63 struct semaphore lo_bh_mutex; 63 struct semaphore lo_bh_mutex;
64 atomic_t lo_pending; 64 int lo_pending;
65 65
66 request_queue_t *lo_queue; 66 request_queue_t *lo_queue;
67}; 67};
diff --git a/include/linux/major.h b/include/linux/major.h
index 4b62c42b842c..e36a46702d94 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -100,6 +100,7 @@
100#define I2O_MAJOR 80 /* 80->87 */ 100#define I2O_MAJOR 80 /* 80->87 */
101 101
102#define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */ 102#define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */
103#define SCSI_CHANGER_MAJOR 86
103 104
104#define IDE6_MAJOR 88 105#define IDE6_MAJOR 88
105#define IDE7_MAJOR 89 106#define IDE7_MAJOR 89
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 4a36edf1c974..796220ce47cc 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -20,9 +20,14 @@ typedef struct mempool_s {
20 mempool_free_t *free; 20 mempool_free_t *free;
21 wait_queue_head_t wait; 21 wait_queue_head_t wait;
22} mempool_t; 22} mempool_t;
23extern mempool_t * mempool_create(int min_nr, mempool_alloc_t *alloc_fn, 23
24 mempool_free_t *free_fn, void *pool_data); 24extern mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
25extern int mempool_resize(mempool_t *pool, int new_min_nr, unsigned int __nocast gfp_mask); 25 mempool_free_t *free_fn, void *pool_data);
26extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn,
27 mempool_free_t *free_fn, void *pool_data, int nid);
28
29extern int mempool_resize(mempool_t *pool, int new_min_nr,
30 unsigned int __nocast gfp_mask);
26extern void mempool_destroy(mempool_t *pool); 31extern void mempool_destroy(mempool_t *pool);
27extern void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask); 32extern void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask);
28extern void mempool_free(void *element, mempool_t *pool); 33extern void mempool_free(void *element, mempool_t *pool);
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 20971fe78a8d..374b615ea9ea 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -65,9 +65,13 @@
65#define ADVERTISE_SLCT 0x001f /* Selector bits */ 65#define ADVERTISE_SLCT 0x001f /* Selector bits */
66#define ADVERTISE_CSMA 0x0001 /* Only selector supported */ 66#define ADVERTISE_CSMA 0x0001 /* Only selector supported */
67#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ 67#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */
68#define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */
68#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ 69#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */
70#define ADVERTISE_1000XHALF 0x0040 /* Try for 1000BASE-X half-duplex */
69#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ 71#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */
72#define ADVERTISE_1000XPAUSE 0x0080 /* Try for 1000BASE-X pause */
70#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ 73#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */
74#define ADVERTISE_1000XPSE_ASYM 0x0100 /* Try for 1000BASE-X asym pause */
71#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ 75#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */
72#define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */ 76#define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */
73#define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */ 77#define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */
@@ -84,9 +88,13 @@
84/* Link partner ability register. */ 88/* Link partner ability register. */
85#define LPA_SLCT 0x001f /* Same as advertise selector */ 89#define LPA_SLCT 0x001f /* Same as advertise selector */
86#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ 90#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */
91#define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */
87#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ 92#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */
93#define LPA_1000XHALF 0x0040 /* Can do 1000BASE-X half-duplex */
88#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ 94#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */
95#define LPA_1000XPAUSE 0x0080 /* Can do 1000BASE-X pause */
89#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ 96#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */
97#define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/
90#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ 98#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */
91#define LPA_PAUSE_CAP 0x0400 /* Can pause */ 99#define LPA_PAUSE_CAP 0x0400 /* Can pause */
92#define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */ 100#define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 17518fe0b311..6eb7f48317f8 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -395,19 +395,81 @@ static inline void put_page(struct page *page)
395/* 395/*
396 * The zone field is never updated after free_area_init_core() 396 * The zone field is never updated after free_area_init_core()
397 * sets it, so none of the operations on it need to be atomic. 397 * sets it, so none of the operations on it need to be atomic.
398 * We'll have up to (MAX_NUMNODES * MAX_NR_ZONES) zones total,
399 * so we use (MAX_NODES_SHIFT + MAX_ZONES_SHIFT) here to get enough bits.
400 */ 398 */
401#define NODEZONE_SHIFT (sizeof(page_flags_t)*8 - MAX_NODES_SHIFT - MAX_ZONES_SHIFT) 399
402#define NODEZONE(node, zone) ((node << ZONES_SHIFT) | zone) 400
401/*
402 * page->flags layout:
403 *
404 * There are three possibilities for how page->flags get
405 * laid out. The first is for the normal case, without
406 * sparsemem. The second is for sparsemem when there is
407 * plenty of space for node and section. The last is when
408 * we have run out of space and have to fall back to an
409 * alternate (slower) way of determining the node.
410 *
411 * No sparsemem: | NODE | ZONE | ... | FLAGS |
412 * with space for node: | SECTION | NODE | ZONE | ... | FLAGS |
413 * no space for node: | SECTION | ZONE | ... | FLAGS |
414 */
415#ifdef CONFIG_SPARSEMEM
416#define SECTIONS_WIDTH SECTIONS_SHIFT
417#else
418#define SECTIONS_WIDTH 0
419#endif
420
421#define ZONES_WIDTH ZONES_SHIFT
422
423#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED
424#define NODES_WIDTH NODES_SHIFT
425#else
426#define NODES_WIDTH 0
427#endif
428
429/* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */
430#define SECTIONS_PGOFF ((sizeof(page_flags_t)*8) - SECTIONS_WIDTH)
431#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
432#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH)
433
434/*
435 * We are going to use the flags for the page to node mapping if its in
436 * there. This includes the case where there is no node, so it is implicit.
437 */
438#define FLAGS_HAS_NODE (NODES_WIDTH > 0 || NODES_SHIFT == 0)
439
440#ifndef PFN_SECTION_SHIFT
441#define PFN_SECTION_SHIFT 0
442#endif
443
444/*
445 * Define the bit shifts to access each section. For non-existant
446 * sections we define the shift as 0; that plus a 0 mask ensures
447 * the compiler will optimise away reference to them.
448 */
449#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0))
450#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0))
451#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0))
452
453/* NODE:ZONE or SECTION:ZONE is used to lookup the zone from a page. */
454#if FLAGS_HAS_NODE
455#define ZONETABLE_SHIFT (NODES_SHIFT + ZONES_SHIFT)
456#else
457#define ZONETABLE_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT)
458#endif
459#define ZONETABLE_PGSHIFT ZONES_PGSHIFT
460
461#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
462#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
463#endif
464
465#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
466#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
467#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
468#define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1)
403 469
404static inline unsigned long page_zonenum(struct page *page) 470static inline unsigned long page_zonenum(struct page *page)
405{ 471{
406 return (page->flags >> NODEZONE_SHIFT) & (~(~0UL << ZONES_SHIFT)); 472 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
407}
408static inline unsigned long page_to_nid(struct page *page)
409{
410 return (page->flags >> (NODEZONE_SHIFT + ZONES_SHIFT));
411} 473}
412 474
413struct zone; 475struct zone;
@@ -415,13 +477,44 @@ extern struct zone *zone_table[];
415 477
416static inline struct zone *page_zone(struct page *page) 478static inline struct zone *page_zone(struct page *page)
417{ 479{
418 return zone_table[page->flags >> NODEZONE_SHIFT]; 480 return zone_table[(page->flags >> ZONETABLE_PGSHIFT) &
481 ZONETABLE_MASK];
419} 482}
420 483
421static inline void set_page_zone(struct page *page, unsigned long nodezone_num) 484static inline unsigned long page_to_nid(struct page *page)
485{
486 if (FLAGS_HAS_NODE)
487 return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
488 else
489 return page_zone(page)->zone_pgdat->node_id;
490}
491static inline unsigned long page_to_section(struct page *page)
422{ 492{
423 page->flags &= ~(~0UL << NODEZONE_SHIFT); 493 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
424 page->flags |= nodezone_num << NODEZONE_SHIFT; 494}
495
496static inline void set_page_zone(struct page *page, unsigned long zone)
497{
498 page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
499 page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
500}
501static inline void set_page_node(struct page *page, unsigned long node)
502{
503 page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
504 page->flags |= (node & NODES_MASK) << NODES_PGSHIFT;
505}
506static inline void set_page_section(struct page *page, unsigned long section)
507{
508 page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
509 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
510}
511
512static inline void set_page_links(struct page *page, unsigned long zone,
513 unsigned long node, unsigned long pfn)
514{
515 set_page_zone(page, zone);
516 set_page_node(page, node);
517 set_page_section(page, pfn_to_section_nr(pfn));
425} 518}
426 519
427#ifndef CONFIG_DISCONTIGMEM 520#ifndef CONFIG_DISCONTIGMEM
@@ -691,6 +784,12 @@ extern void show_mem(void);
691extern void si_meminfo(struct sysinfo * val); 784extern void si_meminfo(struct sysinfo * val);
692extern void si_meminfo_node(struct sysinfo *val, int nid); 785extern void si_meminfo_node(struct sysinfo *val, int nid);
693 786
787#ifdef CONFIG_NUMA
788extern void setup_per_cpu_pageset(void);
789#else
790static inline void setup_per_cpu_pageset(void) {}
791#endif
792
694/* prio_tree.c */ 793/* prio_tree.c */
695void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); 794void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
696void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *); 795void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *);
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index e530c6c092f1..6c90461ed99f 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -63,6 +63,12 @@ struct per_cpu_pageset {
63#endif 63#endif
64} ____cacheline_aligned_in_smp; 64} ____cacheline_aligned_in_smp;
65 65
66#ifdef CONFIG_NUMA
67#define zone_pcp(__z, __cpu) ((__z)->pageset[(__cpu)])
68#else
69#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
70#endif
71
66#define ZONE_DMA 0 72#define ZONE_DMA 0
67#define ZONE_NORMAL 1 73#define ZONE_NORMAL 1
68#define ZONE_HIGHMEM 2 74#define ZONE_HIGHMEM 2
@@ -122,8 +128,11 @@ struct zone {
122 */ 128 */
123 unsigned long lowmem_reserve[MAX_NR_ZONES]; 129 unsigned long lowmem_reserve[MAX_NR_ZONES];
124 130
131#ifdef CONFIG_NUMA
132 struct per_cpu_pageset *pageset[NR_CPUS];
133#else
125 struct per_cpu_pageset pageset[NR_CPUS]; 134 struct per_cpu_pageset pageset[NR_CPUS];
126 135#endif
127 /* 136 /*
128 * free areas of different sizes 137 * free areas of different sizes
129 */ 138 */
@@ -145,6 +154,14 @@ struct zone {
145 int all_unreclaimable; /* All pages pinned */ 154 int all_unreclaimable; /* All pages pinned */
146 155
147 /* 156 /*
157 * Does the allocator try to reclaim pages from the zone as soon
158 * as it fails a watermark_ok() in __alloc_pages?
159 */
160 int reclaim_pages;
161 /* A count of how many reclaimers are scanning this zone */
162 atomic_t reclaim_in_progress;
163
164 /*
148 * prev_priority holds the scanning priority for this zone. It is 165 * prev_priority holds the scanning priority for this zone. It is
149 * defined as the scanning priority at which we achieved our reclaim 166 * defined as the scanning priority at which we achieved our reclaim
150 * target at the previous try_to_free_pages() or balance_pgdat() 167 * target at the previous try_to_free_pages() or balance_pgdat()
@@ -252,7 +269,9 @@ typedef struct pglist_data {
252 struct zone node_zones[MAX_NR_ZONES]; 269 struct zone node_zones[MAX_NR_ZONES];
253 struct zonelist node_zonelists[GFP_ZONETYPES]; 270 struct zonelist node_zonelists[GFP_ZONETYPES];
254 int nr_zones; 271 int nr_zones;
272#ifdef CONFIG_FLAT_NODE_MEM_MAP
255 struct page *node_mem_map; 273 struct page *node_mem_map;
274#endif
256 struct bootmem_data *bdata; 275 struct bootmem_data *bdata;
257 unsigned long node_start_pfn; 276 unsigned long node_start_pfn;
258 unsigned long node_present_pages; /* total number of physical pages */ 277 unsigned long node_present_pages; /* total number of physical pages */
@@ -267,6 +286,12 @@ typedef struct pglist_data {
267 286
268#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) 287#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages)
269#define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages) 288#define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages)
289#ifdef CONFIG_FLAT_NODE_MEM_MAP
290#define pgdat_page_nr(pgdat, pagenr) ((pgdat)->node_mem_map + (pagenr))
291#else
292#define pgdat_page_nr(pgdat, pagenr) pfn_to_page((pgdat)->node_start_pfn + (pagenr))
293#endif
294#define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr))
270 295
271extern struct pglist_data *pgdat_list; 296extern struct pglist_data *pgdat_list;
272 297
@@ -381,9 +406,9 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
381 406
382#include <linux/topology.h> 407#include <linux/topology.h>
383/* Returns the number of the current Node. */ 408/* Returns the number of the current Node. */
384#define numa_node_id() (cpu_to_node(_smp_processor_id())) 409#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
385 410
386#ifndef CONFIG_DISCONTIGMEM 411#ifndef CONFIG_NEED_MULTIPLE_NODES
387 412
388extern struct pglist_data contig_page_data; 413extern struct pglist_data contig_page_data;
389#define NODE_DATA(nid) (&contig_page_data) 414#define NODE_DATA(nid) (&contig_page_data)
@@ -391,36 +416,177 @@ extern struct pglist_data contig_page_data;
391#define MAX_NODES_SHIFT 1 416#define MAX_NODES_SHIFT 1
392#define pfn_to_nid(pfn) (0) 417#define pfn_to_nid(pfn) (0)
393 418
394#else /* CONFIG_DISCONTIGMEM */ 419#else /* CONFIG_NEED_MULTIPLE_NODES */
395 420
396#include <asm/mmzone.h> 421#include <asm/mmzone.h>
397 422
423#endif /* !CONFIG_NEED_MULTIPLE_NODES */
424
425#ifdef CONFIG_SPARSEMEM
426#include <asm/sparsemem.h>
427#endif
428
398#if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED) 429#if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED)
399/* 430/*
400 * with 32 bit page->flags field, we reserve 8 bits for node/zone info. 431 * with 32 bit page->flags field, we reserve 8 bits for node/zone info.
401 * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes. 432 * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes.
402 */ 433 */
403#define MAX_NODES_SHIFT 6 434#define FLAGS_RESERVED 8
435
404#elif BITS_PER_LONG == 64 436#elif BITS_PER_LONG == 64
405/* 437/*
406 * with 64 bit flags field, there's plenty of room. 438 * with 64 bit flags field, there's plenty of room.
407 */ 439 */
408#define MAX_NODES_SHIFT 10 440#define FLAGS_RESERVED 32
441
442#else
443
444#error BITS_PER_LONG not defined
445
409#endif 446#endif
410 447
411#endif /* !CONFIG_DISCONTIGMEM */ 448#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
449#define early_pfn_to_nid(nid) (0UL)
450#endif
451
452#define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT)
453#define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT)
454
455#ifdef CONFIG_SPARSEMEM
456
457/*
458 * SECTION_SHIFT #bits space required to store a section #
459 *
460 * PA_SECTION_SHIFT physical address to/from section number
461 * PFN_SECTION_SHIFT pfn to/from section number
462 */
463#define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS)
464
465#define PA_SECTION_SHIFT (SECTION_SIZE_BITS)
466#define PFN_SECTION_SHIFT (SECTION_SIZE_BITS - PAGE_SHIFT)
467
468#define NR_MEM_SECTIONS (1UL << SECTIONS_SHIFT)
469
470#define PAGES_PER_SECTION (1UL << PFN_SECTION_SHIFT)
471#define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1))
472
473#if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS
474#error Allocator MAX_ORDER exceeds SECTION_SIZE
475#endif
476
477struct page;
478struct mem_section {
479 /*
480 * This is, logically, a pointer to an array of struct
481 * pages. However, it is stored with some other magic.
482 * (see sparse.c::sparse_init_one_section())
483 *
484 * Making it a UL at least makes someone do a cast
485 * before using it wrong.
486 */
487 unsigned long section_mem_map;
488};
489
490extern struct mem_section mem_section[NR_MEM_SECTIONS];
491
492static inline struct mem_section *__nr_to_section(unsigned long nr)
493{
494 return &mem_section[nr];
495}
496
497/*
498 * We use the lower bits of the mem_map pointer to store
499 * a little bit of information. There should be at least
500 * 3 bits here due to 32-bit alignment.
501 */
502#define SECTION_MARKED_PRESENT (1UL<<0)
503#define SECTION_HAS_MEM_MAP (1UL<<1)
504#define SECTION_MAP_LAST_BIT (1UL<<2)
505#define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
506
507static inline struct page *__section_mem_map_addr(struct mem_section *section)
508{
509 unsigned long map = section->section_mem_map;
510 map &= SECTION_MAP_MASK;
511 return (struct page *)map;
512}
513
514static inline int valid_section(struct mem_section *section)
515{
516 return (section->section_mem_map & SECTION_MARKED_PRESENT);
517}
518
519static inline int section_has_mem_map(struct mem_section *section)
520{
521 return (section->section_mem_map & SECTION_HAS_MEM_MAP);
522}
523
524static inline int valid_section_nr(unsigned long nr)
525{
526 return valid_section(__nr_to_section(nr));
527}
412 528
413#if NODES_SHIFT > MAX_NODES_SHIFT 529/*
414#error NODES_SHIFT > MAX_NODES_SHIFT 530 * Given a kernel address, find the home node of the underlying memory.
531 */
532#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
533
534static inline struct mem_section *__pfn_to_section(unsigned long pfn)
535{
536 return __nr_to_section(pfn_to_section_nr(pfn));
537}
538
539#define pfn_to_page(pfn) \
540({ \
541 unsigned long __pfn = (pfn); \
542 __section_mem_map_addr(__pfn_to_section(__pfn)) + __pfn; \
543})
544#define page_to_pfn(page) \
545({ \
546 page - __section_mem_map_addr(__nr_to_section( \
547 page_to_section(page))); \
548})
549
550static inline int pfn_valid(unsigned long pfn)
551{
552 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
553 return 0;
554 return valid_section(__nr_to_section(pfn_to_section_nr(pfn)));
555}
556
557/*
558 * These are _only_ used during initialisation, therefore they
559 * can use __initdata ... They could have names to indicate
560 * this restriction.
561 */
562#ifdef CONFIG_NUMA
563#define pfn_to_nid early_pfn_to_nid
415#endif 564#endif
416 565
417/* There are currently 3 zones: DMA, Normal & Highmem, thus we need 2 bits */ 566#define pfn_to_pgdat(pfn) \
418#define MAX_ZONES_SHIFT 2 567({ \
568 NODE_DATA(pfn_to_nid(pfn)); \
569})
570
571#define early_pfn_valid(pfn) pfn_valid(pfn)
572void sparse_init(void);
573#else
574#define sparse_init() do {} while (0)
575#endif /* CONFIG_SPARSEMEM */
419 576
420#if ZONES_SHIFT > MAX_ZONES_SHIFT 577#ifdef CONFIG_NODES_SPAN_OTHER_NODES
421#error ZONES_SHIFT > MAX_ZONES_SHIFT 578#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
579#else
580#define early_pfn_in_nid(pfn, nid) (1)
422#endif 581#endif
423 582
583#ifndef early_pfn_valid
584#define early_pfn_valid(pfn) (1)
585#endif
586
587void memory_present(int nid, unsigned long start, unsigned long end);
588unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
589
424#endif /* !__ASSEMBLY__ */ 590#endif /* !__ASSEMBLY__ */
425#endif /* __KERNEL__ */ 591#endif /* __KERNEL__ */
426#endif /* _LINUX_MMZONE_H */ 592#endif /* _LINUX_MMZONE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 0e432a0f4aee..f05372b7fe77 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -51,6 +51,9 @@ struct module_attribute {
51 ssize_t (*show)(struct module_attribute *, struct module *, char *); 51 ssize_t (*show)(struct module_attribute *, struct module *, char *);
52 ssize_t (*store)(struct module_attribute *, struct module *, 52 ssize_t (*store)(struct module_attribute *, struct module *,
53 const char *, size_t count); 53 const char *, size_t count);
54 void (*setup)(struct module *, const char *);
55 int (*test)(struct module *);
56 void (*free)(struct module *);
54}; 57};
55 58
56struct module_kobject 59struct module_kobject
@@ -239,6 +242,8 @@ struct module
239 /* Sysfs stuff. */ 242 /* Sysfs stuff. */
240 struct module_kobject mkobj; 243 struct module_kobject mkobj;
241 struct module_param_attrs *param_attrs; 244 struct module_param_attrs *param_attrs;
245 const char *version;
246 const char *srcversion;
242 247
243 /* Exported symbols */ 248 /* Exported symbols */
244 const struct kernel_symbol *syms; 249 const struct kernel_symbol *syms;
diff --git a/include/linux/namespace.h b/include/linux/namespace.h
index 9eca1558d72f..697991b69f9b 100644
--- a/include/linux/namespace.h
+++ b/include/linux/namespace.h
@@ -12,7 +12,6 @@ struct namespace {
12 struct rw_semaphore sem; 12 struct rw_semaphore sem;
13}; 13};
14 14
15extern void umount_tree(struct vfsmount *);
16extern int copy_namespace(int, struct task_struct *); 15extern int copy_namespace(int, struct task_struct *);
17extern void __put_namespace(struct namespace *namespace); 16extern void __put_namespace(struct namespace *namespace);
18 17
diff --git a/include/linux/net.h b/include/linux/net.h
index 6d997ff3f103..20cb226b2268 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -101,7 +101,6 @@ enum sock_type {
101 * @sk: internal networking protocol agnostic socket representation 101 * @sk: internal networking protocol agnostic socket representation
102 * @wait: wait queue for several uses 102 * @wait: wait queue for several uses
103 * @type: socket type (%SOCK_STREAM, etc) 103 * @type: socket type (%SOCK_STREAM, etc)
104 * @passcred: credentials (used only in Unix Sockets (aka PF_LOCAL))
105 */ 104 */
106struct socket { 105struct socket {
107 socket_state state; 106 socket_state state;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ac11d73be4ce..3a0ed7f9e801 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -41,7 +41,7 @@
41struct divert_blk; 41struct divert_blk;
42struct vlan_group; 42struct vlan_group;
43struct ethtool_ops; 43struct ethtool_ops;
44struct netpoll; 44struct netpoll_info;
45 /* source back-compat hooks */ 45 /* source back-compat hooks */
46#define SET_ETHTOOL_OPS(netdev,ops) \ 46#define SET_ETHTOOL_OPS(netdev,ops) \
47 ( (netdev)->ethtool_ops = (ops) ) 47 ( (netdev)->ethtool_ops = (ops) )
@@ -164,12 +164,6 @@ struct netif_rx_stats
164 unsigned total; 164 unsigned total;
165 unsigned dropped; 165 unsigned dropped;
166 unsigned time_squeeze; 166 unsigned time_squeeze;
167 unsigned throttled;
168 unsigned fastroute_hit;
169 unsigned fastroute_success;
170 unsigned fastroute_defer;
171 unsigned fastroute_deferred_out;
172 unsigned fastroute_latency_reduction;
173 unsigned cpu_collision; 167 unsigned cpu_collision;
174}; 168};
175 169
@@ -204,7 +198,7 @@ struct hh_cache
204 /* cached hardware header; allow for machine alignment needs. */ 198 /* cached hardware header; allow for machine alignment needs. */
205#define HH_DATA_MOD 16 199#define HH_DATA_MOD 16
206#define HH_DATA_OFF(__len) \ 200#define HH_DATA_OFF(__len) \
207 (HH_DATA_MOD - ((__len) & (HH_DATA_MOD - 1))) 201 (HH_DATA_MOD - (((__len - 1) & (HH_DATA_MOD - 1)) + 1))
208#define HH_DATA_ALIGN(__len) \ 202#define HH_DATA_ALIGN(__len) \
209 (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1)) 203 (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1))
210 unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; 204 unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)];
@@ -401,7 +395,7 @@ struct net_device
401 } reg_state; 395 } reg_state;
402 396
403 /* Net device features */ 397 /* Net device features */
404 int features; 398 unsigned long features;
405#define NETIF_F_SG 1 /* Scatter/gather IO. */ 399#define NETIF_F_SG 1 /* Scatter/gather IO. */
406#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */ 400#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */
407#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ 401#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
@@ -468,7 +462,7 @@ struct net_device
468 unsigned char *haddr); 462 unsigned char *haddr);
469 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); 463 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
470#ifdef CONFIG_NETPOLL 464#ifdef CONFIG_NETPOLL
471 struct netpoll *np; 465 struct netpoll_info *npinfo;
472#endif 466#endif
473#ifdef CONFIG_NET_POLL_CONTROLLER 467#ifdef CONFIG_NET_POLL_CONTROLLER
474 void (*poll_controller)(struct net_device *dev); 468 void (*poll_controller)(struct net_device *dev);
@@ -503,7 +497,7 @@ static inline void *netdev_priv(struct net_device *dev)
503#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) 497#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev))
504 498
505struct packet_type { 499struct packet_type {
506 unsigned short type; /* This is really htons(ether_type). */ 500 __be16 type; /* This is really htons(ether_type). */
507 struct net_device *dev; /* NULL is wildcarded here */ 501 struct net_device *dev; /* NULL is wildcarded here */
508 int (*func) (struct sk_buff *, struct net_device *, 502 int (*func) (struct sk_buff *, struct net_device *,
509 struct packet_type *); 503 struct packet_type *);
@@ -562,12 +556,9 @@ static inline int unregister_gifconf(unsigned int family)
562 556
563struct softnet_data 557struct softnet_data
564{ 558{
565 int throttle; 559 struct net_device *output_queue;
566 int cng_level;
567 int avg_blog;
568 struct sk_buff_head input_pkt_queue; 560 struct sk_buff_head input_pkt_queue;
569 struct list_head poll_list; 561 struct list_head poll_list;
570 struct net_device *output_queue;
571 struct sk_buff *completion_queue; 562 struct sk_buff *completion_queue;
572 563
573 struct net_device backlog_dev; /* Sorry. 8) */ 564 struct net_device backlog_dev; /* Sorry. 8) */
@@ -913,6 +904,7 @@ extern void dev_mc_discard(struct net_device *dev);
913extern void dev_set_promiscuity(struct net_device *dev, int inc); 904extern void dev_set_promiscuity(struct net_device *dev, int inc);
914extern void dev_set_allmulti(struct net_device *dev, int inc); 905extern void dev_set_allmulti(struct net_device *dev, int inc);
915extern void netdev_state_change(struct net_device *dev); 906extern void netdev_state_change(struct net_device *dev);
907extern void netdev_features_change(struct net_device *dev);
916/* Load a device via the kmod */ 908/* Load a device via the kmod */
917extern void dev_load(const char *name); 909extern void dev_load(const char *name);
918extern void dev_mcast_init(void); 910extern void dev_mcast_init(void);
@@ -924,10 +916,6 @@ extern int skb_checksum_help(struct sk_buff *skb, int inward);
924extern void net_enable_timestamp(void); 916extern void net_enable_timestamp(void);
925extern void net_disable_timestamp(void); 917extern void net_disable_timestamp(void);
926 918
927#ifdef CONFIG_SYSCTL
928extern char *net_sysctl_strdup(const char *s);
929#endif
930
931#endif /* __KERNEL__ */ 919#endif /* __KERNEL__ */
932 920
933#endif /* _LINUX_DEV_H */ 921#endif /* _LINUX_DEV_H */
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 9e5750079e09..3ebc36afae1a 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -75,12 +75,6 @@ enum nf_ip_hook_priorities {
75#define SO_ORIGINAL_DST 80 75#define SO_ORIGINAL_DST 80
76 76
77#ifdef __KERNEL__ 77#ifdef __KERNEL__
78#ifdef CONFIG_NETFILTER_DEBUG
79void nf_debug_ip_local_deliver(struct sk_buff *skb);
80void nf_debug_ip_loopback_xmit(struct sk_buff *newskb);
81void nf_debug_ip_finish_output2(struct sk_buff *skb);
82#endif /*CONFIG_NETFILTER_DEBUG*/
83
84extern int ip_route_me_harder(struct sk_buff **pskb); 78extern int ip_route_me_harder(struct sk_buff **pskb);
85 79
86/* Call this before modifying an existing IP packet: ensures it is 80/* Call this before modifying an existing IP packet: ensures it is
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h
index d84be02cb4fc..694aec9b4784 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_core.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h
@@ -1,7 +1,6 @@
1#ifndef _IP_CONNTRACK_CORE_H 1#ifndef _IP_CONNTRACK_CORE_H
2#define _IP_CONNTRACK_CORE_H 2#define _IP_CONNTRACK_CORE_H
3#include <linux/netfilter.h> 3#include <linux/netfilter.h>
4#include <linux/netfilter_ipv4/lockhelp.h>
5 4
6/* This header is used to share core functionality between the 5/* This header is used to share core functionality between the
7 standalone connection tracking module, and the compatibility layer's use 6 standalone connection tracking module, and the compatibility layer's use
@@ -47,6 +46,6 @@ static inline int ip_conntrack_confirm(struct sk_buff **pskb)
47 46
48extern struct list_head *ip_conntrack_hash; 47extern struct list_head *ip_conntrack_hash;
49extern struct list_head ip_conntrack_expect_list; 48extern struct list_head ip_conntrack_expect_list;
50DECLARE_RWLOCK_EXTERN(ip_conntrack_lock); 49extern rwlock_t ip_conntrack_lock;
51#endif /* _IP_CONNTRACK_CORE_H */ 50#endif /* _IP_CONNTRACK_CORE_H */
52 51
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
index 2b72b86176f0..e201ec6e9905 100644
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ b/include/linux/netfilter_ipv4/ip_nat.h
@@ -50,10 +50,9 @@ struct ip_nat_multi_range_compat
50 50
51#ifdef __KERNEL__ 51#ifdef __KERNEL__
52#include <linux/list.h> 52#include <linux/list.h>
53#include <linux/netfilter_ipv4/lockhelp.h>
54 53
55/* Protects NAT hash tables, and NAT-private part of conntracks. */ 54/* Protects NAT hash tables, and NAT-private part of conntracks. */
56DECLARE_RWLOCK_EXTERN(ip_nat_lock); 55extern rwlock_t ip_nat_lock;
57 56
58/* The structure embedded in the conntrack structure. */ 57/* The structure embedded in the conntrack structure. */
59struct ip_nat_info 58struct ip_nat_info
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
index baa83e757156..d9bceedfb3dc 100644
--- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
+++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
@@ -18,7 +18,6 @@ struct clusterip_config;
18struct ipt_clusterip_tgt_info { 18struct ipt_clusterip_tgt_info {
19 19
20 u_int32_t flags; 20 u_int32_t flags;
21 struct clusterip_config *config;
22 21
23 /* only relevant for new ones */ 22 /* only relevant for new ones */
24 u_int8_t clustermac[6]; 23 u_int8_t clustermac[6];
@@ -27,6 +26,8 @@ struct ipt_clusterip_tgt_info {
27 u_int16_t local_nodes[CLUSTERIP_MAX_NODES]; 26 u_int16_t local_nodes[CLUSTERIP_MAX_NODES];
28 enum clusterip_hashmode hash_mode; 27 enum clusterip_hashmode hash_mode;
29 u_int32_t hash_initval; 28 u_int32_t hash_initval;
29
30 struct clusterip_config *config;
30}; 31};
31 32
32#endif /*_IPT_CLUSTERIP_H_target*/ 33#endif /*_IPT_CLUSTERIP_H_target*/
diff --git a/include/linux/netfilter_ipv4/listhelp.h b/include/linux/netfilter_ipv4/listhelp.h
index f2ae7c5e57bb..360429f48737 100644
--- a/include/linux/netfilter_ipv4/listhelp.h
+++ b/include/linux/netfilter_ipv4/listhelp.h
@@ -2,7 +2,6 @@
2#define _LISTHELP_H 2#define _LISTHELP_H
3#include <linux/config.h> 3#include <linux/config.h>
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/netfilter_ipv4/lockhelp.h>
6 5
7/* Header to do more comprehensive job than linux/list.h; assume list 6/* Header to do more comprehensive job than linux/list.h; assume list
8 is first entry in structure. */ 7 is first entry in structure. */
diff --git a/include/linux/netfilter_ipv4/lockhelp.h b/include/linux/netfilter_ipv4/lockhelp.h
deleted file mode 100644
index a3288633ab46..000000000000
--- a/include/linux/netfilter_ipv4/lockhelp.h
+++ /dev/null
@@ -1,129 +0,0 @@
1#ifndef _LOCKHELP_H
2#define _LOCKHELP_H
3#include <linux/config.h>
4
5#include <linux/spinlock.h>
6#include <asm/atomic.h>
7#include <linux/interrupt.h>
8#include <linux/smp.h>
9
10/* Header to do help in lock debugging. */
11
12#ifdef CONFIG_NETFILTER_DEBUG
13struct spinlock_debug
14{
15 spinlock_t l;
16 atomic_t locked_by;
17};
18
19struct rwlock_debug
20{
21 rwlock_t l;
22 long read_locked_map;
23 long write_locked_map;
24};
25
26#define DECLARE_LOCK(l) \
27struct spinlock_debug l = { SPIN_LOCK_UNLOCKED, ATOMIC_INIT(-1) }
28#define DECLARE_LOCK_EXTERN(l) \
29extern struct spinlock_debug l
30#define DECLARE_RWLOCK(l) \
31struct rwlock_debug l = { RW_LOCK_UNLOCKED, 0, 0 }
32#define DECLARE_RWLOCK_EXTERN(l) \
33extern struct rwlock_debug l
34
35#define MUST_BE_LOCKED(l) \
36do { if (atomic_read(&(l)->locked_by) != smp_processor_id()) \
37 printk("ASSERT %s:%u %s unlocked\n", __FILE__, __LINE__, #l); \
38} while(0)
39
40#define MUST_BE_UNLOCKED(l) \
41do { if (atomic_read(&(l)->locked_by) == smp_processor_id()) \
42 printk("ASSERT %s:%u %s locked\n", __FILE__, __LINE__, #l); \
43} while(0)
44
45/* Write locked OK as well. */
46#define MUST_BE_READ_LOCKED(l) \
47do { if (!((l)->read_locked_map & (1UL << smp_processor_id())) \
48 && !((l)->write_locked_map & (1UL << smp_processor_id()))) \
49 printk("ASSERT %s:%u %s not readlocked\n", __FILE__, __LINE__, #l); \
50} while(0)
51
52#define MUST_BE_WRITE_LOCKED(l) \
53do { if (!((l)->write_locked_map & (1UL << smp_processor_id()))) \
54 printk("ASSERT %s:%u %s not writelocked\n", __FILE__, __LINE__, #l); \
55} while(0)
56
57#define MUST_BE_READ_WRITE_UNLOCKED(l) \
58do { if ((l)->read_locked_map & (1UL << smp_processor_id())) \
59 printk("ASSERT %s:%u %s readlocked\n", __FILE__, __LINE__, #l); \
60 else if ((l)->write_locked_map & (1UL << smp_processor_id())) \
61 printk("ASSERT %s:%u %s writelocked\n", __FILE__, __LINE__, #l); \
62} while(0)
63
64#define LOCK_BH(lk) \
65do { \
66 MUST_BE_UNLOCKED(lk); \
67 spin_lock_bh(&(lk)->l); \
68 atomic_set(&(lk)->locked_by, smp_processor_id()); \
69} while(0)
70
71#define UNLOCK_BH(lk) \
72do { \
73 MUST_BE_LOCKED(lk); \
74 atomic_set(&(lk)->locked_by, -1); \
75 spin_unlock_bh(&(lk)->l); \
76} while(0)
77
78#define READ_LOCK(lk) \
79do { \
80 MUST_BE_READ_WRITE_UNLOCKED(lk); \
81 read_lock_bh(&(lk)->l); \
82 set_bit(smp_processor_id(), &(lk)->read_locked_map); \
83} while(0)
84
85#define WRITE_LOCK(lk) \
86do { \
87 MUST_BE_READ_WRITE_UNLOCKED(lk); \
88 write_lock_bh(&(lk)->l); \
89 set_bit(smp_processor_id(), &(lk)->write_locked_map); \
90} while(0)
91
92#define READ_UNLOCK(lk) \
93do { \
94 if (!((lk)->read_locked_map & (1UL << smp_processor_id()))) \
95 printk("ASSERT: %s:%u %s not readlocked\n", \
96 __FILE__, __LINE__, #lk); \
97 clear_bit(smp_processor_id(), &(lk)->read_locked_map); \
98 read_unlock_bh(&(lk)->l); \
99} while(0)
100
101#define WRITE_UNLOCK(lk) \
102do { \
103 MUST_BE_WRITE_LOCKED(lk); \
104 clear_bit(smp_processor_id(), &(lk)->write_locked_map); \
105 write_unlock_bh(&(lk)->l); \
106} while(0)
107
108#else
109#define DECLARE_LOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED
110#define DECLARE_LOCK_EXTERN(l) extern spinlock_t l
111#define DECLARE_RWLOCK(l) rwlock_t l = RW_LOCK_UNLOCKED
112#define DECLARE_RWLOCK_EXTERN(l) extern rwlock_t l
113
114#define MUST_BE_LOCKED(l)
115#define MUST_BE_UNLOCKED(l)
116#define MUST_BE_READ_LOCKED(l)
117#define MUST_BE_WRITE_LOCKED(l)
118#define MUST_BE_READ_WRITE_UNLOCKED(l)
119
120#define LOCK_BH(l) spin_lock_bh(l)
121#define UNLOCK_BH(l) spin_unlock_bh(l)
122
123#define READ_LOCK(l) read_lock_bh(l)
124#define WRITE_LOCK(l) write_lock_bh(l)
125#define READ_UNLOCK(l) read_unlock_bh(l)
126#define WRITE_UNLOCK(l) write_unlock_bh(l)
127#endif /*CONFIG_NETFILTER_DEBUG*/
128
129#endif /* _LOCKHELP_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index b2738ac8bc99..3029cad63a01 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -14,6 +14,7 @@
14#define NETLINK_SELINUX 7 /* SELinux event notifications */ 14#define NETLINK_SELINUX 7 /* SELinux event notifications */
15#define NETLINK_ARPD 8 15#define NETLINK_ARPD 8
16#define NETLINK_AUDIT 9 /* auditing */ 16#define NETLINK_AUDIT 9 /* auditing */
17#define NETLINK_FIB_LOOKUP 10
17#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ 18#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */
18#define NETLINK_IP6_FW 13 19#define NETLINK_IP6_FW 13
19#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ 20#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
@@ -146,7 +147,7 @@ struct netlink_callback
146 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); 147 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb);
147 int (*done)(struct netlink_callback *cb); 148 int (*done)(struct netlink_callback *cb);
148 int family; 149 int family;
149 long args[4]; 150 long args[5];
150}; 151};
151 152
152struct netlink_notify 153struct netlink_notify
@@ -156,7 +157,7 @@ struct netlink_notify
156}; 157};
157 158
158static __inline__ struct nlmsghdr * 159static __inline__ struct nlmsghdr *
159__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len) 160__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
160{ 161{
161 struct nlmsghdr *nlh; 162 struct nlmsghdr *nlh;
162 int size = NLMSG_LENGTH(len); 163 int size = NLMSG_LENGTH(len);
@@ -164,15 +165,31 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len)
164 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); 165 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size));
165 nlh->nlmsg_type = type; 166 nlh->nlmsg_type = type;
166 nlh->nlmsg_len = size; 167 nlh->nlmsg_len = size;
167 nlh->nlmsg_flags = 0; 168 nlh->nlmsg_flags = flags;
168 nlh->nlmsg_pid = pid; 169 nlh->nlmsg_pid = pid;
169 nlh->nlmsg_seq = seq; 170 nlh->nlmsg_seq = seq;
170 return nlh; 171 return nlh;
171} 172}
172 173
174#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
175({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \
176 goto nlmsg_failure; \
177 __nlmsg_put(skb, pid, seq, type, len, flags); })
178
173#define NLMSG_PUT(skb, pid, seq, type, len) \ 179#define NLMSG_PUT(skb, pid, seq, type, len) \
174({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) goto nlmsg_failure; \ 180 NLMSG_NEW(skb, pid, seq, type, len, 0)
175 __nlmsg_put(skb, pid, seq, type, len); }) 181
182#define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \
183 NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
184 (cb)->nlh->nlmsg_seq, type, len, flags)
185
186#define NLMSG_END(skb, nlh) \
187({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
188 (skb)->len; })
189
190#define NLMSG_CANCEL(skb, nlh) \
191({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \
192 -1; })
176 193
177extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 194extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
178 struct nlmsghdr *nlh, 195 struct nlmsghdr *nlh,
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index c0d8b90c5202..bcd0ac33f592 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -16,14 +16,19 @@ struct netpoll;
16struct netpoll { 16struct netpoll {
17 struct net_device *dev; 17 struct net_device *dev;
18 char dev_name[16], *name; 18 char dev_name[16], *name;
19 int rx_flags;
20 void (*rx_hook)(struct netpoll *, int, char *, int); 19 void (*rx_hook)(struct netpoll *, int, char *, int);
21 void (*drop)(struct sk_buff *skb); 20 void (*drop)(struct sk_buff *skb);
22 u32 local_ip, remote_ip; 21 u32 local_ip, remote_ip;
23 u16 local_port, remote_port; 22 u16 local_port, remote_port;
24 unsigned char local_mac[6], remote_mac[6]; 23 unsigned char local_mac[6], remote_mac[6];
24};
25
26struct netpoll_info {
25 spinlock_t poll_lock; 27 spinlock_t poll_lock;
26 int poll_owner; 28 int poll_owner;
29 int rx_flags;
30 spinlock_t rx_lock;
31 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
27}; 32};
28 33
29void netpoll_poll(struct netpoll *np); 34void netpoll_poll(struct netpoll *np);
@@ -39,22 +44,35 @@ void netpoll_queue(struct sk_buff *skb);
39#ifdef CONFIG_NETPOLL 44#ifdef CONFIG_NETPOLL
40static inline int netpoll_rx(struct sk_buff *skb) 45static inline int netpoll_rx(struct sk_buff *skb)
41{ 46{
42 return skb->dev->np && skb->dev->np->rx_flags && __netpoll_rx(skb); 47 struct netpoll_info *npinfo = skb->dev->npinfo;
48 unsigned long flags;
49 int ret = 0;
50
51 if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags))
52 return 0;
53
54 spin_lock_irqsave(&npinfo->rx_lock, flags);
55 /* check rx_flags again with the lock held */
56 if (npinfo->rx_flags && __netpoll_rx(skb))
57 ret = 1;
58 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
59
60 return ret;
43} 61}
44 62
45static inline void netpoll_poll_lock(struct net_device *dev) 63static inline void netpoll_poll_lock(struct net_device *dev)
46{ 64{
47 if (dev->np) { 65 if (dev->npinfo) {
48 spin_lock(&dev->np->poll_lock); 66 spin_lock(&dev->npinfo->poll_lock);
49 dev->np->poll_owner = smp_processor_id(); 67 dev->npinfo->poll_owner = smp_processor_id();
50 } 68 }
51} 69}
52 70
53static inline void netpoll_poll_unlock(struct net_device *dev) 71static inline void netpoll_poll_unlock(struct net_device *dev)
54{ 72{
55 if (dev->np) { 73 if (dev->npinfo) {
56 spin_unlock(&dev->np->poll_lock); 74 dev->npinfo->poll_owner = -1;
57 dev->np->poll_owner = -1; 75 spin_unlock(&dev->npinfo->poll_lock);
58 } 76 }
59} 77}
60 78
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 5ca8a8d8ccdf..0c1c306cdaec 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -28,7 +28,7 @@
28#define NFS4_ACCESS_DELETE 0x0010 28#define NFS4_ACCESS_DELETE 0x0010
29#define NFS4_ACCESS_EXECUTE 0x0020 29#define NFS4_ACCESS_EXECUTE 0x0020
30 30
31#define NFS4_FH_PERISTENT 0x0000 31#define NFS4_FH_PERSISTENT 0x0000
32#define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 32#define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001
33#define NFS4_FH_VOLATILE_ANY 0x0002 33#define NFS4_FH_VOLATILE_ANY 0x0002
34#define NFS4_FH_VOL_MIGRATION 0x0004 34#define NFS4_FH_VOL_MIGRATION 0x0004
@@ -382,6 +382,8 @@ enum {
382 NFSPROC4_CLNT_READDIR, 382 NFSPROC4_CLNT_READDIR,
383 NFSPROC4_CLNT_SERVER_CAPS, 383 NFSPROC4_CLNT_SERVER_CAPS,
384 NFSPROC4_CLNT_DELEGRETURN, 384 NFSPROC4_CLNT_DELEGRETURN,
385 NFSPROC4_CLNT_GETACL,
386 NFSPROC4_CLNT_SETACL,
385}; 387};
386 388
387#endif 389#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index dbac7f363e5d..8ea249110fb0 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -15,7 +15,6 @@
15#include <linux/pagemap.h> 15#include <linux/pagemap.h>
16#include <linux/rwsem.h> 16#include <linux/rwsem.h>
17#include <linux/wait.h> 17#include <linux/wait.h>
18#include <linux/uio.h>
19 18
20#include <linux/nfs_fs_sb.h> 19#include <linux/nfs_fs_sb.h>
21 20
@@ -29,7 +28,6 @@
29#include <linux/nfs4.h> 28#include <linux/nfs4.h>
30#include <linux/nfs_xdr.h> 29#include <linux/nfs_xdr.h>
31#include <linux/rwsem.h> 30#include <linux/rwsem.h>
32#include <linux/workqueue.h>
33#include <linux/mempool.h> 31#include <linux/mempool.h>
34 32
35/* 33/*
@@ -44,13 +42,6 @@
44#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 42#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096
45 43
46/* 44/*
47 * The upper limit on timeouts for the exponential backoff algorithm.
48 */
49#define NFS_WRITEBACK_DELAY (5*HZ)
50#define NFS_WRITEBACK_LOCKDELAY (60*HZ)
51#define NFS_COMMIT_DELAY (5*HZ)
52
53/*
54 * superblock magic number for NFS 45 * superblock magic number for NFS
55 */ 46 */
56#define NFS_SUPER_MAGIC 0x6969 47#define NFS_SUPER_MAGIC 0x6969
@@ -60,9 +51,6 @@
60 */ 51 */
61#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) 52#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS)
62 53
63#define NFS_RW_SYNC 0x0001 /* O_SYNC handling */
64#define NFS_RW_SWAP 0x0002 /* This is a swap request */
65
66/* 54/*
67 * When flushing a cluster of dirty pages, there can be different 55 * When flushing a cluster of dirty pages, there can be different
68 * strategies: 56 * strategies:
@@ -96,7 +84,8 @@ struct nfs_open_context {
96 int error; 84 int error;
97 85
98 struct list_head list; 86 struct list_head list;
99 wait_queue_head_t waitq; 87
88 __u64 dir_cookie;
100}; 89};
101 90
102/* 91/*
@@ -104,6 +93,8 @@ struct nfs_open_context {
104 */ 93 */
105struct nfs_delegation; 94struct nfs_delegation;
106 95
96struct posix_acl;
97
107/* 98/*
108 * nfs fs inode data in memory 99 * nfs fs inode data in memory
109 */ 100 */
@@ -140,7 +131,6 @@ struct nfs_inode {
140 * 131 *
141 * mtime != read_cache_mtime 132 * mtime != read_cache_mtime
142 */ 133 */
143 unsigned long readdir_timestamp;
144 unsigned long read_cache_jiffies; 134 unsigned long read_cache_jiffies;
145 unsigned long attrtimeo; 135 unsigned long attrtimeo;
146 unsigned long attrtimeo_timestamp; 136 unsigned long attrtimeo_timestamp;
@@ -158,6 +148,10 @@ struct nfs_inode {
158 atomic_t data_updates; 148 atomic_t data_updates;
159 149
160 struct nfs_access_entry cache_access; 150 struct nfs_access_entry cache_access;
151#ifdef CONFIG_NFS_V3_ACL
152 struct posix_acl *acl_access;
153 struct posix_acl *acl_default;
154#endif
161 155
162 /* 156 /*
163 * This is the cookie verifier used for NFSv3 readdir 157 * This is the cookie verifier used for NFSv3 readdir
@@ -183,13 +177,13 @@ struct nfs_inode {
183 wait_queue_head_t nfs_i_wait; 177 wait_queue_head_t nfs_i_wait;
184 178
185#ifdef CONFIG_NFS_V4 179#ifdef CONFIG_NFS_V4
180 struct nfs4_cached_acl *nfs4_acl;
186 /* NFSv4 state */ 181 /* NFSv4 state */
187 struct list_head open_states; 182 struct list_head open_states;
188 struct nfs_delegation *delegation; 183 struct nfs_delegation *delegation;
189 int delegation_state; 184 int delegation_state;
190 struct rw_semaphore rwsem; 185 struct rw_semaphore rwsem;
191#endif /* CONFIG_NFS_V4*/ 186#endif /* CONFIG_NFS_V4*/
192
193 struct inode vfs_inode; 187 struct inode vfs_inode;
194}; 188};
195 189
@@ -203,6 +197,8 @@ struct nfs_inode {
203#define NFS_INO_INVALID_DATA 0x0010 /* cached data is invalid */ 197#define NFS_INO_INVALID_DATA 0x0010 /* cached data is invalid */
204#define NFS_INO_INVALID_ATIME 0x0020 /* cached atime is invalid */ 198#define NFS_INO_INVALID_ATIME 0x0020 /* cached atime is invalid */
205#define NFS_INO_INVALID_ACCESS 0x0040 /* cached access cred invalid */ 199#define NFS_INO_INVALID_ACCESS 0x0040 /* cached access cred invalid */
200#define NFS_INO_INVALID_ACL 0x0080 /* cached acls are invalid */
201#define NFS_INO_REVAL_PAGECACHE 0x1000 /* must revalidate pagecache */
206 202
207static inline struct nfs_inode *NFS_I(struct inode *inode) 203static inline struct nfs_inode *NFS_I(struct inode *inode)
208{ 204{
@@ -294,12 +290,12 @@ extern int nfs_release(struct inode *, struct file *);
294extern int nfs_attribute_timeout(struct inode *inode); 290extern int nfs_attribute_timeout(struct inode *inode);
295extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 291extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
296extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 292extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
293extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
297extern int nfs_setattr(struct dentry *, struct iattr *); 294extern int nfs_setattr(struct dentry *, struct iattr *);
298extern void nfs_begin_attr_update(struct inode *); 295extern void nfs_begin_attr_update(struct inode *);
299extern void nfs_end_attr_update(struct inode *); 296extern void nfs_end_attr_update(struct inode *);
300extern void nfs_begin_data_update(struct inode *); 297extern void nfs_begin_data_update(struct inode *);
301extern void nfs_end_data_update(struct inode *); 298extern void nfs_end_data_update(struct inode *);
302extern void nfs_end_data_update_defer(struct inode *);
303extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred); 299extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred);
304extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 300extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
305extern void put_nfs_open_context(struct nfs_open_context *ctx); 301extern void put_nfs_open_context(struct nfs_open_context *ctx);
@@ -314,6 +310,9 @@ extern u32 root_nfs_parse_addr(char *name); /*__init*/
314 * linux/fs/nfs/file.c 310 * linux/fs/nfs/file.c
315 */ 311 */
316extern struct inode_operations nfs_file_inode_operations; 312extern struct inode_operations nfs_file_inode_operations;
313#ifdef CONFIG_NFS_V3
314extern struct inode_operations nfs3_file_inode_operations;
315#endif /* CONFIG_NFS_V3 */
317extern struct file_operations nfs_file_operations; 316extern struct file_operations nfs_file_operations;
318extern struct address_space_operations nfs_file_aops; 317extern struct address_space_operations nfs_file_aops;
319 318
@@ -329,6 +328,22 @@ static inline struct rpc_cred *nfs_file_cred(struct file *file)
329} 328}
330 329
331/* 330/*
331 * linux/fs/nfs/xattr.c
332 */
333#ifdef CONFIG_NFS_V3_ACL
334extern ssize_t nfs3_listxattr(struct dentry *, char *, size_t);
335extern ssize_t nfs3_getxattr(struct dentry *, const char *, void *, size_t);
336extern int nfs3_setxattr(struct dentry *, const char *,
337 const void *, size_t, int);
338extern int nfs3_removexattr (struct dentry *, const char *name);
339#else
340# define nfs3_listxattr NULL
341# define nfs3_getxattr NULL
342# define nfs3_setxattr NULL
343# define nfs3_removexattr NULL
344#endif
345
346/*
332 * linux/fs/nfs/direct.c 347 * linux/fs/nfs/direct.c
333 */ 348 */
334extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, 349extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t,
@@ -342,6 +357,9 @@ extern ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf,
342 * linux/fs/nfs/dir.c 357 * linux/fs/nfs/dir.c
343 */ 358 */
344extern struct inode_operations nfs_dir_inode_operations; 359extern struct inode_operations nfs_dir_inode_operations;
360#ifdef CONFIG_NFS_V3
361extern struct inode_operations nfs3_dir_inode_operations;
362#endif /* CONFIG_NFS_V3 */
345extern struct file_operations nfs_dir_operations; 363extern struct file_operations nfs_dir_operations;
346extern struct dentry_operations nfs_dentry_operations; 364extern struct dentry_operations nfs_dentry_operations;
347 365
@@ -377,10 +395,10 @@ extern void nfs_commit_done(struct rpc_task *);
377 */ 395 */
378extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); 396extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int);
379#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 397#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
380extern int nfs_commit_inode(struct inode *, unsigned long, unsigned int, int); 398extern int nfs_commit_inode(struct inode *, int);
381#else 399#else
382static inline int 400static inline int
383nfs_commit_inode(struct inode *inode, unsigned long idx_start, unsigned int npages, int how) 401nfs_commit_inode(struct inode *inode, int how)
384{ 402{
385 return 0; 403 return 0;
386} 404}
@@ -434,11 +452,6 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
434 mempool_free(p, nfs_wdata_mempool); 452 mempool_free(p, nfs_wdata_mempool);
435} 453}
436 454
437/* Hack for future NFS swap support */
438#ifndef IS_SWAPFILE
439# define IS_SWAPFILE(inode) (0)
440#endif
441
442/* 455/*
443 * linux/fs/nfs/read.c 456 * linux/fs/nfs/read.c
444 */ 457 */
@@ -468,6 +481,29 @@ static inline void nfs_readdata_free(struct nfs_read_data *p)
468extern void nfs_readdata_release(struct rpc_task *task); 481extern void nfs_readdata_release(struct rpc_task *task);
469 482
470/* 483/*
484 * linux/fs/nfs3proc.c
485 */
486#ifdef CONFIG_NFS_V3_ACL
487extern struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type);
488extern int nfs3_proc_setacl(struct inode *inode, int type,
489 struct posix_acl *acl);
490extern int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode,
491 mode_t mode);
492extern void nfs3_forget_cached_acls(struct inode *inode);
493#else
494static inline int nfs3_proc_set_default_acl(struct inode *dir,
495 struct inode *inode,
496 mode_t mode)
497{
498 return 0;
499}
500
501static inline void nfs3_forget_cached_acls(struct inode *inode)
502{
503}
504#endif /* CONFIG_NFS_V3_ACL */
505
506/*
471 * linux/fs/mount_clnt.c 507 * linux/fs/mount_clnt.c
472 * (Used only by nfsroot module) 508 * (Used only by nfsroot module)
473 */ 509 */
@@ -515,230 +551,6 @@ extern void * nfs_root_data(void);
515 551
516#define NFS_JUKEBOX_RETRY_TIME (5 * HZ) 552#define NFS_JUKEBOX_RETRY_TIME (5 * HZ)
517 553
518#ifdef CONFIG_NFS_V4
519
520struct idmap;
521
522/*
523 * In a seqid-mutating op, this macro controls which error return
524 * values trigger incrementation of the seqid.
525 *
526 * from rfc 3010:
527 * The client MUST monotonically increment the sequence number for the
528 * CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE
529 * operations. This is true even in the event that the previous
530 * operation that used the sequence number received an error. The only
531 * exception to this rule is if the previous operation received one of
532 * the following errors: NFSERR_STALE_CLIENTID, NFSERR_STALE_STATEID,
533 * NFSERR_BAD_STATEID, NFSERR_BAD_SEQID, NFSERR_BADXDR,
534 * NFSERR_RESOURCE, NFSERR_NOFILEHANDLE.
535 *
536 */
537#define seqid_mutating_err(err) \
538(((err) != NFSERR_STALE_CLIENTID) && \
539 ((err) != NFSERR_STALE_STATEID) && \
540 ((err) != NFSERR_BAD_STATEID) && \
541 ((err) != NFSERR_BAD_SEQID) && \
542 ((err) != NFSERR_BAD_XDR) && \
543 ((err) != NFSERR_RESOURCE) && \
544 ((err) != NFSERR_NOFILEHANDLE))
545
546enum nfs4_client_state {
547 NFS4CLNT_OK = 0,
548};
549
550/*
551 * The nfs4_client identifies our client state to the server.
552 */
553struct nfs4_client {
554 struct list_head cl_servers; /* Global list of servers */
555 struct in_addr cl_addr; /* Server identifier */
556 u64 cl_clientid; /* constant */
557 nfs4_verifier cl_confirm;
558 unsigned long cl_state;
559
560 u32 cl_lockowner_id;
561
562 /*
563 * The following rwsem ensures exclusive access to the server
564 * while we recover the state following a lease expiration.
565 */
566 struct rw_semaphore cl_sem;
567
568 struct list_head cl_delegations;
569 struct list_head cl_state_owners;
570 struct list_head cl_unused;
571 int cl_nunused;
572 spinlock_t cl_lock;
573 atomic_t cl_count;
574
575 struct rpc_clnt * cl_rpcclient;
576 struct rpc_cred * cl_cred;
577
578 struct list_head cl_superblocks; /* List of nfs_server structs */
579
580 unsigned long cl_lease_time;
581 unsigned long cl_last_renewal;
582 struct work_struct cl_renewd;
583 struct work_struct cl_recoverd;
584
585 wait_queue_head_t cl_waitq;
586 struct rpc_wait_queue cl_rpcwaitq;
587
588 /* used for the setclientid verifier */
589 struct timespec cl_boot_time;
590
591 /* idmapper */
592 struct idmap * cl_idmap;
593
594 /* Our own IP address, as a null-terminated string.
595 * This is used to generate the clientid, and the callback address.
596 */
597 char cl_ipaddr[16];
598 unsigned char cl_id_uniquifier;
599};
600
601/*
602 * NFS4 state_owners and lock_owners are simply labels for ordered
603 * sequences of RPC calls. Their sole purpose is to provide once-only
604 * semantics by allowing the server to identify replayed requests.
605 *
606 * The ->so_sema is held during all state_owner seqid-mutating operations:
607 * OPEN, OPEN_DOWNGRADE, and CLOSE. Its purpose is to properly serialize
608 * so_seqid.
609 */
610struct nfs4_state_owner {
611 struct list_head so_list; /* per-clientid list of state_owners */
612 struct nfs4_client *so_client;
613 u32 so_id; /* 32-bit identifier, unique */
614 struct semaphore so_sema;
615 u32 so_seqid; /* protected by so_sema */
616 atomic_t so_count;
617
618 struct rpc_cred *so_cred; /* Associated cred */
619 struct list_head so_states;
620 struct list_head so_delegations;
621};
622
623/*
624 * struct nfs4_state maintains the client-side state for a given
625 * (state_owner,inode) tuple (OPEN) or state_owner (LOCK).
626 *
627 * OPEN:
628 * In order to know when to OPEN_DOWNGRADE or CLOSE the state on the server,
629 * we need to know how many files are open for reading or writing on a
630 * given inode. This information too is stored here.
631 *
632 * LOCK: one nfs4_state (LOCK) to hold the lock stateid nfs4_state(OPEN)
633 */
634
635struct nfs4_lock_state {
636 struct list_head ls_locks; /* Other lock stateids */
637 fl_owner_t ls_owner; /* POSIX lock owner */
638#define NFS_LOCK_INITIALIZED 1
639 int ls_flags;
640 u32 ls_seqid;
641 u32 ls_id;
642 nfs4_stateid ls_stateid;
643 atomic_t ls_count;
644};
645
646/* bits for nfs4_state->flags */
647enum {
648 LK_STATE_IN_USE,
649 NFS_DELEGATED_STATE,
650};
651
652struct nfs4_state {
653 struct list_head open_states; /* List of states for the same state_owner */
654 struct list_head inode_states; /* List of states for the same inode */
655 struct list_head lock_states; /* List of subservient lock stateids */
656
657 struct nfs4_state_owner *owner; /* Pointer to the open owner */
658 struct inode *inode; /* Pointer to the inode */
659
660 unsigned long flags; /* Do we hold any locks? */
661 struct semaphore lock_sema; /* Serializes file locking operations */
662 rwlock_t state_lock; /* Protects the lock_states list */
663
664 nfs4_stateid stateid;
665
666 unsigned int nreaders;
667 unsigned int nwriters;
668 int state; /* State on the server (R,W, or RW) */
669 atomic_t count;
670};
671
672
673struct nfs4_exception {
674 long timeout;
675 int retry;
676};
677
678struct nfs4_state_recovery_ops {
679 int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *);
680 int (*recover_lock)(struct nfs4_state *, struct file_lock *);
681};
682
683extern struct dentry_operations nfs4_dentry_operations;
684extern struct inode_operations nfs4_dir_inode_operations;
685
686/* nfs4proc.c */
687extern int nfs4_map_errors(int err);
688extern int nfs4_proc_setclientid(struct nfs4_client *, u32, unsigned short);
689extern int nfs4_proc_setclientid_confirm(struct nfs4_client *);
690extern int nfs4_proc_async_renew(struct nfs4_client *);
691extern int nfs4_proc_renew(struct nfs4_client *);
692extern int nfs4_do_close(struct inode *inode, struct nfs4_state *state, mode_t mode);
693extern struct inode *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *);
694extern int nfs4_open_revalidate(struct inode *, struct dentry *, int);
695
696extern struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops;
697extern struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops;
698
699/* nfs4renewd.c */
700extern void nfs4_schedule_state_renewal(struct nfs4_client *);
701extern void nfs4_renewd_prepare_shutdown(struct nfs_server *);
702extern void nfs4_kill_renewd(struct nfs4_client *);
703
704/* nfs4state.c */
705extern void init_nfsv4_state(struct nfs_server *);
706extern void destroy_nfsv4_state(struct nfs_server *);
707extern struct nfs4_client *nfs4_get_client(struct in_addr *);
708extern void nfs4_put_client(struct nfs4_client *clp);
709extern int nfs4_init_client(struct nfs4_client *clp);
710extern struct nfs4_client *nfs4_find_client(struct in_addr *);
711extern u32 nfs4_alloc_lockowner_id(struct nfs4_client *);
712
713extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *);
714extern void nfs4_put_state_owner(struct nfs4_state_owner *);
715extern void nfs4_drop_state_owner(struct nfs4_state_owner *);
716extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *);
717extern void nfs4_put_open_state(struct nfs4_state *);
718extern void nfs4_close_state(struct nfs4_state *, mode_t);
719extern struct nfs4_state *nfs4_find_state(struct inode *, struct rpc_cred *, mode_t mode);
720extern void nfs4_increment_seqid(int status, struct nfs4_state_owner *sp);
721extern void nfs4_schedule_state_recovery(struct nfs4_client *);
722extern struct nfs4_lock_state *nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t);
723extern struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t);
724extern void nfs4_put_lock_state(struct nfs4_lock_state *state);
725extern void nfs4_increment_lock_seqid(int status, struct nfs4_lock_state *ls);
726extern void nfs4_notify_setlk(struct nfs4_state *, struct file_lock *, struct nfs4_lock_state *);
727extern void nfs4_notify_unlck(struct nfs4_state *, struct file_lock *, struct nfs4_lock_state *);
728extern void nfs4_copy_stateid(nfs4_stateid *, struct nfs4_state *, fl_owner_t);
729
730
731
732struct nfs4_mount_data;
733#else
734#define init_nfsv4_state(server) do { } while (0)
735#define destroy_nfsv4_state(server) do { } while (0)
736#define nfs4_put_state_owner(inode, owner) do { } while (0)
737#define nfs4_put_open_state(state) do { } while (0)
738#define nfs4_close_state(a, b) do { } while (0)
739#define nfs4_renewd_prepare_shutdown(server) do { } while (0)
740#endif
741
742#endif /* __KERNEL__ */ 554#endif /* __KERNEL__ */
743 555
744/* 556/*
diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h
index e9a749588a7b..e2c18dabff86 100644
--- a/include/linux/nfs_fs_i.h
+++ b/include/linux/nfs_fs_i.h
@@ -16,6 +16,11 @@ struct nfs_lock_info {
16 struct nlm_lockowner *owner; 16 struct nlm_lockowner *owner;
17}; 17};
18 18
19struct nfs4_lock_state;
20struct nfs4_lock_info {
21 struct nfs4_lock_state *owner;
22};
23
19/* 24/*
20 * Lock flag values 25 * Lock flag values
21 */ 26 */
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index fc51645d61ee..3d3a305488cf 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -10,6 +10,7 @@
10struct nfs_server { 10struct nfs_server {
11 struct rpc_clnt * client; /* RPC client handle */ 11 struct rpc_clnt * client; /* RPC client handle */
12 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */ 12 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */
13 struct rpc_clnt * client_acl; /* ACL RPC client handle */
13 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ 14 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */
14 struct backing_dev_info backing_dev_info; 15 struct backing_dev_info backing_dev_info;
15 int flags; /* various flags */ 16 int flags; /* various flags */
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index 0071428231f9..659c75438454 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -58,6 +58,7 @@ struct nfs_mount_data {
58#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ 58#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */
59#define NFS_MOUNT_NONLM 0x0200 /* 3 */ 59#define NFS_MOUNT_NONLM 0x0200 /* 3 */
60#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ 60#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */
61#define NFS_MOUNT_NOACL 0x0800 /* 4 */
61#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ 62#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */
62#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ 63#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */
63#define NFS_MOUNT_FLAGMASK 0xFFFF 64#define NFS_MOUNT_FLAGMASK 0xFFFF
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 39e4895bcdb4..da2e077b65e2 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -20,12 +20,19 @@
20#include <asm/atomic.h> 20#include <asm/atomic.h>
21 21
22/* 22/*
23 * Valid flags for the radix tree
24 */
25#define NFS_PAGE_TAG_DIRTY 0
26#define NFS_PAGE_TAG_WRITEBACK 1
27
28/*
23 * Valid flags for a dirty buffer 29 * Valid flags for a dirty buffer
24 */ 30 */
25#define PG_BUSY 0 31#define PG_BUSY 0
26#define PG_NEED_COMMIT 1 32#define PG_NEED_COMMIT 1
27#define PG_NEED_RESCHED 2 33#define PG_NEED_RESCHED 2
28 34
35struct nfs_inode;
29struct nfs_page { 36struct nfs_page {
30 struct list_head wb_list, /* Defines state of page: */ 37 struct list_head wb_list, /* Defines state of page: */
31 *wb_list_head; /* read/write/commit */ 38 *wb_list_head; /* read/write/commit */
@@ -54,14 +61,17 @@ extern void nfs_clear_request(struct nfs_page *req);
54extern void nfs_release_request(struct nfs_page *req); 61extern void nfs_release_request(struct nfs_page *req);
55 62
56 63
57extern void nfs_list_add_request(struct nfs_page *, struct list_head *); 64extern int nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst,
58 65 unsigned long idx_start, unsigned int npages);
59extern int nfs_scan_list(struct list_head *, struct list_head *, 66extern int nfs_scan_list(struct list_head *, struct list_head *,
60 unsigned long, unsigned int); 67 unsigned long, unsigned int);
61extern int nfs_coalesce_requests(struct list_head *, struct list_head *, 68extern int nfs_coalesce_requests(struct list_head *, struct list_head *,
62 unsigned int); 69 unsigned int);
63extern int nfs_wait_on_request(struct nfs_page *); 70extern int nfs_wait_on_request(struct nfs_page *);
64extern void nfs_unlock_request(struct nfs_page *req); 71extern void nfs_unlock_request(struct nfs_page *req);
72extern int nfs_set_page_writeback_locked(struct nfs_page *req);
73extern void nfs_clear_page_writeback(struct nfs_page *req);
74
65 75
66/* 76/*
67 * Lock the page of an asynchronous request without incrementing the wb_count 77 * Lock the page of an asynchronous request without incrementing the wb_count
@@ -86,6 +96,18 @@ nfs_lock_request(struct nfs_page *req)
86 return 1; 96 return 1;
87} 97}
88 98
99/**
100 * nfs_list_add_request - Insert a request into a list
101 * @req: request
102 * @head: head of list into which to insert the request.
103 */
104static inline void
105nfs_list_add_request(struct nfs_page *req, struct list_head *head)
106{
107 list_add_tail(&req->wb_list, head);
108 req->wb_list_head = head;
109}
110
89 111
90/** 112/**
91 * nfs_list_remove_request - Remove a request from its wb_list 113 * nfs_list_remove_request - Remove a request from its wb_list
@@ -96,10 +118,6 @@ nfs_list_remove_request(struct nfs_page *req)
96{ 118{
97 if (list_empty(&req->wb_list)) 119 if (list_empty(&req->wb_list))
98 return; 120 return;
99 if (!NFS_WBACK_BUSY(req)) {
100 printk(KERN_ERR "NFS: unlocked request attempted removed from list!\n");
101 BUG();
102 }
103 list_del_init(&req->wb_list); 121 list_del_init(&req->wb_list);
104 req->wb_list_head = NULL; 122 req->wb_list_head = NULL;
105} 123}
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 47037d9521cb..a2bf6914ff1b 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -2,6 +2,7 @@
2#define _LINUX_NFS_XDR_H 2#define _LINUX_NFS_XDR_H
3 3
4#include <linux/sunrpc/xprt.h> 4#include <linux/sunrpc/xprt.h>
5#include <linux/nfsacl.h>
5 6
6struct nfs4_fsid { 7struct nfs4_fsid {
7 __u64 major; 8 __u64 major;
@@ -326,6 +327,20 @@ struct nfs_setattrargs {
326 const u32 * bitmask; 327 const u32 * bitmask;
327}; 328};
328 329
330struct nfs_setaclargs {
331 struct nfs_fh * fh;
332 size_t acl_len;
333 unsigned int acl_pgbase;
334 struct page ** acl_pages;
335};
336
337struct nfs_getaclargs {
338 struct nfs_fh * fh;
339 size_t acl_len;
340 unsigned int acl_pgbase;
341 struct page ** acl_pages;
342};
343
329struct nfs_setattrres { 344struct nfs_setattrres {
330 struct nfs_fattr * fattr; 345 struct nfs_fattr * fattr;
331 const struct nfs_server * server; 346 const struct nfs_server * server;
@@ -354,6 +369,20 @@ struct nfs_readdirargs {
354 struct page ** pages; 369 struct page ** pages;
355}; 370};
356 371
372struct nfs3_getaclargs {
373 struct nfs_fh * fh;
374 int mask;
375 struct page ** pages;
376};
377
378struct nfs3_setaclargs {
379 struct inode * inode;
380 int mask;
381 struct posix_acl * acl_access;
382 struct posix_acl * acl_default;
383 struct page ** pages;
384};
385
357struct nfs_diropok { 386struct nfs_diropok {
358 struct nfs_fh * fh; 387 struct nfs_fh * fh;
359 struct nfs_fattr * fattr; 388 struct nfs_fattr * fattr;
@@ -477,6 +506,15 @@ struct nfs3_readdirres {
477 int plus; 506 int plus;
478}; 507};
479 508
509struct nfs3_getaclres {
510 struct nfs_fattr * fattr;
511 int mask;
512 unsigned int acl_access_count;
513 unsigned int acl_default_count;
514 struct posix_acl * acl_access;
515 struct posix_acl * acl_default;
516};
517
480#ifdef CONFIG_NFS_V4 518#ifdef CONFIG_NFS_V4
481 519
482typedef u64 clientid4; 520typedef u64 clientid4;
@@ -667,6 +705,7 @@ struct nfs_rpc_ops {
667 int version; /* Protocol version */ 705 int version; /* Protocol version */
668 struct dentry_operations *dentry_ops; 706 struct dentry_operations *dentry_ops;
669 struct inode_operations *dir_inode_ops; 707 struct inode_operations *dir_inode_ops;
708 struct inode_operations *file_inode_ops;
670 709
671 int (*getroot) (struct nfs_server *, struct nfs_fh *, 710 int (*getroot) (struct nfs_server *, struct nfs_fh *,
672 struct nfs_fsinfo *); 711 struct nfs_fsinfo *);
@@ -713,6 +752,7 @@ struct nfs_rpc_ops {
713 int (*file_open) (struct inode *, struct file *); 752 int (*file_open) (struct inode *, struct file *);
714 int (*file_release) (struct inode *, struct file *); 753 int (*file_release) (struct inode *, struct file *);
715 int (*lock)(struct file *, int, struct file_lock *); 754 int (*lock)(struct file *, int, struct file_lock *);
755 void (*clear_acl_cache)(struct inode *);
716}; 756};
717 757
718/* 758/*
@@ -732,4 +772,7 @@ extern struct rpc_version nfs_version2;
732extern struct rpc_version nfs_version3; 772extern struct rpc_version nfs_version3;
733extern struct rpc_version nfs_version4; 773extern struct rpc_version nfs_version4;
734 774
775extern struct rpc_version nfsacl_version3;
776extern struct rpc_program nfsacl_program;
777
735#endif 778#endif
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h
new file mode 100644
index 000000000000..54487a99beb8
--- /dev/null
+++ b/include/linux/nfsacl.h
@@ -0,0 +1,58 @@
1/*
2 * File: linux/nfsacl.h
3 *
4 * (C) 2003 Andreas Gruenbacher <agruen@suse.de>
5 */
6#ifndef __LINUX_NFSACL_H
7#define __LINUX_NFSACL_H
8
9#define NFS_ACL_PROGRAM 100227
10
11#define ACLPROC2_GETACL 1
12#define ACLPROC2_SETACL 2
13#define ACLPROC2_GETATTR 3
14#define ACLPROC2_ACCESS 4
15
16#define ACLPROC3_GETACL 1
17#define ACLPROC3_SETACL 2
18
19
20/* Flags for the getacl/setacl mode */
21#define NFS_ACL 0x0001
22#define NFS_ACLCNT 0x0002
23#define NFS_DFACL 0x0004
24#define NFS_DFACLCNT 0x0008
25
26/* Flag for Default ACL entries */
27#define NFS_ACL_DEFAULT 0x1000
28
29#ifdef __KERNEL__
30
31#include <linux/posix_acl.h>
32
33/* Maximum number of ACL entries over NFS */
34#define NFS_ACL_MAX_ENTRIES 1024
35
36#define NFSACL_MAXWORDS (2*(2+3*NFS_ACL_MAX_ENTRIES))
37#define NFSACL_MAXPAGES ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \
38 >> PAGE_SHIFT)
39
40static inline unsigned int
41nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default)
42{
43 unsigned int w = 16;
44 w += max(acl_access ? (int)acl_access->a_count : 3, 4) * 12;
45 if (acl_default)
46 w += max((int)acl_default->a_count, 4) * 12;
47 return w;
48}
49
50extern unsigned int
51nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode,
52 struct posix_acl *acl, int encode_entries, int typeflag);
53extern unsigned int
54nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt,
55 struct posix_acl **pacl);
56
57#endif /* __KERNEL__ */
58#endif /* __LINUX_NFSACL_H */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 8f85d9a59607..5791dfd30dd0 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -15,6 +15,7 @@
15#include <linux/unistd.h> 15#include <linux/unistd.h>
16#include <linux/dirent.h> 16#include <linux/dirent.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/posix_acl.h>
18#include <linux/mount.h> 19#include <linux/mount.h>
19 20
20#include <linux/nfsd/debug.h> 21#include <linux/nfsd/debug.h>
@@ -124,20 +125,39 @@ int nfsd_statfs(struct svc_rqst *, struct svc_fh *,
124int nfsd_notify_change(struct inode *, struct iattr *); 125int nfsd_notify_change(struct inode *, struct iattr *);
125int nfsd_permission(struct svc_export *, struct dentry *, int); 126int nfsd_permission(struct svc_export *, struct dentry *, int);
126 127
128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
129#ifdef CONFIG_NFSD_V2_ACL
130extern struct svc_version nfsd_acl_version2;
131#else
132#define nfsd_acl_version2 NULL
133#endif
134#ifdef CONFIG_NFSD_V3_ACL
135extern struct svc_version nfsd_acl_version3;
136#else
137#define nfsd_acl_version3 NULL
138#endif
139struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int);
140int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *);
141#endif
142
127 143
128/* 144/*
129 * NFSv4 State 145 * NFSv4 State
130 */ 146 */
131#ifdef CONFIG_NFSD_V4 147#ifdef CONFIG_NFSD_V4
132int nfs4_state_init(void); 148void nfs4_state_init(void);
149int nfs4_state_start(void);
133void nfs4_state_shutdown(void); 150void nfs4_state_shutdown(void);
134time_t nfs4_lease_time(void); 151time_t nfs4_lease_time(void);
135void nfs4_reset_lease(time_t leasetime); 152void nfs4_reset_lease(time_t leasetime);
153int nfs4_reset_recoverydir(char *recdir);
136#else 154#else
137static inline int nfs4_state_init(void){return 0;} 155static inline void nfs4_state_init(void){};
156static inline int nfs4_state_start(void){return 0;}
138static inline void nfs4_state_shutdown(void){} 157static inline void nfs4_state_shutdown(void){}
139static inline time_t nfs4_lease_time(void){return 0;} 158static inline time_t nfs4_lease_time(void){return 0;}
140static inline void nfs4_reset_lease(time_t leasetime){} 159static inline void nfs4_reset_lease(time_t leasetime){}
160static inline int nfs4_reset_recoverydir(char *recdir) {return 0;}
141#endif 161#endif
142 162
143/* 163/*
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index b6b2fe1e7c63..a84a3fa99be1 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -61,11 +61,6 @@ typedef struct {
61#define si_stateownerid si_opaque.so_stateownerid 61#define si_stateownerid si_opaque.so_stateownerid
62#define si_fileid si_opaque.so_fileid 62#define si_fileid si_opaque.so_fileid
63 63
64extern stateid_t zerostateid;
65extern stateid_t onestateid;
66
67#define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
68#define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
69 64
70struct nfs4_cb_recall { 65struct nfs4_cb_recall {
71 u32 cbr_ident; 66 u32 cbr_ident;
@@ -77,8 +72,8 @@ struct nfs4_cb_recall {
77}; 72};
78 73
79struct nfs4_delegation { 74struct nfs4_delegation {
80 struct list_head dl_del_perfile; /* nfs4_file->fi_del_perfile */ 75 struct list_head dl_perfile;
81 struct list_head dl_del_perclnt; /* nfs4_client->cl_del_perclnt*/ 76 struct list_head dl_perclnt;
82 struct list_head dl_recall_lru; /* delegation recalled */ 77 struct list_head dl_recall_lru; /* delegation recalled */
83 atomic_t dl_count; /* ref count */ 78 atomic_t dl_count; /* ref count */
84 struct nfs4_client *dl_client; 79 struct nfs4_client *dl_client;
@@ -97,7 +92,6 @@ struct nfs4_delegation {
97/* client delegation callback info */ 92/* client delegation callback info */
98struct nfs4_callback { 93struct nfs4_callback {
99 /* SETCLIENTID info */ 94 /* SETCLIENTID info */
100 u32 cb_parsed; /* addr parsed */
101 u32 cb_addr; 95 u32 cb_addr;
102 unsigned short cb_port; 96 unsigned short cb_port;
103 u32 cb_prog; 97 u32 cb_prog;
@@ -109,6 +103,8 @@ struct nfs4_callback {
109 struct rpc_clnt * cb_client; 103 struct rpc_clnt * cb_client;
110}; 104};
111 105
106#define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */
107
112/* 108/*
113 * struct nfs4_client - one per client. Clientids live here. 109 * struct nfs4_client - one per client. Clientids live here.
114 * o Each nfs4_client is hashed by clientid. 110 * o Each nfs4_client is hashed by clientid.
@@ -122,10 +118,11 @@ struct nfs4_callback {
122struct nfs4_client { 118struct nfs4_client {
123 struct list_head cl_idhash; /* hash by cl_clientid.id */ 119 struct list_head cl_idhash; /* hash by cl_clientid.id */
124 struct list_head cl_strhash; /* hash by cl_name */ 120 struct list_head cl_strhash; /* hash by cl_name */
125 struct list_head cl_perclient; /* list: stateowners */ 121 struct list_head cl_openowners;
126 struct list_head cl_del_perclnt; /* list: delegations */ 122 struct list_head cl_delegations;
127 struct list_head cl_lru; /* tail queue */ 123 struct list_head cl_lru; /* tail queue */
128 struct xdr_netobj cl_name; /* id generated by client */ 124 struct xdr_netobj cl_name; /* id generated by client */
125 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
129 nfs4_verifier cl_verifier; /* generated by client */ 126 nfs4_verifier cl_verifier; /* generated by client */
130 time_t cl_time; /* time of last lease renewal */ 127 time_t cl_time; /* time of last lease renewal */
131 u32 cl_addr; /* client ipaddress */ 128 u32 cl_addr; /* client ipaddress */
@@ -134,6 +131,7 @@ struct nfs4_client {
134 nfs4_verifier cl_confirm; /* generated by server */ 131 nfs4_verifier cl_confirm; /* generated by server */
135 struct nfs4_callback cl_callback; /* callback info */ 132 struct nfs4_callback cl_callback; /* callback info */
136 atomic_t cl_count; /* ref count */ 133 atomic_t cl_count; /* ref count */
134 u32 cl_firststate; /* recovery dir creation */
137}; 135};
138 136
139/* struct nfs4_client_reset 137/* struct nfs4_client_reset
@@ -143,7 +141,7 @@ struct nfs4_client {
143 */ 141 */
144struct nfs4_client_reclaim { 142struct nfs4_client_reclaim {
145 struct list_head cr_strhash; /* hash by cr_name */ 143 struct list_head cr_strhash; /* hash by cr_name */
146 struct xdr_netobj cr_name; /* id generated by client */ 144 char cr_recdir[HEXDIR_LEN]; /* recover dir */
147}; 145};
148 146
149static inline void 147static inline void
@@ -197,9 +195,9 @@ struct nfs4_stateowner {
197 struct kref so_ref; 195 struct kref so_ref;
198 struct list_head so_idhash; /* hash by so_id */ 196 struct list_head so_idhash; /* hash by so_id */
199 struct list_head so_strhash; /* hash by op_name */ 197 struct list_head so_strhash; /* hash by op_name */
200 struct list_head so_perclient; /* nfs4_client->cl_perclient */ 198 struct list_head so_perclient;
201 struct list_head so_perfilestate; /* list: nfs4_stateid */ 199 struct list_head so_stateids;
202 struct list_head so_perlockowner; /* nfs4_stateid->st_perlockowner */ 200 struct list_head so_perstateid; /* for lockowners only */
203 struct list_head so_close_lru; /* tail queue */ 201 struct list_head so_close_lru; /* tail queue */
204 time_t so_time; /* time of placement on so_close_lru */ 202 time_t so_time; /* time of placement on so_close_lru */
205 int so_is_open_owner; /* 1=openowner,0=lockowner */ 203 int so_is_open_owner; /* 1=openowner,0=lockowner */
@@ -217,9 +215,10 @@ struct nfs4_stateowner {
217* share_acces, share_deny on the file. 215* share_acces, share_deny on the file.
218*/ 216*/
219struct nfs4_file { 217struct nfs4_file {
218 struct kref fi_ref;
220 struct list_head fi_hash; /* hash by "struct inode *" */ 219 struct list_head fi_hash; /* hash by "struct inode *" */
221 struct list_head fi_perfile; /* list: nfs4_stateid */ 220 struct list_head fi_stateids;
222 struct list_head fi_del_perfile; /* list: nfs4_delegation */ 221 struct list_head fi_delegations;
223 struct inode *fi_inode; 222 struct inode *fi_inode;
224 u32 fi_id; /* used with stateowner->so_id 223 u32 fi_id; /* used with stateowner->so_id
225 * for stateid_hashtbl hash */ 224 * for stateid_hashtbl hash */
@@ -241,8 +240,8 @@ struct nfs4_file {
241struct nfs4_stateid { 240struct nfs4_stateid {
242 struct list_head st_hash; 241 struct list_head st_hash;
243 struct list_head st_perfile; 242 struct list_head st_perfile;
244 struct list_head st_perfilestate; 243 struct list_head st_perstateowner;
245 struct list_head st_perlockowner; 244 struct list_head st_lockowners;
246 struct nfs4_stateowner * st_stateowner; 245 struct nfs4_stateowner * st_stateowner;
247 struct nfs4_file * st_file; 246 struct nfs4_file * st_file;
248 stateid_t st_stateid; 247 stateid_t st_stateid;
@@ -267,12 +266,9 @@ struct nfs4_stateid {
267 ((err) != nfserr_stale_stateid) && \ 266 ((err) != nfserr_stale_stateid) && \
268 ((err) != nfserr_bad_stateid)) 267 ((err) != nfserr_bad_stateid))
269 268
270extern time_t nfs4_laundromat(void);
271extern int nfsd4_renew(clientid_t *clid); 269extern int nfsd4_renew(clientid_t *clid);
272extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, 270extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh,
273 stateid_t *stateid, int flags, struct file **filp); 271 stateid_t *stateid, int flags, struct file **filp);
274extern int nfs4_share_conflict(struct svc_fh *current_fh,
275 unsigned int deny_type);
276extern void nfs4_lock_state(void); 272extern void nfs4_lock_state(void);
277extern void nfs4_unlock_state(void); 273extern void nfs4_unlock_state(void);
278extern int nfs4_in_grace(void); 274extern int nfs4_in_grace(void);
@@ -282,6 +278,15 @@ extern void nfs4_free_stateowner(struct kref *kref);
282extern void nfsd4_probe_callback(struct nfs4_client *clp); 278extern void nfsd4_probe_callback(struct nfs4_client *clp);
283extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 279extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
284extern void nfs4_put_delegation(struct nfs4_delegation *dp); 280extern void nfs4_put_delegation(struct nfs4_delegation *dp);
281extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
282extern void nfsd4_init_recdir(char *recdir_name);
283extern int nfsd4_recdir_load(void);
284extern void nfsd4_shutdown_recdir(void);
285extern int nfs4_client_to_reclaim(const char *name);
286extern int nfs4_has_reclaimed_state(const char *name);
287extern void nfsd4_recdir_purge_old(void);
288extern int nfsd4_create_clid_dir(struct nfs4_client *clp);
289extern void nfsd4_remove_clid_dir(struct nfs4_client *clp);
285 290
286static inline void 291static inline void
287nfs4_put_stateowner(struct nfs4_stateowner *so) 292nfs4_put_stateowner(struct nfs4_stateowner *so)
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index ecccef777dae..130d4f588a37 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -169,4 +169,8 @@ int nfssvc_encode_entry(struct readdir_cd *, const char *name,
169 169
170int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 170int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
171 171
172/* Helper functions for NFSv2 ACL code */
173u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp);
174u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp);
175
172#endif /* LINUX_NFSD_H */ 176#endif /* LINUX_NFSD_H */
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 0ae9e0ef5f68..21e18ce7ca63 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -110,6 +110,19 @@ struct nfsd3_commitargs {
110 __u32 count; 110 __u32 count;
111}; 111};
112 112
113struct nfsd3_getaclargs {
114 struct svc_fh fh;
115 int mask;
116};
117
118struct posix_acl;
119struct nfsd3_setaclargs {
120 struct svc_fh fh;
121 int mask;
122 struct posix_acl *acl_access;
123 struct posix_acl *acl_default;
124};
125
113struct nfsd3_attrstat { 126struct nfsd3_attrstat {
114 __u32 status; 127 __u32 status;
115 struct svc_fh fh; 128 struct svc_fh fh;
@@ -209,6 +222,14 @@ struct nfsd3_commitres {
209 struct svc_fh fh; 222 struct svc_fh fh;
210}; 223};
211 224
225struct nfsd3_getaclres {
226 __u32 status;
227 struct svc_fh fh;
228 int mask;
229 struct posix_acl *acl_access;
230 struct posix_acl *acl_default;
231};
232
212/* dummy type for release */ 233/* dummy type for release */
213struct nfsd3_fhandle_pair { 234struct nfsd3_fhandle_pair {
214 __u32 dummy; 235 __u32 dummy;
@@ -241,6 +262,7 @@ union nfsd3_xdrstore {
241 struct nfsd3_fsinfores fsinfores; 262 struct nfsd3_fsinfores fsinfores;
242 struct nfsd3_pathconfres pathconfres; 263 struct nfsd3_pathconfres pathconfres;
243 struct nfsd3_commitres commitres; 264 struct nfsd3_commitres commitres;
265 struct nfsd3_getaclres getaclres;
244}; 266};
245 267
246#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) 268#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
@@ -316,6 +338,10 @@ int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
316int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, 338int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
317 int namlen, loff_t offset, ino_t ino, 339 int namlen, loff_t offset, ino_t ino,
318 unsigned int); 340 unsigned int);
341/* Helper functions for NFSv3 ACL code */
342u32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p,
343 struct svc_fh *fhp);
344u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp);
319 345
320 346
321#endif /* _LINUX_NFSD_XDR3_H */ 347#endif /* _LINUX_NFSD_XDR3_H */
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index a1f5ad0be1bf..4d24d65c0e88 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -210,6 +210,7 @@ struct nfsd4_open {
210 u32 op_share_access; /* request */ 210 u32 op_share_access; /* request */
211 u32 op_share_deny; /* request */ 211 u32 op_share_deny; /* request */
212 stateid_t op_stateid; /* response */ 212 stateid_t op_stateid; /* response */
213 u32 op_recall; /* recall */
213 struct nfsd4_change_info op_cinfo; /* response */ 214 struct nfsd4_change_info op_cinfo; /* response */
214 u32 op_rflags; /* response */ 215 u32 op_rflags; /* response */
215 int op_truncate; /* used during processing */ 216 int op_truncate; /* used during processing */
diff --git a/include/linux/nfsd_idmap.h b/include/linux/nfsd_idmap.h
index 9bb7f30e923b..e82746fcad14 100644
--- a/include/linux/nfsd_idmap.h
+++ b/include/linux/nfsd_idmap.h
@@ -43,8 +43,13 @@
43/* XXX from linux/nfs_idmap.h */ 43/* XXX from linux/nfs_idmap.h */
44#define IDMAP_NAMESZ 128 44#define IDMAP_NAMESZ 128
45 45
46#ifdef CONFIG_NFSD_V4
46void nfsd_idmap_init(void); 47void nfsd_idmap_init(void);
47void nfsd_idmap_shutdown(void); 48void nfsd_idmap_shutdown(void);
49#else
50static inline void nfsd_idmap_init(void) {};
51static inline void nfsd_idmap_shutdown(void) {};
52#endif
48 53
49int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); 54int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *);
50int nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *); 55int nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *);
diff --git a/include/linux/node.h b/include/linux/node.h
index 6e0a697e594e..254dc3de650b 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -27,6 +27,7 @@ struct node {
27}; 27};
28 28
29extern int register_node(struct node *, int, struct node *); 29extern int register_node(struct node *, int, struct node *);
30extern void unregister_node(struct node *node);
30 31
31#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 32#define to_node(sys_device) container_of(sys_device, struct node, sysdev)
32 33
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 9303a003e9ab..5937dd6053c3 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -56,6 +56,7 @@ extern int notifier_call_chain(struct notifier_block **n, unsigned long val, voi
56#define NETDEV_CHANGEADDR 0x0008 56#define NETDEV_CHANGEADDR 0x0008
57#define NETDEV_GOING_DOWN 0x0009 57#define NETDEV_GOING_DOWN 0x0009
58#define NETDEV_CHANGENAME 0x000A 58#define NETDEV_CHANGENAME 0x000A
59#define NETDEV_FEAT_CHANGE 0x000B
59 60
60#define SYS_DOWN 0x0001 /* Notify of system down */ 61#define SYS_DOWN 0x0001 /* Notify of system down */
61#define SYS_RESTART SYS_DOWN 62#define SYS_RESTART SYS_DOWN
diff --git a/include/linux/numa.h b/include/linux/numa.h
index bd0c8c4e9a95..f0c539bd3cfc 100644
--- a/include/linux/numa.h
+++ b/include/linux/numa.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#ifdef CONFIG_DISCONTIGMEM 6#ifndef CONFIG_FLATMEM
7#include <asm/numnodes.h> 7#include <asm/numnodes.h>
8#endif 8#endif
9 9
diff --git a/include/linux/nvram.h b/include/linux/nvram.h
index b031e41b5e0d..9189829c131c 100644
--- a/include/linux/nvram.h
+++ b/include/linux/nvram.h
@@ -20,8 +20,6 @@ extern void __nvram_write_byte(unsigned char c, int i);
20extern void nvram_write_byte(unsigned char c, int i); 20extern void nvram_write_byte(unsigned char c, int i);
21extern int __nvram_check_checksum(void); 21extern int __nvram_check_checksum(void);
22extern int nvram_check_checksum(void); 22extern int nvram_check_checksum(void);
23extern void __nvram_set_checksum(void);
24extern void nvram_set_checksum(void);
25#endif 23#endif
26 24
27#endif /* _LINUX_NVRAM_H */ 25#endif /* _LINUX_NVRAM_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 39ab8c6b5652..f5a6695d4d21 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -61,21 +61,20 @@
61#define PG_active 6 61#define PG_active 6
62#define PG_slab 7 /* slab debug (Suparna wants this) */ 62#define PG_slab 7 /* slab debug (Suparna wants this) */
63 63
64#define PG_highmem 8 64#define PG_checked 8 /* kill me in 2.5.<early>. */
65#define PG_checked 9 /* kill me in 2.5.<early>. */ 65#define PG_arch_1 9
66#define PG_arch_1 10 66#define PG_reserved 10
67#define PG_reserved 11 67#define PG_private 11 /* Has something at ->private */
68 68
69#define PG_private 12 /* Has something at ->private */ 69#define PG_writeback 12 /* Page is under writeback */
70#define PG_writeback 13 /* Page is under writeback */ 70#define PG_nosave 13 /* Used for system suspend/resume */
71#define PG_nosave 14 /* Used for system suspend/resume */ 71#define PG_compound 14 /* Part of a compound page */
72#define PG_compound 15 /* Part of a compound page */ 72#define PG_swapcache 15 /* Swap page: swp_entry_t in private */
73 73
74#define PG_swapcache 16 /* Swap page: swp_entry_t in private */ 74#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */
75#define PG_mappedtodisk 17 /* Has blocks allocated on-disk */ 75#define PG_reclaim 17 /* To be reclaimed asap */
76#define PG_reclaim 18 /* To be reclaimed asap */ 76#define PG_nosave_free 18 /* Free, should not be written */
77#define PG_nosave_free 19 /* Free, should not be written */ 77#define PG_uncached 19 /* Page has been mapped as uncached */
78#define PG_uncached 20 /* Page has been mapped as uncached */
79 78
80/* 79/*
81 * Global page accounting. One instance per CPU. Only unsigned longs are 80 * Global page accounting. One instance per CPU. Only unsigned longs are
@@ -136,8 +135,8 @@ struct page_state {
136 135
137extern void get_page_state(struct page_state *ret); 136extern void get_page_state(struct page_state *ret);
138extern void get_full_page_state(struct page_state *ret); 137extern void get_full_page_state(struct page_state *ret);
139extern unsigned long __read_page_state(unsigned offset); 138extern unsigned long __read_page_state(unsigned long offset);
140extern void __mod_page_state(unsigned offset, unsigned long delta); 139extern void __mod_page_state(unsigned long offset, unsigned long delta);
141 140
142#define read_page_state(member) \ 141#define read_page_state(member) \
143 __read_page_state(offsetof(struct page_state, member)) 142 __read_page_state(offsetof(struct page_state, member))
@@ -215,7 +214,7 @@ extern void __mod_page_state(unsigned offset, unsigned long delta);
215#define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags) 214#define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags)
216 215
217#ifdef CONFIG_HIGHMEM 216#ifdef CONFIG_HIGHMEM
218#define PageHighMem(page) test_bit(PG_highmem, &(page)->flags) 217#define PageHighMem(page) is_highmem(page_zone(page))
219#else 218#else
220#define PageHighMem(page) 0 /* needed to optimize away at compile time */ 219#define PageHighMem(page) 0 /* needed to optimize away at compile time */
221#endif 220#endif
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 0422031161ba..d9a25647a295 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -52,12 +52,12 @@ void release_pages(struct page **pages, int nr, int cold);
52 52
53static inline struct page *page_cache_alloc(struct address_space *x) 53static inline struct page *page_cache_alloc(struct address_space *x)
54{ 54{
55 return alloc_pages(mapping_gfp_mask(x), 0); 55 return alloc_pages(mapping_gfp_mask(x)|__GFP_NORECLAIM, 0);
56} 56}
57 57
58static inline struct page *page_cache_alloc_cold(struct address_space *x) 58static inline struct page *page_cache_alloc_cold(struct address_space *x)
59{ 59{
60 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0); 60 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD|__GFP_NORECLAIM, 0);
61} 61}
62 62
63typedef int filler_t(void *, struct page *); 63typedef int filler_t(void *, struct page *);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index ae27792b5aa4..bf608808a60c 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -575,6 +575,7 @@
575#define PCI_DEVICE_ID_CT_65550 0x00e0 575#define PCI_DEVICE_ID_CT_65550 0x00e0
576#define PCI_DEVICE_ID_CT_65554 0x00e4 576#define PCI_DEVICE_ID_CT_65554 0x00e4
577#define PCI_DEVICE_ID_CT_65555 0x00e5 577#define PCI_DEVICE_ID_CT_65555 0x00e5
578#define PCI_DEVICE_ID_CT_69000 0x00c0
578 579
579#define PCI_VENDOR_ID_MIRO 0x1031 580#define PCI_VENDOR_ID_MIRO 0x1031
580#define PCI_DEVICE_ID_MIRO_36050 0x5601 581#define PCI_DEVICE_ID_MIRO_36050 0x5601
@@ -874,6 +875,7 @@
874#define PCI_DEVICE_ID_APPLE_KL_USB_P 0x0026 875#define PCI_DEVICE_ID_APPLE_KL_USB_P 0x0026
875#define PCI_DEVICE_ID_APPLE_UNI_N_AGP_P 0x0027 876#define PCI_DEVICE_ID_APPLE_UNI_N_AGP_P 0x0027
876#define PCI_DEVICE_ID_APPLE_UNI_N_AGP15 0x002d 877#define PCI_DEVICE_ID_APPLE_UNI_N_AGP15 0x002d
878#define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e
877#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 879#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030
878#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 880#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032
879#define PCI_DEVIEC_ID_APPLE_UNI_N_ATA 0x0033 881#define PCI_DEVIEC_ID_APPLE_UNI_N_ATA 0x0033
@@ -1230,6 +1232,12 @@
1230#define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258 1232#define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258
1231#define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259 1233#define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259
1232#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B 1234#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B
1235#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265
1236#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
1237#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267
1238#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268
1239#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269
1240#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B
1233#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280 1241#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280
1234#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281 1242#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281
1235#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282 1243#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282
@@ -1560,6 +1568,7 @@
1560#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 1568#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220
1561#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB 1569#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB
1562#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221 1570#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221
1571#define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227
1563#define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225 1572#define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225
1564#define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227 1573#define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227
1565#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 1574#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230
@@ -2064,12 +2073,14 @@
2064 2073
2065#define PCI_VENDOR_ID_BROADCOM 0x14e4 2074#define PCI_VENDOR_ID_BROADCOM 0x14e4
2066#define PCI_DEVICE_ID_TIGON3_5752 0x1600 2075#define PCI_DEVICE_ID_TIGON3_5752 0x1600
2076#define PCI_DEVICE_ID_TIGON3_5752M 0x1601
2067#define PCI_DEVICE_ID_TIGON3_5700 0x1644 2077#define PCI_DEVICE_ID_TIGON3_5700 0x1644
2068#define PCI_DEVICE_ID_TIGON3_5701 0x1645 2078#define PCI_DEVICE_ID_TIGON3_5701 0x1645
2069#define PCI_DEVICE_ID_TIGON3_5702 0x1646 2079#define PCI_DEVICE_ID_TIGON3_5702 0x1646
2070#define PCI_DEVICE_ID_TIGON3_5703 0x1647 2080#define PCI_DEVICE_ID_TIGON3_5703 0x1647
2071#define PCI_DEVICE_ID_TIGON3_5704 0x1648 2081#define PCI_DEVICE_ID_TIGON3_5704 0x1648
2072#define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649 2082#define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649
2083#define PCI_DEVICE_ID_NX2_5706 0x164a
2073#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d 2084#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d
2074#define PCI_DEVICE_ID_TIGON3_5705 0x1653 2085#define PCI_DEVICE_ID_TIGON3_5705 0x1653
2075#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 2086#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
@@ -2089,6 +2100,7 @@
2089#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 2100#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6
2090#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 2101#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7
2091#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 2102#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8
2103#define PCI_DEVICE_ID_NX2_5706S 0x16aa
2092#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 2104#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6
2093#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 2105#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7
2094#define PCI_DEVICE_ID_TIGON3_5781 0x16dd 2106#define PCI_DEVICE_ID_TIGON3_5781 0x16dd
@@ -2373,6 +2385,8 @@
2373#define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582 2385#define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582
2374#define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590 2386#define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590
2375#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 2387#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592
2388#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770
2389#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772
2376#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640 2390#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640
2377#define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641 2391#define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641
2378#define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642 2392#define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index e6b519220245..724066778aff 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -245,6 +245,7 @@ struct sadb_x_nat_t_port {
245 245
246/* Security Association flags */ 246/* Security Association flags */
247#define SADB_SAFLAGS_PFS 1 247#define SADB_SAFLAGS_PFS 1
248#define SADB_SAFLAGS_NOPMTUDISC 0x20000000
248#define SADB_SAFLAGS_DECAP_DSCP 0x40000000 249#define SADB_SAFLAGS_DECAP_DSCP 0x40000000
249#define SADB_SAFLAGS_NOECN 0x80000000 250#define SADB_SAFLAGS_NOECN 0x80000000
250 251
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index d2aa214d6803..25d2d67c1faf 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -408,6 +408,7 @@ enum
408 TCF_EM_NBYTE, 408 TCF_EM_NBYTE,
409 TCF_EM_U32, 409 TCF_EM_U32,
410 TCF_EM_META, 410 TCF_EM_META,
411 TCF_EM_TEXT,
411 __TCF_EM_MAX 412 __TCF_EM_MAX
412}; 413};
413 414
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 73d84c071cb1..1d9da36eb9db 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -427,6 +427,7 @@ enum
427 TCA_NETEM_UNSPEC, 427 TCA_NETEM_UNSPEC,
428 TCA_NETEM_CORR, 428 TCA_NETEM_CORR,
429 TCA_NETEM_DELAY_DIST, 429 TCA_NETEM_DELAY_DIST,
430 TCA_NETEM_REORDER,
430 __TCA_NETEM_MAX, 431 __TCA_NETEM_MAX,
431}; 432};
432 433
@@ -437,7 +438,7 @@ struct tc_netem_qopt
437 __u32 latency; /* added delay (us) */ 438 __u32 latency; /* added delay (us) */
438 __u32 limit; /* fifo limit (packets) */ 439 __u32 limit; /* fifo limit (packets) */
439 __u32 loss; /* random packet loss (0=none ~0=100%) */ 440 __u32 loss; /* random packet loss (0=none ~0=100%) */
440 __u32 gap; /* re-ordering gap (0 for delay all) */ 441 __u32 gap; /* re-ordering gap (0 for none) */
441 __u32 duplicate; /* random packet dup (0=none ~0=100%) */ 442 __u32 duplicate; /* random packet dup (0=none ~0=100%) */
442 __u32 jitter; /* random jitter in latency (us) */ 443 __u32 jitter; /* random jitter in latency (us) */
443}; 444};
@@ -449,6 +450,12 @@ struct tc_netem_corr
449 __u32 dup_corr; /* duplicate correlation */ 450 __u32 dup_corr; /* duplicate correlation */
450}; 451};
451 452
453struct tc_netem_reorder
454{
455 __u32 probability;
456 __u32 correlation;
457};
458
452#define NETEM_DIST_SCALE 8192 459#define NETEM_DIST_SCALE 8192
453 460
454#endif 461#endif
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index 4e2d2a942ecb..4b32bce9a289 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -159,7 +159,7 @@ struct packet_iosched
159 struct bio *read_queue_tail; 159 struct bio *read_queue_tail;
160 struct bio *write_queue; 160 struct bio *write_queue;
161 struct bio *write_queue_tail; 161 struct bio *write_queue_tail;
162 int high_prio_read; /* An important read request has been queued */ 162 sector_t last_write; /* The sector where the last write ended */
163 int successive_reads; 163 int successive_reads;
164}; 164};
165 165
diff --git a/include/linux/pm.h b/include/linux/pm.h
index ed2b76e75199..14479325e3f3 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -103,7 +103,8 @@ extern int pm_active;
103/* 103/*
104 * Register a device with power management 104 * Register a device with power management
105 */ 105 */
106struct pm_dev __deprecated *pm_register(pm_dev_t type, unsigned long id, pm_callback callback); 106struct pm_dev __deprecated *
107pm_register(pm_dev_t type, unsigned long id, pm_callback callback);
107 108
108/* 109/*
109 * Unregister a device with power management 110 * Unregister a device with power management
@@ -190,17 +191,18 @@ typedef u32 __bitwise pm_message_t;
190/* 191/*
191 * There are 4 important states driver can be in: 192 * There are 4 important states driver can be in:
192 * ON -- driver is working 193 * ON -- driver is working
193 * FREEZE -- stop operations and apply whatever policy is applicable to a suspended driver 194 * FREEZE -- stop operations and apply whatever policy is applicable to a
194 * of that class, freeze queues for block like IDE does, drop packets for 195 * suspended driver of that class, freeze queues for block like IDE
195 * ethernet, etc... stop DMA engine too etc... so a consistent image can be 196 * does, drop packets for ethernet, etc... stop DMA engine too etc...
196 * saved; but do not power any hardware down. 197 * so a consistent image can be saved; but do not power any hardware
197 * SUSPEND - like FREEZE, but hardware is doing as much powersaving as possible. Roughly 198 * down.
198 * pci D3. 199 * SUSPEND - like FREEZE, but hardware is doing as much powersaving as
200 * possible. Roughly pci D3.
199 * 201 *
200 * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3 (SUSPEND). 202 * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3
201 * We'll need to fix the drivers. So yes, putting 3 to all diferent defines is intentional, 203 * (SUSPEND). We'll need to fix the drivers. So yes, putting 3 to all different
202 * and will go away as soon as drivers are fixed. Also note that typedef is neccessary, 204 * defines is intentional, and will go away as soon as drivers are fixed. Also
203 * we'll probably want to switch to 205 * note that typedef is neccessary, we'll probably want to switch to
204 * typedef struct pm_message_t { int event; int flags; } pm_message_t 206 * typedef struct pm_message_t { int event; int flags; } pm_message_t
205 * or something similar soon. 207 * or something similar soon.
206 */ 208 */
@@ -222,11 +224,18 @@ struct dev_pm_info {
222 224
223extern void device_pm_set_parent(struct device * dev, struct device * parent); 225extern void device_pm_set_parent(struct device * dev, struct device * parent);
224 226
225extern int device_suspend(pm_message_t state);
226extern int device_power_down(pm_message_t state); 227extern int device_power_down(pm_message_t state);
227extern void device_power_up(void); 228extern void device_power_up(void);
228extern void device_resume(void); 229extern void device_resume(void);
229 230
231#ifdef CONFIG_PM
232extern int device_suspend(pm_message_t state);
233#else
234static inline int device_suspend(pm_message_t state)
235{
236 return 0;
237}
238#endif
230 239
231#endif /* __KERNEL__ */ 240#endif /* __KERNEL__ */
232 241
diff --git a/include/linux/posix_acl_xattr.h b/include/linux/posix_acl_xattr.h
index 5efd0a6dad94..6e53c34035cd 100644
--- a/include/linux/posix_acl_xattr.h
+++ b/include/linux/posix_acl_xattr.h
@@ -23,13 +23,13 @@
23#define ACL_UNDEFINED_ID (-1) 23#define ACL_UNDEFINED_ID (-1)
24 24
25typedef struct { 25typedef struct {
26 __u16 e_tag; 26 __le16 e_tag;
27 __u16 e_perm; 27 __le16 e_perm;
28 __u32 e_id; 28 __le32 e_id;
29} posix_acl_xattr_entry; 29} posix_acl_xattr_entry;
30 30
31typedef struct { 31typedef struct {
32 __u32 a_version; 32 __le32 a_version;
33 posix_acl_xattr_entry a_entries[0]; 33 posix_acl_xattr_entry a_entries[0];
34} posix_acl_xattr_header; 34} posix_acl_xattr_header;
35 35
@@ -52,4 +52,7 @@ posix_acl_xattr_count(size_t size)
52 return size / sizeof(posix_acl_xattr_entry); 52 return size / sizeof(posix_acl_xattr_entry);
53} 53}
54 54
55struct posix_acl *posix_acl_from_xattr(const void *value, size_t size);
56int posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size);
57
55#endif /* _POSIX_ACL_XATTR_H */ 58#endif /* _POSIX_ACL_XATTR_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 59e505261fd6..0563581e3a02 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -74,6 +74,13 @@ struct kcore_list {
74 size_t size; 74 size_t size;
75}; 75};
76 76
77struct vmcore {
78 struct list_head list;
79 unsigned long long paddr;
80 unsigned long size;
81 loff_t offset;
82};
83
77#ifdef CONFIG_PROC_FS 84#ifdef CONFIG_PROC_FS
78 85
79extern struct proc_dir_entry proc_root; 86extern struct proc_dir_entry proc_root;
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 22ba580b0ae8..fc610bb0f733 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -46,11 +46,11 @@ struct qnx4_inode_entry {
46 char di_fname[QNX4_SHORT_NAME_MAX]; 46 char di_fname[QNX4_SHORT_NAME_MAX];
47 qnx4_off_t di_size; 47 qnx4_off_t di_size;
48 qnx4_xtnt_t di_first_xtnt; 48 qnx4_xtnt_t di_first_xtnt;
49 __u32 di_xblk; 49 __le32 di_xblk;
50 __s32 di_ftime; 50 __le32 di_ftime;
51 __s32 di_mtime; 51 __le32 di_mtime;
52 __s32 di_atime; 52 __le32 di_atime;
53 __s32 di_ctime; 53 __le32 di_ctime;
54 qnx4_nxtnt_t di_num_xtnts; 54 qnx4_nxtnt_t di_num_xtnts;
55 qnx4_mode_t di_mode; 55 qnx4_mode_t di_mode;
56 qnx4_muid_t di_uid; 56 qnx4_muid_t di_uid;
@@ -63,18 +63,18 @@ struct qnx4_inode_entry {
63 63
64struct qnx4_link_info { 64struct qnx4_link_info {
65 char dl_fname[QNX4_NAME_MAX]; 65 char dl_fname[QNX4_NAME_MAX];
66 __u32 dl_inode_blk; 66 __le32 dl_inode_blk;
67 __u8 dl_inode_ndx; 67 __u8 dl_inode_ndx;
68 __u8 dl_spare[10]; 68 __u8 dl_spare[10];
69 __u8 dl_status; 69 __u8 dl_status;
70}; 70};
71 71
72struct qnx4_xblk { 72struct qnx4_xblk {
73 __u32 xblk_next_xblk; 73 __le32 xblk_next_xblk;
74 __u32 xblk_prev_xblk; 74 __le32 xblk_prev_xblk;
75 __u8 xblk_num_xtnts; 75 __u8 xblk_num_xtnts;
76 __u8 xblk_spare[3]; 76 __u8 xblk_spare[3];
77 __s32 xblk_num_blocks; 77 __le32 xblk_num_blocks;
78 qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK]; 78 qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK];
79 char xblk_signature[8]; 79 char xblk_signature[8];
80 qnx4_xtnt_t xblk_first_xtnt; 80 qnx4_xtnt_t xblk_first_xtnt;
diff --git a/include/linux/qnxtypes.h b/include/linux/qnxtypes.h
index fb518e318c7c..a3eb1137857b 100644
--- a/include/linux/qnxtypes.h
+++ b/include/linux/qnxtypes.h
@@ -12,18 +12,18 @@
12#ifndef _QNX4TYPES_H 12#ifndef _QNX4TYPES_H
13#define _QNX4TYPES_H 13#define _QNX4TYPES_H
14 14
15typedef __u16 qnx4_nxtnt_t; 15typedef __le16 qnx4_nxtnt_t;
16typedef __u8 qnx4_ftype_t; 16typedef __u8 qnx4_ftype_t;
17 17
18typedef struct { 18typedef struct {
19 __u32 xtnt_blk; 19 __le32 xtnt_blk;
20 __u32 xtnt_size; 20 __le32 xtnt_size;
21} qnx4_xtnt_t; 21} qnx4_xtnt_t;
22 22
23typedef __u16 qnx4_mode_t; 23typedef __le16 qnx4_mode_t;
24typedef __u16 qnx4_muid_t; 24typedef __le16 qnx4_muid_t;
25typedef __u16 qnx4_mgid_t; 25typedef __le16 qnx4_mgid_t;
26typedef __u32 qnx4_off_t; 26typedef __le32 qnx4_off_t;
27typedef __u16 qnx4_nlink_t; 27typedef __le16 qnx4_nlink_t;
28 28
29#endif 29#endif
diff --git a/include/linux/quota.h b/include/linux/quota.h
index ac5b90f4f256..700ead45084f 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -138,8 +138,11 @@ struct if_dqinfo {
138#include <linux/dqblk_v2.h> 138#include <linux/dqblk_v2.h>
139 139
140/* Maximal numbers of writes for quota operation (insert/delete/update) 140/* Maximal numbers of writes for quota operation (insert/delete/update)
141 * (over all formats) - info block, 4 pointer blocks, data block */ 141 * (over VFS all formats) */
142#define DQUOT_MAX_WRITES 6 142#define DQUOT_INIT_ALLOC max(V1_INIT_ALLOC, V2_INIT_ALLOC)
143#define DQUOT_INIT_REWRITE max(V1_INIT_REWRITE, V2_INIT_REWRITE)
144#define DQUOT_DEL_ALLOC max(V1_DEL_ALLOC, V2_DEL_ALLOC)
145#define DQUOT_DEL_REWRITE max(V1_DEL_REWRITE, V2_DEL_REWRITE)
143 146
144/* 147/*
145 * Data for one user/group kept in memory 148 * Data for one user/group kept in memory
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index e57baa85e744..d211507ab246 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -39,7 +39,8 @@ extern int dquot_commit_info(struct super_block *sb, int type);
39extern int dquot_mark_dquot_dirty(struct dquot *dquot); 39extern int dquot_mark_dquot_dirty(struct dquot *dquot);
40 40
41extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); 41extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path);
42extern int vfs_quota_on_mount(int type, int format_id, struct dentry *dentry); 42extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
43 int format_id, int type);
43extern int vfs_quota_off(struct super_block *sb, int type); 44extern int vfs_quota_off(struct super_block *sb, int type);
44#define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type) 45#define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type)
45extern int vfs_quota_sync(struct super_block *sb, int type); 46extern int vfs_quota_sync(struct super_block *sb, int type);
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
new file mode 100644
index 000000000000..e24b74b11150
--- /dev/null
+++ b/include/linux/raid/bitmap.h
@@ -0,0 +1,273 @@
1/*
2 * bitmap.h: Copyright (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
3 *
4 * additions: Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc.
5 */
6#ifndef BITMAP_H
7#define BITMAP_H 1
8
9#define BITMAP_MAJOR 3
10#define BITMAP_MINOR 38
11
12/*
13 * in-memory bitmap:
14 *
15 * Use 16 bit block counters to track pending writes to each "chunk".
16 * The 2 high order bits are special-purpose, the first is a flag indicating
17 * whether a resync is needed. The second is a flag indicating whether a
18 * resync is active.
19 * This means that the counter is actually 14 bits:
20 *
21 * +--------+--------+------------------------------------------------+
22 * | resync | resync | counter |
23 * | needed | active | |
24 * | (0-1) | (0-1) | (0-16383) |
25 * +--------+--------+------------------------------------------------+
26 *
27 * The "resync needed" bit is set when:
28 * a '1' bit is read from storage at startup.
29 * a write request fails on some drives
30 * a resync is aborted on a chunk with 'resync active' set
31 * It is cleared (and resync-active set) when a resync starts across all drives
32 * of the chunk.
33 *
34 *
35 * The "resync active" bit is set when:
36 * a resync is started on all drives, and resync_needed is set.
37 * resync_needed will be cleared (as long as resync_active wasn't already set).
38 * It is cleared when a resync completes.
39 *
40 * The counter counts pending write requests, plus the on-disk bit.
41 * When the counter is '1' and the resync bits are clear, the on-disk
42 * bit can be cleared aswell, thus setting the counter to 0.
43 * When we set a bit, or in the counter (to start a write), if the fields is
44 * 0, we first set the disk bit and set the counter to 1.
45 *
46 * If the counter is 0, the on-disk bit is clear and the stipe is clean
47 * Anything that dirties the stipe pushes the counter to 2 (at least)
48 * and sets the on-disk bit (lazily).
49 * If a periodic sweep find the counter at 2, it is decremented to 1.
50 * If the sweep find the counter at 1, the on-disk bit is cleared and the
51 * counter goes to zero.
52 *
53 * Also, we'll hijack the "map" pointer itself and use it as two 16 bit block
54 * counters as a fallback when "page" memory cannot be allocated:
55 *
56 * Normal case (page memory allocated):
57 *
58 * page pointer (32-bit)
59 *
60 * [ ] ------+
61 * |
62 * +-------> [ ][ ]..[ ] (4096 byte page == 2048 counters)
63 * c1 c2 c2048
64 *
65 * Hijacked case (page memory allocation failed):
66 *
67 * hijacked page pointer (32-bit)
68 *
69 * [ ][ ] (no page memory allocated)
70 * counter #1 (16-bit) counter #2 (16-bit)
71 *
72 */
73
74#ifdef __KERNEL__
75
76#define PAGE_BITS (PAGE_SIZE << 3)
77#define PAGE_BIT_SHIFT (PAGE_SHIFT + 3)
78
79typedef __u16 bitmap_counter_t;
80#define COUNTER_BITS 16
81#define COUNTER_BIT_SHIFT 4
82#define COUNTER_BYTE_RATIO (COUNTER_BITS / 8)
83#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
84
85#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
86#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
87#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
88#define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK)
89#define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK)
90#define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX)
91
92/* how many counters per page? */
93#define PAGE_COUNTER_RATIO (PAGE_BITS / COUNTER_BITS)
94/* same, except a shift value for more efficient bitops */
95#define PAGE_COUNTER_SHIFT (PAGE_BIT_SHIFT - COUNTER_BIT_SHIFT)
96/* same, except a mask value for more efficient bitops */
97#define PAGE_COUNTER_MASK (PAGE_COUNTER_RATIO - 1)
98
99#define BITMAP_BLOCK_SIZE 512
100#define BITMAP_BLOCK_SHIFT 9
101
102/* how many blocks per chunk? (this is variable) */
103#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->chunksize >> BITMAP_BLOCK_SHIFT)
104#define CHUNK_BLOCK_SHIFT(bitmap) ((bitmap)->chunkshift - BITMAP_BLOCK_SHIFT)
105#define CHUNK_BLOCK_MASK(bitmap) (CHUNK_BLOCK_RATIO(bitmap) - 1)
106
107/* when hijacked, the counters and bits represent even larger "chunks" */
108/* there will be 1024 chunks represented by each counter in the page pointers */
109#define PAGEPTR_BLOCK_RATIO(bitmap) \
110 (CHUNK_BLOCK_RATIO(bitmap) << PAGE_COUNTER_SHIFT >> 1)
111#define PAGEPTR_BLOCK_SHIFT(bitmap) \
112 (CHUNK_BLOCK_SHIFT(bitmap) + PAGE_COUNTER_SHIFT - 1)
113#define PAGEPTR_BLOCK_MASK(bitmap) (PAGEPTR_BLOCK_RATIO(bitmap) - 1)
114
115/*
116 * on-disk bitmap:
117 *
118 * Use one bit per "chunk" (block set). We do the disk I/O on the bitmap
119 * file a page at a time. There's a superblock at the start of the file.
120 */
121
122/* map chunks (bits) to file pages - offset by the size of the superblock */
123#define CHUNK_BIT_OFFSET(chunk) ((chunk) + (sizeof(bitmap_super_t) << 3))
124
125#endif
126
127/*
128 * bitmap structures:
129 */
130
131#define BITMAP_MAGIC 0x6d746962
132
133/* use these for bitmap->flags and bitmap->sb->state bit-fields */
134enum bitmap_state {
135 BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
136 BITMAP_STALE = 0x002 /* the bitmap file is out of date or had -EIO */
137};
138
139/* the superblock at the front of the bitmap file -- little endian */
140typedef struct bitmap_super_s {
141 __u32 magic; /* 0 BITMAP_MAGIC */
142 __u32 version; /* 4 the bitmap major for now, could change... */
143 __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */
144 __u64 events; /* 24 event counter for the bitmap (1)*/
145 __u64 events_cleared;/*32 event counter when last bit cleared (2) */
146 __u64 sync_size; /* 40 the size of the md device's sync range(3) */
147 __u32 state; /* 48 bitmap state information */
148 __u32 chunksize; /* 52 the bitmap chunk size in bytes */
149 __u32 daemon_sleep; /* 56 seconds between disk flushes */
150
151 __u8 pad[256 - 60]; /* set to zero */
152} bitmap_super_t;
153
154/* notes:
155 * (1) This event counter is updated before the eventcounter in the md superblock
156 * When a bitmap is loaded, it is only accepted if this event counter is equal
157 * to, or one greater than, the event counter in the superblock.
158 * (2) This event counter is updated when the other one is *if*and*only*if* the
159 * array is not degraded. As bits are not cleared when the array is degraded,
160 * this represents the last time that any bits were cleared.
161 * If a device is being added that has an event count with this value or
162 * higher, it is accepted as conforming to the bitmap.
163 * (3)This is the number of sectors represented by the bitmap, and is the range that
164 * resync happens across. For raid1 and raid5/6 it is the size of individual
165 * devices. For raid10 it is the size of the array.
166 */
167
168#ifdef __KERNEL__
169
170/* the in-memory bitmap is represented by bitmap_pages */
171struct bitmap_page {
172 /*
173 * map points to the actual memory page
174 */
175 char *map;
176 /*
177 * in emergencies (when map cannot be alloced), hijack the map
178 * pointer and use it as two counters itself
179 */
180 unsigned int hijacked:1;
181 /*
182 * count of dirty bits on the page
183 */
184 unsigned int count:31;
185};
186
187/* keep track of bitmap file pages that have pending writes on them */
188struct page_list {
189 struct list_head list;
190 struct page *page;
191};
192
193/* the main bitmap structure - one per mddev */
194struct bitmap {
195 struct bitmap_page *bp;
196 unsigned long pages; /* total number of pages in the bitmap */
197 unsigned long missing_pages; /* number of pages not yet allocated */
198
199 mddev_t *mddev; /* the md device that the bitmap is for */
200
201 int counter_bits; /* how many bits per block counter */
202
203 /* bitmap chunksize -- how much data does each bit represent? */
204 unsigned long chunksize;
205 unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */
206 unsigned long chunks; /* total number of data chunks for the array */
207
208 /* We hold a count on the chunk currently being synced, and drop
209 * it when the last block is started. If the resync is aborted
210 * midway, we need to be able to drop that count, so we remember
211 * the counted chunk..
212 */
213 unsigned long syncchunk;
214
215 __u64 events_cleared;
216
217 /* bitmap spinlock */
218 spinlock_t lock;
219
220 long offset; /* offset from superblock if file is NULL */
221 struct file *file; /* backing disk file */
222 struct page *sb_page; /* cached copy of the bitmap file superblock */
223 struct page **filemap; /* list of cache pages for the file */
224 unsigned long *filemap_attr; /* attributes associated w/ filemap pages */
225 unsigned long file_pages; /* number of pages in the file */
226
227 unsigned long flags;
228
229 /*
230 * the bitmap daemon - periodically wakes up and sweeps the bitmap
231 * file, cleaning up bits and flushing out pages to disk as necessary
232 */
233 unsigned long daemon_lastrun; /* jiffies of last run */
234 unsigned long daemon_sleep; /* how many seconds between updates? */
235
236 /*
237 * bitmap_writeback_daemon waits for file-pages that have been written,
238 * as there is no way to get a call-back when a page write completes.
239 */
240 mdk_thread_t *writeback_daemon;
241 spinlock_t write_lock;
242 wait_queue_head_t write_wait;
243 struct list_head complete_pages;
244 mempool_t *write_pool;
245};
246
247/* the bitmap API */
248
249/* these are used only by md/bitmap */
250int bitmap_create(mddev_t *mddev);
251void bitmap_destroy(mddev_t *mddev);
252int bitmap_active(struct bitmap *bitmap);
253
254char *file_path(struct file *file, char *buf, int count);
255void bitmap_print_sb(struct bitmap *bitmap);
256int bitmap_update_sb(struct bitmap *bitmap);
257
258int bitmap_setallbits(struct bitmap *bitmap);
259void bitmap_write_all(struct bitmap *bitmap);
260
261/* these are exported */
262int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors);
263void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors,
264 int success);
265int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks);
266void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
267void bitmap_close_sync(struct bitmap *bitmap);
268
269int bitmap_unplug(struct bitmap *bitmap);
270int bitmap_daemon_work(struct bitmap *bitmap);
271#endif
272
273#endif
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index a6a67d102bfa..ffa316ce4dc8 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -60,7 +60,14 @@
60 */ 60 */
61#define MD_MAJOR_VERSION 0 61#define MD_MAJOR_VERSION 0
62#define MD_MINOR_VERSION 90 62#define MD_MINOR_VERSION 90
63#define MD_PATCHLEVEL_VERSION 1 63/*
64 * MD_PATCHLEVEL_VERSION indicates kernel functionality.
65 * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
66 * and major_version/minor_version accordingly
67 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
68 * in the super status byte
69 */
70#define MD_PATCHLEVEL_VERSION 2
64 71
65extern int register_md_personality (int p_num, mdk_personality_t *p); 72extern int register_md_personality (int p_num, mdk_personality_t *p);
66extern int unregister_md_personality (int p_num); 73extern int unregister_md_personality (int p_num);
@@ -69,7 +76,7 @@ extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
69extern void md_unregister_thread (mdk_thread_t *thread); 76extern void md_unregister_thread (mdk_thread_t *thread);
70extern void md_wakeup_thread(mdk_thread_t *thread); 77extern void md_wakeup_thread(mdk_thread_t *thread);
71extern void md_check_recovery(mddev_t *mddev); 78extern void md_check_recovery(mddev_t *mddev);
72extern void md_write_start(mddev_t *mddev); 79extern void md_write_start(mddev_t *mddev, struct bio *bi);
73extern void md_write_end(mddev_t *mddev); 80extern void md_write_end(mddev_t *mddev);
74extern void md_handle_safemode(mddev_t *mddev); 81extern void md_handle_safemode(mddev_t *mddev);
75extern void md_done_sync(mddev_t *mddev, int blocks, int ok); 82extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
@@ -78,6 +85,12 @@ extern void md_unplug_mddev(mddev_t *mddev);
78 85
79extern void md_print_devices (void); 86extern void md_print_devices (void);
80 87
88extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
89 sector_t sector, int size, struct page *page);
90extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
91 struct page *page, int rw);
92
93
81#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } 94#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
82 95
83#endif 96#endif
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index c9a0d4013be7..8c14ba565a45 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -15,6 +15,9 @@
15#ifndef _MD_K_H 15#ifndef _MD_K_H
16#define _MD_K_H 16#define _MD_K_H
17 17
18/* and dm-bio-list.h is not under include/linux because.... ??? */
19#include "../../../drivers/md/dm-bio-list.h"
20
18#define MD_RESERVED 0UL 21#define MD_RESERVED 0UL
19#define LINEAR 1UL 22#define LINEAR 1UL
20#define RAID0 2UL 23#define RAID0 2UL
@@ -180,6 +183,10 @@ struct mdk_rdev_s
180 183
181 int desc_nr; /* descriptor index in the superblock */ 184 int desc_nr; /* descriptor index in the superblock */
182 int raid_disk; /* role of device in array */ 185 int raid_disk; /* role of device in array */
186 int saved_raid_disk; /* role that device used to have in the
187 * array and could again if we did a partial
188 * resync from the bitmap
189 */
183 190
184 atomic_t nr_pending; /* number of pending requests. 191 atomic_t nr_pending; /* number of pending requests.
185 * only maintained for arrays that 192 * only maintained for arrays that
@@ -252,6 +259,11 @@ struct mddev_s
252 atomic_t recovery_active; /* blocks scheduled, but not written */ 259 atomic_t recovery_active; /* blocks scheduled, but not written */
253 wait_queue_head_t recovery_wait; 260 wait_queue_head_t recovery_wait;
254 sector_t recovery_cp; 261 sector_t recovery_cp;
262
263 spinlock_t write_lock;
264 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
265 atomic_t pending_writes; /* number of active superblock writes */
266
255 unsigned int safemode; /* if set, update "clean" superblock 267 unsigned int safemode; /* if set, update "clean" superblock
256 * when no writes pending. 268 * when no writes pending.
257 */ 269 */
@@ -260,6 +272,13 @@ struct mddev_s
260 atomic_t writes_pending; 272 atomic_t writes_pending;
261 request_queue_t *queue; /* for plugging ... */ 273 request_queue_t *queue; /* for plugging ... */
262 274
275 struct bitmap *bitmap; /* the bitmap for the device */
276 struct file *bitmap_file; /* the bitmap file */
277 long bitmap_offset; /* offset from superblock of
278 * start of bitmap. May be
279 * negative, but not '0'
280 */
281
263 struct list_head all_mddevs; 282 struct list_head all_mddevs;
264}; 283};
265 284
@@ -291,7 +310,7 @@ struct mdk_personality_s
291 int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev); 310 int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev);
292 int (*hot_remove_disk) (mddev_t *mddev, int number); 311 int (*hot_remove_disk) (mddev_t *mddev, int number);
293 int (*spare_active) (mddev_t *mddev); 312 int (*spare_active) (mddev_t *mddev);
294 int (*sync_request)(mddev_t *mddev, sector_t sector_nr, int go_faster); 313 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster);
295 int (*resize) (mddev_t *mddev, sector_t sectors); 314 int (*resize) (mddev_t *mddev, sector_t sectors);
296 int (*reshape) (mddev_t *mddev, int raid_disks); 315 int (*reshape) (mddev_t *mddev, int raid_disks);
297 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); 316 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size);
@@ -334,6 +353,7 @@ typedef struct mdk_thread_s {
334 unsigned long flags; 353 unsigned long flags;
335 struct completion *event; 354 struct completion *event;
336 struct task_struct *tsk; 355 struct task_struct *tsk;
356 unsigned long timeout;
337 const char *name; 357 const char *name;
338} mdk_thread_t; 358} mdk_thread_t;
339 359
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 8ba95d67329f..dc65cd435494 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -96,6 +96,7 @@ typedef struct mdp_device_descriptor_s {
96#define MD_SB_CLEAN 0 96#define MD_SB_CLEAN 0
97#define MD_SB_ERRORS 1 97#define MD_SB_ERRORS 1
98 98
99#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */
99typedef struct mdp_superblock_s { 100typedef struct mdp_superblock_s {
100 /* 101 /*
101 * Constant generic information 102 * Constant generic information
@@ -184,7 +185,7 @@ struct mdp_superblock_1 {
184 /* constant array information - 128 bytes */ 185 /* constant array information - 128 bytes */
185 __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ 186 __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */
186 __u32 major_version; /* 1 */ 187 __u32 major_version; /* 1 */
187 __u32 feature_map; /* 0 for now */ 188 __u32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */
188 __u32 pad0; /* always set to 0 when writing */ 189 __u32 pad0; /* always set to 0 when writing */
189 190
190 __u8 set_uuid[16]; /* user-space generated. */ 191 __u8 set_uuid[16]; /* user-space generated. */
@@ -197,7 +198,11 @@ struct mdp_superblock_1 {
197 198
198 __u32 chunksize; /* in 512byte sectors */ 199 __u32 chunksize; /* in 512byte sectors */
199 __u32 raid_disks; 200 __u32 raid_disks;
200 __u8 pad1[128-96]; /* set to 0 when written */ 201 __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts
202 * NOTE: signed, so bitmap can be before superblock
203 * only meaningful of feature_map[0] is set.
204 */
205 __u8 pad1[128-100]; /* set to 0 when written */
201 206
202 /* constant this-device information - 64 bytes */ 207 /* constant this-device information - 64 bytes */
203 __u64 data_offset; /* sector start of data, often 0 */ 208 __u64 data_offset; /* sector start of data, often 0 */
diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h
index a2df5c2a42af..81da20ccec4d 100644
--- a/include/linux/raid/md_u.h
+++ b/include/linux/raid/md_u.h
@@ -23,6 +23,7 @@
23#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) 23#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
24#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) 24#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
25#define RAID_AUTORUN _IO (MD_MAJOR, 0x14) 25#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
26#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
26 27
27/* configuration */ 28/* configuration */
28#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) 29#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
@@ -36,6 +37,7 @@
36#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) 37#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
37#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) 38#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
38#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) 39#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
40#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
39 41
40/* usage */ 42/* usage */
41#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) 43#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
@@ -106,6 +108,11 @@ typedef struct mdu_start_info_s {
106 108
107} mdu_start_info_t; 109} mdu_start_info_t;
108 110
111typedef struct mdu_bitmap_file_s
112{
113 char pathname[4096];
114} mdu_bitmap_file_t;
115
109typedef struct mdu_param_s 116typedef struct mdu_param_s
110{ 117{
111 int personality; /* 1,2,3,4 */ 118 int personality; /* 1,2,3,4 */
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index abbfdd9afe1e..9d93cf12e890 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -36,12 +36,21 @@ struct r1_private_data_s {
36 spinlock_t device_lock; 36 spinlock_t device_lock;
37 37
38 struct list_head retry_list; 38 struct list_head retry_list;
39 /* queue pending writes and submit them on unplug */
40 struct bio_list pending_bio_list;
41 /* queue of writes that have been unplugged */
42 struct bio_list flushing_bio_list;
43
39 /* for use when syncing mirrors: */ 44 /* for use when syncing mirrors: */
40 45
41 spinlock_t resync_lock; 46 spinlock_t resync_lock;
42 int nr_pending; 47 int nr_pending;
43 int barrier; 48 int barrier;
44 sector_t next_resync; 49 sector_t next_resync;
50 int fullsync; /* set to 1 if a full sync is needed,
51 * (fresh device added).
52 * Cleared when a sync completes.
53 */
45 54
46 wait_queue_head_t wait_idle; 55 wait_queue_head_t wait_idle;
47 wait_queue_head_t wait_resume; 56 wait_queue_head_t wait_resume;
@@ -85,14 +94,17 @@ struct r1bio_s {
85 int read_disk; 94 int read_disk;
86 95
87 struct list_head retry_list; 96 struct list_head retry_list;
97 struct bitmap_update *bitmap_update;
88 /* 98 /*
89 * if the IO is in WRITE direction, then multiple bios are used. 99 * if the IO is in WRITE direction, then multiple bios are used.
90 * We choose the number when they are allocated. 100 * We choose the number when they are allocated.
91 */ 101 */
92 struct bio *bios[0]; 102 struct bio *bios[0];
103 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/
93}; 104};
94 105
95/* bits for r1bio.state */ 106/* bits for r1bio.state */
96#define R1BIO_Uptodate 0 107#define R1BIO_Uptodate 0
97#define R1BIO_IsSync 1 108#define R1BIO_IsSync 1
109#define R1BIO_Degraded 2
98#endif 110#endif
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index d60fafc8bdc5..2d4dd23168dd 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -51,6 +51,10 @@ extern void machine_restart(char *cmd);
51extern void machine_halt(void); 51extern void machine_halt(void);
52extern void machine_power_off(void); 52extern void machine_power_off(void);
53 53
54extern void machine_shutdown(void);
55struct pt_regs;
56extern void machine_crash_shutdown(struct pt_regs *);
57
54#endif 58#endif
55 59
56#endif /* _LINUX_REBOOT_H */ 60#endif /* _LINUX_REBOOT_H */
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index 2aef9c3f5ce8..0760507a545b 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -1,6 +1,5 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/posix_acl.h> 2#include <linux/posix_acl.h>
3#include <linux/xattr_acl.h>
4 3
5#define REISERFS_ACL_VERSION 0x0001 4#define REISERFS_ACL_VERSION 0x0001
6 5
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 32148625fc2f..4c7c5689ad93 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1644,11 +1644,18 @@ struct reiserfs_journal_header {
1644#define JOURNAL_MAX_TRANS_AGE 30 1644#define JOURNAL_MAX_TRANS_AGE 30
1645#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) 1645#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
1646#ifdef CONFIG_QUOTA 1646#ifdef CONFIG_QUOTA
1647#define REISERFS_QUOTA_TRANS_BLOCKS 2 /* We need to update data and inode (atime) */ 1647/* We need to update data and inode (atime) */
1648#define REISERFS_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*(JOURNAL_PER_BALANCE_CNT+2)+1) /* 1 balancing, 1 bitmap, 1 data per write + stat data update */ 1648#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0)
1649/* 1 balancing, 1 bitmap, 1 data per write + stat data update */
1650#define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \
1651(DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0)
1652/* same as with INIT */
1653#define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \
1654(DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0)
1649#else 1655#else
1650#define REISERFS_QUOTA_TRANS_BLOCKS 0 1656#define REISERFS_QUOTA_TRANS_BLOCKS(s) 0
1651#define REISERFS_QUOTA_INIT_BLOCKS 0 1657#define REISERFS_QUOTA_INIT_BLOCKS(s) 0
1658#define REISERFS_QUOTA_DEL_BLOCKS(s) 0
1652#endif 1659#endif
1653 1660
1654/* both of these can be as low as 1, or as high as you want. The min is the 1661/* both of these can be as low as 1, or as high as you want. The min is the
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 37a3a7afbec7..31c709d0fe18 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -467,6 +467,8 @@ enum reiserfs_mount_options {
467 REISERFS_ERROR_RO, 467 REISERFS_ERROR_RO,
468 REISERFS_ERROR_CONTINUE, 468 REISERFS_ERROR_CONTINUE,
469 469
470 REISERFS_QUOTA, /* Some quota option specified */
471
470 REISERFS_TEST1, 472 REISERFS_TEST1,
471 REISERFS_TEST2, 473 REISERFS_TEST2,
472 REISERFS_TEST3, 474 REISERFS_TEST3,
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 11b484e37ac9..e80fb7ee6efd 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -93,6 +93,12 @@ int page_referenced(struct page *, int is_locked, int ignore_token);
93int try_to_unmap(struct page *); 93int try_to_unmap(struct page *);
94 94
95/* 95/*
96 * Called from mm/filemap_xip.c to unmap empty zero page
97 */
98pte_t *page_check_address(struct page *, struct mm_struct *, unsigned long);
99
100
101/*
96 * Used by swapoff to help locate where page is expected in vma. 102 * Used by swapoff to help locate where page is expected in vma.
97 */ 103 */
98unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); 104unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 91ac97c20777..d021888b58f1 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -89,6 +89,13 @@ enum {
89 RTM_GETANYCAST = 62, 89 RTM_GETANYCAST = 62,
90#define RTM_GETANYCAST RTM_GETANYCAST 90#define RTM_GETANYCAST RTM_GETANYCAST
91 91
92 RTM_NEWNEIGHTBL = 64,
93#define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL
94 RTM_GETNEIGHTBL = 66,
95#define RTM_GETNEIGHTBL RTM_GETNEIGHTBL
96 RTM_SETNEIGHTBL,
97#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL
98
92 __RTM_MAX, 99 __RTM_MAX,
93#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 100#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
94}; 101};
@@ -493,6 +500,106 @@ struct nda_cacheinfo
493 __u32 ndm_refcnt; 500 __u32 ndm_refcnt;
494}; 501};
495 502
503
504/*****************************************************************
505 * Neighbour tables specific messages.
506 *
507 * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
508 * NLM_F_DUMP flag set. Every neighbour table configuration is
509 * spread over multiple messages to avoid running into message
510 * size limits on systems with many interfaces. The first message
511 * in the sequence transports all not device specific data such as
512 * statistics, configuration, and the default parameter set.
513 * This message is followed by 0..n messages carrying device
514 * specific parameter sets.
515 * Although the ordering should be sufficient, NDTA_NAME can be
516 * used to identify sequences. The initial message can be identified
517 * by checking for NDTA_CONFIG. The device specific messages do
518 * not contain this TLV but have NDTPA_IFINDEX set to the
519 * corresponding interface index.
520 *
521 * To change neighbour table attributes, send RTM_SETNEIGHTBL
522 * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
523 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
524 * otherwise. Device specific parameter sets can be changed by
525 * setting NDTPA_IFINDEX to the interface index of the corresponding
526 * device.
527 ****/
528
529struct ndt_stats
530{
531 __u64 ndts_allocs;
532 __u64 ndts_destroys;
533 __u64 ndts_hash_grows;
534 __u64 ndts_res_failed;
535 __u64 ndts_lookups;
536 __u64 ndts_hits;
537 __u64 ndts_rcv_probes_mcast;
538 __u64 ndts_rcv_probes_ucast;
539 __u64 ndts_periodic_gc_runs;
540 __u64 ndts_forced_gc_runs;
541};
542
543enum {
544 NDTPA_UNSPEC,
545 NDTPA_IFINDEX, /* u32, unchangeable */
546 NDTPA_REFCNT, /* u32, read-only */
547 NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
548 NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
549 NDTPA_RETRANS_TIME, /* u64, msecs */
550 NDTPA_GC_STALETIME, /* u64, msecs */
551 NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
552 NDTPA_QUEUE_LEN, /* u32 */
553 NDTPA_APP_PROBES, /* u32 */
554 NDTPA_UCAST_PROBES, /* u32 */
555 NDTPA_MCAST_PROBES, /* u32 */
556 NDTPA_ANYCAST_DELAY, /* u64, msecs */
557 NDTPA_PROXY_DELAY, /* u64, msecs */
558 NDTPA_PROXY_QLEN, /* u32 */
559 NDTPA_LOCKTIME, /* u64, msecs */
560 __NDTPA_MAX
561};
562#define NDTPA_MAX (__NDTPA_MAX - 1)
563
564struct ndtmsg
565{
566 __u8 ndtm_family;
567 __u8 ndtm_pad1;
568 __u16 ndtm_pad2;
569};
570
571struct ndt_config
572{
573 __u16 ndtc_key_len;
574 __u16 ndtc_entry_size;
575 __u32 ndtc_entries;
576 __u32 ndtc_last_flush; /* delta to now in msecs */
577 __u32 ndtc_last_rand; /* delta to now in msecs */
578 __u32 ndtc_hash_rnd;
579 __u32 ndtc_hash_mask;
580 __u32 ndtc_hash_chain_gc;
581 __u32 ndtc_proxy_qlen;
582};
583
584enum {
585 NDTA_UNSPEC,
586 NDTA_NAME, /* char *, unchangeable */
587 NDTA_THRESH1, /* u32 */
588 NDTA_THRESH2, /* u32 */
589 NDTA_THRESH3, /* u32 */
590 NDTA_CONFIG, /* struct ndt_config, read-only */
591 NDTA_PARMS, /* nested TLV NDTPA_* */
592 NDTA_STATS, /* struct ndt_stats, read-only */
593 NDTA_GC_INTERVAL, /* u64, msecs */
594 __NDTA_MAX
595};
596#define NDTA_MAX (__NDTA_MAX - 1)
597
598#define NDTA_RTA(r) ((struct rtattr*)(((char*)(r)) + \
599 NLMSG_ALIGN(sizeof(struct ndtmsg))))
600#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
601
602
496/**** 603/****
497 * General form of address family dependent message. 604 * General form of address family dependent message.
498 ****/ 605 ****/
@@ -785,10 +892,82 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
785 goto rtattr_failure; \ 892 goto rtattr_failure; \
786 __rta_fill(skb, attrtype, attrlen, data); }) 893 __rta_fill(skb, attrtype, attrlen, data); })
787 894
788#define RTA_PUT_NOHDR(skb, attrlen, data) \ 895#define RTA_APPEND(skb, attrlen, data) \
789({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \ 896({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \
790 goto rtattr_failure; \ 897 goto rtattr_failure; \
791 memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); }) 898 memcpy(skb_put(skb, attrlen), data, attrlen); })
899
900#define RTA_PUT_NOHDR(skb, attrlen, data) \
901 RTA_APPEND(skb, RTA_ALIGN(attrlen), data)
902
903#define RTA_PUT_U8(skb, attrtype, value) \
904({ u8 _tmp = (value); \
905 RTA_PUT(skb, attrtype, sizeof(u8), &_tmp); })
906
907#define RTA_PUT_U16(skb, attrtype, value) \
908({ u16 _tmp = (value); \
909 RTA_PUT(skb, attrtype, sizeof(u16), &_tmp); })
910
911#define RTA_PUT_U32(skb, attrtype, value) \
912({ u32 _tmp = (value); \
913 RTA_PUT(skb, attrtype, sizeof(u32), &_tmp); })
914
915#define RTA_PUT_U64(skb, attrtype, value) \
916({ u64 _tmp = (value); \
917 RTA_PUT(skb, attrtype, sizeof(u64), &_tmp); })
918
919#define RTA_PUT_SECS(skb, attrtype, value) \
920 RTA_PUT_U64(skb, attrtype, (value) / HZ)
921
922#define RTA_PUT_MSECS(skb, attrtype, value) \
923 RTA_PUT_U64(skb, attrtype, jiffies_to_msecs(value))
924
925#define RTA_PUT_STRING(skb, attrtype, value) \
926 RTA_PUT(skb, attrtype, strlen(value) + 1, value)
927
928#define RTA_PUT_FLAG(skb, attrtype) \
929 RTA_PUT(skb, attrtype, 0, NULL);
930
931#define RTA_NEST(skb, type) \
932({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \
933 RTA_PUT(skb, type, 0, NULL); \
934 __start; })
935
936#define RTA_NEST_END(skb, start) \
937({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \
938 (skb)->len; })
939
940#define RTA_NEST_CANCEL(skb, start) \
941({ if (start) \
942 skb_trim(skb, (unsigned char *) (start) - (skb)->data); \
943 -1; })
944
945#define RTA_GET_U8(rta) \
946({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u8)) \
947 goto rtattr_failure; \
948 *(u8 *) RTA_DATA(rta); })
949
950#define RTA_GET_U16(rta) \
951({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u16)) \
952 goto rtattr_failure; \
953 *(u16 *) RTA_DATA(rta); })
954
955#define RTA_GET_U32(rta) \
956({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u32)) \
957 goto rtattr_failure; \
958 *(u32 *) RTA_DATA(rta); })
959
960#define RTA_GET_U64(rta) \
961({ u64 _tmp; \
962 if (!rta || RTA_PAYLOAD(rta) < sizeof(u64)) \
963 goto rtattr_failure; \
964 memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \
965 _tmp; })
966
967#define RTA_GET_FLAG(rta) (!!(rta))
968
969#define RTA_GET_SECS(rta) ((unsigned long) RTA_GET_U64(rta) * HZ)
970#define RTA_GET_MSECS(rta) (msecs_to_jiffies((unsigned long) RTA_GET_U64(rta)))
792 971
793static inline struct rtattr * 972static inline struct rtattr *
794__rta_reserve(struct sk_buff *skb, int attrtype, int attrlen) 973__rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4dbb109022f3..9530b1903160 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -201,8 +201,8 @@ extern unsigned long
201arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, 201arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
202 unsigned long len, unsigned long pgoff, 202 unsigned long len, unsigned long pgoff,
203 unsigned long flags); 203 unsigned long flags);
204extern void arch_unmap_area(struct vm_area_struct *area); 204extern void arch_unmap_area(struct mm_struct *, unsigned long);
205extern void arch_unmap_area_topdown(struct vm_area_struct *area); 205extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
206 206
207#define set_mm_counter(mm, member, value) (mm)->_##member = (value) 207#define set_mm_counter(mm, member, value) (mm)->_##member = (value)
208#define get_mm_counter(mm, member) ((mm)->_##member) 208#define get_mm_counter(mm, member) ((mm)->_##member)
@@ -218,9 +218,10 @@ struct mm_struct {
218 unsigned long (*get_unmapped_area) (struct file *filp, 218 unsigned long (*get_unmapped_area) (struct file *filp,
219 unsigned long addr, unsigned long len, 219 unsigned long addr, unsigned long len,
220 unsigned long pgoff, unsigned long flags); 220 unsigned long pgoff, unsigned long flags);
221 void (*unmap_area) (struct vm_area_struct *area); 221 void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
222 unsigned long mmap_base; /* base of mmap area */ 222 unsigned long mmap_base; /* base of mmap area */
223 unsigned long free_area_cache; /* first hole */ 223 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */
224 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */
224 pgd_t * pgd; 225 pgd_t * pgd;
225 atomic_t mm_users; /* How many users with user space? */ 226 atomic_t mm_users; /* How many users with user space? */
226 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 227 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
@@ -245,7 +246,7 @@ struct mm_struct {
245 246
246 unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ 247 unsigned long saved_auxv[42]; /* for /proc/PID/auxv */
247 248
248 unsigned dumpable:1; 249 unsigned dumpable:2;
249 cpumask_t cpu_vm_mask; 250 cpumask_t cpu_vm_mask;
250 251
251 /* Architecture-specific MM context */ 252 /* Architecture-specific MM context */
@@ -367,6 +368,11 @@ struct signal_struct {
367#endif 368#endif
368}; 369};
369 370
371/* Context switch must be unlocked if interrupts are to be enabled */
372#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
373# define __ARCH_WANT_UNLOCKED_CTXSW
374#endif
375
370/* 376/*
371 * Bits in flags field of signal_struct. 377 * Bits in flags field of signal_struct.
372 */ 378 */
@@ -459,10 +465,11 @@ enum idle_type
459#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ 465#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */
460#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */ 466#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */
461#define SD_BALANCE_EXEC 4 /* Balance on exec */ 467#define SD_BALANCE_EXEC 4 /* Balance on exec */
462#define SD_WAKE_IDLE 8 /* Wake to idle CPU on task wakeup */ 468#define SD_BALANCE_FORK 8 /* Balance on fork, clone */
463#define SD_WAKE_AFFINE 16 /* Wake task to waking CPU */ 469#define SD_WAKE_IDLE 16 /* Wake to idle CPU on task wakeup */
464#define SD_WAKE_BALANCE 32 /* Perform balancing at task wakeup */ 470#define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */
465#define SD_SHARE_CPUPOWER 64 /* Domain members share cpu power */ 471#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */
472#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */
466 473
467struct sched_group { 474struct sched_group {
468 struct sched_group *next; /* Must be a circular list */ 475 struct sched_group *next; /* Must be a circular list */
@@ -487,6 +494,11 @@ struct sched_domain {
487 unsigned long long cache_hot_time; /* Task considered cache hot (ns) */ 494 unsigned long long cache_hot_time; /* Task considered cache hot (ns) */
488 unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */ 495 unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */
489 unsigned int per_cpu_gain; /* CPU % gained by adding domain cpus */ 496 unsigned int per_cpu_gain; /* CPU % gained by adding domain cpus */
497 unsigned int busy_idx;
498 unsigned int idle_idx;
499 unsigned int newidle_idx;
500 unsigned int wake_idx;
501 unsigned int forkexec_idx;
490 int flags; /* See SD_* */ 502 int flags; /* See SD_* */
491 503
492 /* Runtime fields. */ 504 /* Runtime fields. */
@@ -510,10 +522,16 @@ struct sched_domain {
510 unsigned long alb_failed; 522 unsigned long alb_failed;
511 unsigned long alb_pushed; 523 unsigned long alb_pushed;
512 524
513 /* sched_balance_exec() stats */ 525 /* SD_BALANCE_EXEC stats */
514 unsigned long sbe_attempts; 526 unsigned long sbe_cnt;
527 unsigned long sbe_balanced;
515 unsigned long sbe_pushed; 528 unsigned long sbe_pushed;
516 529
530 /* SD_BALANCE_FORK stats */
531 unsigned long sbf_cnt;
532 unsigned long sbf_balanced;
533 unsigned long sbf_pushed;
534
517 /* try_to_wake_up() stats */ 535 /* try_to_wake_up() stats */
518 unsigned long ttwu_wake_remote; 536 unsigned long ttwu_wake_remote;
519 unsigned long ttwu_move_affine; 537 unsigned long ttwu_move_affine;
@@ -521,6 +539,8 @@ struct sched_domain {
521#endif 539#endif
522}; 540};
523 541
542extern void partition_sched_domains(cpumask_t *partition1,
543 cpumask_t *partition2);
524#ifdef ARCH_HAS_SCHED_DOMAIN 544#ifdef ARCH_HAS_SCHED_DOMAIN
525/* Useful helpers that arch setup code may use. Defined in kernel/sched.c */ 545/* Useful helpers that arch setup code may use. Defined in kernel/sched.c */
526extern cpumask_t cpu_isolated_map; 546extern cpumask_t cpu_isolated_map;
@@ -560,9 +580,10 @@ struct group_info {
560 groups_free(group_info); \ 580 groups_free(group_info); \
561} while (0) 581} while (0)
562 582
563struct group_info *groups_alloc(int gidsetsize); 583extern struct group_info *groups_alloc(int gidsetsize);
564void groups_free(struct group_info *group_info); 584extern void groups_free(struct group_info *group_info);
565int set_current_groups(struct group_info *group_info); 585extern int set_current_groups(struct group_info *group_info);
586extern int groups_search(struct group_info *group_info, gid_t grp);
566/* access the groups "array" with this macro */ 587/* access the groups "array" with this macro */
567#define GROUP_AT(gi, i) \ 588#define GROUP_AT(gi, i) \
568 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) 589 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
@@ -580,6 +601,9 @@ struct task_struct {
580 601
581 int lock_depth; /* BKL lock depth */ 602 int lock_depth; /* BKL lock depth */
582 603
604#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
605 int oncpu;
606#endif
583 int prio, static_prio; 607 int prio, static_prio;
584 struct list_head run_list; 608 struct list_head run_list;
585 prio_array_t *array; 609 prio_array_t *array;
@@ -659,6 +683,7 @@ struct task_struct {
659 struct user_struct *user; 683 struct user_struct *user;
660#ifdef CONFIG_KEYS 684#ifdef CONFIG_KEYS
661 struct key *thread_keyring; /* keyring private to this thread */ 685 struct key *thread_keyring; /* keyring private to this thread */
686 unsigned char jit_keyring; /* default keyring to attach requested keys to */
662#endif 687#endif
663 int oomkilladj; /* OOM kill score adjustment (bit shift). */ 688 int oomkilladj; /* OOM kill score adjustment (bit shift). */
664 char comm[TASK_COMM_LEN]; /* executable name excluding path 689 char comm[TASK_COMM_LEN]; /* executable name excluding path
@@ -701,8 +726,6 @@ struct task_struct {
701 spinlock_t alloc_lock; 726 spinlock_t alloc_lock;
702/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ 727/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
703 spinlock_t proc_lock; 728 spinlock_t proc_lock;
704/* context-switch lock */
705 spinlock_t switch_lock;
706 729
707/* journalling filesystem info */ 730/* journalling filesystem info */
708 void *journal_info; 731 void *journal_info;
@@ -909,7 +932,7 @@ extern void FASTCALL(wake_up_new_task(struct task_struct * tsk,
909#else 932#else
910 static inline void kick_process(struct task_struct *tsk) { } 933 static inline void kick_process(struct task_struct *tsk) { }
911#endif 934#endif
912extern void FASTCALL(sched_fork(task_t * p)); 935extern void FASTCALL(sched_fork(task_t * p, int clone_flags));
913extern void FASTCALL(sched_exit(task_t * p)); 936extern void FASTCALL(sched_exit(task_t * p));
914 937
915extern int in_group_p(gid_t); 938extern int in_group_p(gid_t);
@@ -1242,33 +1265,78 @@ extern void normalize_rt_tasks(void);
1242 1265
1243#endif 1266#endif
1244 1267
1245/* try_to_freeze
1246 *
1247 * Checks whether we need to enter the refrigerator
1248 * and returns 1 if we did so.
1249 */
1250#ifdef CONFIG_PM 1268#ifdef CONFIG_PM
1251extern void refrigerator(unsigned long); 1269/*
1270 * Check if a process has been frozen
1271 */
1272static inline int frozen(struct task_struct *p)
1273{
1274 return p->flags & PF_FROZEN;
1275}
1276
1277/*
1278 * Check if there is a request to freeze a process
1279 */
1280static inline int freezing(struct task_struct *p)
1281{
1282 return p->flags & PF_FREEZE;
1283}
1284
1285/*
1286 * Request that a process be frozen
1287 * FIXME: SMP problem. We may not modify other process' flags!
1288 */
1289static inline void freeze(struct task_struct *p)
1290{
1291 p->flags |= PF_FREEZE;
1292}
1293
1294/*
1295 * Wake up a frozen process
1296 */
1297static inline int thaw_process(struct task_struct *p)
1298{
1299 if (frozen(p)) {
1300 p->flags &= ~PF_FROZEN;
1301 wake_up_process(p);
1302 return 1;
1303 }
1304 return 0;
1305}
1306
1307/*
1308 * freezing is complete, mark process as frozen
1309 */
1310static inline void frozen_process(struct task_struct *p)
1311{
1312 p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN;
1313}
1314
1315extern void refrigerator(void);
1252extern int freeze_processes(void); 1316extern int freeze_processes(void);
1253extern void thaw_processes(void); 1317extern void thaw_processes(void);
1254 1318
1255static inline int try_to_freeze(unsigned long refrigerator_flags) 1319static inline int try_to_freeze(void)
1256{ 1320{
1257 if (unlikely(current->flags & PF_FREEZE)) { 1321 if (freezing(current)) {
1258 refrigerator(refrigerator_flags); 1322 refrigerator();
1259 return 1; 1323 return 1;
1260 } else 1324 } else
1261 return 0; 1325 return 0;
1262} 1326}
1263#else 1327#else
1264static inline void refrigerator(unsigned long flag) {} 1328static inline int frozen(struct task_struct *p) { return 0; }
1329static inline int freezing(struct task_struct *p) { return 0; }
1330static inline void freeze(struct task_struct *p) { BUG(); }
1331static inline int thaw_process(struct task_struct *p) { return 1; }
1332static inline void frozen_process(struct task_struct *p) { BUG(); }
1333
1334static inline void refrigerator(void) {}
1265static inline int freeze_processes(void) { BUG(); return 0; } 1335static inline int freeze_processes(void) { BUG(); return 0; }
1266static inline void thaw_processes(void) {} 1336static inline void thaw_processes(void) {}
1267 1337
1268static inline int try_to_freeze(unsigned long refrigerator_flags) 1338static inline int try_to_freeze(void) { return 0; }
1269{ 1339
1270 return 0;
1271}
1272#endif /* CONFIG_PM */ 1340#endif /* CONFIG_PM */
1273#endif /* __KERNEL__ */ 1341#endif /* __KERNEL__ */
1274 1342
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 0a98f5ec5cae..7be18b5e2fb4 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -231,10 +231,8 @@ extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
231extern long do_sigpending(void __user *, unsigned long); 231extern long do_sigpending(void __user *, unsigned long);
232extern int sigprocmask(int, sigset_t *, sigset_t *); 232extern int sigprocmask(int, sigset_t *, sigset_t *);
233 233
234#ifndef HAVE_ARCH_GET_SIGNAL_TO_DELIVER
235struct pt_regs; 234struct pt_regs;
236extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 235extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
237#endif
238 236
239#endif /* __KERNEL__ */ 237#endif /* __KERNEL__ */
240 238
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index cc04f5cd2286..416a2e4024b2 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -27,6 +27,7 @@
27#include <linux/highmem.h> 27#include <linux/highmem.h>
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <linux/net.h> 29#include <linux/net.h>
30#include <linux/textsearch.h>
30#include <net/checksum.h> 31#include <net/checksum.h>
31 32
32#define HAVE_ALLOC_SKB /* For the drivers to know */ 33#define HAVE_ALLOC_SKB /* For the drivers to know */
@@ -193,7 +194,6 @@ struct skb_shared_info {
193 * @nfcache: Cache info 194 * @nfcache: Cache info
194 * @nfct: Associated connection, if any 195 * @nfct: Associated connection, if any
195 * @nfctinfo: Relationship of this skb to the connection 196 * @nfctinfo: Relationship of this skb to the connection
196 * @nf_debug: Netfilter debugging
197 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 197 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
198 * @private: Data which is private to the HIPPI implementation 198 * @private: Data which is private to the HIPPI implementation
199 * @tc_index: Traffic control index 199 * @tc_index: Traffic control index
@@ -264,9 +264,6 @@ struct sk_buff {
264 __u32 nfcache; 264 __u32 nfcache;
265 __u32 nfctinfo; 265 __u32 nfctinfo;
266 struct nf_conntrack *nfct; 266 struct nf_conntrack *nfct;
267#ifdef CONFIG_NETFILTER_DEBUG
268 unsigned int nf_debug;
269#endif
270#ifdef CONFIG_BRIDGE_NETFILTER 267#ifdef CONFIG_BRIDGE_NETFILTER
271 struct nf_bridge_info *nf_bridge; 268 struct nf_bridge_info *nf_bridge;
272#endif 269#endif
@@ -325,6 +322,28 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
325extern void skb_under_panic(struct sk_buff *skb, int len, 322extern void skb_under_panic(struct sk_buff *skb, int len,
326 void *here); 323 void *here);
327 324
325struct skb_seq_state
326{
327 __u32 lower_offset;
328 __u32 upper_offset;
329 __u32 frag_idx;
330 __u32 stepped_offset;
331 struct sk_buff *root_skb;
332 struct sk_buff *cur_skb;
333 __u8 *frag_data;
334};
335
336extern void skb_prepare_seq_read(struct sk_buff *skb,
337 unsigned int from, unsigned int to,
338 struct skb_seq_state *st);
339extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
340 struct skb_seq_state *st);
341extern void skb_abort_seq_read(struct skb_seq_state *st);
342
343extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
344 unsigned int to, struct ts_config *config,
345 struct ts_state *state);
346
328/* Internal */ 347/* Internal */
329#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) 348#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end))
330 349
@@ -1219,15 +1238,6 @@ static inline void nf_reset(struct sk_buff *skb)
1219{ 1238{
1220 nf_conntrack_put(skb->nfct); 1239 nf_conntrack_put(skb->nfct);
1221 skb->nfct = NULL; 1240 skb->nfct = NULL;
1222#ifdef CONFIG_NETFILTER_DEBUG
1223 skb->nf_debug = 0;
1224#endif
1225}
1226static inline void nf_reset_debug(struct sk_buff *skb)
1227{
1228#ifdef CONFIG_NETFILTER_DEBUG
1229 skb->nf_debug = 0;
1230#endif
1231} 1241}
1232 1242
1233#ifdef CONFIG_BRIDGE_NETFILTER 1243#ifdef CONFIG_BRIDGE_NETFILTER
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 7d66385ae750..76cf7e60216c 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -64,6 +64,7 @@ extern int kmem_cache_shrink(kmem_cache_t *);
64extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast); 64extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast);
65extern void kmem_cache_free(kmem_cache_t *, void *); 65extern void kmem_cache_free(kmem_cache_t *, void *);
66extern unsigned int kmem_cache_size(kmem_cache_t *); 66extern unsigned int kmem_cache_size(kmem_cache_t *);
67extern const char *kmem_cache_name(kmem_cache_t *);
67extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags); 68extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags);
68 69
69/* Size description struct for general caches. */ 70/* Size description struct for general caches. */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index dcf1db3b35d3..9dfa3ee769ae 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -92,10 +92,7 @@ void smp_prepare_boot_cpu(void);
92/* 92/*
93 * These macros fold the SMP functionality into a single CPU system 93 * These macros fold the SMP functionality into a single CPU system
94 */ 94 */
95 95#define raw_smp_processor_id() 0
96#if !defined(__smp_processor_id) || !defined(CONFIG_PREEMPT)
97# define smp_processor_id() 0
98#endif
99#define hard_smp_processor_id() 0 96#define hard_smp_processor_id() 0
100#define smp_call_function(func,info,retry,wait) ({ 0; }) 97#define smp_call_function(func,info,retry,wait) ({ 0; })
101#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; }) 98#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; })
@@ -106,30 +103,25 @@ static inline void smp_send_reschedule(int cpu) { }
106#endif /* !SMP */ 103#endif /* !SMP */
107 104
108/* 105/*
109 * DEBUG_PREEMPT support: check whether smp_processor_id() is being 106 * smp_processor_id(): get the current CPU ID.
110 * used in a preemption-safe way.
111 * 107 *
112 * An architecture has to enable this debugging code explicitly. 108 * if DEBUG_PREEMPT is enabled the we check whether it is
113 * It can do so by renaming the smp_processor_id() macro to 109 * used in a preemption-safe way. (smp_processor_id() is safe
114 * __smp_processor_id(). This should only be done after some minimal 110 * if it's used in a preemption-off critical section, or in
115 * testing, because usually there are a number of false positives 111 * a thread that is bound to the current CPU.)
116 * that an architecture will trigger.
117 * 112 *
118 * To fix a false positive (i.e. smp_processor_id() use that the 113 * NOTE: raw_smp_processor_id() is for internal use only
119 * debugging code reports but which use for some reason is legal), 114 * (smp_processor_id() is the preferred variant), but in rare
120 * change the smp_processor_id() reference to _smp_processor_id(), 115 * instances it might also be used to turn off false positives
121 * which is the nondebug variant. NOTE: don't use this to hack around 116 * (i.e. smp_processor_id() use that the debugging code reports but
122 * real bugs. 117 * which use for some reason is legal). Don't use this to hack around
118 * the warning message, as your code might not work under PREEMPT.
123 */ 119 */
124#ifdef __smp_processor_id 120#ifdef CONFIG_DEBUG_PREEMPT
125# if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT) 121 extern unsigned int debug_smp_processor_id(void);
126 extern unsigned int smp_processor_id(void); 122# define smp_processor_id() debug_smp_processor_id()
127# else
128# define smp_processor_id() __smp_processor_id()
129# endif
130# define _smp_processor_id() __smp_processor_id()
131#else 123#else
132# define _smp_processor_id() smp_processor_id() 124# define smp_processor_id() raw_smp_processor_id()
133#endif 125#endif
134 126
135#define get_cpu() ({ preempt_disable(); smp_processor_id(); }) 127#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
diff --git a/include/linux/string.h b/include/linux/string.h
index b9fc59469956..93994c613095 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -88,6 +88,8 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
88extern void * memchr(const void *,int,__kernel_size_t); 88extern void * memchr(const void *,int,__kernel_size_t);
89#endif 89#endif
90 90
91extern char *kstrdup(const char *s, int gfp);
92
91#ifdef __cplusplus 93#ifdef __cplusplus
92} 94}
93#endif 95#endif
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 2709caf4d128..ab151bbb66df 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -111,6 +111,11 @@ struct rpc_procinfo {
111struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, 111struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname,
112 struct rpc_program *info, 112 struct rpc_program *info,
113 u32 version, rpc_authflavor_t authflavor); 113 u32 version, rpc_authflavor_t authflavor);
114struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname,
115 struct rpc_program *info,
116 u32 version, rpc_authflavor_t authflavor);
117struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
118 struct rpc_program *, int);
114struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 119struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
115int rpc_shutdown_client(struct rpc_clnt *); 120int rpc_shutdown_client(struct rpc_clnt *);
116int rpc_destroy_client(struct rpc_clnt *); 121int rpc_destroy_client(struct rpc_clnt *);
@@ -129,6 +134,7 @@ void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset);
129void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset); 134void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset);
130void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 135void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
131size_t rpc_max_payload(struct rpc_clnt *); 136size_t rpc_max_payload(struct rpc_clnt *);
137int rpc_ping(struct rpc_clnt *clnt, int flags);
132 138
133static __inline__ 139static __inline__
134int rpc_call(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags) 140int rpc_call(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags)
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 99d17ed7cebb..4d77e90d0b30 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -31,7 +31,6 @@ struct rpc_wait_queue;
31struct rpc_wait { 31struct rpc_wait {
32 struct list_head list; /* wait queue links */ 32 struct list_head list; /* wait queue links */
33 struct list_head links; /* Links to related tasks */ 33 struct list_head links; /* Links to related tasks */
34 wait_queue_head_t waitq; /* sync: sleep on this q */
35 struct rpc_wait_queue * rpc_waitq; /* RPC wait queue we're on */ 34 struct rpc_wait_queue * rpc_waitq; /* RPC wait queue we're on */
36}; 35};
37 36
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 37003970cf2e..5af8800e0ce3 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -185,6 +185,17 @@ xdr_ressize_check(struct svc_rqst *rqstp, u32 *p)
185 return vec->iov_len <= PAGE_SIZE; 185 return vec->iov_len <= PAGE_SIZE;
186} 186}
187 187
188static inline struct page *
189svc_take_res_page(struct svc_rqst *rqstp)
190{
191 if (rqstp->rq_arghi <= rqstp->rq_argused)
192 return NULL;
193 rqstp->rq_arghi--;
194 rqstp->rq_respages[rqstp->rq_resused] =
195 rqstp->rq_argpages[rqstp->rq_arghi];
196 return rqstp->rq_respages[rqstp->rq_resused++];
197}
198
188static inline int svc_take_page(struct svc_rqst *rqstp) 199static inline int svc_take_page(struct svc_rqst *rqstp)
189{ 200{
190 if (rqstp->rq_arghi <= rqstp->rq_argused) 201 if (rqstp->rq_arghi <= rqstp->rq_argused)
@@ -240,9 +251,10 @@ struct svc_deferred_req {
240}; 251};
241 252
242/* 253/*
243 * RPC program 254 * List of RPC programs on the same transport endpoint
244 */ 255 */
245struct svc_program { 256struct svc_program {
257 struct svc_program * pg_next; /* other programs (same xprt) */
246 u32 pg_prog; /* program number */ 258 u32 pg_prog; /* program number */
247 unsigned int pg_lovers; /* lowest version */ 259 unsigned int pg_lovers; /* lowest version */
248 unsigned int pg_hivers; /* lowest version */ 260 unsigned int pg_hivers; /* lowest version */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 541dcf838abf..34ec3e8d99b3 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -146,7 +146,8 @@ extern void xdr_shift_buf(struct xdr_buf *, size_t);
146extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *); 146extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *);
147extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, int, int); 147extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, int, int);
148extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, int); 148extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, int);
149extern int read_bytes_from_xdr_buf(struct xdr_buf *buf, int base, void *obj, int len); 149extern int read_bytes_from_xdr_buf(struct xdr_buf *, int, void *, int);
150extern int write_bytes_to_xdr_buf(struct xdr_buf *, int, void *, int);
150 151
151/* 152/*
152 * Helper structure for copying from an sk_buff. 153 * Helper structure for copying from an sk_buff.
@@ -160,7 +161,7 @@ typedef struct {
160 161
161typedef size_t (*skb_read_actor_t)(skb_reader_t *desc, void *to, size_t len); 162typedef size_t (*skb_read_actor_t)(skb_reader_t *desc, void *to, size_t len);
162 163
163extern void xdr_partial_copy_from_skb(struct xdr_buf *, unsigned int, 164extern ssize_t xdr_partial_copy_from_skb(struct xdr_buf *, unsigned int,
164 skb_reader_t *, skb_read_actor_t); 165 skb_reader_t *, skb_read_actor_t);
165 166
166struct socket; 167struct socket;
@@ -168,6 +169,22 @@ struct sockaddr;
168extern int xdr_sendpages(struct socket *, struct sockaddr *, int, 169extern int xdr_sendpages(struct socket *, struct sockaddr *, int,
169 struct xdr_buf *, unsigned int, int); 170 struct xdr_buf *, unsigned int, int);
170 171
172extern int xdr_encode_word(struct xdr_buf *, int, u32);
173extern int xdr_decode_word(struct xdr_buf *, int, u32 *);
174
175struct xdr_array2_desc;
176typedef int (*xdr_xcode_elem_t)(struct xdr_array2_desc *desc, void *elem);
177struct xdr_array2_desc {
178 unsigned int elem_size;
179 unsigned int array_len;
180 xdr_xcode_elem_t xcode;
181};
182
183extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base,
184 struct xdr_array2_desc *desc);
185extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
186 struct xdr_array2_desc *desc);
187
171/* 188/*
172 * Provide some simple tools for XDR buffer overflow-checking etc. 189 * Provide some simple tools for XDR buffer overflow-checking etc.
173 */ 190 */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 2bf0d5fabcdb..f2e96fdfaae0 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -58,7 +58,7 @@ static inline int software_suspend(void)
58} 58}
59#endif 59#endif
60 60
61#ifdef CONFIG_SMP 61#ifdef CONFIG_SUSPEND_SMP
62extern void disable_nonboot_cpus(void); 62extern void disable_nonboot_cpus(void);
63extern void enable_nonboot_cpus(void); 63extern void enable_nonboot_cpus(void);
64#else 64#else
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 3bbc41be9bd0..2343f999e6e1 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -172,7 +172,8 @@ extern int rotate_reclaimable_page(struct page *page);
172extern void swap_setup(void); 172extern void swap_setup(void);
173 173
174/* linux/mm/vmscan.c */ 174/* linux/mm/vmscan.c */
175extern int try_to_free_pages(struct zone **, unsigned int, unsigned int); 175extern int try_to_free_pages(struct zone **, unsigned int);
176extern int zone_reclaim(struct zone *, unsigned int, unsigned int);
176extern int shrink_all_memory(int); 177extern int shrink_all_memory(int);
177extern int vm_swappiness; 178extern int vm_swappiness;
178 179
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c39f6f72cbbc..52830b6d94e5 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -159,8 +159,9 @@ asmlinkage long sys_shutdown(int, int);
159asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, 159asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd,
160 void __user *arg); 160 void __user *arg);
161asmlinkage long sys_restart_syscall(void); 161asmlinkage long sys_restart_syscall(void);
162asmlinkage long sys_kexec_load(void *entry, unsigned long nr_segments, 162asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
163 struct kexec_segment *segments, unsigned long flags); 163 struct kexec_segment __user *segments,
164 unsigned long flags);
164 165
165asmlinkage long sys_exit(int error_code); 166asmlinkage long sys_exit(int error_code);
166asmlinkage void sys_exit_group(int error_code); 167asmlinkage void sys_exit_group(int error_code);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 772998147e3e..ebfe1250f0a4 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -136,6 +136,7 @@ enum
136 KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */ 136 KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
137 KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ 137 KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
138 KERN_RANDOMIZE=68, /* int: randomize virtual address space */ 138 KERN_RANDOMIZE=68, /* int: randomize virtual address space */
139 KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
139}; 140};
140 141
141 142
@@ -242,6 +243,7 @@ enum
242 NET_CORE_MOD_CONG=16, 243 NET_CORE_MOD_CONG=16,
243 NET_CORE_DEV_WEIGHT=17, 244 NET_CORE_DEV_WEIGHT=17,
244 NET_CORE_SOMAXCONN=18, 245 NET_CORE_SOMAXCONN=18,
246 NET_CORE_BUDGET=19,
245}; 247};
246 248
247/* /proc/sys/net/ethernet */ 249/* /proc/sys/net/ethernet */
@@ -332,20 +334,14 @@ enum
332 NET_TCP_FRTO=92, 334 NET_TCP_FRTO=92,
333 NET_TCP_LOW_LATENCY=93, 335 NET_TCP_LOW_LATENCY=93,
334 NET_IPV4_IPFRAG_SECRET_INTERVAL=94, 336 NET_IPV4_IPFRAG_SECRET_INTERVAL=94,
335 NET_TCP_WESTWOOD=95,
336 NET_IPV4_IGMP_MAX_MSF=96, 337 NET_IPV4_IGMP_MAX_MSF=96,
337 NET_TCP_NO_METRICS_SAVE=97, 338 NET_TCP_NO_METRICS_SAVE=97,
338 NET_TCP_VEGAS=98,
339 NET_TCP_VEGAS_ALPHA=99,
340 NET_TCP_VEGAS_BETA=100,
341 NET_TCP_VEGAS_GAMMA=101,
342 NET_TCP_BIC=102,
343 NET_TCP_BIC_FAST_CONVERGENCE=103,
344 NET_TCP_BIC_LOW_WINDOW=104,
345 NET_TCP_DEFAULT_WIN_SCALE=105, 339 NET_TCP_DEFAULT_WIN_SCALE=105,
346 NET_TCP_MODERATE_RCVBUF=106, 340 NET_TCP_MODERATE_RCVBUF=106,
347 NET_TCP_TSO_WIN_DIVISOR=107, 341 NET_TCP_TSO_WIN_DIVISOR=107,
348 NET_TCP_BIC_BETA=108, 342 NET_TCP_BIC_BETA=108,
343 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
344 NET_TCP_CONG_CONTROL=110,
349}; 345};
350 346
351enum { 347enum {
@@ -399,6 +395,7 @@ enum
399 NET_IPV4_CONF_FORCE_IGMP_VERSION=17, 395 NET_IPV4_CONF_FORCE_IGMP_VERSION=17,
400 NET_IPV4_CONF_ARP_ANNOUNCE=18, 396 NET_IPV4_CONF_ARP_ANNOUNCE=18,
401 NET_IPV4_CONF_ARP_IGNORE=19, 397 NET_IPV4_CONF_ARP_IGNORE=19,
398 NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
402 __NET_IPV4_CONF_MAX 399 __NET_IPV4_CONF_MAX
403}; 400};
404 401
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 38b58b30814a..392da5a6dacb 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -16,13 +16,13 @@ struct kobject;
16struct module; 16struct module;
17 17
18struct attribute { 18struct attribute {
19 char * name; 19 const char * name;
20 struct module * owner; 20 struct module * owner;
21 mode_t mode; 21 mode_t mode;
22}; 22};
23 23
24struct attribute_group { 24struct attribute_group {
25 char * name; 25 const char * name;
26 struct attribute ** attrs; 26 struct attribute ** attrs;
27}; 27};
28 28
@@ -73,6 +73,7 @@ struct sysfs_dirent {
73 int s_type; 73 int s_type;
74 umode_t s_mode; 74 umode_t s_mode;
75 struct dentry * s_dentry; 75 struct dentry * s_dentry;
76 struct iattr * s_iattr;
76}; 77};
77 78
78#define SYSFS_ROOT 0x0001 79#define SYSFS_ROOT 0x0001
@@ -105,11 +106,11 @@ sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode);
105extern void 106extern void
106sysfs_remove_file(struct kobject *, const struct attribute *); 107sysfs_remove_file(struct kobject *, const struct attribute *);
107 108
108extern int 109extern int
109sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name); 110sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name);
110 111
111extern void 112extern void
112sysfs_remove_link(struct kobject *, char * name); 113sysfs_remove_link(struct kobject *, const char * name);
113 114
114int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); 115int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr);
115int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); 116int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr);
@@ -153,12 +154,12 @@ static inline void sysfs_remove_file(struct kobject * k, const struct attribute
153 ; 154 ;
154} 155}
155 156
156static inline int sysfs_create_link(struct kobject * k, struct kobject * t, char * n) 157static inline int sysfs_create_link(struct kobject * k, struct kobject * t, const char * n)
157{ 158{
158 return 0; 159 return 0;
159} 160}
160 161
161static inline void sysfs_remove_link(struct kobject * k, char * name) 162static inline void sysfs_remove_link(struct kobject * k, const char * name)
162{ 163{
163 ; 164 ;
164} 165}
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h
index aa6b48bb4dcd..a6b2cc530af5 100644
--- a/include/linux/tc_ematch/tc_em_meta.h
+++ b/include/linux/tc_ematch/tc_em_meta.h
@@ -56,6 +56,36 @@ enum
56 TCF_META_ID_TCCLASSID, 56 TCF_META_ID_TCCLASSID,
57 TCF_META_ID_RTCLASSID, 57 TCF_META_ID_RTCLASSID,
58 TCF_META_ID_RTIIF, 58 TCF_META_ID_RTIIF,
59 TCF_META_ID_SK_FAMILY,
60 TCF_META_ID_SK_STATE,
61 TCF_META_ID_SK_REUSE,
62 TCF_META_ID_SK_BOUND_IF,
63 TCF_META_ID_SK_REFCNT,
64 TCF_META_ID_SK_SHUTDOWN,
65 TCF_META_ID_SK_PROTO,
66 TCF_META_ID_SK_TYPE,
67 TCF_META_ID_SK_RCVBUF,
68 TCF_META_ID_SK_RMEM_ALLOC,
69 TCF_META_ID_SK_WMEM_ALLOC,
70 TCF_META_ID_SK_OMEM_ALLOC,
71 TCF_META_ID_SK_WMEM_QUEUED,
72 TCF_META_ID_SK_RCV_QLEN,
73 TCF_META_ID_SK_SND_QLEN,
74 TCF_META_ID_SK_ERR_QLEN,
75 TCF_META_ID_SK_FORWARD_ALLOCS,
76 TCF_META_ID_SK_SNDBUF,
77 TCF_META_ID_SK_ALLOCS,
78 TCF_META_ID_SK_ROUTE_CAPS,
79 TCF_META_ID_SK_HASHENT,
80 TCF_META_ID_SK_LINGERTIME,
81 TCF_META_ID_SK_ACK_BACKLOG,
82 TCF_META_ID_SK_MAX_ACK_BACKLOG,
83 TCF_META_ID_SK_PRIO,
84 TCF_META_ID_SK_RCVLOWAT,
85 TCF_META_ID_SK_RCVTIMEO,
86 TCF_META_ID_SK_SNDTIMEO,
87 TCF_META_ID_SK_SENDMSG_OFF,
88 TCF_META_ID_SK_WRITE_PENDING,
59 __TCF_META_ID_MAX 89 __TCF_META_ID_MAX
60}; 90};
61#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) 91#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1)
diff --git a/include/linux/tc_ematch/tc_em_text.h b/include/linux/tc_ematch/tc_em_text.h
new file mode 100644
index 000000000000..7cd43e99c7f5
--- /dev/null
+++ b/include/linux/tc_ematch/tc_em_text.h
@@ -0,0 +1,19 @@
1#ifndef __LINUX_TC_EM_TEXT_H
2#define __LINUX_TC_EM_TEXT_H
3
4#include <linux/pkt_cls.h>
5
6#define TC_EM_TEXT_ALGOSIZ 16
7
8struct tcf_em_text
9{
10 char algo[TC_EM_TEXT_ALGOSIZ];
11 __u16 from_offset;
12 __u16 to_offset;
13 __u16 pattern_len;
14 __u8 from_layer:4;
15 __u8 to_layer:4;
16 __u8 pad;
17};
18
19#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 14a55e3e3a50..dfd93d03f5d2 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -127,6 +127,7 @@ enum {
127#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ 127#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
128#define TCP_INFO 11 /* Information about this connection. */ 128#define TCP_INFO 11 /* Information about this connection. */
129#define TCP_QUICKACK 12 /* Block/reenable quick acks */ 129#define TCP_QUICKACK 12 /* Block/reenable quick acks */
130#define TCP_CONGESTION 13 /* Congestion control algorithm */
130 131
131#define TCPI_OPT_TIMESTAMPS 1 132#define TCPI_OPT_TIMESTAMPS 1
132#define TCPI_OPT_SACK 2 133#define TCPI_OPT_SACK 2
@@ -203,13 +204,6 @@ struct tcp_sack_block {
203 __u32 end_seq; 204 __u32 end_seq;
204}; 205};
205 206
206enum tcp_congestion_algo {
207 TCP_RENO=0,
208 TCP_VEGAS,
209 TCP_WESTWOOD,
210 TCP_BIC,
211};
212
213struct tcp_options_received { 207struct tcp_options_received {
214/* PAWS/RTTM data */ 208/* PAWS/RTTM data */
215 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ 209 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
@@ -230,6 +224,17 @@ struct tcp_options_received {
230 __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ 224 __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
231}; 225};
232 226
227struct tcp_request_sock {
228 struct inet_request_sock req;
229 __u32 rcv_isn;
230 __u32 snt_isn;
231};
232
233static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
234{
235 return (struct tcp_request_sock *)req;
236}
237
233struct tcp_sock { 238struct tcp_sock {
234 /* inet_sock has to be the first member of tcp_sock */ 239 /* inet_sock has to be the first member of tcp_sock */
235 struct inet_sock inet; 240 struct inet_sock inet;
@@ -294,7 +299,7 @@ struct tcp_sock {
294 __u8 reordering; /* Packet reordering metric. */ 299 __u8 reordering; /* Packet reordering metric. */
295 __u8 frto_counter; /* Number of new acks after RTO */ 300 __u8 frto_counter; /* Number of new acks after RTO */
296 301
297 __u8 adv_cong; /* Using Vegas, Westwood, or BIC */ 302 __u8 unused;
298 __u8 defer_accept; /* User waits for some data after accept() */ 303 __u8 defer_accept; /* User waits for some data after accept() */
299 304
300/* RTT measurement */ 305/* RTT measurement */
@@ -368,22 +373,7 @@ struct tcp_sock {
368 373
369 __u32 total_retrans; /* Total retransmits for entire connection */ 374 __u32 total_retrans; /* Total retransmits for entire connection */
370 375
371 /* The syn_wait_lock is necessary only to avoid proc interface having 376 struct request_sock_queue accept_queue; /* FIFO of established children */
372 * to grab the main lock sock while browsing the listening hash
373 * (otherwise it's deadlock prone).
374 * This lock is acquired in read mode only from listening_get_next()
375 * and it's acquired in write mode _only_ from code that is actively
376 * changing the syn_wait_queue. All readers that are holding
377 * the master sock lock don't need to grab this lock in read mode
378 * too as the syn_wait_queue writes are always protected from
379 * the main sock lock.
380 */
381 rwlock_t syn_wait_lock;
382 struct tcp_listen_opt *listen_opt;
383
384 /* FIFO of established children */
385 struct open_request *accept_queue;
386 struct open_request *accept_queue_tail;
387 377
388 unsigned int keepalive_time; /* time before keep alive takes place */ 378 unsigned int keepalive_time; /* time before keep alive takes place */
389 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 379 unsigned int keepalive_intvl; /* time interval between keep alive probes */
@@ -405,37 +395,10 @@ struct tcp_sock {
405 __u32 time; 395 __u32 time;
406 } rcvq_space; 396 } rcvq_space;
407 397
408/* TCP Westwood structure */ 398 /* Pluggable TCP congestion control hook */
409 struct { 399 struct tcp_congestion_ops *ca_ops;
410 __u32 bw_ns_est; /* first bandwidth estimation..not too smoothed 8) */ 400 u32 ca_priv[16];
411 __u32 bw_est; /* bandwidth estimate */ 401#define TCP_CA_PRIV_SIZE (16*sizeof(u32))
412 __u32 rtt_win_sx; /* here starts a new evaluation... */
413 __u32 bk;
414 __u32 snd_una; /* used for evaluating the number of acked bytes */
415 __u32 cumul_ack;
416 __u32 accounted;
417 __u32 rtt;
418 __u32 rtt_min; /* minimum observed RTT */
419 } westwood;
420
421/* Vegas variables */
422 struct {
423 __u32 beg_snd_nxt; /* right edge during last RTT */
424 __u32 beg_snd_una; /* left edge during last RTT */
425 __u32 beg_snd_cwnd; /* saves the size of the cwnd */
426 __u8 doing_vegas_now;/* if true, do vegas for this RTT */
427 __u16 cntRTT; /* # of RTTs measured within last RTT */
428 __u32 minRTT; /* min of RTTs measured within last RTT (in usec) */
429 __u32 baseRTT; /* the min of all Vegas RTT measurements seen (in usec) */
430 } vegas;
431
432 /* BI TCP Parameters */
433 struct {
434 __u32 cnt; /* increase cwnd by 1 after this number of ACKs */
435 __u32 last_max_cwnd; /* last maximium snd_cwnd */
436 __u32 last_cwnd; /* the last snd_cwnd */
437 __u32 last_stamp; /* time when updated last_cwnd */
438 } bictcp;
439}; 402};
440 403
441static inline struct tcp_sock *tcp_sk(const struct sock *sk) 404static inline struct tcp_sock *tcp_sk(const struct sock *sk)
@@ -443,6 +406,11 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk)
443 return (struct tcp_sock *)sk; 406 return (struct tcp_sock *)sk;
444} 407}
445 408
409static inline void *tcp_ca(const struct tcp_sock *tp)
410{
411 return (void *) tp->ca_priv;
412}
413
446#endif 414#endif
447 415
448#endif /* _LINUX_TCP_H */ 416#endif /* _LINUX_TCP_H */
diff --git a/include/linux/tcp_diag.h b/include/linux/tcp_diag.h
index ceee962e1d15..7a5996743946 100644
--- a/include/linux/tcp_diag.h
+++ b/include/linux/tcp_diag.h
@@ -99,9 +99,10 @@ enum
99 TCPDIAG_MEMINFO, 99 TCPDIAG_MEMINFO,
100 TCPDIAG_INFO, 100 TCPDIAG_INFO,
101 TCPDIAG_VEGASINFO, 101 TCPDIAG_VEGASINFO,
102 TCPDIAG_CONG,
102}; 103};
103 104
104#define TCPDIAG_MAX TCPDIAG_VEGASINFO 105#define TCPDIAG_MAX TCPDIAG_CONG
105 106
106 107
107/* TCPDIAG_MEM */ 108/* TCPDIAG_MEM */
@@ -123,5 +124,4 @@ struct tcpvegas_info {
123 __u32 tcpv_minrtt; 124 __u32 tcpv_minrtt;
124}; 125};
125 126
126
127#endif /* _TCP_DIAG_H_ */ 127#endif /* _TCP_DIAG_H_ */
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h
new file mode 100644
index 000000000000..941f45ac117a
--- /dev/null
+++ b/include/linux/textsearch.h
@@ -0,0 +1,180 @@
1#ifndef __LINUX_TEXTSEARCH_H
2#define __LINUX_TEXTSEARCH_H
3
4#ifdef __KERNEL__
5
6#include <linux/types.h>
7#include <linux/list.h>
8#include <linux/kernel.h>
9#include <linux/module.h>
10#include <linux/err.h>
11
12struct ts_config;
13
14/**
15 * TS_AUTOLOAD - Automatically load textsearch modules when needed
16 */
17#define TS_AUTOLOAD 1
18
19/**
20 * struct ts_state - search state
21 * @offset: offset for next match
22 * @cb: control buffer, for persistant variables of get_next_block()
23 */
24struct ts_state
25{
26 unsigned int offset;
27 char cb[40];
28};
29
30/**
31 * struct ts_ops - search module operations
32 * @name: name of search algorithm
33 * @init: initialization function to prepare a search
34 * @find: find the next occurrence of the pattern
35 * @destroy: destroy algorithm specific parts of a search configuration
36 * @get_pattern: return head of pattern
37 * @get_pattern_len: return length of pattern
38 * @owner: module reference to algorithm
39 */
40struct ts_ops
41{
42 const char *name;
43 struct ts_config * (*init)(const void *, unsigned int, int);
44 unsigned int (*find)(struct ts_config *,
45 struct ts_state *);
46 void (*destroy)(struct ts_config *);
47 void * (*get_pattern)(struct ts_config *);
48 unsigned int (*get_pattern_len)(struct ts_config *);
49 struct module *owner;
50 struct list_head list;
51};
52
53/**
54 * struct ts_config - search configuration
55 * @ops: operations of chosen algorithm
56 * @get_next_block: callback to fetch the next block to search in
57 * @finish: callback to finalize a search
58 */
59struct ts_config
60{
61 struct ts_ops *ops;
62
63 /**
64 * get_next_block - fetch next block of data
65 * @consumed: number of bytes consumed by the caller
66 * @dst: destination buffer
67 * @conf: search configuration
68 * @state: search state
69 *
70 * Called repeatedly until 0 is returned. Must assign the
71 * head of the next block of data to &*dst and return the length
72 * of the block or 0 if at the end. consumed == 0 indicates
73 * a new search. May store/read persistant values in state->cb.
74 */
75 unsigned int (*get_next_block)(unsigned int consumed,
76 const u8 **dst,
77 struct ts_config *conf,
78 struct ts_state *state);
79
80 /**
81 * finish - finalize/clean a series of get_next_block() calls
82 * @conf: search configuration
83 * @state: search state
84 *
85 * Called after the last use of get_next_block(), may be used
86 * to cleanup any leftovers.
87 */
88 void (*finish)(struct ts_config *conf,
89 struct ts_state *state);
90};
91
92/**
93 * textsearch_next - continue searching for a pattern
94 * @conf: search configuration
95 * @state: search state
96 *
97 * Continues a search looking for more occurrences of the pattern.
98 * textsearch_find() must be called to find the first occurrence
99 * in order to reset the state.
100 *
101 * Returns the position of the next occurrence of the pattern or
102 * UINT_MAX if not match was found.
103 */
104static inline unsigned int textsearch_next(struct ts_config *conf,
105 struct ts_state *state)
106{
107 unsigned int ret = conf->ops->find(conf, state);
108
109 if (conf->finish)
110 conf->finish(conf, state);
111
112 return ret;
113}
114
115/**
116 * textsearch_find - start searching for a pattern
117 * @conf: search configuration
118 * @state: search state
119 *
120 * Returns the position of first occurrence of the pattern or
121 * UINT_MAX if no match was found.
122 */
123static inline unsigned int textsearch_find(struct ts_config *conf,
124 struct ts_state *state)
125{
126 state->offset = 0;
127 return textsearch_next(conf, state);
128}
129
130/**
131 * textsearch_get_pattern - return head of the pattern
132 * @conf: search configuration
133 */
134static inline void *textsearch_get_pattern(struct ts_config *conf)
135{
136 return conf->ops->get_pattern(conf);
137}
138
139/**
140 * textsearch_get_pattern_len - return length of the pattern
141 * @conf: search configuration
142 */
143static inline unsigned int textsearch_get_pattern_len(struct ts_config *conf)
144{
145 return conf->ops->get_pattern_len(conf);
146}
147
148extern int textsearch_register(struct ts_ops *);
149extern int textsearch_unregister(struct ts_ops *);
150extern struct ts_config *textsearch_prepare(const char *, const void *,
151 unsigned int, int, int);
152extern void textsearch_destroy(struct ts_config *conf);
153extern unsigned int textsearch_find_continuous(struct ts_config *,
154 struct ts_state *,
155 const void *, unsigned int);
156
157
158#define TS_PRIV_ALIGNTO 8
159#define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1))
160
161static inline struct ts_config *alloc_ts_config(size_t payload, int gfp_mask)
162{
163 struct ts_config *conf;
164
165 conf = kmalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask);
166 if (conf == NULL)
167 return ERR_PTR(-ENOMEM);
168
169 memset(conf, 0, TS_PRIV_ALIGN(sizeof(*conf)) + payload);
170 return conf;
171}
172
173static inline void *ts_config_priv(struct ts_config *conf)
174{
175 return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config)));
176}
177
178#endif /* __KERNEL__ */
179
180#endif
diff --git a/include/linux/textsearch_fsm.h b/include/linux/textsearch_fsm.h
new file mode 100644
index 000000000000..fdfa078c66e5
--- /dev/null
+++ b/include/linux/textsearch_fsm.h
@@ -0,0 +1,48 @@
1#ifndef __LINUX_TEXTSEARCH_FSM_H
2#define __LINUX_TEXTSEARCH_FSM_H
3
4#include <linux/types.h>
5
6enum {
7 TS_FSM_SPECIFIC, /* specific character */
8 TS_FSM_WILDCARD, /* any character */
9 TS_FSM_DIGIT, /* isdigit() */
10 TS_FSM_XDIGIT, /* isxdigit() */
11 TS_FSM_PRINT, /* isprint() */
12 TS_FSM_ALPHA, /* isalpha() */
13 TS_FSM_ALNUM, /* isalnum() */
14 TS_FSM_ASCII, /* isascii() */
15 TS_FSM_CNTRL, /* iscntrl() */
16 TS_FSM_GRAPH, /* isgraph() */
17 TS_FSM_LOWER, /* islower() */
18 TS_FSM_UPPER, /* isupper() */
19 TS_FSM_PUNCT, /* ispunct() */
20 TS_FSM_SPACE, /* isspace() */
21 __TS_FSM_TYPE_MAX,
22};
23#define TS_FSM_TYPE_MAX (__TS_FSM_TYPE_MAX - 1)
24
25enum {
26 TS_FSM_SINGLE, /* 1 occurrence */
27 TS_FSM_PERHAPS, /* 1 or 0 occurrence */
28 TS_FSM_ANY, /* 0..n occurrences */
29 TS_FSM_MULTI, /* 1..n occurrences */
30 TS_FSM_HEAD_IGNORE, /* 0..n ignored occurrences at head */
31 __TS_FSM_RECUR_MAX,
32};
33#define TS_FSM_RECUR_MAX (__TS_FSM_RECUR_MAX - 1)
34
35/**
36 * struct ts_fsm_token - state machine token (state)
37 * @type: type of token
38 * @recur: number of recurrences
39 * @value: character value for TS_FSM_SPECIFIC
40 */
41struct ts_fsm_token
42{
43 __u16 type;
44 __u8 recur;
45 __u8 value;
46};
47
48#endif
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 90db1cc62ddd..221f81ac2002 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -6,45 +6,33 @@
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/stddef.h> 7#include <linux/stddef.h>
8 8
9struct tvec_t_base_s; 9struct timer_base_s;
10 10
11struct timer_list { 11struct timer_list {
12 struct list_head entry; 12 struct list_head entry;
13 unsigned long expires; 13 unsigned long expires;
14 14
15 spinlock_t lock;
16 unsigned long magic; 15 unsigned long magic;
17 16
18 void (*function)(unsigned long); 17 void (*function)(unsigned long);
19 unsigned long data; 18 unsigned long data;
20 19
21 struct tvec_t_base_s *base; 20 struct timer_base_s *base;
22}; 21};
23 22
24#define TIMER_MAGIC 0x4b87ad6e 23#define TIMER_MAGIC 0x4b87ad6e
25 24
25extern struct timer_base_s __init_timer_base;
26
26#define TIMER_INITIALIZER(_function, _expires, _data) { \ 27#define TIMER_INITIALIZER(_function, _expires, _data) { \
27 .function = (_function), \ 28 .function = (_function), \
28 .expires = (_expires), \ 29 .expires = (_expires), \
29 .data = (_data), \ 30 .data = (_data), \
30 .base = NULL, \ 31 .base = &__init_timer_base, \
31 .magic = TIMER_MAGIC, \ 32 .magic = TIMER_MAGIC, \
32 .lock = SPIN_LOCK_UNLOCKED, \
33 } 33 }
34 34
35/*** 35void fastcall init_timer(struct timer_list * timer);
36 * init_timer - initialize a timer.
37 * @timer: the timer to be initialized
38 *
39 * init_timer() must be done to a timer prior calling *any* of the
40 * other timer functions.
41 */
42static inline void init_timer(struct timer_list * timer)
43{
44 timer->base = NULL;
45 timer->magic = TIMER_MAGIC;
46 spin_lock_init(&timer->lock);
47}
48 36
49/*** 37/***
50 * timer_pending - is a timer pending? 38 * timer_pending - is a timer pending?
@@ -58,7 +46,7 @@ static inline void init_timer(struct timer_list * timer)
58 */ 46 */
59static inline int timer_pending(const struct timer_list * timer) 47static inline int timer_pending(const struct timer_list * timer)
60{ 48{
61 return timer->base != NULL; 49 return timer->entry.next != NULL;
62} 50}
63 51
64extern void add_timer_on(struct timer_list *timer, int cpu); 52extern void add_timer_on(struct timer_list *timer, int cpu);
@@ -88,13 +76,15 @@ static inline void add_timer(struct timer_list * timer)
88} 76}
89 77
90#ifdef CONFIG_SMP 78#ifdef CONFIG_SMP
79 extern int try_to_del_timer_sync(struct timer_list *timer);
91 extern int del_timer_sync(struct timer_list *timer); 80 extern int del_timer_sync(struct timer_list *timer);
92 extern int del_singleshot_timer_sync(struct timer_list *timer);
93#else 81#else
94# define del_timer_sync(t) del_timer(t) 82# define try_to_del_timer_sync(t) del_timer(t)
95# define del_singleshot_timer_sync(t) del_timer(t) 83# define del_timer_sync(t) del_timer(t)
96#endif 84#endif
97 85
86#define del_singleshot_timer_sync(t) del_timer_sync(t)
87
98extern void init_timers(void); 88extern void init_timers(void);
99extern void run_local_timers(void); 89extern void run_local_timers(void);
100extern void it_real_fn(unsigned long); 90extern void it_real_fn(unsigned long);
diff --git a/include/linux/topology.h b/include/linux/topology.h
index d70e8972c67f..0320225e96da 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -89,6 +89,11 @@
89 .cache_hot_time = 0, \ 89 .cache_hot_time = 0, \
90 .cache_nice_tries = 0, \ 90 .cache_nice_tries = 0, \
91 .per_cpu_gain = 25, \ 91 .per_cpu_gain = 25, \
92 .busy_idx = 0, \
93 .idle_idx = 0, \
94 .newidle_idx = 1, \
95 .wake_idx = 0, \
96 .forkexec_idx = 0, \
92 .flags = SD_LOAD_BALANCE \ 97 .flags = SD_LOAD_BALANCE \
93 | SD_BALANCE_NEWIDLE \ 98 | SD_BALANCE_NEWIDLE \
94 | SD_BALANCE_EXEC \ 99 | SD_BALANCE_EXEC \
@@ -115,12 +120,15 @@
115 .cache_hot_time = (5*1000000/2), \ 120 .cache_hot_time = (5*1000000/2), \
116 .cache_nice_tries = 1, \ 121 .cache_nice_tries = 1, \
117 .per_cpu_gain = 100, \ 122 .per_cpu_gain = 100, \
123 .busy_idx = 2, \
124 .idle_idx = 1, \
125 .newidle_idx = 2, \
126 .wake_idx = 1, \
127 .forkexec_idx = 1, \
118 .flags = SD_LOAD_BALANCE \ 128 .flags = SD_LOAD_BALANCE \
119 | SD_BALANCE_NEWIDLE \ 129 | SD_BALANCE_NEWIDLE \
120 | SD_BALANCE_EXEC \ 130 | SD_BALANCE_EXEC \
121 | SD_WAKE_AFFINE \ 131 | SD_WAKE_AFFINE, \
122 | SD_WAKE_IDLE \
123 | SD_WAKE_BALANCE, \
124 .last_balance = jiffies, \ 132 .last_balance = jiffies, \
125 .balance_interval = 1, \ 133 .balance_interval = 1, \
126 .nr_balance_failed = 0, \ 134 .nr_balance_failed = 0, \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1b76106272d3..59ff42c629ec 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -345,6 +345,7 @@ extern int tty_check_change(struct tty_struct * tty);
345extern void stop_tty(struct tty_struct * tty); 345extern void stop_tty(struct tty_struct * tty);
346extern void start_tty(struct tty_struct * tty); 346extern void start_tty(struct tty_struct * tty);
347extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc); 347extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
348extern int tty_unregister_ldisc(int disc);
348extern int tty_register_driver(struct tty_driver *driver); 349extern int tty_register_driver(struct tty_driver *driver);
349extern int tty_unregister_driver(struct tty_driver *driver); 350extern int tty_unregister_driver(struct tty_driver *driver);
350extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev); 351extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 41d1a644c9d4..eb282b581546 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -287,15 +287,14 @@ struct usb_bus {
287 287
288 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 288 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
289 289
290 struct class_device class_dev; /* class device for this bus */ 290 struct class_device *class_dev; /* class device for this bus */
291 struct kref kref; /* handles reference counting this bus */
291 void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */ 292 void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */
292#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 293#if defined(CONFIG_USB_MON)
293 struct mon_bus *mon_bus; /* non-null when associated */ 294 struct mon_bus *mon_bus; /* non-null when associated */
294 int monitored; /* non-zero when monitored */ 295 int monitored; /* non-zero when monitored */
295#endif 296#endif
296}; 297};
297#define to_usb_bus(d) container_of(d, struct usb_bus, class_dev)
298
299 298
300/* -------------------------------------------------------------------------- */ 299/* -------------------------------------------------------------------------- */
301 300
@@ -796,6 +795,10 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
796 * of the iso_frame_desc array, and the number of errors is reported in 795 * of the iso_frame_desc array, and the number of errors is reported in
797 * error_count. Completion callbacks for ISO transfers will normally 796 * error_count. Completion callbacks for ISO transfers will normally
798 * (re)submit URBs to ensure a constant transfer rate. 797 * (re)submit URBs to ensure a constant transfer rate.
798 *
799 * Note that even fields marked "public" should not be touched by the driver
800 * when the urb is owned by the hcd, that is, since the call to
801 * usb_submit_urb() till the entry into the completion routine.
799 */ 802 */
800struct urb 803struct urb
801{ 804{
@@ -803,12 +806,12 @@ struct urb
803 struct kref kref; /* reference count of the URB */ 806 struct kref kref; /* reference count of the URB */
804 spinlock_t lock; /* lock for the URB */ 807 spinlock_t lock; /* lock for the URB */
805 void *hcpriv; /* private data for host controller */ 808 void *hcpriv; /* private data for host controller */
806 struct list_head urb_list; /* list pointer to all active urbs */
807 int bandwidth; /* bandwidth for INT/ISO request */ 809 int bandwidth; /* bandwidth for INT/ISO request */
808 atomic_t use_count; /* concurrent submissions counter */ 810 atomic_t use_count; /* concurrent submissions counter */
809 u8 reject; /* submissions will fail */ 811 u8 reject; /* submissions will fail */
810 812
811 /* public, documented fields in the urb that can be used by drivers */ 813 /* public, documented fields in the urb that can be used by drivers */
814 struct list_head urb_list; /* list head for use by the urb owner */
812 struct usb_device *dev; /* (in) pointer to associated device */ 815 struct usb_device *dev; /* (in) pointer to associated device */
813 unsigned int pipe; /* (in) pipe information */ 816 unsigned int pipe; /* (in) pipe information */
814 int status; /* (return) non-ISO status */ 817 int status; /* (return) non-ISO status */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 17c874a8eb3f..d38c9fecdc36 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -33,7 +33,7 @@ int default_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key
33struct __wait_queue { 33struct __wait_queue {
34 unsigned int flags; 34 unsigned int flags;
35#define WQ_FLAG_EXCLUSIVE 0x01 35#define WQ_FLAG_EXCLUSIVE 0x01
36 struct task_struct * task; 36 void *private;
37 wait_queue_func_t func; 37 wait_queue_func_t func;
38 struct list_head task_list; 38 struct list_head task_list;
39}; 39};
@@ -60,7 +60,7 @@ typedef struct __wait_queue_head wait_queue_head_t;
60 */ 60 */
61 61
62#define __WAITQUEUE_INITIALIZER(name, tsk) { \ 62#define __WAITQUEUE_INITIALIZER(name, tsk) { \
63 .task = tsk, \ 63 .private = tsk, \
64 .func = default_wake_function, \ 64 .func = default_wake_function, \
65 .task_list = { NULL, NULL } } 65 .task_list = { NULL, NULL } }
66 66
@@ -86,7 +86,7 @@ static inline void init_waitqueue_head(wait_queue_head_t *q)
86static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) 86static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p)
87{ 87{
88 q->flags = 0; 88 q->flags = 0;
89 q->task = p; 89 q->private = p;
90 q->func = default_wake_function; 90 q->func = default_wake_function;
91} 91}
92 92
@@ -94,7 +94,7 @@ static inline void init_waitqueue_func_entry(wait_queue_t *q,
94 wait_queue_func_t func) 94 wait_queue_func_t func)
95{ 95{
96 q->flags = 0; 96 q->flags = 0;
97 q->task = NULL; 97 q->private = NULL;
98 q->func = func; 98 q->func = func;
99} 99}
100 100
@@ -110,7 +110,7 @@ static inline int waitqueue_active(wait_queue_head_t *q)
110 * aio specifies a wait queue entry with an async notification 110 * aio specifies a wait queue entry with an async notification
111 * callback routine, not associated with any task. 111 * callback routine, not associated with any task.
112 */ 112 */
113#define is_sync_wait(wait) (!(wait) || ((wait)->task)) 113#define is_sync_wait(wait) (!(wait) || ((wait)->private))
114 114
115extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)); 115extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait));
116extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait)); 116extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait));
@@ -384,18 +384,16 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
384 384
385#define DEFINE_WAIT(name) \ 385#define DEFINE_WAIT(name) \
386 wait_queue_t name = { \ 386 wait_queue_t name = { \
387 .task = current, \ 387 .private = current, \
388 .func = autoremove_wake_function, \ 388 .func = autoremove_wake_function, \
389 .task_list = { .next = &(name).task_list, \ 389 .task_list = LIST_HEAD_INIT((name).task_list), \
390 .prev = &(name).task_list, \
391 }, \
392 } 390 }
393 391
394#define DEFINE_WAIT_BIT(name, word, bit) \ 392#define DEFINE_WAIT_BIT(name, word, bit) \
395 struct wait_bit_queue name = { \ 393 struct wait_bit_queue name = { \
396 .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ 394 .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \
397 .wait = { \ 395 .wait = { \
398 .task = current, \ 396 .private = current, \
399 .func = wake_bit_function, \ 397 .func = wake_bit_function, \
400 .task_list = \ 398 .task_list = \
401 LIST_HEAD_INIT((name).wait.task_list), \ 399 LIST_HEAD_INIT((name).wait.task_list), \
@@ -404,7 +402,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
404 402
405#define init_wait(wait) \ 403#define init_wait(wait) \
406 do { \ 404 do { \
407 (wait)->task = current; \ 405 (wait)->private = current; \
408 (wait)->func = autoremove_wake_function; \ 406 (wait)->func = autoremove_wake_function; \
409 INIT_LIST_HEAD(&(wait)->task_list); \ 407 INIT_LIST_HEAD(&(wait)->task_list); \
410 } while (0) 408 } while (0)
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 2f51f2b6562e..ae485f9c916e 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * This file define a set of standard wireless extensions 2 * This file define a set of standard wireless extensions
3 * 3 *
4 * Version : 17 21.6.04 4 * Version : 18 12.3.05
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2004 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _LINUX_WIRELESS_H 10#ifndef _LINUX_WIRELESS_H
@@ -82,7 +82,7 @@
82 * (there is some stuff that will be added in the future...) 82 * (there is some stuff that will be added in the future...)
83 * I just plan to increment with each new version. 83 * I just plan to increment with each new version.
84 */ 84 */
85#define WIRELESS_EXT 17 85#define WIRELESS_EXT 18
86 86
87/* 87/*
88 * Changes : 88 * Changes :
@@ -182,6 +182,21 @@
182 * - Document (struct iw_quality *)->updated, add new flags (INVALID) 182 * - Document (struct iw_quality *)->updated, add new flags (INVALID)
183 * - Wireless Event capability in struct iw_range 183 * - Wireless Event capability in struct iw_range
184 * - Add support for relative TxPower (yick !) 184 * - Add support for relative TxPower (yick !)
185 *
186 * V17 to V18 (From Jouni Malinen <jkmaline@cc.hut.fi>)
187 * ----------
188 * - Add support for WPA/WPA2
189 * - Add extended encoding configuration (SIOCSIWENCODEEXT and
190 * SIOCGIWENCODEEXT)
191 * - Add SIOCSIWGENIE/SIOCGIWGENIE
192 * - Add SIOCSIWMLME
193 * - Add SIOCSIWPMKSA
194 * - Add struct iw_range bit field for supported encoding capabilities
195 * - Add optional scan request parameters for SIOCSIWSCAN
196 * - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA
197 * related parameters (extensible up to 4096 parameter values)
198 * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE,
199 * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND
185 */ 200 */
186 201
187/**************************** CONSTANTS ****************************/ 202/**************************** CONSTANTS ****************************/
@@ -256,6 +271,30 @@
256#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ 271#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */
257#define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ 272#define SIOCGIWPOWER 0x8B2D /* get Power Management settings */
258 273
274/* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM).
275 * This ioctl uses struct iw_point and data buffer that includes IE id and len
276 * fields. More than one IE may be included in the request. Setting the generic
277 * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers
278 * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers
279 * are required to report the used IE as a wireless event, e.g., when
280 * associating with an AP. */
281#define SIOCSIWGENIE 0x8B30 /* set generic IE */
282#define SIOCGIWGENIE 0x8B31 /* get generic IE */
283
284/* WPA : IEEE 802.11 MLME requests */
285#define SIOCSIWMLME 0x8B16 /* request MLME operation; uses
286 * struct iw_mlme */
287/* WPA : Authentication mode parameters */
288#define SIOCSIWAUTH 0x8B32 /* set authentication mode params */
289#define SIOCGIWAUTH 0x8B33 /* get authentication mode params */
290
291/* WPA : Extended version of encoding configuration */
292#define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */
293#define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */
294
295/* WPA2 : PMKSA cache management */
296#define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */
297
259/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ 298/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
260 299
261/* These 32 ioctl are wireless device private, for 16 commands. 300/* These 32 ioctl are wireless device private, for 16 commands.
@@ -297,6 +336,34 @@
297#define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ 336#define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */
298#define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */ 337#define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */
299#define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */ 338#define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */
339#define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..)
340 * (scan results); This includes id and
341 * length fields. One IWEVGENIE may
342 * contain more than one IE. Scan
343 * results may contain one or more
344 * IWEVGENIE events. */
345#define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure
346 * (struct iw_michaelmicfailure)
347 */
348#define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request.
349 * The data includes id and length
350 * fields and may contain more than one
351 * IE. This event is required in
352 * Managed mode if the driver
353 * generates its own WPA/RSN IE. This
354 * should be sent just before
355 * IWEVREGISTERED event for the
356 * association. */
357#define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association
358 * Response. The data includes id and
359 * length fields and may contain more
360 * than one IE. This may be sent
361 * between IWEVASSOCREQIE and
362 * IWEVREGISTERED events for the
363 * association. */
364#define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN
365 * pre-authentication
366 * (struct iw_pmkid_cand) */
300 367
301#define IWEVFIRST 0x8C00 368#define IWEVFIRST 0x8C00
302 369
@@ -432,12 +499,94 @@
432#define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ 499#define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */
433#define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ 500#define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */
434#define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ 501#define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */
502/* struct iw_scan_req scan_type */
503#define IW_SCAN_TYPE_ACTIVE 0
504#define IW_SCAN_TYPE_PASSIVE 1
435/* Maximum size of returned data */ 505/* Maximum size of returned data */
436#define IW_SCAN_MAX_DATA 4096 /* In bytes */ 506#define IW_SCAN_MAX_DATA 4096 /* In bytes */
437 507
438/* Max number of char in custom event - use multiple of them if needed */ 508/* Max number of char in custom event - use multiple of them if needed */
439#define IW_CUSTOM_MAX 256 /* In bytes */ 509#define IW_CUSTOM_MAX 256 /* In bytes */
440 510
511/* Generic information element */
512#define IW_GENERIC_IE_MAX 1024
513
514/* MLME requests (SIOCSIWMLME / struct iw_mlme) */
515#define IW_MLME_DEAUTH 0
516#define IW_MLME_DISASSOC 1
517
518/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
519#define IW_AUTH_INDEX 0x0FFF
520#define IW_AUTH_FLAGS 0xF000
521/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095)
522 * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the
523 * parameter that is being set/get to; value will be read/written to
524 * struct iw_param value field) */
525#define IW_AUTH_WPA_VERSION 0
526#define IW_AUTH_CIPHER_PAIRWISE 1
527#define IW_AUTH_CIPHER_GROUP 2
528#define IW_AUTH_KEY_MGMT 3
529#define IW_AUTH_TKIP_COUNTERMEASURES 4
530#define IW_AUTH_DROP_UNENCRYPTED 5
531#define IW_AUTH_80211_AUTH_ALG 6
532#define IW_AUTH_WPA_ENABLED 7
533#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8
534#define IW_AUTH_ROAMING_CONTROL 9
535#define IW_AUTH_PRIVACY_INVOKED 10
536
537/* IW_AUTH_WPA_VERSION values (bit field) */
538#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001
539#define IW_AUTH_WPA_VERSION_WPA 0x00000002
540#define IW_AUTH_WPA_VERSION_WPA2 0x00000004
541
542/* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */
543#define IW_AUTH_CIPHER_NONE 0x00000001
544#define IW_AUTH_CIPHER_WEP40 0x00000002
545#define IW_AUTH_CIPHER_TKIP 0x00000004
546#define IW_AUTH_CIPHER_CCMP 0x00000008
547#define IW_AUTH_CIPHER_WEP104 0x00000010
548
549/* IW_AUTH_KEY_MGMT values (bit field) */
550#define IW_AUTH_KEY_MGMT_802_1X 1
551#define IW_AUTH_KEY_MGMT_PSK 2
552
553/* IW_AUTH_80211_AUTH_ALG values (bit field) */
554#define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001
555#define IW_AUTH_ALG_SHARED_KEY 0x00000002
556#define IW_AUTH_ALG_LEAP 0x00000004
557
558/* IW_AUTH_ROAMING_CONTROL values */
559#define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */
560#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming
561 * control */
562
563/* SIOCSIWENCODEEXT definitions */
564#define IW_ENCODE_SEQ_MAX_SIZE 8
565/* struct iw_encode_ext ->alg */
566#define IW_ENCODE_ALG_NONE 0
567#define IW_ENCODE_ALG_WEP 1
568#define IW_ENCODE_ALG_TKIP 2
569#define IW_ENCODE_ALG_CCMP 3
570/* struct iw_encode_ext ->ext_flags */
571#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001
572#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002
573#define IW_ENCODE_EXT_GROUP_KEY 0x00000004
574#define IW_ENCODE_EXT_SET_TX_KEY 0x00000008
575
576/* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */
577#define IW_MICFAILURE_KEY_ID 0x00000003 /* Key ID 0..3 */
578#define IW_MICFAILURE_GROUP 0x00000004
579#define IW_MICFAILURE_PAIRWISE 0x00000008
580#define IW_MICFAILURE_STAKEY 0x00000010
581#define IW_MICFAILURE_COUNT 0x00000060 /* 1 or 2 (0 = count not supported)
582 */
583
584/* Bit field values for enc_capa in struct iw_range */
585#define IW_ENC_CAPA_WPA 0x00000001
586#define IW_ENC_CAPA_WPA2 0x00000002
587#define IW_ENC_CAPA_CIPHER_TKIP 0x00000004
588#define IW_ENC_CAPA_CIPHER_CCMP 0x00000008
589
441/* Event capability macros - in (struct iw_range *)->event_capa 590/* Event capability macros - in (struct iw_range *)->event_capa
442 * Because we have more than 32 possible events, we use an array of 591 * Because we have more than 32 possible events, we use an array of
443 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ 592 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
@@ -546,6 +695,132 @@ struct iw_thrspy
546 struct iw_quality high; /* High threshold */ 695 struct iw_quality high; /* High threshold */
547}; 696};
548 697
698/*
699 * Optional data for scan request
700 *
701 * Note: these optional parameters are controlling parameters for the
702 * scanning behavior, these do not apply to getting scan results
703 * (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and
704 * provide a merged results with all BSSes even if the previous scan
705 * request limited scanning to a subset, e.g., by specifying an SSID.
706 * Especially, scan results are required to include an entry for the
707 * current BSS if the driver is in Managed mode and associated with an AP.
708 */
709struct iw_scan_req
710{
711 __u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */
712 __u8 essid_len;
713 __u8 num_channels; /* num entries in channel_list;
714 * 0 = scan all allowed channels */
715 __u8 flags; /* reserved as padding; use zero, this may
716 * be used in the future for adding flags
717 * to request different scan behavior */
718 struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or
719 * individual address of a specific BSS */
720
721 /*
722 * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using
723 * the current ESSID. This allows scan requests for specific ESSID
724 * without having to change the current ESSID and potentially breaking
725 * the current association.
726 */
727 __u8 essid[IW_ESSID_MAX_SIZE];
728
729 /*
730 * Optional parameters for changing the default scanning behavior.
731 * These are based on the MLME-SCAN.request from IEEE Std 802.11.
732 * TU is 1.024 ms. If these are set to 0, driver is expected to use
733 * reasonable default values. min_channel_time defines the time that
734 * will be used to wait for the first reply on each channel. If no
735 * replies are received, next channel will be scanned after this. If
736 * replies are received, total time waited on the channel is defined by
737 * max_channel_time.
738 */
739 __u32 min_channel_time; /* in TU */
740 __u32 max_channel_time; /* in TU */
741
742 struct iw_freq channel_list[IW_MAX_FREQUENCIES];
743};
744
745/* ------------------------- WPA SUPPORT ------------------------- */
746
747/*
748 * Extended data structure for get/set encoding (this is used with
749 * SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_*
750 * flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and
751 * only the data contents changes (key data -> this structure, including
752 * key data).
753 *
754 * If the new key is the first group key, it will be set as the default
755 * TX key. Otherwise, default TX key index is only changed if
756 * IW_ENCODE_EXT_SET_TX_KEY flag is set.
757 *
758 * Key will be changed with SIOCSIWENCODEEXT in all cases except for
759 * special "change TX key index" operation which is indicated by setting
760 * key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY.
761 *
762 * tx_seq/rx_seq are only used when respective
763 * IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal
764 * TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start
765 * TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally
766 * used only by an Authenticator (AP or an IBSS station) to get the
767 * current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and
768 * RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for
769 * debugging/testing.
770 */
771struct iw_encode_ext
772{
773 __u32 ext_flags; /* IW_ENCODE_EXT_* */
774 __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
775 __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
776 struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast
777 * (group) keys or unicast address for
778 * individual keys */
779 __u16 alg; /* IW_ENCODE_ALG_* */
780 __u16 key_len;
781 __u8 key[0];
782};
783
784/* SIOCSIWMLME data */
785struct iw_mlme
786{
787 __u16 cmd; /* IW_MLME_* */
788 __u16 reason_code;
789 struct sockaddr addr;
790};
791
792/* SIOCSIWPMKSA data */
793#define IW_PMKSA_ADD 1
794#define IW_PMKSA_REMOVE 2
795#define IW_PMKSA_FLUSH 3
796
797#define IW_PMKID_LEN 16
798
799struct iw_pmksa
800{
801 __u32 cmd; /* IW_PMKSA_* */
802 struct sockaddr bssid;
803 __u8 pmkid[IW_PMKID_LEN];
804};
805
806/* IWEVMICHAELMICFAILURE data */
807struct iw_michaelmicfailure
808{
809 __u32 flags;
810 struct sockaddr src_addr;
811 __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
812};
813
814/* IWEVPMKIDCAND data */
815#define IW_PMKID_CAND_PREAUTH 0x00000001 /* RNS pre-authentication enabled */
816struct iw_pmkid_cand
817{
818 __u32 flags; /* IW_PMKID_CAND_* */
819 __u32 index; /* the smaller the index, the higher the
820 * priority */
821 struct sockaddr bssid;
822};
823
549/* ------------------------ WIRELESS STATS ------------------------ */ 824/* ------------------------ WIRELESS STATS ------------------------ */
550/* 825/*
551 * Wireless statistics (used for /proc/net/wireless) 826 * Wireless statistics (used for /proc/net/wireless)
@@ -725,6 +1000,8 @@ struct iw_range
725 struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ 1000 struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */
726 /* Note : this frequency list doesn't need to fit channel numbers, 1001 /* Note : this frequency list doesn't need to fit channel numbers,
727 * because each entry contain its channel index */ 1002 * because each entry contain its channel index */
1003
1004 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */
728}; 1005};
729 1006
730/* 1007/*
diff --git a/include/linux/x25.h b/include/linux/x25.h
index 7531cfed5885..16d44931afa0 100644
--- a/include/linux/x25.h
+++ b/include/linux/x25.h
@@ -4,6 +4,8 @@
4 * History 4 * History
5 * mar/20/00 Daniela Squassoni Disabling/enabling of facilities 5 * mar/20/00 Daniela Squassoni Disabling/enabling of facilities
6 * negotiation. 6 * negotiation.
7 * apr/02/05 Shaun Pereira Selective sub address matching with
8 * call user data
7 */ 9 */
8 10
9#ifndef X25_KERNEL_H 11#ifndef X25_KERNEL_H
@@ -16,6 +18,9 @@
16#define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4) 18#define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4)
17#define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5) 19#define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5)
18#define SIOCX25GCAUSEDIAG (SIOCPROTOPRIVATE + 6) 20#define SIOCX25GCAUSEDIAG (SIOCPROTOPRIVATE + 6)
21#define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7)
22#define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8)
23#define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9)
19 24
20/* 25/*
21 * Values for {get,set}sockopt. 26 * Values for {get,set}sockopt.
@@ -109,4 +114,11 @@ struct x25_causediag {
109 unsigned char diagnostic; 114 unsigned char diagnostic;
110}; 115};
111 116
117/*
118 * Further optional call user data match length selection
119 */
120struct x25_subaddr {
121 unsigned int cudmatchlength;
122};
123
112#endif 124#endif
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index fd2ef742a9fd..f0d423300d84 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -174,6 +174,8 @@ enum xfrm_attr_type_t {
174 XFRMA_ALG_COMP, /* struct xfrm_algo */ 174 XFRMA_ALG_COMP, /* struct xfrm_algo */
175 XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ 175 XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */
176 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ 176 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */
177 XFRMA_SA,
178 XFRMA_POLICY,
177 __XFRMA_MAX 179 __XFRMA_MAX
178 180
179#define XFRMA_MAX (__XFRMA_MAX - 1) 181#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -194,6 +196,7 @@ struct xfrm_usersa_info {
194 __u8 flags; 196 __u8 flags;
195#define XFRM_STATE_NOECN 1 197#define XFRM_STATE_NOECN 1
196#define XFRM_STATE_DECAP_DSCP 2 198#define XFRM_STATE_DECAP_DSCP 2
199#define XFRM_STATE_NOPMTUDISC 4
197}; 200};
198 201
199struct xfrm_usersa_id { 202struct xfrm_usersa_id {
@@ -257,5 +260,7 @@ struct xfrm_usersa_flush {
257 260
258#define XFRMGRP_ACQUIRE 1 261#define XFRMGRP_ACQUIRE 1
259#define XFRMGRP_EXPIRE 2 262#define XFRMGRP_EXPIRE 2
263#define XFRMGRP_SA 4
264#define XFRMGRP_POLICY 8
260 265
261#endif /* _LINUX_XFRM_H */ 266#endif /* _LINUX_XFRM_H */