aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-07-02 08:39:09 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-07-02 08:39:09 -0400
commitd2f6409584e2c62ffad81690562330ff3bf4a458 (patch)
tree3bdfb97d0b51be2f7f414f2107e97603c1206abb /include/linux
parente1b09eba2686eca94a3a188042b518df6044a3c1 (diff)
parent4a89a04f1ee21a7c1f4413f1ad7dcfac50ff9b63 (diff)
Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/a.out.h2
-rw-r--r--include/linux/acpi.h19
-rw-r--r--include/linux/arcfb.h8
-rw-r--r--include/linux/atalk.h28
-rw-r--r--include/linux/auto_fs4.h2
-rw-r--r--include/linux/binfmts.h5
-rw-r--r--include/linux/bio.h14
-rw-r--r--include/linux/blkdev.h42
-rw-r--r--include/linux/bootmem.h13
-rw-r--r--include/linux/byteorder/swabb.h17
-rw-r--r--include/linux/cciss_ioctl.h1
-rw-r--r--include/linux/cpu.h1
-rw-r--r--include/linux/crash_dump.h18
-rw-r--r--include/linux/device.h71
-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/elevator.h8
-rw-r--r--include/linux/etherdevice.h3
-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.h93
-rw-r--r--include/linux/fsl_devices.h8
-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/highmem.h1
-rw-r--r--include/linux/hugetlb.h40
-rw-r--r--include/linux/hwmon-sysfs.h36
-rw-r--r--include/linux/i2c-dev.h1
-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.h2
-rw-r--r--include/linux/if_bonding.h7
-rw-r--r--include/linux/in6.h2
-rw-r--r--include/linux/init.h12
-rw-r--r--include/linux/init_task.h3
-rw-r--r--include/linux/input.h6
-rw-r--r--include/linux/ioc4.h179
-rw-r--r--include/linux/ioc4_common.h21
-rw-r--r--include/linux/ioprio.h88
-rw-r--r--include/linux/ipmi.h5
-rw-r--r--include/linux/irq.h10
-rw-r--r--include/linux/joystick.h33
-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.h80
-rw-r--r--include/linux/libps2.h1
-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/mempool.h11
-rw-r--r--include/linux/mm.h125
-rw-r--r--include/linux/mmzone.h192
-rw-r--r--include/linux/mod_devicetable.h46
-rw-r--r--include/linux/module.h5
-rw-r--r--include/linux/namespace.h1
-rw-r--r--include/linux/netdevice.h19
-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.h4
-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/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.h33
-rw-r--r--include/linux/pci_ids.h11
-rw-r--r--include/linux/pfkeyv2.h1
-rw-r--r--include/linux/pkt_cls.h2
-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/pmu.h6
-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.h15
-rw-r--r--include/linux/sched.h138
-rw-r--r--include/linux/seccomp.h10
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serio.h6
-rw-r--r--include/linux/skbuff.h36
-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.h12
-rw-r--r--include/linux/sysfs.h15
-rw-r--r--include/linux/tc_ematch/tc_em_text.h19
-rw-r--r--include/linux/tcp.h50
-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.h7
-rw-r--r--include/linux/usb_ch9.h189
-rw-r--r--include/linux/usb_gadget.h2
-rw-r--r--include/linux/usb_isp116x.h47
-rw-r--r--include/linux/videodev2.h2
-rw-r--r--include/linux/wait.h16
-rw-r--r--include/linux/writeback.h8
-rw-r--r--include/linux/x25.h12
-rw-r--r--include/linux/xattr_acl.h50
-rw-r--r--include/linux/xfrm.h1
159 files changed, 3462 insertions, 1208 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 b123cc08773d..ef8483673aa3 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -342,11 +342,19 @@ struct acpi_table_ecdt {
342 342
343/* PCI MMCONFIG */ 343/* PCI MMCONFIG */
344 344
345/* Defined in PCI Firmware Specification 3.0 */
346struct acpi_table_mcfg_config {
347 u32 base_address;
348 u32 base_reserved;
349 u16 pci_segment_group_number;
350 u8 start_bus_number;
351 u8 end_bus_number;
352 u8 reserved[4];
353} __attribute__ ((packed));
345struct acpi_table_mcfg { 354struct acpi_table_mcfg {
346 struct acpi_table_header header; 355 struct acpi_table_header header;
347 u8 reserved[8]; 356 u8 reserved[8];
348 u32 base_address; 357 struct acpi_table_mcfg_config config[0];
349 u32 base_reserved;
350} __attribute__ ((packed)); 358} __attribute__ ((packed));
351 359
352/* Table Handlers */ 360/* Table Handlers */
@@ -391,6 +399,7 @@ int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
391int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header); 399int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
392int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); 400int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
393int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); 401int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
402int acpi_parse_mcfg (unsigned long phys_addr, unsigned long size);
394void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr); 403void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
395void acpi_table_print_madt_entry (acpi_table_entry_header *madt); 404void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
396void acpi_table_print_srat_entry (acpi_table_entry_header *srat); 405void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
@@ -407,9 +416,13 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu);
407int acpi_unmap_lsapic(int cpu); 416int acpi_unmap_lsapic(int cpu);
408#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 417#endif /* CONFIG_ACPI_HOTPLUG_CPU */
409 418
419int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
420int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
421
410extern int acpi_mp_config; 422extern int acpi_mp_config;
411 423
412extern u32 pci_mmcfg_base_addr; 424extern struct acpi_table_mcfg_config *pci_mmcfg_config;
425extern int pci_mmcfg_config_num;
413 426
414extern int sbf_port ; 427extern int sbf_port ;
415 428
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/atalk.h b/include/linux/atalk.h
index 31d3fc25ccbd..911c09cb9bf9 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_ATALK_H__ 1#ifndef __LINUX_ATALK_H__
2#define __LINUX_ATALK_H__ 2#define __LINUX_ATALK_H__
3 3
4#include <asm/byteorder.h>
5
4/* 6/*
5 * AppleTalk networking structures 7 * AppleTalk networking structures
6 * 8 *
@@ -20,7 +22,7 @@
20#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) 22#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
21 23
22struct atalk_addr { 24struct atalk_addr {
23 __u16 s_net; 25 __be16 s_net;
24 __u8 s_node; 26 __u8 s_node;
25}; 27};
26 28
@@ -33,8 +35,8 @@ struct sockaddr_at {
33 35
34struct atalk_netrange { 36struct atalk_netrange {
35 __u8 nr_phase; 37 __u8 nr_phase;
36 __u16 nr_firstnet; 38 __be16 nr_firstnet;
37 __u16 nr_lastnet; 39 __be16 nr_lastnet;
38}; 40};
39 41
40#ifdef __KERNEL__ 42#ifdef __KERNEL__
@@ -70,8 +72,8 @@ struct atalk_iface {
70struct atalk_sock { 72struct atalk_sock {
71 /* struct sock has to be the first member of atalk_sock */ 73 /* struct sock has to be the first member of atalk_sock */
72 struct sock sk; 74 struct sock sk;
73 unsigned short dest_net; 75 __be16 dest_net;
74 unsigned short src_net; 76 __be16 src_net;
75 unsigned char dest_node; 77 unsigned char dest_node;
76 unsigned char src_node; 78 unsigned char src_node;
77 unsigned char dest_port; 79 unsigned char dest_port;
@@ -95,9 +97,9 @@ struct ddpehdr {
95 deh_hops:4, 97 deh_hops:4,
96 deh_len:10; 98 deh_len:10;
97#endif 99#endif
98 __u16 deh_sum; 100 __be16 deh_sum;
99 __u16 deh_dnet; 101 __be16 deh_dnet;
100 __u16 deh_snet; 102 __be16 deh_snet;
101 __u8 deh_dnode; 103 __u8 deh_dnode;
102 __u8 deh_snode; 104 __u8 deh_snode;
103 __u8 deh_dport; 105 __u8 deh_dport;
@@ -142,24 +144,24 @@ struct ddpshdr {
142 144
143/* AppleTalk AARP headers */ 145/* AppleTalk AARP headers */
144struct elapaarp { 146struct elapaarp {
145 __u16 hw_type; 147 __be16 hw_type;
146#define AARP_HW_TYPE_ETHERNET 1 148#define AARP_HW_TYPE_ETHERNET 1
147#define AARP_HW_TYPE_TOKENRING 2 149#define AARP_HW_TYPE_TOKENRING 2
148 __u16 pa_type; 150 __be16 pa_type;
149 __u8 hw_len; 151 __u8 hw_len;
150 __u8 pa_len; 152 __u8 pa_len;
151#define AARP_PA_ALEN 4 153#define AARP_PA_ALEN 4
152 __u16 function; 154 __be16 function;
153#define AARP_REQUEST 1 155#define AARP_REQUEST 1
154#define AARP_REPLY 2 156#define AARP_REPLY 2
155#define AARP_PROBE 3 157#define AARP_PROBE 3
156 __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); 158 __u8 hw_src[ETH_ALEN] __attribute__ ((packed));
157 __u8 pa_src_zero __attribute__ ((packed)); 159 __u8 pa_src_zero __attribute__ ((packed));
158 __u16 pa_src_net __attribute__ ((packed)); 160 __be16 pa_src_net __attribute__ ((packed));
159 __u8 pa_src_node __attribute__ ((packed)); 161 __u8 pa_src_node __attribute__ ((packed));
160 __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); 162 __u8 hw_dst[ETH_ALEN] __attribute__ ((packed));
161 __u8 pa_dst_zero __attribute__ ((packed)); 163 __u8 pa_dst_zero __attribute__ ((packed));
162 __u16 pa_dst_net __attribute__ ((packed)); 164 __be16 pa_dst_net __attribute__ ((packed));
163 __u8 pa_dst_node __attribute__ ((packed)); 165 __u8 pa_dst_node __attribute__ ((packed));
164}; 166};
165 167
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/bio.h b/include/linux/bio.h
index 038022763f09..36ef29fa0d8b 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/highmem.h> 23#include <linux/highmem.h>
24#include <linux/mempool.h> 24#include <linux/mempool.h>
25#include <linux/ioprio.h>
25 26
26/* Platforms may set this to teach the BIO layer about IOMMU hardware. */ 27/* Platforms may set this to teach the BIO layer about IOMMU hardware. */
27#include <asm/io.h> 28#include <asm/io.h>
@@ -150,6 +151,19 @@ struct bio {
150#define BIO_RW_SYNC 4 151#define BIO_RW_SYNC 4
151 152
152/* 153/*
154 * upper 16 bits of bi_rw define the io priority of this bio
155 */
156#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS)
157#define bio_prio(bio) ((bio)->bi_rw >> BIO_PRIO_SHIFT)
158#define bio_prio_valid(bio) ioprio_valid(bio_prio(bio))
159
160#define bio_set_prio(bio, prio) do { \
161 WARN_ON(prio >= (1 << IOPRIO_BITS)); \
162 (bio)->bi_rw &= ((1UL << BIO_PRIO_SHIFT) - 1); \
163 (bio)->bi_rw |= ((unsigned long) (prio) << BIO_PRIO_SHIFT); \
164} while (0)
165
166/*
153 * various member access, note that bio_data should of course not be used 167 * various member access, note that bio_data should of course not be used
154 * on highmem page vectors 168 * on highmem page vectors
155 */ 169 */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4a99b76c5a33..0881b5cdee3d 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -54,16 +54,23 @@ struct as_io_context {
54 54
55struct cfq_queue; 55struct cfq_queue;
56struct cfq_io_context { 56struct cfq_io_context {
57 void (*dtor)(struct cfq_io_context *);
58 void (*exit)(struct cfq_io_context *);
59
60 struct io_context *ioc;
61
62 /* 57 /*
63 * circular list of cfq_io_contexts belonging to a process io context 58 * circular list of cfq_io_contexts belonging to a process io context
64 */ 59 */
65 struct list_head list; 60 struct list_head list;
66 struct cfq_queue *cfqq; 61 struct cfq_queue *cfqq;
62 void *key;
63
64 struct io_context *ioc;
65
66 unsigned long last_end_request;
67 unsigned long last_queue;
68 unsigned long ttime_total;
69 unsigned long ttime_samples;
70 unsigned long ttime_mean;
71
72 void (*dtor)(struct cfq_io_context *);
73 void (*exit)(struct cfq_io_context *);
67}; 74};
68 75
69/* 76/*
@@ -73,7 +80,9 @@ struct cfq_io_context {
73 */ 80 */
74struct io_context { 81struct io_context {
75 atomic_t refcount; 82 atomic_t refcount;
76 pid_t pid; 83 struct task_struct *task;
84
85 int (*set_ioprio)(struct io_context *, unsigned int);
77 86
78 /* 87 /*
79 * For request batching 88 * For request batching
@@ -81,14 +90,13 @@ struct io_context {
81 unsigned long last_waited; /* Time last woken after wait for request */ 90 unsigned long last_waited; /* Time last woken after wait for request */
82 int nr_batch_requests; /* Number of requests left in the batch */ 91 int nr_batch_requests; /* Number of requests left in the batch */
83 92
84 spinlock_t lock;
85
86 struct as_io_context *aic; 93 struct as_io_context *aic;
87 struct cfq_io_context *cic; 94 struct cfq_io_context *cic;
88}; 95};
89 96
90void put_io_context(struct io_context *ioc); 97void put_io_context(struct io_context *ioc);
91void exit_io_context(void); 98void exit_io_context(void);
99struct io_context *current_io_context(int gfp_flags);
92struct io_context *get_io_context(int gfp_flags); 100struct io_context *get_io_context(int gfp_flags);
93void copy_io_context(struct io_context **pdst, struct io_context **psrc); 101void copy_io_context(struct io_context **pdst, struct io_context **psrc);
94void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); 102void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
@@ -134,6 +142,8 @@ struct request {
134 142
135 void *elevator_private; 143 void *elevator_private;
136 144
145 unsigned short ioprio;
146
137 int rq_status; /* should split this into a few status bits */ 147 int rq_status; /* should split this into a few status bits */
138 struct gendisk *rq_disk; 148 struct gendisk *rq_disk;
139 int errors; 149 int errors;
@@ -285,16 +295,12 @@ enum blk_queue_state {
285 Queue_up, 295 Queue_up,
286}; 296};
287 297
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 { 298struct blk_queue_tag {
292 struct request **tag_index; /* map of busy tags */ 299 struct request **tag_index; /* map of busy tags */
293 unsigned long *tag_map; /* bit map of free/busy tags */ 300 unsigned long *tag_map; /* bit map of free/busy tags */
294 struct list_head busy_list; /* fifo list of busy tags */ 301 struct list_head busy_list; /* fifo list of busy tags */
295 int busy; /* current depth */ 302 int busy; /* current depth */
296 int max_depth; /* what we will send to device */ 303 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 */ 304 atomic_t refcnt; /* map can be shared */
299}; 305};
300 306
@@ -396,6 +402,7 @@ struct request_queue
396 */ 402 */
397 unsigned int sg_timeout; 403 unsigned int sg_timeout;
398 unsigned int sg_reserved_size; 404 unsigned int sg_reserved_size;
405 int node;
399 406
400 struct list_head drain_list; 407 struct list_head drain_list;
401 408
@@ -542,15 +549,12 @@ extern void generic_make_request(struct bio *bio);
542extern void blk_put_request(struct request *); 549extern void blk_put_request(struct request *);
543extern void blk_end_sync_rq(struct request *rq); 550extern void blk_end_sync_rq(struct request *rq);
544extern void blk_attempt_remerge(request_queue_t *, struct request *); 551extern 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); 552extern struct request *blk_get_request(request_queue_t *, int, int);
547extern void blk_insert_request(request_queue_t *, struct request *, int, void *); 553extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
548extern void blk_requeue_request(request_queue_t *, struct request *); 554extern void blk_requeue_request(request_queue_t *, struct request *);
549extern void blk_plug_device(request_queue_t *); 555extern void blk_plug_device(request_queue_t *);
550extern int blk_remove_plug(request_queue_t *); 556extern int blk_remove_plug(request_queue_t *);
551extern void blk_recount_segments(request_queue_t *, struct bio *); 557extern 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 *); 558extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
555extern void blk_start_queue(request_queue_t *q); 559extern void blk_start_queue(request_queue_t *q);
556extern void blk_stop_queue(request_queue_t *q); 560extern void blk_stop_queue(request_queue_t *q);
@@ -615,6 +619,8 @@ static inline void blkdev_dequeue_request(struct request *req)
615/* 619/*
616 * Access functions for manipulating queue properties 620 * Access functions for manipulating queue properties
617 */ 621 */
622extern request_queue_t *blk_init_queue_node(request_fn_proc *rfn,
623 spinlock_t *lock, int node_id);
618extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *); 624extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *);
619extern void blk_cleanup_queue(request_queue_t *); 625extern void blk_cleanup_queue(request_queue_t *);
620extern void blk_queue_make_request(request_queue_t *, make_request_fn *); 626extern void blk_queue_make_request(request_queue_t *, make_request_fn *);
@@ -632,7 +638,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); 638extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
633extern void blk_queue_ordered(request_queue_t *, int); 639extern void blk_queue_ordered(request_queue_t *, int);
634extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); 640extern 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 *); 641extern struct request *blk_start_pre_flush(request_queue_t *,struct request *);
637extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int); 642extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int);
638extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int); 643extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int);
@@ -646,7 +651,8 @@ extern void blk_wait_queue_drained(request_queue_t *, int);
646extern void blk_finish_queue_drain(request_queue_t *); 651extern void blk_finish_queue_drain(request_queue_t *);
647 652
648int blk_get_queue(request_queue_t *); 653int blk_get_queue(request_queue_t *);
649request_queue_t *blk_alloc_queue(int); 654request_queue_t *blk_alloc_queue(int gfp_mask);
655request_queue_t *blk_alloc_queue_node(int,int);
650#define blk_put_queue(q) blk_cleanup_queue((q)) 656#define blk_put_queue(q) blk_cleanup_queue((q))
651 657
652/* 658/*
@@ -675,8 +681,6 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *);
675 681
676#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) 682#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
677 683
678extern void drive_stat_acct(struct request *, int, int);
679
680static inline int queue_hardsect_size(request_queue_t *q) 684static inline int queue_hardsect_size(request_queue_t *q)
681{ 685{
682 int retval = 512; 686 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/byteorder/swabb.h b/include/linux/byteorder/swabb.h
index d28d9a804d3b..d5f2a3205109 100644
--- a/include/linux/byteorder/swabb.h
+++ b/include/linux/byteorder/swabb.h
@@ -92,29 +92,32 @@
92#endif /* OPTIMIZE */ 92#endif /* OPTIMIZE */
93 93
94 94
95static __inline__ __const__ __u32 __fswahw32(__u32 x) 95static inline __u32 __fswahw32(__u32 x)
96{ 96{
97 return __arch__swahw32(x); 97 return __arch__swahw32(x);
98} 98}
99static __inline__ __u32 __swahw32p(__u32 *x) 99
100static inline __u32 __swahw32p(__u32 *x)
100{ 101{
101 return __arch__swahw32p(x); 102 return __arch__swahw32p(x);
102} 103}
103static __inline__ void __swahw32s(__u32 *addr) 104
105static inline void __swahw32s(__u32 *addr)
104{ 106{
105 __arch__swahw32s(addr); 107 __arch__swahw32s(addr);
106} 108}
107 109
108 110static inline __u32 __fswahb32(__u32 x)
109static __inline__ __const__ __u32 __fswahb32(__u32 x)
110{ 111{
111 return __arch__swahb32(x); 112 return __arch__swahb32(x);
112} 113}
113static __inline__ __u32 __swahb32p(__u32 *x) 114
115static inline __u32 __swahb32p(__u32 *x)
114{ 116{
115 return __arch__swahb32p(x); 117 return __arch__swahb32p(x);
116} 118}
117static __inline__ void __swahb32s(__u32 *addr) 119
120static inline void __swahb32s(__u32 *addr)
118{ 121{
119 __arch__swahb32s(addr); 122 __arch__swahb32s(addr);
120} 123}
diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h
index ee0c6e8995da..424d5e622b43 100644
--- a/include/linux/cciss_ioctl.h
+++ b/include/linux/cciss_ioctl.h
@@ -10,6 +10,7 @@
10typedef struct _cciss_pci_info_struct 10typedef struct _cciss_pci_info_struct
11{ 11{
12 unsigned char bus; 12 unsigned char bus;
13 unsigned short domain;
13 unsigned char dev_fn; 14 unsigned char dev_fn;
14 __u32 board_id; 15 __u32 board_id;
15} cciss_pci_info_struct; 16} cciss_pci_info_struct;
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/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..f378c846e6d5 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;
@@ -67,7 +69,7 @@ struct bus_type {
67extern int bus_register(struct bus_type * bus); 69extern int bus_register(struct bus_type * bus);
68extern void bus_unregister(struct bus_type * bus); 70extern void bus_unregister(struct bus_type * bus);
69 71
70extern int bus_rescan_devices(struct bus_type * bus); 72extern void bus_rescan_devices(struct bus_type * bus);
71 73
72extern struct bus_type * get_bus(struct bus_type * bus); 74extern struct bus_type * get_bus(struct bus_type * bus);
73extern void put_bus(struct bus_type * bus); 75extern void put_bus(struct bus_type * bus);
@@ -78,6 +80,8 @@ extern struct bus_type * find_bus(char * name);
78 80
79int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, 81int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data,
80 int (*fn)(struct device *, void *)); 82 int (*fn)(struct device *, void *));
83struct device * bus_find_device(struct bus_type *bus, struct device *start,
84 void *data, int (*match)(struct device *, void *));
81 85
82int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, 86int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
83 void * data, int (*fn)(struct device_driver *, void *)); 87 void * data, int (*fn)(struct device_driver *, void *));
@@ -98,17 +102,18 @@ extern int bus_create_file(struct bus_type *, struct bus_attribute *);
98extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 102extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
99 103
100struct device_driver { 104struct device_driver {
101 char * name; 105 const char * name;
102 struct bus_type * bus; 106 struct bus_type * bus;
103 107
104 struct completion unloaded; 108 struct completion unloaded;
105 struct kobject kobj; 109 struct kobject kobj;
106 struct list_head devices; 110 struct klist klist_devices;
111 struct klist_node knode_bus;
107 112
108 struct module * owner; 113 struct module * owner;
109 114
110 int (*probe) (struct device * dev); 115 int (*probe) (struct device * dev);
111 int (*remove) (struct device * dev); 116 int (*remove) (struct device * dev);
112 void (*shutdown) (struct device * dev); 117 void (*shutdown) (struct device * dev);
113 int (*suspend) (struct device * dev, pm_message_t state, u32 level); 118 int (*suspend) (struct device * dev, pm_message_t state, u32 level);
114 int (*resume) (struct device * dev, u32 level); 119 int (*resume) (struct device * dev, u32 level);
@@ -137,12 +142,19 @@ struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store)
137extern int driver_create_file(struct device_driver *, struct driver_attribute *); 142extern int driver_create_file(struct device_driver *, struct driver_attribute *);
138extern void driver_remove_file(struct device_driver *, struct driver_attribute *); 143extern void driver_remove_file(struct device_driver *, struct driver_attribute *);
139 144
145extern int driver_for_each_device(struct device_driver * drv, struct device * start,
146 void * data, int (*fn)(struct device *, void *));
147struct device * driver_find_device(struct device_driver *drv,
148 struct device *start, void *data,
149 int (*match)(struct device *, void *));
150
140 151
141/* 152/*
142 * device classes 153 * device classes
143 */ 154 */
144struct class { 155struct class {
145 char * name; 156 const char * name;
157 struct module * owner;
146 158
147 struct subsystem subsys; 159 struct subsystem subsys;
148 struct list_head children; 160 struct list_head children;
@@ -185,6 +197,7 @@ struct class_device {
185 struct kobject kobj; 197 struct kobject kobj;
186 struct class * class; /* required */ 198 struct class * class; /* required */
187 dev_t devt; /* dev_t, creates the sysfs "dev" */ 199 dev_t devt; /* dev_t, creates the sysfs "dev" */
200 struct class_device_attribute *devt_attr;
188 struct device * dev; /* not necessary, but nice to have */ 201 struct device * dev; /* not necessary, but nice to have */
189 void * class_data; /* class-specific data */ 202 void * class_data; /* class-specific data */
190 203
@@ -245,26 +258,28 @@ struct class_interface {
245extern int class_interface_register(struct class_interface *); 258extern int class_interface_register(struct class_interface *);
246extern void class_interface_unregister(struct class_interface *); 259extern void class_interface_unregister(struct class_interface *);
247 260
248/* interface for class simple stuff */ 261extern struct class *class_create(struct module *owner, char *name);
249extern struct class_simple *class_simple_create(struct module *owner, char *name); 262extern void class_destroy(struct class *cls);
250extern void class_simple_destroy(struct class_simple *cs); 263extern 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, ...) 264 struct device *device, char *fmt, ...)
252 __attribute__((format(printf,4,5))); 265 __attribute__((format(printf,4,5)));
253extern int class_simple_set_hotplug(struct class_simple *, 266extern 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 267
257 268
258struct device { 269struct device {
259 struct list_head node; /* node in sibling list */ 270 struct klist klist_children;
260 struct list_head bus_list; /* node in bus's list */ 271 struct klist_node knode_parent; /* node in sibling list */
261 struct list_head driver_list; 272 struct klist_node knode_driver;
262 struct list_head children; 273 struct klist_node knode_bus;
263 struct device * parent; 274 struct device * parent;
264 275
265 struct kobject kobj; 276 struct kobject kobj;
266 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 277 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
267 278
279 struct semaphore sem; /* semaphore to synchronize calls to
280 * its driver.
281 */
282
268 struct bus_type * bus; /* type of bus device is on */ 283 struct bus_type * bus; /* type of bus device is on */
269 struct device_driver *driver; /* which driver has allocated this 284 struct device_driver *driver; /* which driver has allocated this
270 device */ 285 device */
@@ -288,12 +303,6 @@ struct device {
288 void (*release)(struct device * dev); 303 void (*release)(struct device * dev);
289}; 304};
290 305
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 * 306static inline void *
298dev_get_drvdata (struct device *dev) 307dev_get_drvdata (struct device *dev)
299{ 308{
@@ -321,7 +330,6 @@ extern int device_for_each_child(struct device *, void *,
321 * Manual binding of a device to driver. See drivers/base/bus.c 330 * Manual binding of a device to driver. See drivers/base/bus.c
322 * for information on use. 331 * for information on use.
323 */ 332 */
324extern int driver_probe_device(struct device_driver * drv, struct device * dev);
325extern void device_bind_driver(struct device * dev); 333extern void device_bind_driver(struct device * dev);
326extern void device_release_driver(struct device * dev); 334extern void device_release_driver(struct device * dev);
327extern int device_attach(struct device * dev); 335extern int device_attach(struct device * dev);
@@ -332,8 +340,10 @@ extern void driver_attach(struct device_driver * drv);
332 340
333struct device_attribute { 341struct device_attribute {
334 struct attribute attr; 342 struct attribute attr;
335 ssize_t (*show)(struct device * dev, char * buf); 343 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
336 ssize_t (*store)(struct device * dev, const char * buf, size_t count); 344 char *buf);
345 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
346 const char *buf, size_t count);
337}; 347};
338 348
339#define DEVICE_ATTR(_name,_mode,_show,_store) \ 349#define DEVICE_ATTR(_name,_mode,_show,_store) \
@@ -360,13 +370,12 @@ extern int (*platform_notify_remove)(struct device * dev);
360 */ 370 */
361extern struct device * get_device(struct device * dev); 371extern struct device * get_device(struct device * dev);
362extern void put_device(struct device * dev); 372extern void put_device(struct device * dev);
363extern struct device *device_find(const char *name, struct bus_type *bus);
364 373
365 374
366/* drivers/base/platform.c */ 375/* drivers/base/platform.c */
367 376
368struct platform_device { 377struct platform_device {
369 char * name; 378 const char * name;
370 u32 id; 379 u32 id;
371 struct device dev; 380 struct device dev;
372 u32 num_resources; 381 u32 num_resources;
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/elevator.h b/include/linux/elevator.h
index ee54f81faad5..ea6bbc2d7407 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -16,9 +16,9 @@ typedef void (elevator_remove_req_fn) (request_queue_t *, struct request *);
16typedef void (elevator_requeue_req_fn) (request_queue_t *, struct request *); 16typedef void (elevator_requeue_req_fn) (request_queue_t *, struct request *);
17typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *); 17typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *);
18typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *); 18typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *);
19typedef int (elevator_may_queue_fn) (request_queue_t *, int); 19typedef int (elevator_may_queue_fn) (request_queue_t *, int, struct bio *);
20 20
21typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, int); 21typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, int);
22typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); 22typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
23typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); 23typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
24 24
@@ -96,9 +96,9 @@ extern struct request *elv_former_request(request_queue_t *, struct request *);
96extern struct request *elv_latter_request(request_queue_t *, struct request *); 96extern struct request *elv_latter_request(request_queue_t *, struct request *);
97extern int elv_register_queue(request_queue_t *q); 97extern int elv_register_queue(request_queue_t *q);
98extern void elv_unregister_queue(request_queue_t *q); 98extern void elv_unregister_queue(request_queue_t *q);
99extern int elv_may_queue(request_queue_t *, int); 99extern int elv_may_queue(request_queue_t *, int, struct bio *);
100extern void elv_completed_request(request_queue_t *, struct request *); 100extern void elv_completed_request(request_queue_t *, struct request *);
101extern int elv_set_request(request_queue_t *, struct request *, int); 101extern int elv_set_request(request_queue_t *, struct request *, struct bio *, int);
102extern void elv_put_request(request_queue_t *, struct request *); 102extern void elv_put_request(request_queue_t *, struct request *);
103 103
104/* 104/*
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index a1478258d002..cf3847edc50f 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -25,6 +25,7 @@
25#define _LINUX_ETHERDEVICE_H 25#define _LINUX_ETHERDEVICE_H
26 26
27#include <linux/if_ether.h> 27#include <linux/if_ether.h>
28#include <linux/netdevice.h>
28#include <linux/random.h> 29#include <linux/random.h>
29 30
30#ifdef __KERNEL__ 31#ifdef __KERNEL__
@@ -65,7 +66,7 @@ static inline int is_zero_ether_addr(const u8 *addr)
65 */ 66 */
66static inline int is_multicast_ether_addr(const u8 *addr) 67static inline int is_multicast_ether_addr(const u8 *addr)
67{ 68{
68 return addr[0] & 0x01; 69 return ((addr[0] != 0xff) && (0x01 & addr[0]));
69} 70}
70 71
71/** 72/**
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..047bde30836a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -213,6 +213,7 @@ extern int dir_notify_enable;
213#include <linux/radix-tree.h> 213#include <linux/radix-tree.h>
214#include <linux/prio_tree.h> 214#include <linux/prio_tree.h>
215#include <linux/init.h> 215#include <linux/init.h>
216#include <linux/sched.h>
216 217
217#include <asm/atomic.h> 218#include <asm/atomic.h>
218#include <asm/semaphore.h> 219#include <asm/semaphore.h>
@@ -220,6 +221,7 @@ extern int dir_notify_enable;
220 221
221struct iovec; 222struct iovec;
222struct nameidata; 223struct nameidata;
224struct kiocb;
223struct pipe_inode_info; 225struct pipe_inode_info;
224struct poll_table_struct; 226struct poll_table_struct;
225struct kstatfs; 227struct kstatfs;
@@ -240,7 +242,7 @@ typedef int (get_block_t)(struct inode *inode, sector_t iblock,
240typedef int (get_blocks_t)(struct inode *inode, sector_t iblock, 242typedef int (get_blocks_t)(struct inode *inode, sector_t iblock,
241 unsigned long max_blocks, 243 unsigned long max_blocks,
242 struct buffer_head *bh_result, int create); 244 struct buffer_head *bh_result, int create);
243typedef void (dio_iodone_t)(struct inode *inode, loff_t offset, 245typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
244 ssize_t bytes, void *private); 246 ssize_t bytes, void *private);
245 247
246/* 248/*
@@ -302,7 +304,6 @@ struct iattr {
302struct page; 304struct page;
303struct address_space; 305struct address_space;
304struct writeback_control; 306struct writeback_control;
305struct kiocb;
306 307
307struct address_space_operations { 308struct address_space_operations {
308 int (*writepage)(struct page *page, struct writeback_control *wbc); 309 int (*writepage)(struct page *page, struct writeback_control *wbc);
@@ -330,6 +331,8 @@ struct address_space_operations {
330 int (*releasepage) (struct page *, int); 331 int (*releasepage) (struct page *, int);
331 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 332 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
332 loff_t offset, unsigned long nr_segs); 333 loff_t offset, unsigned long nr_segs);
334 struct page* (*get_xip_page)(struct address_space *, sector_t,
335 int);
333}; 336};
334 337
335struct backing_dev_info; 338struct backing_dev_info;
@@ -581,7 +584,6 @@ struct file {
581 atomic_t f_count; 584 atomic_t f_count;
582 unsigned int f_flags; 585 unsigned int f_flags;
583 mode_t f_mode; 586 mode_t f_mode;
584 int f_error;
585 loff_t f_pos; 587 loff_t f_pos;
586 struct fown_struct f_owner; 588 struct fown_struct f_owner;
587 unsigned int f_uid, f_gid; 589 unsigned int f_uid, f_gid;
@@ -674,6 +676,7 @@ struct file_lock {
674 struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ 676 struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */
675 union { 677 union {
676 struct nfs_lock_info nfs_fl; 678 struct nfs_lock_info nfs_fl;
679 struct nfs4_lock_info nfs4_fl;
677 } fl_u; 680 } fl_u;
678}; 681};
679 682
@@ -820,16 +823,34 @@ enum {
820#define vfs_check_frozen(sb, level) \ 823#define vfs_check_frozen(sb, level) \
821 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) 824 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
822 825
826static inline void get_fs_excl(void)
827{
828 atomic_inc(&current->fs_excl);
829}
830
831static inline void put_fs_excl(void)
832{
833 atomic_dec(&current->fs_excl);
834}
835
836static inline int has_fs_excl(void)
837{
838 return atomic_read(&current->fs_excl);
839}
840
841
823/* 842/*
824 * Superblock locking. 843 * Superblock locking.
825 */ 844 */
826static inline void lock_super(struct super_block * sb) 845static inline void lock_super(struct super_block * sb)
827{ 846{
847 get_fs_excl();
828 down(&sb->s_lock); 848 down(&sb->s_lock);
829} 849}
830 850
831static inline void unlock_super(struct super_block * sb) 851static inline void unlock_super(struct super_block * sb)
832{ 852{
853 put_fs_excl();
833 up(&sb->s_lock); 854 up(&sb->s_lock);
834} 855}
835 856
@@ -883,7 +904,9 @@ struct block_device_operations {
883 int (*open) (struct inode *, struct file *); 904 int (*open) (struct inode *, struct file *);
884 int (*release) (struct inode *, struct file *); 905 int (*release) (struct inode *, struct file *);
885 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); 906 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
907 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
886 long (*compat_ioctl) (struct file *, unsigned, unsigned long); 908 long (*compat_ioctl) (struct file *, unsigned, unsigned long);
909 int (*direct_access) (struct block_device *, sector_t, unsigned long *);
887 int (*media_changed) (struct gendisk *); 910 int (*media_changed) (struct gendisk *);
888 int (*revalidate_disk) (struct gendisk *); 911 int (*revalidate_disk) (struct gendisk *);
889 struct module *owner; 912 struct module *owner;
@@ -1024,6 +1047,7 @@ struct super_operations {
1024#define I_FREEING 16 1047#define I_FREEING 16
1025#define I_CLEAR 32 1048#define I_CLEAR 32
1026#define I_NEW 64 1049#define I_NEW 64
1050#define I_WILL_FREE 128
1027 1051
1028#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1052#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1029 1053
@@ -1494,6 +1518,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); 1518extern int generic_file_open(struct inode * inode, struct file * filp);
1495extern int nonseekable_open(struct inode * inode, struct file * filp); 1519extern int nonseekable_open(struct inode * inode, struct file * filp);
1496 1520
1521#ifdef CONFIG_FS_XIP
1522extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len,
1523 loff_t *ppos);
1524extern ssize_t xip_file_sendfile(struct file *in_file, loff_t *ppos,
1525 size_t count, read_actor_t actor,
1526 void *target);
1527extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma);
1528extern ssize_t xip_file_write(struct file *filp, const char __user *buf,
1529 size_t len, loff_t *ppos);
1530extern int xip_truncate_page(struct address_space *mapping, loff_t from);
1531#else
1532static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
1533{
1534 return 0;
1535}
1536#endif
1537
1497static inline void do_generic_file_read(struct file * filp, loff_t *ppos, 1538static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
1498 read_descriptor_t * desc, 1539 read_descriptor_t * desc,
1499 read_actor_t actor) 1540 read_actor_t actor)
@@ -1657,6 +1698,52 @@ static inline void simple_transaction_set(struct file *file, size_t n)
1657 ar->size = n; 1698 ar->size = n;
1658} 1699}
1659 1700
1701/*
1702 * simple attribute files
1703 *
1704 * These attributes behave similar to those in sysfs:
1705 *
1706 * Writing to an attribute immediately sets a value, an open file can be
1707 * written to multiple times.
1708 *
1709 * Reading from an attribute creates a buffer from the value that might get
1710 * read with multiple read calls. When the attribute has been read
1711 * completely, no further read calls are possible until the file is opened
1712 * again.
1713 *
1714 * All attributes contain a text representation of a numeric value
1715 * that are accessed with the get() and set() functions.
1716 */
1717#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \
1718static int __fops ## _open(struct inode *inode, struct file *file) \
1719{ \
1720 __simple_attr_check_format(__fmt, 0ull); \
1721 return simple_attr_open(inode, file, __get, __set, __fmt); \
1722} \
1723static struct file_operations __fops = { \
1724 .owner = THIS_MODULE, \
1725 .open = __fops ## _open, \
1726 .release = simple_attr_close, \
1727 .read = simple_attr_read, \
1728 .write = simple_attr_write, \
1729};
1730
1731static inline void __attribute__((format(printf, 1, 2)))
1732__simple_attr_check_format(const char *fmt, ...)
1733{
1734 /* don't do anything, just let the compiler check the arguments; */
1735}
1736
1737int simple_attr_open(struct inode *inode, struct file *file,
1738 u64 (*get)(void *), void (*set)(void *, u64),
1739 const char *fmt);
1740int simple_attr_close(struct inode *inode, struct file *file);
1741ssize_t simple_attr_read(struct file *file, char __user *buf,
1742 size_t len, loff_t *ppos);
1743ssize_t simple_attr_write(struct file *file, const char __user *buf,
1744 size_t len, loff_t *ppos);
1745
1746
1660#ifdef CONFIG_SECURITY 1747#ifdef CONFIG_SECURITY
1661static inline char *alloc_secdata(void) 1748static inline char *alloc_secdata(void)
1662{ 1749{
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/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/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-dev.h b/include/linux/i2c-dev.h
index d228230ffe5d..541695679762 100644
--- a/include/linux/i2c-dev.h
+++ b/include/linux/i2c-dev.h
@@ -25,6 +25,7 @@
25#define _LINUX_I2C_DEV_H 25#define _LINUX_I2C_DEV_H
26 26
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/compiler.h>
28 29
29/* Some IOCTL commands are defined in <linux/i2c.h> */ 30/* Some IOCTL commands are defined in <linux/i2c.h> */
30/* Note: 10-bit addresses are NOT supported! */ 31/* Note: 10-bit addresses are NOT supported! */
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 336d6e509f59..92129078d4f3 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -917,7 +917,7 @@ typedef struct hwif_s {
917 unsigned dma; 917 unsigned dma;
918 918
919 void (*led_act)(void *data, int rw); 919 void (*led_act)(void *data, int rw);
920} ide_hwif_t; 920} ____cacheline_maxaligned_in_smp ide_hwif_t;
921 921
922/* 922/*
923 * internal ide interrupt handler type 923 * internal ide interrupt handler type
diff --git a/include/linux/if_bonding.h b/include/linux/if_bonding.h
index 57024ce2c74f..84598fa2e9de 100644
--- a/include/linux/if_bonding.h
+++ b/include/linux/if_bonding.h
@@ -35,6 +35,9 @@
35 * 35 *
36 * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com> 36 * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com>
37 * - Code cleanup and style changes 37 * - Code cleanup and style changes
38 *
39 * 2005/05/05 - Jason Gabler <jygabler at lbl dot gov>
40 * - added definitions for various XOR hashing policies
38 */ 41 */
39 42
40#ifndef _LINUX_IF_BONDING_H 43#ifndef _LINUX_IF_BONDING_H
@@ -80,6 +83,10 @@
80 83
81#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ 84#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */
82 85
86/* hashing types */
87#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
88#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ MAC) */
89
83typedef struct ifbond { 90typedef struct ifbond {
84 __s32 bond_mode; 91 __s32 bond_mode;
85 __s32 num_slaves; 92 __s32 num_slaves;
diff --git a/include/linux/in6.h b/include/linux/in6.h
index f8256c582845..dcf5720ffcbb 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -156,7 +156,7 @@ struct in6_flowlabel_req
156#define IPV6_CHECKSUM 7 156#define IPV6_CHECKSUM 7
157#define IPV6_HOPLIMIT 8 157#define IPV6_HOPLIMIT 8
158#define IPV6_NEXTHOP 9 158#define IPV6_NEXTHOP 9
159#define IPV6_AUTHHDR 10 159#define IPV6_AUTHHDR 10 /* obsolete */
160#define IPV6_FLOWINFO 11 160#define IPV6_FLOWINFO 11
161 161
162#define IPV6_UNICAST_HOPS 16 162#define IPV6_UNICAST_HOPS 16
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..c727c195a91a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -81,6 +81,7 @@ extern struct group_info init_groups;
81 .mm = NULL, \ 81 .mm = NULL, \
82 .active_mm = &init_mm, \ 82 .active_mm = &init_mm, \
83 .run_list = LIST_HEAD_INIT(tsk.run_list), \ 83 .run_list = LIST_HEAD_INIT(tsk.run_list), \
84 .ioprio = 0, \
84 .time_slice = HZ, \ 85 .time_slice = HZ, \
85 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 86 .tasks = LIST_HEAD_INIT(tsk.tasks), \
86 .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \ 87 .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \
@@ -108,9 +109,9 @@ extern struct group_info init_groups;
108 .blocked = {{0}}, \ 109 .blocked = {{0}}, \
109 .alloc_lock = SPIN_LOCK_UNLOCKED, \ 110 .alloc_lock = SPIN_LOCK_UNLOCKED, \
110 .proc_lock = SPIN_LOCK_UNLOCKED, \ 111 .proc_lock = SPIN_LOCK_UNLOCKED, \
111 .switch_lock = SPIN_LOCK_UNLOCKED, \
112 .journal_info = NULL, \ 112 .journal_info = NULL, \
113 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 113 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
114 .fs_excl = ATOMIC_INIT(0), \
114} 115}
115 116
116 117
diff --git a/include/linux/input.h b/include/linux/input.h
index 72731d7d189e..b9cc0ac71f44 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -859,6 +859,10 @@ struct input_dev {
859 int (*erase_effect)(struct input_dev *dev, int effect_id); 859 int (*erase_effect)(struct input_dev *dev, int effect_id);
860 860
861 struct input_handle *grab; 861 struct input_handle *grab;
862
863 struct semaphore sem; /* serializes open and close operations */
864 unsigned int users;
865
862 struct device *dev; 866 struct device *dev;
863 867
864 struct list_head h_list; 868 struct list_head h_list;
@@ -1015,7 +1019,7 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
1015 dev->absbit[LONG(axis)] |= BIT(axis); 1019 dev->absbit[LONG(axis)] |= BIT(axis);
1016} 1020}
1017 1021
1018extern struct class_simple *input_class; 1022extern struct class *input_class;
1019 1023
1020#endif 1024#endif
1021#endif 1025#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/ioprio.h b/include/linux/ioprio.h
new file mode 100644
index 000000000000..8a453a0b5e4b
--- /dev/null
+++ b/include/linux/ioprio.h
@@ -0,0 +1,88 @@
1#ifndef IOPRIO_H
2#define IOPRIO_H
3
4#include <linux/sched.h>
5
6/*
7 * Gives us 8 prio classes with 13-bits of data for each class
8 */
9#define IOPRIO_BITS (16)
10#define IOPRIO_CLASS_SHIFT (13)
11#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
12
13#define IOPRIO_PRIO_CLASS(mask) ((mask) >> IOPRIO_CLASS_SHIFT)
14#define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK)
15#define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data)
16
17#define ioprio_valid(mask) (IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE)
18
19/*
20 * These are the io priority groups as implemented by CFQ. RT is the realtime
21 * class, it always gets premium service. BE is the best-effort scheduling
22 * class, the default for any process. IDLE is the idle scheduling class, it
23 * is only served when no one else is using the disk.
24 */
25enum {
26 IOPRIO_CLASS_NONE,
27 IOPRIO_CLASS_RT,
28 IOPRIO_CLASS_BE,
29 IOPRIO_CLASS_IDLE,
30};
31
32/*
33 * 8 best effort priority levels are supported
34 */
35#define IOPRIO_BE_NR (8)
36
37asmlinkage int sys_ioprio_set(int, int, int);
38asmlinkage int sys_ioprio_get(int, int);
39
40enum {
41 IOPRIO_WHO_PROCESS = 1,
42 IOPRIO_WHO_PGRP,
43 IOPRIO_WHO_USER,
44};
45
46/*
47 * if process has set io priority explicitly, use that. if not, convert
48 * the cpu scheduler nice value to an io priority
49 */
50#define IOPRIO_NORM (4)
51static inline int task_ioprio(struct task_struct *task)
52{
53 WARN_ON(!ioprio_valid(task->ioprio));
54 return IOPRIO_PRIO_DATA(task->ioprio);
55}
56
57static inline int task_nice_ioprio(struct task_struct *task)
58{
59 return (task_nice(task) + 20) / 5;
60}
61
62/*
63 * For inheritance, return the highest of the two given priorities
64 */
65static inline int ioprio_best(unsigned short aprio, unsigned short bprio)
66{
67 unsigned short aclass = IOPRIO_PRIO_CLASS(aprio);
68 unsigned short bclass = IOPRIO_PRIO_CLASS(bprio);
69
70 if (!ioprio_valid(aprio))
71 return bprio;
72 if (!ioprio_valid(bprio))
73 return aprio;
74
75 if (aclass == IOPRIO_CLASS_NONE)
76 aclass = IOPRIO_CLASS_BE;
77 if (bclass == IOPRIO_CLASS_NONE)
78 bclass = IOPRIO_CLASS_BE;
79
80 if (aclass == bclass)
81 return min(aprio, bprio);
82 if (aclass > bclass)
83 return bprio;
84 else
85 return aprio;
86}
87
88#endif
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/irq.h b/include/linux/irq.h
index c3ff4d101667..069d3b84d311 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;
@@ -81,10 +85,10 @@ extern int no_irq_affinity;
81extern int noirqdebug_setup(char *str); 85extern int noirqdebug_setup(char *str);
82 86
83extern fastcall int handle_IRQ_event(unsigned int irq, struct pt_regs *regs, 87extern 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,
87extern void report_bad_irq(unsigned int irq, irq_desc_t *desc, int action_ret); 91 int action_ret, struct pt_regs *regs);
88extern int can_request_irq(unsigned int irq, unsigned long irqflags); 92extern int can_request_irq(unsigned int irq, unsigned long irqflags);
89 93
90extern void init_irq_proc(void); 94extern void init_irq_proc(void);
diff --git a/include/linux/joystick.h b/include/linux/joystick.h
index b7e0ab622cd7..06b9af77eb7f 100644
--- a/include/linux/joystick.h
+++ b/include/linux/joystick.h
@@ -111,18 +111,35 @@ struct js_corr {
111#define JS_SET_ALL 8 111#define JS_SET_ALL 8
112 112
113struct JS_DATA_TYPE { 113struct JS_DATA_TYPE {
114 int buttons; 114 __s32 buttons;
115 int x; 115 __s32 x;
116 int y; 116 __s32 y;
117}; 117};
118 118
119struct JS_DATA_SAVE_TYPE { 119struct JS_DATA_SAVE_TYPE_32 {
120 int JS_TIMEOUT; 120 __s32 JS_TIMEOUT;
121 int BUSY; 121 __s32 BUSY;
122 long JS_EXPIRETIME; 122 __s32 JS_EXPIRETIME;
123 long JS_TIMELIMIT; 123 __s32 JS_TIMELIMIT;
124 struct JS_DATA_TYPE JS_SAVE; 124 struct JS_DATA_TYPE JS_SAVE;
125 struct JS_DATA_TYPE JS_CORR; 125 struct JS_DATA_TYPE JS_CORR;
126}; 126};
127 127
128struct JS_DATA_SAVE_TYPE_64 {
129 __s32 JS_TIMEOUT;
130 __s32 BUSY;
131 __s64 JS_EXPIRETIME;
132 __s64 JS_TIMELIMIT;
133 struct JS_DATA_TYPE JS_SAVE;
134 struct JS_DATA_TYPE JS_CORR;
135};
136
137#if BITS_PER_LONG == 64
138#define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_64
139#elif BITS_PER_LONG == 32
140#define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_32
141#else
142#error Unexpected BITS_PER_LONG
143#endif
144
128#endif /* _LINUX_JOYSTICK_H */ 145#endif /* _LINUX_JOYSTICK_H */
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..b7a194c4362a 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,41 @@ 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 void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs);
108#else /* ARCH_SUPPORTS_KRETPROBES */
109static inline void arch_prepare_kretprobe(struct kretprobe *rp,
110 struct pt_regs *regs)
111{
112}
113#endif /* ARCH_SUPPORTS_KRETPROBES */
114/*
115 * Function-return probe -
116 * Note:
117 * User needs to provide a handler function, and initialize maxactive.
118 * maxactive - The maximum number of instances of the probed function that
119 * can be active concurrently.
120 * nmissed - tracks the number of times the probed function's return was
121 * ignored, due to maxactive being too low.
122 *
123 */
124struct kretprobe {
125 struct kprobe kp;
126 kretprobe_handler_t handler;
127 int maxactive;
128 int nmissed;
129 struct hlist_head free_instances;
130 struct hlist_head used_instances;
131};
132
133struct kretprobe_instance {
134 struct hlist_node uflist; /* either on free list or used list */
135 struct hlist_node hlist;
136 struct kretprobe *rp;
137 kprobe_opcode_t *ret_addr;
138 struct task_struct *task;
139};
140
88#ifdef CONFIG_KPROBES 141#ifdef CONFIG_KPROBES
89/* Locks kprobe: irq must be disabled */ 142/* Locks kprobe: irq must be disabled */
90void lock_kprobes(void); 143void lock_kprobes(void);
@@ -99,11 +152,17 @@ static inline int kprobe_running(void)
99 152
100extern int arch_prepare_kprobe(struct kprobe *p); 153extern int arch_prepare_kprobe(struct kprobe *p);
101extern void arch_copy_kprobe(struct kprobe *p); 154extern void arch_copy_kprobe(struct kprobe *p);
155extern void arch_arm_kprobe(struct kprobe *p);
156extern void arch_disarm_kprobe(struct kprobe *p);
102extern void arch_remove_kprobe(struct kprobe *p); 157extern void arch_remove_kprobe(struct kprobe *p);
158extern int arch_init(void);
103extern void show_registers(struct pt_regs *regs); 159extern void show_registers(struct pt_regs *regs);
160extern kprobe_opcode_t *get_insn_slot(void);
161extern void free_insn_slot(kprobe_opcode_t *slot);
104 162
105/* Get the kprobe at this addr (if any). Must have called lock_kprobes */ 163/* Get the kprobe at this addr (if any). Must have called lock_kprobes */
106struct kprobe *get_kprobe(void *addr); 164struct kprobe *get_kprobe(void *addr);
165struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk);
107 166
108int register_kprobe(struct kprobe *p); 167int register_kprobe(struct kprobe *p);
109void unregister_kprobe(struct kprobe *p); 168void unregister_kprobe(struct kprobe *p);
@@ -113,7 +172,14 @@ int register_jprobe(struct jprobe *p);
113void unregister_jprobe(struct jprobe *p); 172void unregister_jprobe(struct jprobe *p);
114void jprobe_return(void); 173void jprobe_return(void);
115 174
116#else 175int register_kretprobe(struct kretprobe *rp);
176void unregister_kretprobe(struct kretprobe *rp);
177
178struct kretprobe_instance *get_free_rp_inst(struct kretprobe *rp);
179void add_rp_inst(struct kretprobe_instance *ri);
180void kprobe_flush_task(struct task_struct *tk);
181void recycle_rp_inst(struct kretprobe_instance *ri);
182#else /* CONFIG_KPROBES */
117static inline int kprobe_running(void) 183static inline int kprobe_running(void)
118{ 184{
119 return 0; 185 return 0;
@@ -135,5 +201,15 @@ static inline void unregister_jprobe(struct jprobe *p)
135static inline void jprobe_return(void) 201static inline void jprobe_return(void)
136{ 202{
137} 203}
138#endif 204static inline int register_kretprobe(struct kretprobe *rp)
205{
206 return -ENOSYS;
207}
208static inline void unregister_kretprobe(struct kretprobe *rp)
209{
210}
211static inline void kprobe_flush_task(struct task_struct *tk)
212{
213}
214#endif /* CONFIG_KPROBES */
139#endif /* _LINUX_KPROBES_H */ 215#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index 923bdbc6d9e4..a710bddda4eb 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -41,6 +41,7 @@ struct ps2dev {
41 41
42void ps2_init(struct ps2dev *ps2dev, struct serio *serio); 42void ps2_init(struct ps2dev *ps2dev, struct serio *serio);
43int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); 43int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout);
44void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout);
44int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); 45int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
45int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command); 46int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command);
46int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); 47int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data);
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/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/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/mod_devicetable.h b/include/linux/mod_devicetable.h
index d6eb7b2efc04..9b6d05172ed4 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -175,4 +175,50 @@ struct serio_device_id {
175}; 175};
176 176
177 177
178/* PCMCIA */
179
180struct pcmcia_device_id {
181 __u16 match_flags;
182
183 __u16 manf_id;
184 __u16 card_id;
185
186 __u8 func_id;
187
188 /* for real multi-function devices */
189 __u8 function;
190
191 /* for pseude multi-function devices */
192 __u8 device_no;
193
194 __u32 prod_id_hash[4];
195
196 /* not matched against in kernelspace*/
197#ifdef __KERNEL__
198 const char * prod_id[4];
199#else
200 kernel_ulong_t prod_id[4];
201#endif
202
203 /* not matched against */
204 kernel_ulong_t driver_info;
205#ifdef __KERNEL__
206 char * cisfile;
207#else
208 kernel_ulong_t cisfile;
209#endif
210};
211
212#define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001
213#define PCMCIA_DEV_ID_MATCH_CARD_ID 0x0002
214#define PCMCIA_DEV_ID_MATCH_FUNC_ID 0x0004
215#define PCMCIA_DEV_ID_MATCH_FUNCTION 0x0008
216#define PCMCIA_DEV_ID_MATCH_PROD_ID1 0x0010
217#define PCMCIA_DEV_ID_MATCH_PROD_ID2 0x0020
218#define PCMCIA_DEV_ID_MATCH_PROD_ID3 0x0040
219#define PCMCIA_DEV_ID_MATCH_PROD_ID4 0x0080
220#define PCMCIA_DEV_ID_MATCH_DEVICE_NO 0x0100
221#define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
222#define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
223
178#endif /* LINUX_MOD_DEVICETABLE_H */ 224#endif /* LINUX_MOD_DEVICETABLE_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/netdevice.h b/include/linux/netdevice.h
index ba5d1236aa17..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
@@ -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);
@@ -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) */
@@ -925,10 +916,6 @@ extern int skb_checksum_help(struct sk_buff *skb, int inward);
925extern void net_enable_timestamp(void); 916extern void net_enable_timestamp(void);
926extern void net_disable_timestamp(void); 917extern void net_disable_timestamp(void);
927 918
928#ifdef CONFIG_SYSCTL
929extern char *net_sysctl_strdup(const char *s);
930#endif
931
932#endif /* __KERNEL__ */ 919#endif /* __KERNEL__ */
933 920
934#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 e38407a23d04..27e4d164a108 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
@@ -167,6 +168,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
167 nlh->nlmsg_flags = flags; 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;
171 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
170 return nlh; 172 return nlh;
171} 173}
172 174
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/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.h b/include/linux/pci.h
index b5238bd18830..66798b46f308 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -734,16 +734,20 @@ void pcibios_update_irq(struct pci_dev *, int irq);
734/* Generic PCI functions used internally */ 734/* Generic PCI functions used internally */
735 735
736extern struct pci_bus *pci_find_bus(int domain, int busnr); 736extern struct pci_bus *pci_find_bus(int domain, int busnr);
737void pci_bus_add_devices(struct pci_bus *bus);
737struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); 738struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata);
738static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata) 739static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata)
739{ 740{
740 return pci_scan_bus_parented(NULL, bus, ops, sysdata); 741 struct pci_bus *root_bus;
742 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata);
743 if (root_bus)
744 pci_bus_add_devices(root_bus);
745 return root_bus;
741} 746}
742int pci_scan_slot(struct pci_bus *bus, int devfn); 747int pci_scan_slot(struct pci_bus *bus, int devfn);
743struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 748struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn);
744unsigned int pci_scan_child_bus(struct pci_bus *bus); 749unsigned int pci_scan_child_bus(struct pci_bus *bus);
745void pci_bus_add_device(struct pci_dev *dev); 750void pci_bus_add_device(struct pci_dev *dev);
746void pci_bus_add_devices(struct pci_bus *bus);
747void pci_name_device(struct pci_dev *dev); 751void pci_name_device(struct pci_dev *dev);
748char *pci_class_name(u32 class); 752char *pci_class_name(u32 class);
749void pci_read_bridge_bases(struct pci_bus *child); 753void pci_read_bridge_bases(struct pci_bus *child);
@@ -870,6 +874,15 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
870#define pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle) 874#define pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle)
871#define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr) 875#define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr)
872 876
877enum pci_dma_burst_strategy {
878 PCI_DMA_BURST_INFINITY, /* make bursts as large as possible,
879 strategy_parameter is N/A */
880 PCI_DMA_BURST_BOUNDARY, /* disconnect at every strategy_parameter
881 byte boundaries */
882 PCI_DMA_BURST_MULTIPLE, /* disconnect at some multiple of
883 strategy_parameter byte boundaries */
884};
885
873#if defined(CONFIG_ISA) || defined(CONFIG_EISA) 886#if defined(CONFIG_ISA) || defined(CONFIG_EISA)
874extern struct pci_dev *isa_bridge; 887extern struct pci_dev *isa_bridge;
875#endif 888#endif
@@ -972,6 +985,8 @@ static inline int pci_proc_domain(struct pci_bus *bus)
972} 985}
973#endif 986#endif
974 987
988#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
989
975#endif /* !CONFIG_PCI */ 990#endif /* !CONFIG_PCI */
976 991
977/* these helpers provide future and backwards compatibility 992/* these helpers provide future and backwards compatibility
@@ -1016,6 +1031,20 @@ static inline char *pci_name(struct pci_dev *pdev)
1016#define pci_pretty_name(dev) "" 1031#define pci_pretty_name(dev) ""
1017#endif 1032#endif
1018 1033
1034
1035/* Some archs don't want to expose struct resource to userland as-is
1036 * in sysfs and /proc
1037 */
1038#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER
1039static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
1040 const struct resource *rsrc, u64 *start, u64 *end)
1041{
1042 *start = rsrc->start;
1043 *end = rsrc->end;
1044}
1045#endif /* HAVE_ARCH_PCI_RESOURCE_TO_USER */
1046
1047
1019/* 1048/*
1020 * The world is not perfect and supplies us with broken PCI devices. 1049 * The world is not perfect and supplies us with broken PCI devices.
1021 * For at least a part of these bugs we need a work-around, so both 1050 * For at least a part of these bugs we need a work-around, so both
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index b8b4ebf9abf1..c3ee1ae4545a 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -62,6 +62,8 @@
62 62
63#define PCI_BASE_CLASS_SYSTEM 0x08 63#define PCI_BASE_CLASS_SYSTEM 0x08
64#define PCI_CLASS_SYSTEM_PIC 0x0800 64#define PCI_CLASS_SYSTEM_PIC 0x0800
65#define PCI_CLASS_SYSTEM_PIC_IOAPIC 0x080010
66#define PCI_CLASS_SYSTEM_PIC_IOXAPIC 0x080020
65#define PCI_CLASS_SYSTEM_DMA 0x0801 67#define PCI_CLASS_SYSTEM_DMA 0x0801
66#define PCI_CLASS_SYSTEM_TIMER 0x0802 68#define PCI_CLASS_SYSTEM_TIMER 0x0802
67#define PCI_CLASS_SYSTEM_RTC 0x0803 69#define PCI_CLASS_SYSTEM_RTC 0x0803
@@ -575,6 +577,7 @@
575#define PCI_DEVICE_ID_CT_65550 0x00e0 577#define PCI_DEVICE_ID_CT_65550 0x00e0
576#define PCI_DEVICE_ID_CT_65554 0x00e4 578#define PCI_DEVICE_ID_CT_65554 0x00e4
577#define PCI_DEVICE_ID_CT_65555 0x00e5 579#define PCI_DEVICE_ID_CT_65555 0x00e5
580#define PCI_DEVICE_ID_CT_69000 0x00c0
578 581
579#define PCI_VENDOR_ID_MIRO 0x1031 582#define PCI_VENDOR_ID_MIRO 0x1031
580#define PCI_DEVICE_ID_MIRO_36050 0x5601 583#define PCI_DEVICE_ID_MIRO_36050 0x5601
@@ -711,8 +714,9 @@
711#define PCI_DEVICE_ID_HP_DIVA_AUX 0x1290 714#define PCI_DEVICE_ID_HP_DIVA_AUX 0x1290
712#define PCI_DEVICE_ID_HP_DIVA_RMP3 0x1301 715#define PCI_DEVICE_ID_HP_DIVA_RMP3 0x1301
713#define PCI_DEVICE_ID_HP_CISSA 0x3220 716#define PCI_DEVICE_ID_HP_CISSA 0x3220
714#define PCI_DEVICE_ID_HP_CISSB 0x3230 717#define PCI_DEVICE_ID_HP_CISSB 0x3222
715#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 718#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031
719#define PCI_DEVICE_ID_HP_CISSC 0x3230
716 720
717#define PCI_VENDOR_ID_PCTECH 0x1042 721#define PCI_VENDOR_ID_PCTECH 0x1042
718#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000 722#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000
@@ -1283,6 +1287,8 @@
1283#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348 1287#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348
1284#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C 1288#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C
1285#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E 1289#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E
1290#define PCI_DEVICE_ID_NVIDIA_NVENET_14 0x0372
1291#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373
1286 1292
1287#define PCI_VENDOR_ID_IMS 0x10e0 1293#define PCI_VENDOR_ID_IMS 0x10e0
1288#define PCI_DEVICE_ID_IMS_8849 0x8849 1294#define PCI_DEVICE_ID_IMS_8849 0x8849
@@ -1567,6 +1573,7 @@
1567#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 1573#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220
1568#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB 1574#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB
1569#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221 1575#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221
1576#define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227
1570#define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225 1577#define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225
1571#define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227 1578#define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227
1572#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 1579#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230
@@ -1810,6 +1817,8 @@
1810#define PCI_VENDOR_ID_ITE 0x1283 1817#define PCI_VENDOR_ID_ITE 0x1283
1811#define PCI_DEVICE_ID_ITE_IT8172G 0x8172 1818#define PCI_DEVICE_ID_ITE_IT8172G 0x8172
1812#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801 1819#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
1820#define PCI_DEVICE_ID_ITE_8211 0x8211
1821#define PCI_DEVICE_ID_ITE_8212 0x8212
1813#define PCI_DEVICE_ID_ITE_8872 0x8872 1822#define PCI_DEVICE_ID_ITE_8872 0x8872
1814#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886 1823#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886
1815 1824
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..bd2c5a2bbbf5 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -276,6 +276,7 @@ struct tc_rsvp_pinfo
276 __u8 protocol; 276 __u8 protocol;
277 __u8 tunnelid; 277 __u8 tunnelid;
278 __u8 tunnelhdr; 278 __u8 tunnelhdr;
279 __u8 pad;
279}; 280};
280 281
281/* ROUTE filter */ 282/* ROUTE filter */
@@ -408,6 +409,7 @@ enum
408 TCF_EM_NBYTE, 409 TCF_EM_NBYTE,
409 TCF_EM_U32, 410 TCF_EM_U32,
410 TCF_EM_META, 411 TCF_EM_META,
412 TCF_EM_TEXT,
411 __TCF_EM_MAX 413 __TCF_EM_MAX
412}; 414};
413 415
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 1d9da36eb9db..60ffcb9c5791 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -221,9 +221,11 @@ struct tc_gred_qopt
221/* gred setup */ 221/* gred setup */
222struct tc_gred_sopt 222struct tc_gred_sopt
223{ 223{
224 __u32 DPs; 224 __u32 DPs;
225 __u32 def_DP; 225 __u32 def_DP;
226 __u8 grio; 226 __u8 grio;
227 __u8 pad1;
228 __u16 pad2;
227}; 229};
228 230
229/* HTB section */ 231/* HTB section */
@@ -351,6 +353,7 @@ struct tc_cbq_ovl
351#define TC_CBQ_OVL_DROP 3 353#define TC_CBQ_OVL_DROP 3
352#define TC_CBQ_OVL_RCLASSIC 4 354#define TC_CBQ_OVL_RCLASSIC 4
353 unsigned char priority2; 355 unsigned char priority2;
356 __u16 pad;
354 __u32 penalty; 357 __u32 penalty;
355}; 358};
356 359
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/pmu.h b/include/linux/pmu.h
index 6d73eada277e..373bd3b9b330 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -166,7 +166,7 @@ extern int pmu_i2c_simple_read(int bus, int addr, u8* data, int len);
166extern int pmu_i2c_simple_write(int bus, int addr, u8* data, int len); 166extern int pmu_i2c_simple_write(int bus, int addr, u8* data, int len);
167 167
168 168
169#ifdef CONFIG_PMAC_PBOOK 169#ifdef CONFIG_PM
170/* 170/*
171 * Stuff for putting the powerbook to sleep and waking it again. 171 * Stuff for putting the powerbook to sleep and waking it again.
172 * 172 *
@@ -208,6 +208,8 @@ struct pmu_sleep_notifier
208int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier); 208int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier);
209int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier); 209int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier);
210 210
211#endif /* CONFIG_PM */
212
211#define PMU_MAX_BATTERIES 2 213#define PMU_MAX_BATTERIES 2
212 214
213/* values for pmu_power_flags */ 215/* values for pmu_power_flags */
@@ -235,6 +237,4 @@ extern int pmu_battery_count;
235extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES]; 237extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
236extern unsigned int pmu_power_flags; 238extern unsigned int pmu_power_flags;
237 239
238#endif /* CONFIG_PMAC_PBOOK */
239
240#endif /* __KERNEL__ */ 240#endif /* __KERNEL__ */
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 e68dbf0bf579..657c05ab8f9e 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -363,6 +363,8 @@ enum
363struct rta_session 363struct rta_session
364{ 364{
365 __u8 proto; 365 __u8 proto;
366 __u8 pad1;
367 __u16 pad2;
366 368
367 union { 369 union {
368 struct { 370 struct {
@@ -635,10 +637,13 @@ struct ifinfomsg
635struct prefixmsg 637struct prefixmsg
636{ 638{
637 unsigned char prefix_family; 639 unsigned char prefix_family;
640 unsigned char prefix_pad1;
641 unsigned short prefix_pad2;
638 int prefix_ifindex; 642 int prefix_ifindex;
639 unsigned char prefix_type; 643 unsigned char prefix_type;
640 unsigned char prefix_len; 644 unsigned char prefix_len;
641 unsigned char prefix_flags; 645 unsigned char prefix_flags;
646 unsigned char prefix_pad3;
642}; 647};
643 648
644enum 649enum
@@ -892,10 +897,15 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
892 goto rtattr_failure; \ 897 goto rtattr_failure; \
893 __rta_fill(skb, attrtype, attrlen, data); }) 898 __rta_fill(skb, attrtype, attrlen, data); })
894 899
895#define RTA_PUT_NOHDR(skb, attrlen, data) \ 900#define RTA_APPEND(skb, attrlen, data) \
896({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \ 901({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \
897 goto rtattr_failure; \ 902 goto rtattr_failure; \
898 memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); }) 903 memcpy(skb_put(skb, attrlen), data, attrlen); })
904
905#define RTA_PUT_NOHDR(skb, attrlen, data) \
906({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \
907 memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \
908 RTA_ALIGN(attrlen) - attrlen); })
899 909
900#define RTA_PUT_U8(skb, attrtype, value) \ 910#define RTA_PUT_U8(skb, attrtype, value) \
901({ u8 _tmp = (value); \ 911({ u8 _tmp = (value); \
@@ -975,6 +985,7 @@ __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
975 rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size)); 985 rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size));
976 rta->rta_type = attrtype; 986 rta->rta_type = attrtype;
977 rta->rta_len = size; 987 rta->rta_len = size;
988 memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
978 return rta; 989 return rta;
979} 990}
980 991
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4dbb109022f3..ff48815bd3a2 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,10 +601,15 @@ 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;
586 610
611 unsigned short ioprio;
612
587 unsigned long sleep_avg; 613 unsigned long sleep_avg;
588 unsigned long long timestamp, last_ran; 614 unsigned long long timestamp, last_ran;
589 unsigned long long sched_time; /* sched_clock time spent running */ 615 unsigned long long sched_time; /* sched_clock time spent running */
@@ -659,6 +685,7 @@ struct task_struct {
659 struct user_struct *user; 685 struct user_struct *user;
660#ifdef CONFIG_KEYS 686#ifdef CONFIG_KEYS
661 struct key *thread_keyring; /* keyring private to this thread */ 687 struct key *thread_keyring; /* keyring private to this thread */
688 unsigned char jit_keyring; /* default keyring to attach requested keys to */
662#endif 689#endif
663 int oomkilladj; /* OOM kill score adjustment (bit shift). */ 690 int oomkilladj; /* OOM kill score adjustment (bit shift). */
664 char comm[TASK_COMM_LEN]; /* executable name excluding path 691 char comm[TASK_COMM_LEN]; /* executable name excluding path
@@ -701,8 +728,6 @@ struct task_struct {
701 spinlock_t alloc_lock; 728 spinlock_t alloc_lock;
702/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ 729/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
703 spinlock_t proc_lock; 730 spinlock_t proc_lock;
704/* context-switch lock */
705 spinlock_t switch_lock;
706 731
707/* journalling filesystem info */ 732/* journalling filesystem info */
708 void *journal_info; 733 void *journal_info;
@@ -740,6 +765,7 @@ struct task_struct {
740 nodemask_t mems_allowed; 765 nodemask_t mems_allowed;
741 int cpuset_mems_generation; 766 int cpuset_mems_generation;
742#endif 767#endif
768 atomic_t fs_excl; /* holding fs exclusive resources */
743}; 769};
744 770
745static inline pid_t process_group(struct task_struct *tsk) 771static inline pid_t process_group(struct task_struct *tsk)
@@ -909,7 +935,7 @@ extern void FASTCALL(wake_up_new_task(struct task_struct * tsk,
909#else 935#else
910 static inline void kick_process(struct task_struct *tsk) { } 936 static inline void kick_process(struct task_struct *tsk) { }
911#endif 937#endif
912extern void FASTCALL(sched_fork(task_t * p)); 938extern void FASTCALL(sched_fork(task_t * p, int clone_flags));
913extern void FASTCALL(sched_exit(task_t * p)); 939extern void FASTCALL(sched_exit(task_t * p));
914 940
915extern int in_group_p(gid_t); 941extern int in_group_p(gid_t);
@@ -1089,7 +1115,8 @@ extern void unhash_process(struct task_struct *p);
1089 1115
1090/* 1116/*
1091 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring 1117 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring
1092 * subscriptions and synchronises with wait4(). Also used in procfs. 1118 * subscriptions and synchronises with wait4(). Also used in procfs. Also
1119 * pins the final release of task.io_context.
1093 * 1120 *
1094 * Nests both inside and outside of read_lock(&tasklist_lock). 1121 * Nests both inside and outside of read_lock(&tasklist_lock).
1095 * It must not be nested with write_lock_irq(&tasklist_lock), 1122 * It must not be nested with write_lock_irq(&tasklist_lock),
@@ -1242,33 +1269,78 @@ extern void normalize_rt_tasks(void);
1242 1269
1243#endif 1270#endif
1244 1271
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 1272#ifdef CONFIG_PM
1251extern void refrigerator(unsigned long); 1273/*
1274 * Check if a process has been frozen
1275 */
1276static inline int frozen(struct task_struct *p)
1277{
1278 return p->flags & PF_FROZEN;
1279}
1280
1281/*
1282 * Check if there is a request to freeze a process
1283 */
1284static inline int freezing(struct task_struct *p)
1285{
1286 return p->flags & PF_FREEZE;
1287}
1288
1289/*
1290 * Request that a process be frozen
1291 * FIXME: SMP problem. We may not modify other process' flags!
1292 */
1293static inline void freeze(struct task_struct *p)
1294{
1295 p->flags |= PF_FREEZE;
1296}
1297
1298/*
1299 * Wake up a frozen process
1300 */
1301static inline int thaw_process(struct task_struct *p)
1302{
1303 if (frozen(p)) {
1304 p->flags &= ~PF_FROZEN;
1305 wake_up_process(p);
1306 return 1;
1307 }
1308 return 0;
1309}
1310
1311/*
1312 * freezing is complete, mark process as frozen
1313 */
1314static inline void frozen_process(struct task_struct *p)
1315{
1316 p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN;
1317}
1318
1319extern void refrigerator(void);
1252extern int freeze_processes(void); 1320extern int freeze_processes(void);
1253extern void thaw_processes(void); 1321extern void thaw_processes(void);
1254 1322
1255static inline int try_to_freeze(unsigned long refrigerator_flags) 1323static inline int try_to_freeze(void)
1256{ 1324{
1257 if (unlikely(current->flags & PF_FREEZE)) { 1325 if (freezing(current)) {
1258 refrigerator(refrigerator_flags); 1326 refrigerator();
1259 return 1; 1327 return 1;
1260 } else 1328 } else
1261 return 0; 1329 return 0;
1262} 1330}
1263#else 1331#else
1264static inline void refrigerator(unsigned long flag) {} 1332static inline int frozen(struct task_struct *p) { return 0; }
1333static inline int freezing(struct task_struct *p) { return 0; }
1334static inline void freeze(struct task_struct *p) { BUG(); }
1335static inline int thaw_process(struct task_struct *p) { return 1; }
1336static inline void frozen_process(struct task_struct *p) { BUG(); }
1337
1338static inline void refrigerator(void) {}
1265static inline int freeze_processes(void) { BUG(); return 0; } 1339static inline int freeze_processes(void) { BUG(); return 0; }
1266static inline void thaw_processes(void) {} 1340static inline void thaw_processes(void) {}
1267 1341
1268static inline int try_to_freeze(unsigned long refrigerator_flags) 1342static inline int try_to_freeze(void) { return 0; }
1269{ 1343
1270 return 0;
1271}
1272#endif /* CONFIG_PM */ 1344#endif /* CONFIG_PM */
1273#endif /* __KERNEL__ */ 1345#endif /* __KERNEL__ */
1274 1346
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 3a2702bbb1d6..dc89116bb1ca 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -19,6 +19,11 @@ static inline void secure_computing(int this_syscall)
19 __secure_computing(this_syscall); 19 __secure_computing(this_syscall);
20} 20}
21 21
22static inline int has_secure_computing(struct thread_info *ti)
23{
24 return unlikely(test_ti_thread_flag(ti, TIF_SECCOMP));
25}
26
22#else /* CONFIG_SECCOMP */ 27#else /* CONFIG_SECCOMP */
23 28
24#if (__GNUC__ > 2) 29#if (__GNUC__ > 2)
@@ -28,6 +33,11 @@ static inline void secure_computing(int this_syscall)
28#endif 33#endif
29 34
30#define secure_computing(x) do { } while (0) 35#define secure_computing(x) do { } while (0)
36/* static inline to preserve typechecking */
37static inline int has_secure_computing(struct thread_info *ti)
38{
39 return 0;
40}
31 41
32#endif /* CONFIG_SECCOMP */ 42#endif /* CONFIG_SECCOMP */
33 43
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 823181af6ddf..3e3c1fa35b06 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -22,6 +22,7 @@ struct plat_serial8250_port {
22 unsigned int uartclk; /* UART clock rate */ 22 unsigned int uartclk; /* UART clock rate */
23 unsigned char regshift; /* register shift */ 23 unsigned char regshift; /* register shift */
24 unsigned char iotype; /* UPIO_* */ 24 unsigned char iotype; /* UPIO_* */
25 unsigned char hub6;
25 unsigned int flags; /* UPF_* flags */ 26 unsigned int flags; /* UPF_* flags */
26}; 27};
27 28
diff --git a/include/linux/serio.h b/include/linux/serio.h
index a2d3b9ae06f4..aa4d6493a034 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -83,6 +83,7 @@ static inline void serio_register_port(struct serio *serio)
83} 83}
84 84
85void serio_unregister_port(struct serio *serio); 85void serio_unregister_port(struct serio *serio);
86void serio_unregister_child_port(struct serio *serio);
86void __serio_unregister_port_delayed(struct serio *serio, struct module *owner); 87void __serio_unregister_port_delayed(struct serio *serio, struct module *owner);
87static inline void serio_unregister_port_delayed(struct serio *serio) 88static inline void serio_unregister_port_delayed(struct serio *serio)
88{ 89{
@@ -153,6 +154,11 @@ static inline int serio_pin_driver(struct serio *serio)
153 return down_interruptible(&serio->drv_sem); 154 return down_interruptible(&serio->drv_sem);
154} 155}
155 156
157static inline void serio_pin_driver_uninterruptible(struct serio *serio)
158{
159 down(&serio->drv_sem);
160}
161
156static inline void serio_unpin_driver(struct serio *serio) 162static inline void serio_unpin_driver(struct serio *serio)
157{ 163{
158 up(&serio->drv_sem); 164 up(&serio->drv_sem);
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/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 a17745c80a91..5b5f434ac9a0 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,21 +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,
349 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, 343 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
344 NET_TCP_CONG_CONTROL=110,
350}; 345};
351 346
352enum { 347enum {
@@ -646,6 +641,7 @@ enum {
646 NET_SCTP_ADDIP_ENABLE = 13, 641 NET_SCTP_ADDIP_ENABLE = 13,
647 NET_SCTP_PRSCTP_ENABLE = 14, 642 NET_SCTP_PRSCTP_ENABLE = 14,
648 NET_SCTP_SNDBUF_POLICY = 15, 643 NET_SCTP_SNDBUF_POLICY = 15,
644 NET_SCTP_SACK_TIMEOUT = 16,
649}; 645};
650 646
651/* /proc/sys/net/bridge */ 647/* /proc/sys/net/bridge */
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_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 97a7c9e03df5..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) */
@@ -305,7 +299,7 @@ struct tcp_sock {
305 __u8 reordering; /* Packet reordering metric. */ 299 __u8 reordering; /* Packet reordering metric. */
306 __u8 frto_counter; /* Number of new acks after RTO */ 300 __u8 frto_counter; /* Number of new acks after RTO */
307 301
308 __u8 adv_cong; /* Using Vegas, Westwood, or BIC */ 302 __u8 unused;
309 __u8 defer_accept; /* User waits for some data after accept() */ 303 __u8 defer_accept; /* User waits for some data after accept() */
310 304
311/* RTT measurement */ 305/* RTT measurement */
@@ -401,37 +395,10 @@ struct tcp_sock {
401 __u32 time; 395 __u32 time;
402 } rcvq_space; 396 } rcvq_space;
403 397
404/* TCP Westwood structure */ 398 /* Pluggable TCP congestion control hook */
405 struct { 399 struct tcp_congestion_ops *ca_ops;
406 __u32 bw_ns_est; /* first bandwidth estimation..not too smoothed 8) */ 400 u32 ca_priv[16];
407 __u32 bw_est; /* bandwidth estimate */ 401#define TCP_CA_PRIV_SIZE (16*sizeof(u32))
408 __u32 rtt_win_sx; /* here starts a new evaluation... */
409 __u32 bk;
410 __u32 snd_una; /* used for evaluating the number of acked bytes */
411 __u32 cumul_ack;
412 __u32 accounted;
413 __u32 rtt;
414 __u32 rtt_min; /* minimum observed RTT */
415 } westwood;
416
417/* Vegas variables */
418 struct {
419 __u32 beg_snd_nxt; /* right edge during last RTT */
420 __u32 beg_snd_una; /* left edge during last RTT */
421 __u32 beg_snd_cwnd; /* saves the size of the cwnd */
422 __u8 doing_vegas_now;/* if true, do vegas for this RTT */
423 __u16 cntRTT; /* # of RTTs measured within last RTT */
424 __u32 minRTT; /* min of RTTs measured within last RTT (in usec) */
425 __u32 baseRTT; /* the min of all Vegas RTT measurements seen (in usec) */
426 } vegas;
427
428 /* BI TCP Parameters */
429 struct {
430 __u32 cnt; /* increase cwnd by 1 after this number of ACKs */
431 __u32 last_max_cwnd; /* last maximium snd_cwnd */
432 __u32 last_cwnd; /* the last snd_cwnd */
433 __u32 last_stamp; /* time when updated last_cwnd */
434 } bictcp;
435}; 402};
436 403
437static inline struct tcp_sock *tcp_sk(const struct sock *sk) 404static inline struct tcp_sock *tcp_sk(const struct sock *sk)
@@ -439,6 +406,11 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk)
439 return (struct tcp_sock *)sk; 406 return (struct tcp_sock *)sk;
440} 407}
441 408
409static inline void *tcp_ca(const struct tcp_sock *tp)
410{
411 return (void *) tp->ca_priv;
412}
413
442#endif 414#endif
443 415
444#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 2d1ac5058534..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
diff --git a/include/linux/usb_ch9.h b/include/linux/usb_ch9.h
index f5fe94e09a03..ee21e6bf3867 100644
--- a/include/linux/usb_ch9.h
+++ b/include/linux/usb_ch9.h
@@ -6,17 +6,20 @@
6 * 6 *
7 * - the master/host side Linux-USB kernel driver API; 7 * - the master/host side Linux-USB kernel driver API;
8 * - the "usbfs" user space API; and 8 * - the "usbfs" user space API; and
9 * - (eventually) a Linux "gadget" slave/device side driver API. 9 * - the Linux "gadget" slave/device/peripheral side driver API.
10 * 10 *
11 * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems 11 * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
12 * act either as a USB master/host or as a USB slave/device. That means 12 * act either as a USB master/host or as a USB slave/device. That means
13 * the master and slave side APIs will benefit from working well together. 13 * the master and slave side APIs benefit from working well together.
14 *
15 * There's also "Wireless USB", using low power short range radios for
16 * peripheral interconnection but otherwise building on the USB framework.
14 */ 17 */
15 18
16#ifndef __LINUX_USB_CH9_H 19#ifndef __LINUX_USB_CH9_H
17#define __LINUX_USB_CH9_H 20#define __LINUX_USB_CH9_H
18 21
19#include <asm/types.h> /* __u8 etc */ 22#include <linux/types.h> /* __u8 etc */
20 23
21/*-------------------------------------------------------------------------*/ 24/*-------------------------------------------------------------------------*/
22 25
@@ -68,6 +71,18 @@
68#define USB_REQ_SET_INTERFACE 0x0B 71#define USB_REQ_SET_INTERFACE 0x0B
69#define USB_REQ_SYNCH_FRAME 0x0C 72#define USB_REQ_SYNCH_FRAME 0x0C
70 73
74#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
75#define USB_REQ_GET_ENCRYPTION 0x0E
76#define USB_REQ_SET_HANDSHAKE 0x0F
77#define USB_REQ_GET_HANDSHAKE 0x10
78#define USB_REQ_SET_CONNECTION 0x11
79#define USB_REQ_SET_SECURITY_DATA 0x12
80#define USB_REQ_GET_SECURITY_DATA 0x13
81#define USB_REQ_SET_WUSB_DATA 0x14
82#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
83#define USB_REQ_LOOPBACK_DATA_READ 0x16
84#define USB_REQ_SET_INTERFACE_DS 0x17
85
71/* 86/*
72 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and 87 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
73 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there 88 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there
@@ -75,10 +90,12 @@
75 */ 90 */
76#define USB_DEVICE_SELF_POWERED 0 /* (read only) */ 91#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
77#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ 92#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
78#define USB_DEVICE_TEST_MODE 2 /* (high speed only) */ 93#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
79#define USB_DEVICE_B_HNP_ENABLE 3 /* dev may initiate HNP */ 94#define USB_DEVICE_BATTERY 2 /* (wireless) */
80#define USB_DEVICE_A_HNP_SUPPORT 4 /* RH port supports HNP */ 95#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
81#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* other RH port does */ 96#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
97#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
98#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
82#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ 99#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
83 100
84#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ 101#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
@@ -135,6 +152,13 @@ struct usb_ctrlrequest {
135#define USB_DT_OTG 0x09 152#define USB_DT_OTG 0x09
136#define USB_DT_DEBUG 0x0a 153#define USB_DT_DEBUG 0x0a
137#define USB_DT_INTERFACE_ASSOCIATION 0x0b 154#define USB_DT_INTERFACE_ASSOCIATION 0x0b
155/* these are from the Wireless USB spec */
156#define USB_DT_SECURITY 0x0c
157#define USB_DT_KEY 0x0d
158#define USB_DT_ENCRYPTION_TYPE 0x0e
159#define USB_DT_BOS 0x0f
160#define USB_DT_DEVICE_CAPABILITY 0x10
161#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
138 162
139/* conventional codes for class-specific descriptors */ 163/* conventional codes for class-specific descriptors */
140#define USB_DT_CS_DEVICE 0x21 164#define USB_DT_CS_DEVICE 0x21
@@ -192,6 +216,7 @@ struct usb_device_descriptor {
192#define USB_CLASS_CSCID 0x0b /* chip+ smart card */ 216#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
193#define USB_CLASS_CONTENT_SEC 0x0d /* content security */ 217#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
194#define USB_CLASS_VIDEO 0x0e 218#define USB_CLASS_VIDEO 0x0e
219#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
195#define USB_CLASS_APP_SPEC 0xfe 220#define USB_CLASS_APP_SPEC 0xfe
196#define USB_CLASS_VENDOR_SPEC 0xff 221#define USB_CLASS_VENDOR_SPEC 0xff
197 222
@@ -223,6 +248,7 @@ struct usb_config_descriptor {
223#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */ 248#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
224#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */ 249#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
225#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */ 250#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
251#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */
226 252
227/*-------------------------------------------------------------------------*/ 253/*-------------------------------------------------------------------------*/
228 254
@@ -268,8 +294,8 @@ struct usb_endpoint_descriptor {
268 __le16 wMaxPacketSize; 294 __le16 wMaxPacketSize;
269 __u8 bInterval; 295 __u8 bInterval;
270 296
271 // NOTE: these two are _only_ in audio endpoints. 297 /* NOTE: these two are _only_ in audio endpoints. */
272 // use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. 298 /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
273 __u8 bRefresh; 299 __u8 bRefresh;
274 __u8 bSynchAddress; 300 __u8 bSynchAddress;
275} __attribute__ ((packed)); 301} __attribute__ ((packed));
@@ -289,6 +315,7 @@ struct usb_endpoint_descriptor {
289#define USB_ENDPOINT_XFER_ISOC 1 315#define USB_ENDPOINT_XFER_ISOC 1
290#define USB_ENDPOINT_XFER_BULK 2 316#define USB_ENDPOINT_XFER_BULK 2
291#define USB_ENDPOINT_XFER_INT 3 317#define USB_ENDPOINT_XFER_INT 3
318#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
292 319
293 320
294/*-------------------------------------------------------------------------*/ 321/*-------------------------------------------------------------------------*/
@@ -352,12 +379,154 @@ struct usb_interface_assoc_descriptor {
352 379
353/*-------------------------------------------------------------------------*/ 380/*-------------------------------------------------------------------------*/
354 381
382/* USB_DT_SECURITY: group of wireless security descriptors, including
383 * encryption types available for setting up a CC/association.
384 */
385struct usb_security_descriptor {
386 __u8 bLength;
387 __u8 bDescriptorType;
388
389 __le16 wTotalLength;
390 __u8 bNumEncryptionTypes;
391};
392
393/*-------------------------------------------------------------------------*/
394
395/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys
396 * may be retrieved.
397 */
398struct usb_key_descriptor {
399 __u8 bLength;
400 __u8 bDescriptorType;
401
402 __u8 tTKID[3];
403 __u8 bReserved;
404 __u8 bKeyData[0];
405};
406
407/*-------------------------------------------------------------------------*/
408
409/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */
410struct usb_encryption_descriptor {
411 __u8 bLength;
412 __u8 bDescriptorType;
413
414 __u8 bEncryptionType;
415#define USB_ENC_TYPE_UNSECURE 0
416#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */
417#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */
418#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
419 __u8 bEncryptionValue; /* use in SET_ENCRYPTION */
420 __u8 bAuthKeyIndex;
421};
422
423
424/*-------------------------------------------------------------------------*/
425
426/* USB_DT_BOS: group of wireless capabilities */
427struct usb_bos_descriptor {
428 __u8 bLength;
429 __u8 bDescriptorType;
430
431 __le16 wTotalLength;
432 __u8 bNumDeviceCaps;
433};
434
435/*-------------------------------------------------------------------------*/
436
437/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
438struct usb_dev_cap_header {
439 __u8 bLength;
440 __u8 bDescriptorType;
441 __u8 bDevCapabilityType;
442};
443
444#define USB_CAP_TYPE_WIRELESS_USB 1
445
446struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
447 __u8 bLength;
448 __u8 bDescriptorType;
449 __u8 bDevCapabilityType;
450
451 __u8 bmAttributes;
452#define USB_WIRELESS_P2P_DRD (1 << 1)
453#define USB_WIRELESS_BEACON_MASK (3 << 2)
454#define USB_WIRELESS_BEACON_SELF (1 << 2)
455#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
456#define USB_WIRELESS_BEACON_NONE (3 << 2)
457 __le16 wPHYRates; /* bit rates, Mbps */
458#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */
459#define USB_WIRELESS_PHY_80 (1 << 1)
460#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */
461#define USB_WIRELESS_PHY_160 (1 << 3)
462#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */
463#define USB_WIRELESS_PHY_320 (1 << 5)
464#define USB_WIRELESS_PHY_400 (1 << 6)
465#define USB_WIRELESS_PHY_480 (1 << 7)
466 __u8 bmTFITXPowerInfo; /* TFI power levels */
467 __u8 bmFFITXPowerInfo; /* FFI power levels */
468 __le16 bmBandGroup;
469 __u8 bReserved;
470};
471
472/*-------------------------------------------------------------------------*/
473
474/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
475 * each endpoint descriptor for a wireless device
476 */
477struct usb_wireless_ep_comp_descriptor {
478 __u8 bLength;
479 __u8 bDescriptorType;
480
481 __u8 bMaxBurst;
482 __u8 bMaxSequence;
483 __le16 wMaxStreamDelay;
484 __le16 wOverTheAirPacketSize;
485 __u8 bOverTheAirInterval;
486 __u8 bmCompAttributes;
487#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */
488#define USB_ENDPOINT_SWITCH_NO 0
489#define USB_ENDPOINT_SWITCH_SWITCH 1
490#define USB_ENDPOINT_SWITCH_SCALE 2
491};
492
493/*-------------------------------------------------------------------------*/
494
495/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
496 * host and a device for connection set up, mutual authentication, and
497 * exchanging short lived session keys. The handshake depends on a CC.
498 */
499struct usb_handshake {
500 __u8 bMessageNumber;
501 __u8 bStatus;
502 __u8 tTKID[3];
503 __u8 bReserved;
504 __u8 CDID[16];
505 __u8 nonce[16];
506 __u8 MIC[8];
507};
508
509/*-------------------------------------------------------------------------*/
510
511/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
512 * A CC may also be set up using non-wireless secure channels (including
513 * wired USB!), and some devices may support CCs with multiple hosts.
514 */
515struct usb_connection_context {
516 __u8 CHID[16]; /* persistent host id */
517 __u8 CDID[16]; /* device id (unique w/in host context) */
518 __u8 CK[16]; /* connection key */
519};
520
521/*-------------------------------------------------------------------------*/
522
355/* USB 2.0 defines three speeds, here's how Linux identifies them */ 523/* USB 2.0 defines three speeds, here's how Linux identifies them */
356 524
357enum usb_device_speed { 525enum usb_device_speed {
358 USB_SPEED_UNKNOWN = 0, /* enumerating */ 526 USB_SPEED_UNKNOWN = 0, /* enumerating */
359 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ 527 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
360 USB_SPEED_HIGH /* usb 2.0 */ 528 USB_SPEED_HIGH, /* usb 2.0 */
529 USB_SPEED_VARIABLE, /* wireless (usb 2.5) */
361}; 530};
362 531
363enum usb_device_state { 532enum usb_device_state {
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h
index 9bba9997947b..b00f127cb447 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb_gadget.h
@@ -711,7 +711,7 @@ usb_gadget_disconnect (struct usb_gadget *gadget)
711 * the hardware level driver. Most calls must be handled by 711 * the hardware level driver. Most calls must be handled by
712 * the gadget driver, including descriptor and configuration 712 * the gadget driver, including descriptor and configuration
713 * management. The 16 bit members of the setup data are in 713 * management. The 16 bit members of the setup data are in
714 * cpu order. Called in_interrupt; this may not sleep. Driver 714 * USB byte order. Called in_interrupt; this may not sleep. Driver
715 * queues a response to ep0, or returns negative to stall. 715 * queues a response to ep0, or returns negative to stall.
716 * @disconnect: Invoked after all transfers have been stopped, 716 * @disconnect: Invoked after all transfers have been stopped,
717 * when the host is disconnected. May be called in_interrupt; this 717 * when the host is disconnected. May be called in_interrupt; this
diff --git a/include/linux/usb_isp116x.h b/include/linux/usb_isp116x.h
new file mode 100644
index 000000000000..5f5a9d9bd6c2
--- /dev/null
+++ b/include/linux/usb_isp116x.h
@@ -0,0 +1,47 @@
1
2/*
3 * Board initialization code should put one of these into dev->platform_data
4 * and place the isp116x onto platform_bus.
5 */
6
7struct isp116x_platform_data {
8 /* Enable internal resistors on downstream ports */
9 unsigned sel15Kres:1;
10 /* Chip's internal clock won't be stopped in suspended state.
11 Setting/unsetting this bit takes effect only if
12 'remote_wakeup_enable' below is not set. */
13 unsigned clknotstop:1;
14 /* On-chip overcurrent protection */
15 unsigned oc_enable:1;
16 /* INT output polarity */
17 unsigned int_act_high:1;
18 /* INT edge or level triggered */
19 unsigned int_edge_triggered:1;
20 /* WAKEUP pin connected - NOT SUPPORTED */
21 /* unsigned remote_wakeup_connected:1; */
22 /* Wakeup by devices on usb bus enabled */
23 unsigned remote_wakeup_enable:1;
24 /* Switch or not to switch (keep always powered) */
25 unsigned no_power_switching:1;
26 /* Ganged port power switching (0) or individual port
27 power switching (1) */
28 unsigned power_switching_mode:1;
29 /* Given port_power, msec/2 after power on till power good */
30 u8 potpg;
31 /* Hardware reset set/clear. If implemented, this function must:
32 if set == 0, deassert chip's HW reset pin
33 otherwise, assert chip's HW reset pin */
34 void (*reset) (struct device * dev, int set);
35 /* Hardware clock start/stop. If implemented, this function must:
36 if start == 0, stop the external clock
37 otherwise, start the external clock
38 */
39 void (*clock) (struct device * dev, int start);
40 /* Inter-io delay (ns). The chip is picky about access timings; it
41 expects at least:
42 150ns delay between consecutive accesses to DATA_REG,
43 300ns delay between access to ADDR_REG and DATA_REG
44 OE, WE MUST NOT be changed during these intervals
45 */
46 void (*delay) (struct device * dev, int delay);
47};
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 4e0edce53760..acbfc525576d 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -221,6 +221,8 @@ struct v4l2_pix_format
221/* Vendor-specific formats */ 221/* Vendor-specific formats */
222#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ 222#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */
223#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ 223#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */
224#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */
225#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */
224 226
225/* 227/*
226 * F O R M A T E N U M E R A T I O N 228 * F O R M A T E N U M E R A T I O N
diff --git a/include/linux/wait.h b/include/linux/wait.h
index c9486c3efb4a..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,7 +384,7 @@ 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 = LIST_HEAD_INIT((name).task_list), \ 389 .task_list = LIST_HEAD_INIT((name).task_list), \
390 } 390 }
@@ -393,7 +393,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
393 struct wait_bit_queue name = { \ 393 struct wait_bit_queue name = { \
394 .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ 394 .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \
395 .wait = { \ 395 .wait = { \
396 .task = current, \ 396 .private = current, \
397 .func = wake_bit_function, \ 397 .func = wake_bit_function, \
398 .task_list = \ 398 .task_list = \
399 LIST_HEAD_INIT((name).wait.task_list), \ 399 LIST_HEAD_INIT((name).wait.task_list), \
@@ -402,7 +402,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
402 402
403#define init_wait(wait) \ 403#define init_wait(wait) \
404 do { \ 404 do { \
405 (wait)->task = current; \ 405 (wait)->private = current; \
406 (wait)->func = autoremove_wake_function; \ 406 (wait)->func = autoremove_wake_function; \
407 INIT_LIST_HEAD(&(wait)->task_list); \ 407 INIT_LIST_HEAD(&(wait)->task_list); \
408 } while (0) 408 } while (0)
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 1262cb43c3ab..542dbaee6512 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -14,11 +14,13 @@ extern struct list_head inode_unused;
14 * Yes, writeback.h requires sched.h 14 * Yes, writeback.h requires sched.h
15 * No, sched.h is not included from here. 15 * No, sched.h is not included from here.
16 */ 16 */
17static inline int current_is_pdflush(void) 17static inline int task_is_pdflush(struct task_struct *task)
18{ 18{
19 return current->flags & PF_FLUSHER; 19 return task->flags & PF_FLUSHER;
20} 20}
21 21
22#define current_is_pdflush() task_is_pdflush(current)
23
22/* 24/*
23 * fs/fs-writeback.c 25 * fs/fs-writeback.c
24 */ 26 */
@@ -83,7 +85,7 @@ static inline void wait_on_inode(struct inode *inode)
83/* 85/*
84 * mm/page-writeback.c 86 * mm/page-writeback.c
85 */ 87 */
86int wakeup_bdflush(long nr_pages); 88int wakeup_pdflush(long nr_pages);
87void laptop_io_completion(void); 89void laptop_io_completion(void);
88void laptop_sync_completion(void); 90void laptop_sync_completion(void);
89void throttle_vm_writeout(void); 91void throttle_vm_writeout(void);
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/xattr_acl.h b/include/linux/xattr_acl.h
deleted file mode 100644
index 7a1f9b93a45f..000000000000
--- a/include/linux/xattr_acl.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 File: linux/xattr_acl.h
3
4 (extended attribute representation of access control lists)
5
6 (C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
7*/
8
9#ifndef _LINUX_XATTR_ACL_H
10#define _LINUX_XATTR_ACL_H
11
12#include <linux/posix_acl.h>
13
14#define XATTR_NAME_ACL_ACCESS "system.posix_acl_access"
15#define XATTR_NAME_ACL_DEFAULT "system.posix_acl_default"
16
17#define XATTR_ACL_VERSION 0x0002
18
19typedef struct {
20 __u16 e_tag;
21 __u16 e_perm;
22 __u32 e_id;
23} xattr_acl_entry;
24
25typedef struct {
26 __u32 a_version;
27 xattr_acl_entry a_entries[0];
28} xattr_acl_header;
29
30static inline size_t xattr_acl_size(int count)
31{
32 return sizeof(xattr_acl_header) + count * sizeof(xattr_acl_entry);
33}
34
35static inline int xattr_acl_count(size_t size)
36{
37 if (size < sizeof(xattr_acl_header))
38 return -1;
39 size -= sizeof(xattr_acl_header);
40 if (size % sizeof(xattr_acl_entry))
41 return -1;
42 return size / sizeof(xattr_acl_entry);
43}
44
45struct posix_acl * posix_acl_from_xattr(const void *value, size_t size);
46int posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size);
47
48
49
50#endif /* _LINUX_XATTR_ACL_H */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index d68391a9b9f3..f0d423300d84 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -196,6 +196,7 @@ struct xfrm_usersa_info {
196 __u8 flags; 196 __u8 flags;
197#define XFRM_STATE_NOECN 1 197#define XFRM_STATE_NOECN 1
198#define XFRM_STATE_DECAP_DSCP 2 198#define XFRM_STATE_DECAP_DSCP 2
199#define XFRM_STATE_NOPMTUDISC 4
199}; 200};
200 201
201struct xfrm_usersa_id { 202struct xfrm_usersa_id {