aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/a.out.h2
-rw-r--r--include/linux/acpi.h30
-rw-r--r--include/linux/atalk.h2
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/binfmts.h5
-rw-r--r--include/linux/bio.h14
-rw-r--r--include/linux/blkdev.h41
-rw-r--r--include/linux/bootmem.h13
-rw-r--r--include/linux/buffer_head.h3
-rw-r--r--include/linux/byteorder/swabb.h17
-rw-r--r--include/linux/cache.h6
-rw-r--r--include/linux/cciss_ioctl.h1
-rw-r--r--include/linux/compat_ioctl.h19
-rw-r--r--include/linux/cpu.h1
-rw-r--r--include/linux/cpufreq.h2
-rw-r--r--include/linux/crash_dump.h18
-rw-r--r--include/linux/crypto.h34
-rw-r--r--include/linux/dcookies.h4
-rw-r--r--include/linux/device.h13
-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.h5
-rw-r--r--include/linux/ext2_fs.h25
-rw-r--r--include/linux/ext3_fs.h15
-rw-r--r--include/linux/ext3_jbd.h19
-rw-r--r--include/linux/fadvise.h10
-rw-r--r--include/linux/fcntl.h4
-rw-r--r--include/linux/fddidevice.h2
-rw-r--r--include/linux/fs.h71
-rw-r--r--include/linux/fsnotify.h251
-rw-r--r--include/linux/ftape.h2
-rw-r--r--include/linux/genhd.h3
-rw-r--r--include/linux/gfp.h4
-rw-r--r--include/linux/hardirq.h1
-rw-r--r--include/linux/hdlc.h4
-rw-r--r--include/linux/highmem.h1
-rw-r--r--include/linux/hwmon-sysfs.h (renamed from include/linux/i2c-sysfs.h)8
-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.h8
-rw-r--r--include/linux/if_bonding.h7
-rw-r--r--include/linux/if_shaper.h2
-rw-r--r--include/linux/igmp.h1
-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/inotify.h110
-rw-r--r--include/linux/input.h10
-rw-r--r--include/linux/ioprio.h85
-rw-r--r--include/linux/ipmi.h5
-rw-r--r--include/linux/irq.h6
-rw-r--r--include/linux/jffs2_fs_sb.h9
-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/kmod.h13
-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/mbcache.h2
-rw-r--r--include/linux/mempool.h11
-rw-r--r--include/linux/mm.h141
-rw-r--r--include/linux/mmzone.h171
-rw-r--r--include/linux/mod_devicetable.h57
-rw-r--r--include/linux/module.h5
-rw-r--r--include/linux/mount.h8
-rw-r--r--include/linux/mtd/cfi.h85
-rw-r--r--include/linux/mtd/flashchip.h7
-rw-r--r--include/linux/mtd/inftl.h4
-rw-r--r--include/linux/mtd/map.h33
-rw-r--r--include/linux/mtd/mtd.h15
-rw-r--r--include/linux/mtd/nand.h48
-rw-r--r--include/linux/mtd/plat-ram.h35
-rw-r--r--include/linux/mtd/xip.h31
-rw-r--r--include/linux/namespace.h4
-rw-r--r--include/linux/netdevice.h19
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h5
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLUSTERIP.h3
-rw-r--r--include/linux/netlink.h8
-rw-r--r--include/linux/netpoll.h48
-rw-r--r--include/linux/nfs4.h4
-rw-r--r--include/linux/nfs_fs.h344
-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.h26
-rw-r--r--include/linux/nfsd/state.h56
-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/numa.h2
-rw-r--r--include/linux/nvram.h2
-rw-r--r--include/linux/pci-dynids.h18
-rw-r--r--include/linux/pci.h42
-rw-r--r--include/linux/pci_ids.h36
-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.h35
-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.h3
-rw-r--r--include/linux/reboot.h20
-rw-r--r--include/linux/reiserfs_acl.h53
-rw-r--r--include/linux/reiserfs_fs.h1610
-rw-r--r--include/linux/reiserfs_fs_i.h59
-rw-r--r--include/linux/reiserfs_fs_sb.h614
-rw-r--r--include/linux/reiserfs_xattr.h126
-rw-r--r--include/linux/rmap.h6
-rw-r--r--include/linux/rtnetlink.h15
-rw-r--r--include/linux/sched.h131
-rw-r--r--include/linux/seccomp.h10
-rw-r--r--include/linux/serial.h6
-rw-r--r--include/linux/serialP.h1
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h7
-rw-r--r--include/linux/serio.h6
-rw-r--r--include/linux/skbuff.h74
-rw-r--r--include/linux/slab.h6
-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.h22
-rw-r--r--include/linux/suspend.h2
-rw-r--r--include/linux/swap.h5
-rw-r--r--include/linux/syscalls.h8
-rw-r--r--include/linux/sysctl.h22
-rw-r--r--include/linux/tc_ematch/tc_em_meta.h5
-rw-r--r--include/linux/tc_ematch/tc_em_text.h19
-rw-r--r--include/linux/tcp.h52
-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/uinput.h5
-rw-r--r--include/linux/usb.h10
-rw-r--r--include/linux/usb_cdc.h13
-rw-r--r--include/linux/usb_ch9.h189
-rw-r--r--include/linux/usb_gadget.h14
-rw-r--r--include/linux/usb_input.h25
-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/wanrouter.h3
-rw-r--r--include/linux/watchdog.h10
-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/zlib.h5
174 files changed, 4731 insertions, 2326 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..b46a5205ee7b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -206,7 +206,10 @@ struct acpi_table_plat_int_src {
206 u8 eid; 206 u8 eid;
207 u8 iosapic_vector; 207 u8 iosapic_vector;
208 u32 global_irq; 208 u32 global_irq;
209 u32 reserved; 209 struct {
210 u32 cpei_override_flag:1;
211 u32 reserved:31;
212 } plint_flags;
210} __attribute__ ((packed)); 213} __attribute__ ((packed));
211 214
212enum acpi_interrupt_id { 215enum acpi_interrupt_id {
@@ -342,11 +345,19 @@ struct acpi_table_ecdt {
342 345
343/* PCI MMCONFIG */ 346/* PCI MMCONFIG */
344 347
348/* Defined in PCI Firmware Specification 3.0 */
349struct acpi_table_mcfg_config {
350 u32 base_address;
351 u32 base_reserved;
352 u16 pci_segment_group_number;
353 u8 start_bus_number;
354 u8 end_bus_number;
355 u8 reserved[4];
356} __attribute__ ((packed));
345struct acpi_table_mcfg { 357struct acpi_table_mcfg {
346 struct acpi_table_header header; 358 struct acpi_table_header header;
347 u8 reserved[8]; 359 u8 reserved[8];
348 u32 base_address; 360 struct acpi_table_mcfg_config config[0];
349 u32 base_reserved;
350} __attribute__ ((packed)); 361} __attribute__ ((packed));
351 362
352/* Table Handlers */ 363/* Table Handlers */
@@ -391,6 +402,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); 402int 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); 403int 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); 404int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
405int acpi_parse_mcfg (unsigned long phys_addr, unsigned long size);
394void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr); 406void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
395void acpi_table_print_madt_entry (acpi_table_entry_header *madt); 407void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
396void acpi_table_print_srat_entry (acpi_table_entry_header *srat); 408void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
@@ -407,9 +419,13 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu);
407int acpi_unmap_lsapic(int cpu); 419int acpi_unmap_lsapic(int cpu);
408#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 420#endif /* CONFIG_ACPI_HOTPLUG_CPU */
409 421
422int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
423int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
424
410extern int acpi_mp_config; 425extern int acpi_mp_config;
411 426
412extern u32 pci_mmcfg_base_addr; 427extern struct acpi_table_mcfg_config *pci_mmcfg_config;
428extern int pci_mmcfg_config_num;
413 429
414extern int sbf_port ; 430extern int sbf_port ;
415 431
@@ -437,9 +453,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
437 * If this matches the last registration, any IRQ resources for gsi 453 * If this matches the last registration, any IRQ resources for gsi
438 * are freed. 454 * are freed.
439 */ 455 */
440#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
441void acpi_unregister_gsi (u32 gsi); 456void acpi_unregister_gsi (u32 gsi);
442#endif
443 457
444#ifdef CONFIG_ACPI_PCI 458#ifdef CONFIG_ACPI_PCI
445 459
@@ -462,11 +476,9 @@ struct acpi_prt_list {
462struct pci_dev; 476struct pci_dev;
463 477
464int acpi_pci_irq_enable (struct pci_dev *dev); 478int acpi_pci_irq_enable (struct pci_dev *dev);
465void acpi_penalize_isa_irq(int irq); 479void acpi_penalize_isa_irq(int irq, int active);
466 480
467#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
468void acpi_pci_irq_disable (struct pci_dev *dev); 481void acpi_pci_irq_disable (struct pci_dev *dev);
469#endif
470 482
471struct acpi_pci_driver { 483struct acpi_pci_driver {
472 struct acpi_pci_driver *next; 484 struct acpi_pci_driver *next;
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index 09a1451c1159..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 *
diff --git a/include/linux/audit.h b/include/linux/audit.h
index bf2ad3ba72eb..68aba0c02e49 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -165,7 +165,7 @@
165#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT) 165#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT)
166#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 166#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
167#define AUDIT_ARCH_SPARC (EM_SPARC) 167#define AUDIT_ARCH_SPARC (EM_SPARC)
168#define AUDIT_ARCH_SPARC64 (EM_SPARC64|__AUDIT_ARCH_64BIT) 168#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT)
169#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) 169#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE)
170#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 170#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
171 171
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..19bd8e7e11bf 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,9 +295,6 @@ 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 */
@@ -396,6 +403,7 @@ struct request_queue
396 */ 403 */
397 unsigned int sg_timeout; 404 unsigned int sg_timeout;
398 unsigned int sg_reserved_size; 405 unsigned int sg_reserved_size;
406 int node;
399 407
400 struct list_head drain_list; 408 struct list_head drain_list;
401 409
@@ -542,15 +550,12 @@ extern void generic_make_request(struct bio *bio);
542extern void blk_put_request(struct request *); 550extern void blk_put_request(struct request *);
543extern void blk_end_sync_rq(struct request *rq); 551extern void blk_end_sync_rq(struct request *rq);
544extern void blk_attempt_remerge(request_queue_t *, struct request *); 552extern 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); 553extern struct request *blk_get_request(request_queue_t *, int, int);
547extern void blk_insert_request(request_queue_t *, struct request *, int, void *); 554extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
548extern void blk_requeue_request(request_queue_t *, struct request *); 555extern void blk_requeue_request(request_queue_t *, struct request *);
549extern void blk_plug_device(request_queue_t *); 556extern void blk_plug_device(request_queue_t *);
550extern int blk_remove_plug(request_queue_t *); 557extern int blk_remove_plug(request_queue_t *);
551extern void blk_recount_segments(request_queue_t *, struct bio *); 558extern 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 *); 559extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
555extern void blk_start_queue(request_queue_t *q); 560extern void blk_start_queue(request_queue_t *q);
556extern void blk_stop_queue(request_queue_t *q); 561extern void blk_stop_queue(request_queue_t *q);
@@ -615,6 +620,8 @@ static inline void blkdev_dequeue_request(struct request *req)
615/* 620/*
616 * Access functions for manipulating queue properties 621 * Access functions for manipulating queue properties
617 */ 622 */
623extern request_queue_t *blk_init_queue_node(request_fn_proc *rfn,
624 spinlock_t *lock, int node_id);
618extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *); 625extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *);
619extern void blk_cleanup_queue(request_queue_t *); 626extern void blk_cleanup_queue(request_queue_t *);
620extern void blk_queue_make_request(request_queue_t *, make_request_fn *); 627extern void blk_queue_make_request(request_queue_t *, make_request_fn *);
@@ -632,7 +639,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); 639extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
633extern void blk_queue_ordered(request_queue_t *, int); 640extern void blk_queue_ordered(request_queue_t *, int);
634extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); 641extern 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 *); 642extern struct request *blk_start_pre_flush(request_queue_t *,struct request *);
637extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int); 643extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int);
638extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int); 644extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int);
@@ -646,7 +652,8 @@ extern void blk_wait_queue_drained(request_queue_t *, int);
646extern void blk_finish_queue_drain(request_queue_t *); 652extern void blk_finish_queue_drain(request_queue_t *);
647 653
648int blk_get_queue(request_queue_t *); 654int blk_get_queue(request_queue_t *);
649request_queue_t *blk_alloc_queue(int); 655request_queue_t *blk_alloc_queue(int gfp_mask);
656request_queue_t *blk_alloc_queue_node(int,int);
650#define blk_put_queue(q) blk_cleanup_queue((q)) 657#define blk_put_queue(q) blk_cleanup_queue((q))
651 658
652/* 659/*
@@ -675,8 +682,6 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *);
675 682
676#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) 683#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
677 684
678extern void drive_stat_acct(struct request *, int, int);
679
680static inline int queue_hardsect_size(request_queue_t *q) 685static inline int queue_hardsect_size(request_queue_t *q)
681{ 686{
682 int retval = 512; 687 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/buffer_head.h b/include/linux/buffer_head.h
index 802c91e9b3da..90828493791f 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -19,6 +19,9 @@ enum bh_state_bits {
19 BH_Dirty, /* Is dirty */ 19 BH_Dirty, /* Is dirty */
20 BH_Lock, /* Is locked */ 20 BH_Lock, /* Is locked */
21 BH_Req, /* Has been submitted for I/O */ 21 BH_Req, /* Has been submitted for I/O */
22 BH_Uptodate_Lock,/* Used by the first bh in a page, to serialise
23 * IO completion of other buffers in the page
24 */
22 25
23 BH_Mapped, /* Has a disk mapping */ 26 BH_Mapped, /* Has a disk mapping */
24 BH_New, /* Disk mapping was newly created by get_block */ 27 BH_New, /* Disk mapping was newly created by get_block */
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/cache.h b/include/linux/cache.h
index 4d767b93738a..f6b5a46c5f82 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,6 +13,12 @@
13#define SMP_CACHE_BYTES L1_CACHE_BYTES 13#define SMP_CACHE_BYTES L1_CACHE_BYTES
14#endif 14#endif
15 15
16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64)
17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18#else
19#define __read_mostly
20#endif
21
16#ifndef ____cacheline_aligned 22#ifndef ____cacheline_aligned
17#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) 23#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
18#endif 24#endif
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/compat_ioctl.h b/include/linux/compat_ioctl.h
index 70a4ebb5d964..ecb0d39c0798 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -346,10 +346,27 @@ COMPATIBLE_IOCTL(PPPOEIOCDFWD)
346/* LP */ 346/* LP */
347COMPATIBLE_IOCTL(LPGETSTATUS) 347COMPATIBLE_IOCTL(LPGETSTATUS)
348/* ppdev */ 348/* ppdev */
349COMPATIBLE_IOCTL(PPSETMODE)
350COMPATIBLE_IOCTL(PPRSTATUS)
351COMPATIBLE_IOCTL(PPRCONTROL)
352COMPATIBLE_IOCTL(PPWCONTROL)
353COMPATIBLE_IOCTL(PPFCONTROL)
354COMPATIBLE_IOCTL(PPRDATA)
355COMPATIBLE_IOCTL(PPWDATA)
349COMPATIBLE_IOCTL(PPCLAIM) 356COMPATIBLE_IOCTL(PPCLAIM)
350COMPATIBLE_IOCTL(PPRELEASE) 357COMPATIBLE_IOCTL(PPRELEASE)
351COMPATIBLE_IOCTL(PPEXCL)
352COMPATIBLE_IOCTL(PPYIELD) 358COMPATIBLE_IOCTL(PPYIELD)
359COMPATIBLE_IOCTL(PPEXCL)
360COMPATIBLE_IOCTL(PPDATADIR)
361COMPATIBLE_IOCTL(PPNEGOT)
362COMPATIBLE_IOCTL(PPWCTLONIRQ)
363COMPATIBLE_IOCTL(PPCLRIRQ)
364COMPATIBLE_IOCTL(PPSETPHASE)
365COMPATIBLE_IOCTL(PPGETMODES)
366COMPATIBLE_IOCTL(PPGETMODE)
367COMPATIBLE_IOCTL(PPGETPHASE)
368COMPATIBLE_IOCTL(PPGETFLAGS)
369COMPATIBLE_IOCTL(PPSETFLAGS)
353/* CDROM stuff */ 370/* CDROM stuff */
354COMPATIBLE_IOCTL(CDROMPAUSE) 371COMPATIBLE_IOCTL(CDROMPAUSE)
355COMPATIBLE_IOCTL(CDROMRESUME) 372COMPATIBLE_IOCTL(CDROMRESUME)
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index fe0298e5dae1..e8904c0da686 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -69,6 +69,7 @@ extern struct semaphore cpucontrol;
69 register_cpu_notifier(&fn##_nb); \ 69 register_cpu_notifier(&fn##_nb); \
70} 70}
71int cpu_down(unsigned int cpu); 71int cpu_down(unsigned int cpu);
72extern int __attribute__((weak)) smp_prepare_cpu(int cpu);
72#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 73#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
73#else 74#else
74#define lock_cpu_hotplug() do { } while (0) 75#define lock_cpu_hotplug() do { } while (0)
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 927daa86c9b3..ff7f80f48df1 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -201,7 +201,7 @@ struct cpufreq_driver {
201 201
202 /* optional */ 202 /* optional */
203 int (*exit) (struct cpufreq_policy *policy); 203 int (*exit) (struct cpufreq_policy *policy);
204 int (*suspend) (struct cpufreq_policy *policy, u32 state); 204 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
205 int (*resume) (struct cpufreq_policy *policy); 205 int (*resume) (struct cpufreq_policy *policy);
206 struct freq_attr **attr; 206 struct freq_attr **attr;
207}; 207};
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/crypto.h b/include/linux/crypto.h
index 387da6a3e58c..5e2bcc636a02 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -61,6 +61,15 @@
61#define CRYPTO_DIR_DECRYPT 0 61#define CRYPTO_DIR_DECRYPT 0
62 62
63struct scatterlist; 63struct scatterlist;
64struct crypto_tfm;
65
66struct cipher_desc {
67 struct crypto_tfm *tfm;
68 void (*crfn)(void *ctx, u8 *dst, const u8 *src);
69 unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst,
70 const u8 *src, unsigned int nbytes);
71 void *info;
72};
64 73
65/* 74/*
66 * Algorithms: modular crypto algorithm implementations, managed 75 * Algorithms: modular crypto algorithm implementations, managed
@@ -73,6 +82,19 @@ struct cipher_alg {
73 unsigned int keylen, u32 *flags); 82 unsigned int keylen, u32 *flags);
74 void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); 83 void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src);
75 void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); 84 void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src);
85
86 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc,
87 u8 *dst, const u8 *src,
88 unsigned int nbytes);
89 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc,
90 u8 *dst, const u8 *src,
91 unsigned int nbytes);
92 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc,
93 u8 *dst, const u8 *src,
94 unsigned int nbytes);
95 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc,
96 u8 *dst, const u8 *src,
97 unsigned int nbytes);
76}; 98};
77 99
78struct digest_alg { 100struct digest_alg {
@@ -102,6 +124,7 @@ struct crypto_alg {
102 u32 cra_flags; 124 u32 cra_flags;
103 unsigned int cra_blocksize; 125 unsigned int cra_blocksize;
104 unsigned int cra_ctxsize; 126 unsigned int cra_ctxsize;
127 unsigned int cra_alignmask;
105 const char cra_name[CRYPTO_MAX_ALG_NAME]; 128 const char cra_name[CRYPTO_MAX_ALG_NAME];
106 129
107 union { 130 union {
@@ -136,7 +159,6 @@ static inline int crypto_alg_available(const char *name, u32 flags)
136 * and core processing logic. Managed via crypto_alloc_tfm() and 159 * and core processing logic. Managed via crypto_alloc_tfm() and
137 * crypto_free_tfm(), as well as the various helpers below. 160 * crypto_free_tfm(), as well as the various helpers below.
138 */ 161 */
139struct crypto_tfm;
140 162
141struct cipher_tfm { 163struct cipher_tfm {
142 void *cit_iv; 164 void *cit_iv;
@@ -266,6 +288,16 @@ static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm)
266 return tfm->__crt_alg->cra_digest.dia_digestsize; 288 return tfm->__crt_alg->cra_digest.dia_digestsize;
267} 289}
268 290
291static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm)
292{
293 return tfm->__crt_alg->cra_alignmask;
294}
295
296static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
297{
298 return (void *)&tfm[1];
299}
300
269/* 301/*
270 * API wrappers. 302 * API wrappers.
271 */ 303 */
diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h
index c28050136164..1d68428c925d 100644
--- a/include/linux/dcookies.h
+++ b/include/linux/dcookies.h
@@ -48,12 +48,12 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
48 48
49#else 49#else
50 50
51struct dcookie_user * dcookie_register(void) 51static inline struct dcookie_user * dcookie_register(void)
52{ 52{
53 return NULL; 53 return NULL;
54} 54}
55 55
56void dcookie_unregister(struct dcookie_user * user) 56static inline void dcookie_unregister(struct dcookie_user * user)
57{ 57{
58 return; 58 return;
59} 59}
diff --git a/include/linux/device.h b/include/linux/device.h
index 7b781a72b293..06e5d42f2c7b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -69,7 +69,7 @@ struct bus_type {
69extern int bus_register(struct bus_type * bus); 69extern int bus_register(struct bus_type * bus);
70extern void bus_unregister(struct bus_type * bus); 70extern void bus_unregister(struct bus_type * bus);
71 71
72extern int bus_rescan_devices(struct bus_type * bus); 72extern void bus_rescan_devices(struct bus_type * bus);
73 73
74extern struct bus_type * get_bus(struct bus_type * bus); 74extern struct bus_type * get_bus(struct bus_type * bus);
75extern void put_bus(struct bus_type * bus); 75extern void put_bus(struct bus_type * bus);
@@ -80,6 +80,8 @@ extern struct bus_type * find_bus(char * name);
80 80
81int 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,
82 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 *));
83 85
84int 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,
85 void * data, int (*fn)(struct device_driver *, void *)); 87 void * data, int (*fn)(struct device_driver *, void *));
@@ -142,6 +144,9 @@ extern void driver_remove_file(struct device_driver *, struct driver_attribute *
142 144
143extern int driver_for_each_device(struct device_driver * drv, struct device * start, 145extern int driver_for_each_device(struct device_driver * drv, struct device * start,
144 void * data, int (*fn)(struct device *, void *)); 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 *));
145 150
146 151
147/* 152/*
@@ -279,8 +284,10 @@ struct device {
279 struct device_driver *driver; /* which driver has allocated this 284 struct device_driver *driver; /* which driver has allocated this
280 device */ 285 device */
281 void *driver_data; /* data private to the driver */ 286 void *driver_data; /* data private to the driver */
282 void *platform_data; /* Platform specific data (e.g. ACPI, 287 void *platform_data; /* Platform specific data, device
283 BIOS data relevant to device) */ 288 core doesn't touch it */
289 void *firmware_data; /* Firmware specific data (e.g. ACPI,
290 BIOS data),reserved for device core*/
284 struct dev_pm_info power; 291 struct dev_pm_info power;
285 292
286 u64 *dma_mask; /* dma mask (if dma'able device) */ 293 u64 *dma_mask; /* dma mask (if dma'able device) */
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..ce8518e658b6 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__
@@ -32,7 +33,7 @@ extern int eth_header(struct sk_buff *skb, struct net_device *dev,
32 unsigned short type, void *daddr, 33 unsigned short type, void *daddr,
33 void *saddr, unsigned len); 34 void *saddr, unsigned len);
34extern int eth_rebuild_header(struct sk_buff *skb); 35extern int eth_rebuild_header(struct sk_buff *skb);
35extern unsigned short eth_type_trans(struct sk_buff *skb, struct net_device *dev); 36extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
36extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, 37extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev,
37 unsigned char * haddr); 38 unsigned char * haddr);
38extern int eth_header_cache(struct neighbour *neigh, 39extern int eth_header_cache(struct neighbour *neigh,
@@ -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..c16662836c58 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -239,6 +239,20 @@ struct ext3_new_group_data {
239#define EXT3_IOC_SETRSVSZ _IOW('f', 6, long) 239#define EXT3_IOC_SETRSVSZ _IOW('f', 6, long)
240 240
241/* 241/*
242 * Mount options
243 */
244struct ext3_mount_options {
245 unsigned long s_mount_opt;
246 uid_t s_resuid;
247 gid_t s_resgid;
248 unsigned long s_commit_interval;
249#ifdef CONFIG_QUOTA
250 int s_jquota_fmt;
251 char *s_qf_names[MAXQUOTAS];
252#endif
253};
254
255/*
242 * Structure of an inode on the disk 256 * Structure of an inode on the disk
243 */ 257 */
244struct ext3_inode { 258struct ext3_inode {
@@ -358,6 +372,7 @@ struct ext3_inode {
358#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ 372#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */
359#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ 373#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
360#define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */ 374#define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */
375#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
361 376
362/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ 377/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
363#ifndef _LINUX_EXT2_FS_H 378#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/fadvise.h b/include/linux/fadvise.h
index 6fc656dfb93d..e8e747139b9a 100644
--- a/include/linux/fadvise.h
+++ b/include/linux/fadvise.h
@@ -5,7 +5,17 @@
5#define POSIX_FADV_RANDOM 1 /* Expect random page references. */ 5#define POSIX_FADV_RANDOM 1 /* Expect random page references. */
6#define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ 6#define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
7#define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ 7#define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
8
9/*
10 * The advise values for POSIX_FADV_DONTNEED and POSIX_ADV_NOREUSE
11 * for s390-64 differ from the values for the rest of the world.
12 */
13#if defined(__s390x__)
14#define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */
15#define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */
16#else
8#define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ 17#define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
9#define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ 18#define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
19#endif
10 20
11#endif /* FADVISE_H_INCLUDED */ 21#endif /* FADVISE_H_INCLUDED */
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/fddidevice.h b/include/linux/fddidevice.h
index 002f6367697d..e61e42dfd317 100644
--- a/include/linux/fddidevice.h
+++ b/include/linux/fddidevice.h
@@ -25,7 +25,7 @@
25#include <linux/if_fddi.h> 25#include <linux/if_fddi.h>
26 26
27#ifdef __KERNEL__ 27#ifdef __KERNEL__
28extern unsigned short fddi_type_trans(struct sk_buff *skb, 28extern __be16 fddi_type_trans(struct sk_buff *skb,
29 struct net_device *dev); 29 struct net_device *dev);
30extern struct net_device *alloc_fddidev(int sizeof_priv); 30extern struct net_device *alloc_fddidev(int sizeof_priv);
31#endif 31#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9b8b696d4f15..67e6732d4fdc 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;
@@ -471,6 +474,11 @@ struct inode {
471 struct dnotify_struct *i_dnotify; /* for directory notifications */ 474 struct dnotify_struct *i_dnotify; /* for directory notifications */
472#endif 475#endif
473 476
477#ifdef CONFIG_INOTIFY
478 struct list_head inotify_watches; /* watches on this inode */
479 struct semaphore inotify_sem; /* protects the watches list */
480#endif
481
474 unsigned long i_state; 482 unsigned long i_state;
475 unsigned long dirtied_when; /* jiffies of first dirtying */ 483 unsigned long dirtied_when; /* jiffies of first dirtying */
476 484
@@ -581,7 +589,6 @@ struct file {
581 atomic_t f_count; 589 atomic_t f_count;
582 unsigned int f_flags; 590 unsigned int f_flags;
583 mode_t f_mode; 591 mode_t f_mode;
584 int f_error;
585 loff_t f_pos; 592 loff_t f_pos;
586 struct fown_struct f_owner; 593 struct fown_struct f_owner;
587 unsigned int f_uid, f_gid; 594 unsigned int f_uid, f_gid;
@@ -674,6 +681,7 @@ struct file_lock {
674 struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ 681 struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */
675 union { 682 union {
676 struct nfs_lock_info nfs_fl; 683 struct nfs_lock_info nfs_fl;
684 struct nfs4_lock_info nfs4_fl;
677 } fl_u; 685 } fl_u;
678}; 686};
679 687
@@ -689,11 +697,13 @@ extern struct list_head file_lock_list;
689#include <linux/fcntl.h> 697#include <linux/fcntl.h>
690 698
691extern int fcntl_getlk(struct file *, struct flock __user *); 699extern int fcntl_getlk(struct file *, struct flock __user *);
692extern int fcntl_setlk(struct file *, unsigned int, struct flock __user *); 700extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
701 struct flock __user *);
693 702
694#if BITS_PER_LONG == 32 703#if BITS_PER_LONG == 32
695extern int fcntl_getlk64(struct file *, struct flock64 __user *); 704extern int fcntl_getlk64(struct file *, struct flock64 __user *);
696extern int fcntl_setlk64(struct file *, unsigned int, struct flock64 __user *); 705extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
706 struct flock64 __user *);
697#endif 707#endif
698 708
699extern void send_sigio(struct fown_struct *fown, int fd, int band); 709extern void send_sigio(struct fown_struct *fown, int fd, int band);
@@ -820,16 +830,34 @@ enum {
820#define vfs_check_frozen(sb, level) \ 830#define vfs_check_frozen(sb, level) \
821 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) 831 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
822 832
833static inline void get_fs_excl(void)
834{
835 atomic_inc(&current->fs_excl);
836}
837
838static inline void put_fs_excl(void)
839{
840 atomic_dec(&current->fs_excl);
841}
842
843static inline int has_fs_excl(void)
844{
845 return atomic_read(&current->fs_excl);
846}
847
848
823/* 849/*
824 * Superblock locking. 850 * Superblock locking.
825 */ 851 */
826static inline void lock_super(struct super_block * sb) 852static inline void lock_super(struct super_block * sb)
827{ 853{
854 get_fs_excl();
828 down(&sb->s_lock); 855 down(&sb->s_lock);
829} 856}
830 857
831static inline void unlock_super(struct super_block * sb) 858static inline void unlock_super(struct super_block * sb)
832{ 859{
860 put_fs_excl();
833 up(&sb->s_lock); 861 up(&sb->s_lock);
834} 862}
835 863
@@ -883,7 +911,9 @@ struct block_device_operations {
883 int (*open) (struct inode *, struct file *); 911 int (*open) (struct inode *, struct file *);
884 int (*release) (struct inode *, struct file *); 912 int (*release) (struct inode *, struct file *);
885 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); 913 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
914 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
886 long (*compat_ioctl) (struct file *, unsigned, unsigned long); 915 long (*compat_ioctl) (struct file *, unsigned, unsigned long);
916 int (*direct_access) (struct block_device *, sector_t, unsigned long *);
887 int (*media_changed) (struct gendisk *); 917 int (*media_changed) (struct gendisk *);
888 int (*revalidate_disk) (struct gendisk *); 918 int (*revalidate_disk) (struct gendisk *);
889 struct module *owner; 919 struct module *owner;
@@ -963,8 +993,8 @@ struct inode_operations {
963 int (*rename) (struct inode *, struct dentry *, 993 int (*rename) (struct inode *, struct dentry *,
964 struct inode *, struct dentry *); 994 struct inode *, struct dentry *);
965 int (*readlink) (struct dentry *, char __user *,int); 995 int (*readlink) (struct dentry *, char __user *,int);
966 int (*follow_link) (struct dentry *, struct nameidata *); 996 void * (*follow_link) (struct dentry *, struct nameidata *);
967 void (*put_link) (struct dentry *, struct nameidata *); 997 void (*put_link) (struct dentry *, struct nameidata *, void *);
968 void (*truncate) (struct inode *); 998 void (*truncate) (struct inode *);
969 int (*permission) (struct inode *, int, struct nameidata *); 999 int (*permission) (struct inode *, int, struct nameidata *);
970 int (*setattr) (struct dentry *, struct iattr *); 1000 int (*setattr) (struct dentry *, struct iattr *);
@@ -1024,6 +1054,7 @@ struct super_operations {
1024#define I_FREEING 16 1054#define I_FREEING 16
1025#define I_CLEAR 32 1055#define I_CLEAR 32
1026#define I_NEW 64 1056#define I_NEW 64
1057#define I_WILL_FREE 128
1027 1058
1028#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1059#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1029 1060
@@ -1369,7 +1400,6 @@ extern void emergency_remount(void);
1369extern int do_remount_sb(struct super_block *sb, int flags, 1400extern int do_remount_sb(struct super_block *sb, int flags,
1370 void *data, int force); 1401 void *data, int force);
1371extern sector_t bmap(struct inode *, sector_t); 1402extern sector_t bmap(struct inode *, sector_t);
1372extern int setattr_mask(unsigned int);
1373extern int notify_change(struct dentry *, struct iattr *); 1403extern int notify_change(struct dentry *, struct iattr *);
1374extern int permission(struct inode *, int, struct nameidata *); 1404extern int permission(struct inode *, int, struct nameidata *);
1375extern int generic_permission(struct inode *, int, 1405extern int generic_permission(struct inode *, int,
@@ -1411,7 +1441,11 @@ extern struct inode * igrab(struct inode *);
1411extern ino_t iunique(struct super_block *, ino_t); 1441extern ino_t iunique(struct super_block *, ino_t);
1412extern int inode_needs_sync(struct inode *inode); 1442extern int inode_needs_sync(struct inode *inode);
1413extern void generic_delete_inode(struct inode *inode); 1443extern void generic_delete_inode(struct inode *inode);
1444extern void generic_drop_inode(struct inode *inode);
1414 1445
1446extern struct inode *ilookup5_nowait(struct super_block *sb,
1447 unsigned long hashval, int (*test)(struct inode *, void *),
1448 void *data);
1415extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval, 1449extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval,
1416 int (*test)(struct inode *, void *), void *data); 1450 int (*test)(struct inode *, void *), void *data);
1417extern struct inode *ilookup(struct super_block *sb, unsigned long ino); 1451extern struct inode *ilookup(struct super_block *sb, unsigned long ino);
@@ -1494,6 +1528,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); 1528extern int generic_file_open(struct inode * inode, struct file * filp);
1495extern int nonseekable_open(struct inode * inode, struct file * filp); 1529extern int nonseekable_open(struct inode * inode, struct file * filp);
1496 1530
1531#ifdef CONFIG_FS_XIP
1532extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len,
1533 loff_t *ppos);
1534extern ssize_t xip_file_sendfile(struct file *in_file, loff_t *ppos,
1535 size_t count, read_actor_t actor,
1536 void *target);
1537extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma);
1538extern ssize_t xip_file_write(struct file *filp, const char __user *buf,
1539 size_t len, loff_t *ppos);
1540extern int xip_truncate_page(struct address_space *mapping, loff_t from);
1541#else
1542static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
1543{
1544 return 0;
1545}
1546#endif
1547
1497static inline void do_generic_file_read(struct file * filp, loff_t *ppos, 1548static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
1498 read_descriptor_t * desc, 1549 read_descriptor_t * desc,
1499 read_actor_t actor) 1550 read_actor_t actor)
@@ -1551,8 +1602,8 @@ extern struct file_operations generic_ro_fops;
1551extern int vfs_readlink(struct dentry *, char __user *, int, const char *); 1602extern int vfs_readlink(struct dentry *, char __user *, int, const char *);
1552extern int vfs_follow_link(struct nameidata *, const char *); 1603extern int vfs_follow_link(struct nameidata *, const char *);
1553extern int page_readlink(struct dentry *, char __user *, int); 1604extern int page_readlink(struct dentry *, char __user *, int);
1554extern int page_follow_link_light(struct dentry *, struct nameidata *); 1605extern void *page_follow_link_light(struct dentry *, struct nameidata *);
1555extern void page_put_link(struct dentry *, struct nameidata *); 1606extern void page_put_link(struct dentry *, struct nameidata *, void *);
1556extern int page_symlink(struct inode *inode, const char *symname, int len); 1607extern int page_symlink(struct inode *inode, const char *symname, int len);
1557extern struct inode_operations page_symlink_inode_operations; 1608extern struct inode_operations page_symlink_inode_operations;
1558extern int generic_readlink(struct dentry *, char __user *, int); 1609extern int generic_readlink(struct dentry *, char __user *, int);
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
new file mode 100644
index 000000000000..03b8e7932b83
--- /dev/null
+++ b/include/linux/fsnotify.h
@@ -0,0 +1,251 @@
1#ifndef _LINUX_FS_NOTIFY_H
2#define _LINUX_FS_NOTIFY_H
3
4/*
5 * include/linux/fsnotify.h - generic hooks for filesystem notification, to
6 * reduce in-source duplication from both dnotify and inotify.
7 *
8 * We don't compile any of this away in some complicated menagerie of ifdefs.
9 * Instead, we rely on the code inside to optimize away as needed.
10 *
11 * (C) Copyright 2005 Robert Love
12 */
13
14#ifdef __KERNEL__
15
16#include <linux/dnotify.h>
17#include <linux/inotify.h>
18
19/*
20 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
21 */
22static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
23 const char *old_name, const char *new_name,
24 int isdir, struct inode *target, struct inode *source)
25{
26 u32 cookie = inotify_get_cookie();
27
28 if (old_dir == new_dir)
29 inode_dir_notify(old_dir, DN_RENAME);
30 else {
31 inode_dir_notify(old_dir, DN_DELETE);
32 inode_dir_notify(new_dir, DN_CREATE);
33 }
34
35 if (isdir)
36 isdir = IN_ISDIR;
37 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name);
38 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name);
39
40 if (target) {
41 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL);
42 inotify_inode_is_dead(target);
43 }
44
45 if (source) {
46 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL);
47 }
48}
49
50/*
51 * fsnotify_nameremove - a filename was removed from a directory
52 */
53static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
54{
55 if (isdir)
56 isdir = IN_ISDIR;
57 dnotify_parent(dentry, DN_DELETE);
58 inotify_dentry_parent_queue_event(dentry, IN_DELETE|isdir, 0, dentry->d_name.name);
59}
60
61/*
62 * fsnotify_inoderemove - an inode is going away
63 */
64static inline void fsnotify_inoderemove(struct inode *inode)
65{
66 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL);
67 inotify_inode_is_dead(inode);
68}
69
70/*
71 * fsnotify_create - 'name' was linked in
72 */
73static inline void fsnotify_create(struct inode *inode, const char *name)
74{
75 inode_dir_notify(inode, DN_CREATE);
76 inotify_inode_queue_event(inode, IN_CREATE, 0, name);
77}
78
79/*
80 * fsnotify_mkdir - directory 'name' was created
81 */
82static inline void fsnotify_mkdir(struct inode *inode, const char *name)
83{
84 inode_dir_notify(inode, DN_CREATE);
85 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, name);
86}
87
88/*
89 * fsnotify_access - file was read
90 */
91static inline void fsnotify_access(struct dentry *dentry)
92{
93 struct inode *inode = dentry->d_inode;
94 u32 mask = IN_ACCESS;
95
96 if (S_ISDIR(inode->i_mode))
97 mask |= IN_ISDIR;
98
99 dnotify_parent(dentry, DN_ACCESS);
100 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
101 inotify_inode_queue_event(inode, mask, 0, NULL);
102}
103
104/*
105 * fsnotify_modify - file was modified
106 */
107static inline void fsnotify_modify(struct dentry *dentry)
108{
109 struct inode *inode = dentry->d_inode;
110 u32 mask = IN_MODIFY;
111
112 if (S_ISDIR(inode->i_mode))
113 mask |= IN_ISDIR;
114
115 dnotify_parent(dentry, DN_MODIFY);
116 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
117 inotify_inode_queue_event(inode, mask, 0, NULL);
118}
119
120/*
121 * fsnotify_open - file was opened
122 */
123static inline void fsnotify_open(struct dentry *dentry)
124{
125 struct inode *inode = dentry->d_inode;
126 u32 mask = IN_OPEN;
127
128 if (S_ISDIR(inode->i_mode))
129 mask |= IN_ISDIR;
130
131 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
132 inotify_inode_queue_event(inode, mask, 0, NULL);
133}
134
135/*
136 * fsnotify_close - file was closed
137 */
138static inline void fsnotify_close(struct file *file)
139{
140 struct dentry *dentry = file->f_dentry;
141 struct inode *inode = dentry->d_inode;
142 const char *name = dentry->d_name.name;
143 mode_t mode = file->f_mode;
144 u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE;
145
146 if (S_ISDIR(inode->i_mode))
147 mask |= IN_ISDIR;
148
149 inotify_dentry_parent_queue_event(dentry, mask, 0, name);
150 inotify_inode_queue_event(inode, mask, 0, NULL);
151}
152
153/*
154 * fsnotify_xattr - extended attributes were changed
155 */
156static inline void fsnotify_xattr(struct dentry *dentry)
157{
158 struct inode *inode = dentry->d_inode;
159 u32 mask = IN_ATTRIB;
160
161 if (S_ISDIR(inode->i_mode))
162 mask |= IN_ISDIR;
163
164 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
165 inotify_inode_queue_event(inode, mask, 0, NULL);
166}
167
168/*
169 * fsnotify_change - notify_change event. file was modified and/or metadata
170 * was changed.
171 */
172static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
173{
174 struct inode *inode = dentry->d_inode;
175 int dn_mask = 0;
176 u32 in_mask = 0;
177
178 if (ia_valid & ATTR_UID) {
179 in_mask |= IN_ATTRIB;
180 dn_mask |= DN_ATTRIB;
181 }
182 if (ia_valid & ATTR_GID) {
183 in_mask |= IN_ATTRIB;
184 dn_mask |= DN_ATTRIB;
185 }
186 if (ia_valid & ATTR_SIZE) {
187 in_mask |= IN_MODIFY;
188 dn_mask |= DN_MODIFY;
189 }
190 /* both times implies a utime(s) call */
191 if ((ia_valid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME))
192 {
193 in_mask |= IN_ATTRIB;
194 dn_mask |= DN_ATTRIB;
195 } else if (ia_valid & ATTR_ATIME) {
196 in_mask |= IN_ACCESS;
197 dn_mask |= DN_ACCESS;
198 } else if (ia_valid & ATTR_MTIME) {
199 in_mask |= IN_MODIFY;
200 dn_mask |= DN_MODIFY;
201 }
202 if (ia_valid & ATTR_MODE) {
203 in_mask |= IN_ATTRIB;
204 dn_mask |= DN_ATTRIB;
205 }
206
207 if (dn_mask)
208 dnotify_parent(dentry, dn_mask);
209 if (in_mask) {
210 if (S_ISDIR(inode->i_mode))
211 in_mask |= IN_ISDIR;
212 inotify_inode_queue_event(inode, in_mask, 0, NULL);
213 inotify_dentry_parent_queue_event(dentry, in_mask, 0,
214 dentry->d_name.name);
215 }
216}
217
218#ifdef CONFIG_INOTIFY /* inotify helpers */
219
220/*
221 * fsnotify_oldname_init - save off the old filename before we change it
222 */
223static inline const char *fsnotify_oldname_init(const char *name)
224{
225 return kstrdup(name, GFP_KERNEL);
226}
227
228/*
229 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init
230 */
231static inline void fsnotify_oldname_free(const char *old_name)
232{
233 kfree(old_name);
234}
235
236#else /* CONFIG_INOTIFY */
237
238static inline const char *fsnotify_oldname_init(const char *name)
239{
240 return NULL;
241}
242
243static inline void fsnotify_oldname_free(const char *old_name)
244{
245}
246
247#endif /* ! CONFIG_INOTIFY */
248
249#endif /* __KERNEL__ */
250
251#endif /* _LINUX_FS_NOTIFY_H */
diff --git a/include/linux/ftape.h b/include/linux/ftape.h
index c6b38d5b9186..72faeec9f6e1 100644
--- a/include/linux/ftape.h
+++ b/include/linux/ftape.h
@@ -165,7 +165,7 @@ typedef union {
165# undef CONFIG_FT_FDC_DMA 165# undef CONFIG_FT_FDC_DMA
166# define CONFIG_FT_FDC_DMA 2 166# define CONFIG_FT_FDC_DMA 2
167# endif 167# endif
168#elif CONFIG_FT_ALT_FDC == 1 /* CONFIG_FT_MACH2 */ 168#elif defined(CONFIG_FT_ALT_FDC) /* CONFIG_FT_MACH2 */
169# if CONFIG_FT_FDC_BASE == 0 169# if CONFIG_FT_FDC_BASE == 0
170# undef CONFIG_FT_FDC_BASE 170# undef CONFIG_FT_FDC_BASE
171# define CONFIG_FT_FDC_BASE 0x370 171# define CONFIG_FT_FDC_BASE 0x370
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 8d6bf608b199..7c7400137e97 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -12,8 +12,8 @@ struct vm_area_struct;
12 * GFP bitmasks.. 12 * GFP bitmasks..
13 */ 13 */
14/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */ 14/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
15#define __GFP_DMA 0x01 15#define __GFP_DMA 0x01u
16#define __GFP_HIGHMEM 0x02 16#define __GFP_HIGHMEM 0x02u
17 17
18/* 18/*
19 * Action modifiers - doesn't change the zoning 19 * Action modifiers - doesn't change the zoning
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 8336dba18971..5912874ca83c 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -2,6 +2,7 @@
2#define LINUX_HARDIRQ_H 2#define LINUX_HARDIRQ_H
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/preempt.h>
5#include <linux/smp_lock.h> 6#include <linux/smp_lock.h>
6#include <asm/hardirq.h> 7#include <asm/hardirq.h>
7#include <asm/system.h> 8#include <asm/system.h>
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index ed2927ef1ff7..df695e9ae327 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -242,8 +242,8 @@ static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
242} 242}
243 243
244 244
245static __inline__ unsigned short hdlc_type_trans(struct sk_buff *skb, 245static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
246 struct net_device *dev) 246 struct net_device *dev)
247{ 247{
248 hdlc_device *hdlc = dev_to_hdlc(dev); 248 hdlc_device *hdlc = dev_to_hdlc(dev);
249 249
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/i2c-sysfs.h b/include/linux/hwmon-sysfs.h
index d7bf6ce11679..1b5018a965f5 100644
--- a/include/linux/i2c-sysfs.h
+++ b/include/linux/hwmon-sysfs.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * i2c-sysfs.h - i2c chip driver sysfs defines 2 * hwmon-sysfs.h - hardware monitoring chip driver sysfs defines
3 * 3 *
4 * Copyright (C) 2005 Yani Ioannou <yani.ioannou@gmail.com> 4 * Copyright (C) 2005 Yani Ioannou <yani.ioannou@gmail.com>
5 * 5 *
@@ -17,8 +17,8 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 19 */
20#ifndef _LINUX_I2C_SYSFS_H 20#ifndef _LINUX_HWMON_SYSFS_H
21#define _LINUX_I2C_SYSFS_H 21#define _LINUX_HWMON_SYSFS_H
22 22
23struct sensor_device_attribute{ 23struct sensor_device_attribute{
24 struct device_attribute dev_attr; 24 struct device_attribute dev_attr;
@@ -33,4 +33,4 @@ struct sensor_device_attribute sensor_dev_attr_##_name = { \
33 .index = _index, \ 33 .index = _index, \
34} 34}
35 35
36#endif /* _LINUX_I2C_SYSFS_H */ 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..a6dbb51ecd7b 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
@@ -1501,4 +1501,10 @@ extern struct bus_type ide_bus_type;
1501#define ide_id_has_flush_cache_ext(id) \ 1501#define ide_id_has_flush_cache_ext(id) \
1502 (((id)->cfs_enable_2 & 0x2400) == 0x2400) 1502 (((id)->cfs_enable_2 & 0x2400) == 0x2400)
1503 1503
1504static inline int hwif_to_node(ide_hwif_t *hwif)
1505{
1506 struct pci_dev *dev = hwif->pci_dev;
1507 return dev ? pcibus_to_node(dev->bus) : -1;
1508}
1509
1504#endif /* _IDE_H */ 1510#endif /* _IDE_H */
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/if_shaper.h b/include/linux/if_shaper.h
index 004e6f09a6e2..68c896a36a34 100644
--- a/include/linux/if_shaper.h
+++ b/include/linux/if_shaper.h
@@ -23,7 +23,7 @@ struct shaper
23 __u32 shapeclock; 23 __u32 shapeclock;
24 unsigned long recovery; /* Time we can next clock a packet out on 24 unsigned long recovery; /* Time we can next clock a packet out on
25 an empty queue */ 25 an empty queue */
26 struct semaphore sem; 26 spinlock_t lock;
27 struct net_device_stats stats; 27 struct net_device_stats stats;
28 struct net_device *dev; 28 struct net_device *dev;
29 int (*hard_start_xmit) (struct sk_buff *skb, 29 int (*hard_start_xmit) (struct sk_buff *skb,
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 390e760a96d3..0c31ef0b5bad 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -148,7 +148,6 @@ struct ip_sf_socklist
148struct ip_mc_socklist 148struct ip_mc_socklist
149{ 149{
150 struct ip_mc_socklist *next; 150 struct ip_mc_socklist *next;
151 int count;
152 struct ip_mreqn multi; 151 struct ip_mreqn multi;
153 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ 152 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */
154 struct ip_sf_socklist *sflist; 153 struct ip_sf_socklist *sflist;
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/inotify.h b/include/linux/inotify.h
new file mode 100644
index 000000000000..93bb3afe646b
--- /dev/null
+++ b/include/linux/inotify.h
@@ -0,0 +1,110 @@
1/*
2 * Inode based directory notification for Linux
3 *
4 * Copyright (C) 2005 John McCutchan
5 */
6
7#ifndef _LINUX_INOTIFY_H
8#define _LINUX_INOTIFY_H
9
10#include <linux/types.h>
11
12/*
13 * struct inotify_event - structure read from the inotify device for each event
14 *
15 * When you are watching a directory, you will receive the filename for events
16 * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd.
17 */
18struct inotify_event {
19 __s32 wd; /* watch descriptor */
20 __u32 mask; /* watch mask */
21 __u32 cookie; /* cookie to synchronize two events */
22 __u32 len; /* length (including nulls) of name */
23 char name[0]; /* stub for possible name */
24};
25
26/* the following are legal, implemented events that user-space can watch for */
27#define IN_ACCESS 0x00000001 /* File was accessed */
28#define IN_MODIFY 0x00000002 /* File was modified */
29#define IN_ATTRIB 0x00000004 /* Metadata changed */
30#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */
31#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
32#define IN_OPEN 0x00000020 /* File was opened */
33#define IN_MOVED_FROM 0x00000040 /* File was moved from X */
34#define IN_MOVED_TO 0x00000080 /* File was moved to Y */
35#define IN_CREATE 0x00000100 /* Subfile was created */
36#define IN_DELETE 0x00000200 /* Subfile was deleted */
37#define IN_DELETE_SELF 0x00000400 /* Self was deleted */
38#define IN_MOVE_SELF 0x00000800 /* Self was moved */
39
40/* the following are legal events. they are sent as needed to any watch */
41#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */
42#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
43#define IN_IGNORED 0x00008000 /* File was ignored */
44
45/* helper events */
46#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */
47#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */
48
49/* special flags */
50#define IN_ISDIR 0x40000000 /* event occurred against dir */
51#define IN_ONESHOT 0x80000000 /* only send event once */
52
53/*
54 * All of the events - we build the list by hand so that we can add flags in
55 * the future and not break backward compatibility. Apps will get only the
56 * events that they originally wanted. Be sure to add new events here!
57 */
58#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
59 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
60 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
61 IN_MOVE_SELF)
62
63#ifdef __KERNEL__
64
65#include <linux/dcache.h>
66#include <linux/fs.h>
67#include <linux/config.h>
68
69#ifdef CONFIG_INOTIFY
70
71extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
72 const char *);
73extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
74 const char *);
75extern void inotify_unmount_inodes(struct list_head *);
76extern void inotify_inode_is_dead(struct inode *);
77extern u32 inotify_get_cookie(void);
78
79#else
80
81static inline void inotify_inode_queue_event(struct inode *inode,
82 __u32 mask, __u32 cookie,
83 const char *filename)
84{
85}
86
87static inline void inotify_dentry_parent_queue_event(struct dentry *dentry,
88 __u32 mask, __u32 cookie,
89 const char *filename)
90{
91}
92
93static inline void inotify_unmount_inodes(struct list_head *list)
94{
95}
96
97static inline void inotify_inode_is_dead(struct inode *inode)
98{
99}
100
101static inline u32 inotify_get_cookie(void)
102{
103 return 0;
104}
105
106#endif /* CONFIG_INOTIFY */
107
108#endif /* __KERNEL __ */
109
110#endif /* _LINUX_INOTIFY_H */
diff --git a/include/linux/input.h b/include/linux/input.h
index 9d9598ed760d..bdc53c6cc962 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -811,9 +811,9 @@ struct input_dev {
811 811
812 void *private; 812 void *private;
813 813
814 char *name; 814 const char *name;
815 char *phys; 815 const char *phys;
816 char *uniq; 816 const char *uniq;
817 struct input_id id; 817 struct input_id id;
818 818
819 unsigned long evbit[NBITS(EV_MAX)]; 819 unsigned long evbit[NBITS(EV_MAX)];
@@ -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;
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
new file mode 100644
index 000000000000..88d5961f7a3f
--- /dev/null
+++ b/include/linux/ioprio.h
@@ -0,0 +1,85 @@
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
37enum {
38 IOPRIO_WHO_PROCESS = 1,
39 IOPRIO_WHO_PGRP,
40 IOPRIO_WHO_USER,
41};
42
43/*
44 * if process has set io priority explicitly, use that. if not, convert
45 * the cpu scheduler nice value to an io priority
46 */
47#define IOPRIO_NORM (4)
48static inline int task_ioprio(struct task_struct *task)
49{
50 WARN_ON(!ioprio_valid(task->ioprio));
51 return IOPRIO_PRIO_DATA(task->ioprio);
52}
53
54static inline int task_nice_ioprio(struct task_struct *task)
55{
56 return (task_nice(task) + 20) / 5;
57}
58
59/*
60 * For inheritance, return the highest of the two given priorities
61 */
62static inline int ioprio_best(unsigned short aprio, unsigned short bprio)
63{
64 unsigned short aclass = IOPRIO_PRIO_CLASS(aprio);
65 unsigned short bclass = IOPRIO_PRIO_CLASS(bprio);
66
67 if (!ioprio_valid(aprio))
68 return bprio;
69 if (!ioprio_valid(bprio))
70 return aprio;
71
72 if (aclass == IOPRIO_CLASS_NONE)
73 aclass = IOPRIO_CLASS_BE;
74 if (bclass == IOPRIO_CLASS_NONE)
75 bclass = IOPRIO_CLASS_BE;
76
77 if (aclass == bclass)
78 return min(aprio, bprio);
79 if (aclass > bclass)
80 return bprio;
81 else
82 return aprio;
83}
84
85#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 7fc1022be9ee..069d3b84d311 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -85,10 +85,10 @@ extern int no_irq_affinity;
85extern int noirqdebug_setup(char *str); 85extern int noirqdebug_setup(char *str);
86 86
87extern 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,
88 struct irqaction *action); 88 struct irqaction *action);
89extern 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);
90extern void note_interrupt(unsigned int irq, irq_desc_t *desc, int action_ret); 90extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
91extern void report_bad_irq(unsigned int irq, irq_desc_t *desc, int action_ret); 91 int action_ret, struct pt_regs *regs);
92extern int can_request_irq(unsigned int irq, unsigned long irqflags); 92extern int can_request_irq(unsigned int irq, unsigned long irqflags);
93 93
94extern void init_irq_proc(void); 94extern void init_irq_proc(void);
diff --git a/include/linux/jffs2_fs_sb.h b/include/linux/jffs2_fs_sb.h
index 4afc8d8c2e9e..1e21546622de 100644
--- a/include/linux/jffs2_fs_sb.h
+++ b/include/linux/jffs2_fs_sb.h
@@ -1,4 +1,4 @@
1/* $Id: jffs2_fs_sb.h,v 1.48 2004/11/20 10:41:12 dwmw2 Exp $ */ 1/* $Id: jffs2_fs_sb.h,v 1.52 2005/05/19 16:12:17 gleixner Exp $ */
2 2
3#ifndef _JFFS2_FS_SB 3#ifndef _JFFS2_FS_SB
4#define _JFFS2_FS_SB 4#define _JFFS2_FS_SB
@@ -14,7 +14,8 @@
14#include <linux/rwsem.h> 14#include <linux/rwsem.h>
15 15
16#define JFFS2_SB_FLAG_RO 1 16#define JFFS2_SB_FLAG_RO 1
17#define JFFS2_SB_FLAG_MOUNTING 2 17#define JFFS2_SB_FLAG_SCANNING 2 /* Flash scanning is in progress */
18#define JFFS2_SB_FLAG_BUILDING 4 /* File system building is in progress */
18 19
19struct jffs2_inodirty; 20struct jffs2_inodirty;
20 21
@@ -31,7 +32,7 @@ struct jffs2_sb_info {
31 unsigned int flags; 32 unsigned int flags;
32 33
33 struct task_struct *gc_task; /* GC task struct */ 34 struct task_struct *gc_task; /* GC task struct */
34 struct semaphore gc_thread_start; /* GC thread start mutex */ 35 struct completion gc_thread_start; /* GC thread start completion */
35 struct completion gc_thread_exit; /* GC thread exit completion port */ 36 struct completion gc_thread_exit; /* GC thread exit completion port */
36 37
37 struct semaphore alloc_sem; /* Used to protect all the following 38 struct semaphore alloc_sem; /* Used to protect all the following
@@ -94,7 +95,7 @@ struct jffs2_sb_info {
94 to an obsoleted node. I don't like this. Alternatives welcomed. */ 95 to an obsoleted node. I don't like this. Alternatives welcomed. */
95 struct semaphore erase_free_sem; 96 struct semaphore erase_free_sem;
96 97
97#if defined CONFIG_JFFS2_FS_NAND || defined CONFIG_JFFS2_FS_NOR_ECC 98#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
98 /* Write-behind buffer for NAND flash */ 99 /* Write-behind buffer for NAND flash */
99 unsigned char *wbuf; 100 unsigned char *wbuf;
100 uint32_t wbuf_ofs; 101 uint32_t wbuf_ofs;
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/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/kprobes.h b/include/linux/kprobes.h
index 99ddba5a4e00..e050fc2d4c26 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_kprobes(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/mbcache.h b/include/linux/mbcache.h
index 8e5a10410a30..9263d2db2d67 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -29,7 +29,7 @@ struct mb_cache_op {
29 29
30struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t, 30struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t,
31 int, int); 31 int, int);
32void mb_cache_shrink(struct mb_cache *, struct block_device *); 32void mb_cache_shrink(struct block_device *);
33void mb_cache_destroy(struct mb_cache *); 33void mb_cache_destroy(struct mb_cache *);
34 34
35/* Functions on cache entries */ 35/* Functions on cache entries */
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 1813b162b0a8..82d7024f0765 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];
482}
483
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)
492{
493 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
419} 494}
420 495
421static inline void set_page_zone(struct page *page, unsigned long nodezone_num) 496static inline void set_page_zone(struct page *page, unsigned long zone)
422{ 497{
423 page->flags &= ~(~0UL << NODEZONE_SHIFT); 498 page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
424 page->flags |= nodezone_num << NODEZONE_SHIFT; 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
@@ -532,10 +625,16 @@ static inline int page_mapped(struct page *page)
532 * Used to decide whether a process gets delivered SIGBUS or 625 * Used to decide whether a process gets delivered SIGBUS or
533 * just gets major/minor fault counters bumped up. 626 * just gets major/minor fault counters bumped up.
534 */ 627 */
535#define VM_FAULT_OOM (-1) 628#define VM_FAULT_OOM 0x00
536#define VM_FAULT_SIGBUS 0 629#define VM_FAULT_SIGBUS 0x01
537#define VM_FAULT_MINOR 1 630#define VM_FAULT_MINOR 0x02
538#define VM_FAULT_MAJOR 2 631#define VM_FAULT_MAJOR 0x03
632
633/*
634 * Special case for get_user_pages.
635 * Must be in a distinct bit from the above VM_FAULT_ flags.
636 */
637#define VM_FAULT_WRITE 0x10
539 638
540#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 639#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
541 640
@@ -611,7 +710,13 @@ extern pte_t *FASTCALL(pte_alloc_kernel(struct mm_struct *mm, pmd_t *pmd, unsign
611extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address)); 710extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
612extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); 711extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
613extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); 712extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
614extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access); 713extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
714
715static inline int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access)
716{
717 return __handle_mm_fault(mm, vma, address, write_access) & (~VM_FAULT_WRITE);
718}
719
615extern int make_pages_present(unsigned long addr, unsigned long end); 720extern int make_pages_present(unsigned long addr, unsigned long end);
616extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 721extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
617void install_arg_page(struct vm_area_struct *, struct page *, unsigned long); 722void install_arg_page(struct vm_area_struct *, struct page *, unsigned long);
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 4733d35d8223..6c90461ed99f 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -269,7 +269,9 @@ typedef struct pglist_data {
269 struct zone node_zones[MAX_NR_ZONES]; 269 struct zone node_zones[MAX_NR_ZONES];
270 struct zonelist node_zonelists[GFP_ZONETYPES]; 270 struct zonelist node_zonelists[GFP_ZONETYPES];
271 int nr_zones; 271 int nr_zones;
272#ifdef CONFIG_FLAT_NODE_MEM_MAP
272 struct page *node_mem_map; 273 struct page *node_mem_map;
274#endif
273 struct bootmem_data *bdata; 275 struct bootmem_data *bdata;
274 unsigned long node_start_pfn; 276 unsigned long node_start_pfn;
275 unsigned long node_present_pages; /* total number of physical pages */ 277 unsigned long node_present_pages; /* total number of physical pages */
@@ -284,6 +286,12 @@ typedef struct pglist_data {
284 286
285#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) 287#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages)
286#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))
287 295
288extern struct pglist_data *pgdat_list; 296extern struct pglist_data *pgdat_list;
289 297
@@ -400,7 +408,7 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
400/* Returns the number of the current Node. */ 408/* Returns the number of the current Node. */
401#define numa_node_id() (cpu_to_node(raw_smp_processor_id())) 409#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
402 410
403#ifndef CONFIG_DISCONTIGMEM 411#ifndef CONFIG_NEED_MULTIPLE_NODES
404 412
405extern struct pglist_data contig_page_data; 413extern struct pglist_data contig_page_data;
406#define NODE_DATA(nid) (&contig_page_data) 414#define NODE_DATA(nid) (&contig_page_data)
@@ -408,36 +416,177 @@ extern struct pglist_data contig_page_data;
408#define MAX_NODES_SHIFT 1 416#define MAX_NODES_SHIFT 1
409#define pfn_to_nid(pfn) (0) 417#define pfn_to_nid(pfn) (0)
410 418
411#else /* CONFIG_DISCONTIGMEM */ 419#else /* CONFIG_NEED_MULTIPLE_NODES */
412 420
413#include <asm/mmzone.h> 421#include <asm/mmzone.h>
414 422
423#endif /* !CONFIG_NEED_MULTIPLE_NODES */
424
425#ifdef CONFIG_SPARSEMEM
426#include <asm/sparsemem.h>
427#endif
428
415#if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED) 429#if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED)
416/* 430/*
417 * 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.
418 * 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.
419 */ 433 */
420#define MAX_NODES_SHIFT 6 434#define FLAGS_RESERVED 8
435
421#elif BITS_PER_LONG == 64 436#elif BITS_PER_LONG == 64
422/* 437/*
423 * with 64 bit flags field, there's plenty of room. 438 * with 64 bit flags field, there's plenty of room.
424 */ 439 */
425#define MAX_NODES_SHIFT 10 440#define FLAGS_RESERVED 32
441
442#else
443
444#error BITS_PER_LONG not defined
445
446#endif
447
448#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
449#define early_pfn_to_nid(nid) (0UL)
426#endif 450#endif
427 451
428#endif /* !CONFIG_DISCONTIGMEM */ 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)
429 469
430#if NODES_SHIFT > MAX_NODES_SHIFT 470#define PAGES_PER_SECTION (1UL << PFN_SECTION_SHIFT)
431#error NODES_SHIFT > MAX_NODES_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
432#endif 475#endif
433 476
434/* There are currently 3 zones: DMA, Normal & Highmem, thus we need 2 bits */ 477struct page;
435#define MAX_ZONES_SHIFT 2 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];
436 491
437#if ZONES_SHIFT > MAX_ZONES_SHIFT 492static inline struct mem_section *__nr_to_section(unsigned long nr)
438#error ZONES_SHIFT > MAX_ZONES_SHIFT 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}
528
529/*
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
564#endif
565
566#define pfn_to_pgdat(pfn) \
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 */
576
577#ifdef CONFIG_NODES_SPAN_OTHER_NODES
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)
581#endif
582
583#ifndef early_pfn_valid
584#define early_pfn_valid(pfn) (1)
439#endif 585#endif
440 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
441#endif /* !__ASSEMBLY__ */ 590#endif /* !__ASSEMBLY__ */
442#endif /* __KERNEL__ */ 591#endif /* __KERNEL__ */
443#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..dce53ac1625d 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -174,5 +174,62 @@ struct serio_device_id {
174 __u8 proto; 174 __u8 proto;
175}; 175};
176 176
177/*
178 * Struct used for matching a device
179 */
180struct of_device_id
181{
182 char name[32];
183 char type[32];
184 char compatible[128];
185 void *data;
186};
187
188
189/* PCMCIA */
190
191struct pcmcia_device_id {
192 __u16 match_flags;
193
194 __u16 manf_id;
195 __u16 card_id;
196
197 __u8 func_id;
198
199 /* for real multi-function devices */
200 __u8 function;
201
202 /* for pseude multi-function devices */
203 __u8 device_no;
204
205 __u32 prod_id_hash[4];
206
207 /* not matched against in kernelspace*/
208#ifdef __KERNEL__
209 const char * prod_id[4];
210#else
211 kernel_ulong_t prod_id[4];
212#endif
213
214 /* not matched against */
215 kernel_ulong_t driver_info;
216#ifdef __KERNEL__
217 char * cisfile;
218#else
219 kernel_ulong_t cisfile;
220#endif
221};
222
223#define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001
224#define PCMCIA_DEV_ID_MATCH_CARD_ID 0x0002
225#define PCMCIA_DEV_ID_MATCH_FUNC_ID 0x0004
226#define PCMCIA_DEV_ID_MATCH_FUNCTION 0x0008
227#define PCMCIA_DEV_ID_MATCH_PROD_ID1 0x0010
228#define PCMCIA_DEV_ID_MATCH_PROD_ID2 0x0020
229#define PCMCIA_DEV_ID_MATCH_PROD_ID3 0x0040
230#define PCMCIA_DEV_ID_MATCH_PROD_ID4 0x0080
231#define PCMCIA_DEV_ID_MATCH_DEVICE_NO 0x0100
232#define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
233#define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
177 234
178#endif /* LINUX_MOD_DEVICETABLE_H */ 235#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/mount.h b/include/linux/mount.h
index 8b8d3b9beefd..f8f39937e301 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -12,6 +12,7 @@
12#define _LINUX_MOUNT_H 12#define _LINUX_MOUNT_H
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14 14
15#include <linux/types.h>
15#include <linux/list.h> 16#include <linux/list.h>
16#include <linux/spinlock.h> 17#include <linux/spinlock.h>
17#include <asm/atomic.h> 18#include <asm/atomic.h>
@@ -34,7 +35,7 @@ struct vfsmount
34 int mnt_expiry_mark; /* true if marked for expiry */ 35 int mnt_expiry_mark; /* true if marked for expiry */
35 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 36 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
36 struct list_head mnt_list; 37 struct list_head mnt_list;
37 struct list_head mnt_fslink; /* link in fs-specific expiry list */ 38 struct list_head mnt_expire; /* link in fs-specific expiry list */
38 struct namespace *mnt_namespace; /* containing namespace */ 39 struct namespace *mnt_namespace; /* containing namespace */
39}; 40};
40 41
@@ -47,7 +48,7 @@ static inline struct vfsmount *mntget(struct vfsmount *mnt)
47 48
48extern void __mntput(struct vfsmount *mnt); 49extern void __mntput(struct vfsmount *mnt);
49 50
50static inline void _mntput(struct vfsmount *mnt) 51static inline void mntput_no_expire(struct vfsmount *mnt)
51{ 52{
52 if (mnt) { 53 if (mnt) {
53 if (atomic_dec_and_test(&mnt->mnt_count)) 54 if (atomic_dec_and_test(&mnt->mnt_count))
@@ -59,7 +60,7 @@ static inline void mntput(struct vfsmount *mnt)
59{ 60{
60 if (mnt) { 61 if (mnt) {
61 mnt->mnt_expiry_mark = 0; 62 mnt->mnt_expiry_mark = 0;
62 _mntput(mnt); 63 mntput_no_expire(mnt);
63 } 64 }
64} 65}
65 66
@@ -76,6 +77,7 @@ extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
76extern void mark_mounts_for_expiry(struct list_head *mounts); 77extern void mark_mounts_for_expiry(struct list_head *mounts);
77 78
78extern spinlock_t vfsmount_lock; 79extern spinlock_t vfsmount_lock;
80extern dev_t name_to_dev_t(char *name);
79 81
80#endif 82#endif
81#endif /* _LINUX_MOUNT_H */ 83#endif /* _LINUX_MOUNT_H */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 2ed8c585021e..e6b6a1c66bd5 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -1,7 +1,7 @@
1 1
2/* Common Flash Interface structures 2/* Common Flash Interface structures
3 * See http://support.intel.com/design/flash/technote/index.htm 3 * See http://support.intel.com/design/flash/technote/index.htm
4 * $Id: cfi.h,v 1.50 2004/11/20 12:46:51 dwmw2 Exp $ 4 * $Id: cfi.h,v 1.54 2005/06/06 23:04:36 tpoynor Exp $
5 */ 5 */
6 6
7#ifndef __MTD_CFI_H__ 7#ifndef __MTD_CFI_H__
@@ -148,6 +148,14 @@ struct cfi_pri_intelext {
148 uint8_t extra[0]; 148 uint8_t extra[0];
149} __attribute__((packed)); 149} __attribute__((packed));
150 150
151struct cfi_intelext_otpinfo {
152 uint32_t ProtRegAddr;
153 uint16_t FactGroups;
154 uint8_t FactProtRegSize;
155 uint16_t UserGroups;
156 uint8_t UserProtRegSize;
157} __attribute__((packed));
158
151struct cfi_intelext_blockinfo { 159struct cfi_intelext_blockinfo {
152 uint16_t NumIdentBlocks; 160 uint16_t NumIdentBlocks;
153 uint16_t BlockSize; 161 uint16_t BlockSize;
@@ -244,7 +252,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, int interleave, int
244 * It looks too long to be inline, but in the common case it should almost all 252 * It looks too long to be inline, but in the common case it should almost all
245 * get optimised away. 253 * get optimised away.
246 */ 254 */
247static inline map_word cfi_build_cmd(u_char cmd, struct map_info *map, struct cfi_private *cfi) 255static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi)
248{ 256{
249 map_word val = { {0} }; 257 map_word val = { {0} };
250 int wordwidth, words_per_bus, chip_mode, chips_per_word; 258 int wordwidth, words_per_bus, chip_mode, chips_per_word;
@@ -307,6 +315,69 @@ static inline map_word cfi_build_cmd(u_char cmd, struct map_info *map, struct cf
307} 315}
308#define CMD(x) cfi_build_cmd((x), map, cfi) 316#define CMD(x) cfi_build_cmd((x), map, cfi)
309 317
318
319static inline unsigned char cfi_merge_status(map_word val, struct map_info *map,
320 struct cfi_private *cfi)
321{
322 int wordwidth, words_per_bus, chip_mode, chips_per_word;
323 unsigned long onestat, res = 0;
324 int i;
325
326 /* We do it this way to give the compiler a fighting chance
327 of optimising away all the crap for 'bankwidth' larger than
328 an unsigned long, in the common case where that support is
329 disabled */
330 if (map_bankwidth_is_large(map)) {
331 wordwidth = sizeof(unsigned long);
332 words_per_bus = (map_bankwidth(map)) / wordwidth; // i.e. normally 1
333 } else {
334 wordwidth = map_bankwidth(map);
335 words_per_bus = 1;
336 }
337
338 chip_mode = map_bankwidth(map) / cfi_interleave(cfi);
339 chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map);
340
341 onestat = val.x[0];
342 /* Or all status words together */
343 for (i=1; i < words_per_bus; i++) {
344 onestat |= val.x[i];
345 }
346
347 res = onestat;
348 switch(chips_per_word) {
349 default: BUG();
350#if BITS_PER_LONG >= 64
351 case 8:
352 res |= (onestat >> (chip_mode * 32));
353#endif
354 case 4:
355 res |= (onestat >> (chip_mode * 16));
356 case 2:
357 res |= (onestat >> (chip_mode * 8));
358 case 1:
359 ;
360 }
361
362 /* Last, determine what the bit-pattern should be for a single
363 device, according to chip mode and endianness... */
364 switch (chip_mode) {
365 case 1:
366 break;
367 case 2:
368 res = cfi16_to_cpu(res);
369 break;
370 case 4:
371 res = cfi32_to_cpu(res);
372 break;
373 default: BUG();
374 }
375 return res;
376}
377
378#define MERGESTATUS(x) cfi_merge_status((x), map, cfi)
379
380
310/* 381/*
311 * Sends a CFI command to a bank of flash for the given geometry. 382 * Sends a CFI command to a bank of flash for the given geometry.
312 * 383 *
@@ -357,16 +428,6 @@ static inline void cfi_udelay(int us)
357 } 428 }
358} 429}
359 430
360static inline void cfi_spin_lock(spinlock_t *mutex)
361{
362 spin_lock_bh(mutex);
363}
364
365static inline void cfi_spin_unlock(spinlock_t *mutex)
366{
367 spin_unlock_bh(mutex);
368}
369
370struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, 431struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size,
371 const char* name); 432 const char* name);
372struct cfi_fixup { 433struct cfi_fixup {
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index c66ba812bf90..675776fa3e27 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * (C) 2000 Red Hat. GPLd. 7 * (C) 2000 Red Hat. GPLd.
8 * 8 *
9 * $Id: flashchip.h,v 1.15 2004/11/05 22:41:06 nico Exp $ 9 * $Id: flashchip.h,v 1.17 2005/03/14 18:27:15 bjd Exp $
10 * 10 *
11 */ 11 */
12 12
@@ -29,6 +29,7 @@ typedef enum {
29 FL_ERASE_SUSPENDED, 29 FL_ERASE_SUSPENDED,
30 FL_WRITING, 30 FL_WRITING,
31 FL_WRITING_TO_BUFFER, 31 FL_WRITING_TO_BUFFER,
32 FL_OTP_WRITE,
32 FL_WRITE_SUSPENDING, 33 FL_WRITE_SUSPENDING,
33 FL_WRITE_SUSPENDED, 34 FL_WRITE_SUSPENDED,
34 FL_PM_SUSPENDED, 35 FL_PM_SUSPENDED,
@@ -62,8 +63,8 @@ struct flchip {
62 flstate_t state; 63 flstate_t state;
63 flstate_t oldstate; 64 flstate_t oldstate;
64 65
65 int write_suspended:1; 66 unsigned int write_suspended:1;
66 int erase_suspended:1; 67 unsigned int erase_suspended:1;
67 unsigned long in_progress_block_addr; 68 unsigned long in_progress_block_addr;
68 69
69 spinlock_t *mutex; 70 spinlock_t *mutex;
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index b52c8cbd235c..0268125a6271 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
5 * 5 *
6 * $Id: inftl.h,v 1.6 2004/06/30 14:49:00 dbrown Exp $ 6 * $Id: inftl.h,v 1.7 2005/06/13 13:08:45 sean Exp $
7 */ 7 */
8 8
9#ifndef __MTD_INFTL_H__ 9#ifndef __MTD_INFTL_H__
@@ -20,7 +20,7 @@
20#include <mtd/inftl-user.h> 20#include <mtd/inftl-user.h>
21 21
22#ifndef INFTL_MAJOR 22#ifndef INFTL_MAJOR
23#define INFTL_MAJOR 94 23#define INFTL_MAJOR 96
24#endif 24#endif
25#define INFTL_PARTN_BITS 4 25#define INFTL_PARTN_BITS 4
26 26
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index f0268b99c900..142963f01d29 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -1,6 +1,6 @@
1 1
2/* Overhauled routines for dealing with different mmap regions of flash */ 2/* Overhauled routines for dealing with different mmap regions of flash */
3/* $Id: map.h,v 1.46 2005/01/05 17:09:44 dwmw2 Exp $ */ 3/* $Id: map.h,v 1.52 2005/05/25 10:29:41 gleixner Exp $ */
4 4
5#ifndef __LINUX_MTD_MAP_H__ 5#ifndef __LINUX_MTD_MAP_H__
6#define __LINUX_MTD_MAP_H__ 6#define __LINUX_MTD_MAP_H__
@@ -263,6 +263,17 @@ static inline map_word map_word_and(struct map_info *map, map_word val1, map_wor
263 return r; 263 return r;
264} 264}
265 265
266static inline map_word map_word_clr(struct map_info *map, map_word val1, map_word val2)
267{
268 map_word r;
269 int i;
270
271 for (i=0; i<map_words(map); i++) {
272 r.x[i] = val1.x[i] & ~val2.x[i];
273 }
274 return r;
275}
276
266static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) 277static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2)
267{ 278{
268 map_word r; 279 map_word r;
@@ -273,6 +284,7 @@ static inline map_word map_word_or(struct map_info *map, map_word val1, map_word
273 } 284 }
274 return r; 285 return r;
275} 286}
287
276#define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) 288#define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b))
277 289
278static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) 290static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2)
@@ -328,16 +340,27 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig
328 return orig; 340 return orig;
329} 341}
330 342
343#if BITS_PER_LONG < 64
344#define MAP_FF_LIMIT 4
345#else
346#define MAP_FF_LIMIT 8
347#endif
348
331static inline map_word map_word_ff(struct map_info *map) 349static inline map_word map_word_ff(struct map_info *map)
332{ 350{
333 map_word r; 351 map_word r;
334 int i; 352 int i;
335 353
336 for (i=0; i<map_words(map); i++) { 354 if (map_bankwidth(map) < MAP_FF_LIMIT) {
337 r.x[i] = ~0UL; 355 int bw = 8 * map_bankwidth(map);
356 r.x[0] = (1 << bw) - 1;
357 } else {
358 for (i=0; i<map_words(map); i++)
359 r.x[i] = ~0UL;
338 } 360 }
339 return r; 361 return r;
340} 362}
363
341static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) 364static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
342{ 365{
343 map_word r; 366 map_word r;
@@ -405,7 +428,7 @@ extern void simple_map_init(struct map_info *);
405 428
406 429
407#define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) 430#define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth))
408#define map_is_linear(map) (1) 431#define map_is_linear(map) ({ (void)(map); 1; })
409 432
410#endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */ 433#endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */
411 434
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index b3d134392b31..c50c3f3927d9 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: mtd.h,v 1.56 2004/08/09 18:46:04 dmarlin Exp $ 2 * $Id: mtd.h,v 1.59 2005/04/11 10:19:02 gleixner Exp $
3 * 3 *
4 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 4 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al.
5 * 5 *
@@ -18,6 +18,7 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/uio.h> 20#include <linux/uio.h>
21#include <linux/notifier.h>
21 22
22#include <linux/mtd/compatmac.h> 23#include <linux/mtd/compatmac.h>
23#include <mtd/mtd-abi.h> 24#include <mtd/mtd-abi.h>
@@ -69,7 +70,6 @@ struct mtd_info {
69 70
70 u_int32_t oobblock; // Size of OOB blocks (e.g. 512) 71 u_int32_t oobblock; // Size of OOB blocks (e.g. 512)
71 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) 72 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16)
72 u_int32_t oobavail; // Number of bytes in OOB area available for fs
73 u_int32_t ecctype; 73 u_int32_t ecctype;
74 u_int32_t eccsize; 74 u_int32_t eccsize;
75 75
@@ -80,6 +80,7 @@ struct mtd_info {
80 80
81 // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) 81 // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO)
82 struct nand_oobinfo oobinfo; 82 struct nand_oobinfo oobinfo;
83 u_int32_t oobavail; // Number of bytes in OOB area available for fs
83 84
84 /* Data for variable erase regions. If numeraseregions is zero, 85 /* Data for variable erase regions. If numeraseregions is zero,
85 * it means that the whole device has erasesize as given above. 86 * it means that the whole device has erasesize as given above.
@@ -113,12 +114,12 @@ struct mtd_info {
113 * flash devices. The user data is one time programmable but the 114 * flash devices. The user data is one time programmable but the
114 * factory data is read only. 115 * factory data is read only.
115 */ 116 */
116 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 117 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len);
117
118 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 118 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
119 119 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len);
120 /* This function is not yet implemented */ 120 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
121 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 121 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
122 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len);
122 123
123 /* kvec-based read/write methods. We need these especially for NAND flash, 124 /* kvec-based read/write methods. We need these especially for NAND flash,
124 with its limited number of write cycles per erase. 125 with its limited number of write cycles per erase.
@@ -147,6 +148,8 @@ struct mtd_info {
147 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); 148 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
148 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); 149 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);
149 150
151 struct notifier_block reboot_notifier; /* default mode before reboot */
152
150 void *priv; 153 void *priv;
151 154
152 struct module *owner; 155 struct module *owner;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 9a19c65abd74..9b5b76217584 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -5,7 +5,7 @@
5 * Steven J. Hill <sjhill@realitydiluted.com> 5 * Steven J. Hill <sjhill@realitydiluted.com>
6 * Thomas Gleixner <tglx@linutronix.de> 6 * Thomas Gleixner <tglx@linutronix.de>
7 * 7 *
8 * $Id: nand.h,v 1.68 2004/11/12 10:40:37 gleixner Exp $ 8 * $Id: nand.h,v 1.73 2005/05/31 19:39:17 gleixner Exp $
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -48,6 +48,10 @@
48 * 02-08-2004 tglx added option field to nand structure for chip anomalities 48 * 02-08-2004 tglx added option field to nand structure for chip anomalities
49 * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id 49 * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id
50 * update of nand_chip structure description 50 * update of nand_chip structure description
51 * 01-17-2005 dmarlin added extended commands for AG-AND device and added option
52 * for BBT_AUTO_REFRESH.
53 * 01-20-2005 dmarlin added optional pointer to hardware specific callback for
54 * extra error status checks.
51 */ 55 */
52#ifndef __LINUX_MTD_NAND_H 56#ifndef __LINUX_MTD_NAND_H
53#define __LINUX_MTD_NAND_H 57#define __LINUX_MTD_NAND_H
@@ -115,6 +119,25 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
115#define NAND_CMD_READSTART 0x30 119#define NAND_CMD_READSTART 0x30
116#define NAND_CMD_CACHEDPROG 0x15 120#define NAND_CMD_CACHEDPROG 0x15
117 121
122/* Extended commands for AG-AND device */
123/*
124 * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but
125 * there is no way to distinguish that from NAND_CMD_READ0
126 * until the remaining sequence of commands has been completed
127 * so add a high order bit and mask it off in the command.
128 */
129#define NAND_CMD_DEPLETE1 0x100
130#define NAND_CMD_DEPLETE2 0x38
131#define NAND_CMD_STATUS_MULTI 0x71
132#define NAND_CMD_STATUS_ERROR 0x72
133/* multi-bank error status (banks 0-3) */
134#define NAND_CMD_STATUS_ERROR0 0x73
135#define NAND_CMD_STATUS_ERROR1 0x74
136#define NAND_CMD_STATUS_ERROR2 0x75
137#define NAND_CMD_STATUS_ERROR3 0x76
138#define NAND_CMD_STATUS_RESET 0x7f
139#define NAND_CMD_STATUS_CLEAR 0xff
140
118/* Status bits */ 141/* Status bits */
119#define NAND_STATUS_FAIL 0x01 142#define NAND_STATUS_FAIL 0x01
120#define NAND_STATUS_FAIL_N1 0x02 143#define NAND_STATUS_FAIL_N1 0x02
@@ -143,7 +166,7 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
143 166
144/* 167/*
145 * Constants for Hardware ECC 168 * Constants for Hardware ECC
146*/ 169 */
147/* Reset Hardware ECC for read */ 170/* Reset Hardware ECC for read */
148#define NAND_ECC_READ 0 171#define NAND_ECC_READ 0
149/* Reset Hardware ECC for write */ 172/* Reset Hardware ECC for write */
@@ -151,6 +174,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
151/* Enable Hardware ECC before syndrom is read back from flash */ 174/* Enable Hardware ECC before syndrom is read back from flash */
152#define NAND_ECC_READSYN 2 175#define NAND_ECC_READSYN 2
153 176
177/* Bit mask for flags passed to do_nand_read_ecc */
178#define NAND_GET_DEVICE 0x80
179
180
154/* Option constants for bizarre disfunctionality and real 181/* Option constants for bizarre disfunctionality and real
155* features 182* features
156*/ 183*/
@@ -170,6 +197,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
170/* Chip has a array of 4 pages which can be read without 197/* Chip has a array of 4 pages which can be read without
171 * additional ready /busy waits */ 198 * additional ready /busy waits */
172#define NAND_4PAGE_ARRAY 0x00000040 199#define NAND_4PAGE_ARRAY 0x00000040
200/* Chip requires that BBT is periodically rewritten to prevent
201 * bits from adjacent blocks from 'leaking' in altering data.
202 * This happens with the Renesas AG-AND chips, possibly others. */
203#define BBT_AUTO_REFRESH 0x00000080
173 204
174/* Options valid for Samsung large page devices */ 205/* Options valid for Samsung large page devices */
175#define NAND_SAMSUNG_LP_OPTIONS \ 206#define NAND_SAMSUNG_LP_OPTIONS \
@@ -192,7 +223,8 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_
192 * This can only work if we have the ecc bytes directly behind the 223 * This can only work if we have the ecc bytes directly behind the
193 * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ 224 * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */
194#define NAND_HWECC_SYNDROME 0x00020000 225#define NAND_HWECC_SYNDROME 0x00020000
195 226/* This option skips the bbt scan during initialization. */
227#define NAND_SKIP_BBTSCAN 0x00040000
196 228
197/* Options set by nand scan */ 229/* Options set by nand scan */
198/* Nand scan has allocated oob_buf */ 230/* Nand scan has allocated oob_buf */
@@ -221,10 +253,13 @@ struct nand_chip;
221 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices 253 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices
222 * @lock: protection lock 254 * @lock: protection lock
223 * @active: the mtd device which holds the controller currently 255 * @active: the mtd device which holds the controller currently
256 * @wq: wait queue to sleep on if a NAND operation is in progress
257 * used instead of the per chip wait queue when a hw controller is available
224 */ 258 */
225struct nand_hw_control { 259struct nand_hw_control {
226 spinlock_t lock; 260 spinlock_t lock;
227 struct nand_chip *active; 261 struct nand_chip *active;
262 wait_queue_head_t wq;
228}; 263};
229 264
230/** 265/**
@@ -283,6 +318,8 @@ struct nand_hw_control {
283 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan 318 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan
284 * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices 319 * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices
285 * @priv: [OPTIONAL] pointer to private chip date 320 * @priv: [OPTIONAL] pointer to private chip date
321 * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks
322 * (determine if errors are correctable)
286 */ 323 */
287 324
288struct nand_chip { 325struct nand_chip {
@@ -338,6 +375,7 @@ struct nand_chip {
338 struct nand_bbt_descr *badblock_pattern; 375 struct nand_bbt_descr *badblock_pattern;
339 struct nand_hw_control *controller; 376 struct nand_hw_control *controller;
340 void *priv; 377 void *priv;
378 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);
341}; 379};
342 380
343/* 381/*
@@ -349,6 +387,7 @@ struct nand_chip {
349#define NAND_MFR_NATIONAL 0x8f 387#define NAND_MFR_NATIONAL 0x8f
350#define NAND_MFR_RENESAS 0x07 388#define NAND_MFR_RENESAS 0x07
351#define NAND_MFR_STMICRO 0x20 389#define NAND_MFR_STMICRO 0x20
390#define NAND_MFR_HYNIX 0xad
352 391
353/** 392/**
354 * struct nand_flash_dev - NAND Flash Device ID Structure 393 * struct nand_flash_dev - NAND Flash Device ID Structure
@@ -459,6 +498,9 @@ extern int nand_update_bbt (struct mtd_info *mtd, loff_t offs);
459extern int nand_default_bbt (struct mtd_info *mtd); 498extern int nand_default_bbt (struct mtd_info *mtd);
460extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); 499extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt);
461extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); 500extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt);
501extern int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
502 size_t * retlen, u_char * buf, u_char * oob_buf,
503 struct nand_oobinfo *oobsel, int flags);
462 504
463/* 505/*
464* Constants for oob configuration 506* Constants for oob configuration
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h
new file mode 100644
index 000000000000..2332eda07e0e
--- /dev/null
+++ b/include/linux/mtd/plat-ram.h
@@ -0,0 +1,35 @@
1/* linux/include/mtd/plat-ram.h
2 *
3 * (c) 2004 Simtec Electronics
4 * http://www.simtec.co.uk/products/SWLINUX/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Generic platform device based RAM map
8 *
9 * $Id: plat-ram.h,v 1.2 2005/01/24 00:37:40 bjd Exp $
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 */
16
17#ifndef __LINUX_MTD_PLATRAM_H
18#define __LINUX_MTD_PLATRAM_H __FILE__
19
20#define PLATRAM_RO (0)
21#define PLATRAM_RW (1)
22
23struct platdata_mtd_ram {
24 char *mapname;
25 char **probes;
26 struct mtd_partition *partitions;
27 int nr_partitions;
28 int bankwidth;
29
30 /* control callbacks */
31
32 void (*set_rw)(struct device *dev, int to);
33};
34
35#endif /* __LINUX_MTD_PLATRAM_H */
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h
index fc071125cbcc..7b7deef6b180 100644
--- a/include/linux/mtd/xip.h
+++ b/include/linux/mtd/xip.h
@@ -58,22 +58,16 @@
58 * returned value is <= the real elapsed time. 58 * returned value is <= the real elapsed time.
59 * note 2: this should be able to cope with a few seconds without 59 * note 2: this should be able to cope with a few seconds without
60 * overflowing. 60 * overflowing.
61 *
62 * xip_iprefetch()
63 *
64 * Macro to fill instruction prefetch
65 * e.g. a series of nops: asm volatile (".rep 8; nop; .endr");
61 */ 66 */
62 67
63#if defined(CONFIG_ARCH_SA1100) || defined(CONFIG_ARCH_PXA) 68#include <asm/mtd-xip.h>
64
65#include <asm/hardware.h>
66#ifdef CONFIG_ARCH_PXA
67#include <asm/arch/pxa-regs.h>
68#endif
69
70#define xip_irqpending() (ICIP & ICMR)
71
72/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
73#define xip_currtime() (OSCR)
74#define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4)
75 69
76#else 70#ifndef xip_irqpending
77 71
78#warning "missing IRQ and timer primitives for XIP MTD support" 72#warning "missing IRQ and timer primitives for XIP MTD support"
79#warning "some of the XIP MTD support code will be disabled" 73#warning "some of the XIP MTD support code will be disabled"
@@ -85,16 +79,17 @@
85 79
86#endif 80#endif
87 81
82#ifndef xip_iprefetch
83#define xip_iprefetch() do { } while (0)
84#endif
85
88/* 86/*
89 * xip_cpu_idle() is used when waiting for a delay equal or larger than 87 * xip_cpu_idle() is used when waiting for a delay equal or larger than
90 * the system timer tick period. This should put the CPU into idle mode 88 * the system timer tick period. This should put the CPU into idle mode
91 * to save power and to be woken up only when some interrupts are pending. 89 * to save power and to be woken up only when some interrupts are pending.
92 * As above, this should not rely upon standard kernel code. 90 * This should not rely upon standard kernel code.
93 */ 91 */
94 92#ifndef xip_cpu_idle
95#if defined(CONFIG_CPU_XSCALE)
96#define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
97#else
98#define xip_cpu_idle() do { } while (0) 93#define xip_cpu_idle() do { } while (0)
99#endif 94#endif
100 95
diff --git a/include/linux/namespace.h b/include/linux/namespace.h
index 9eca1558d72f..0e5a86f13b2f 100644
--- a/include/linux/namespace.h
+++ b/include/linux/namespace.h
@@ -12,13 +12,13 @@ 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
19static inline void put_namespace(struct namespace *namespace) 18static inline void put_namespace(struct namespace *namespace)
20{ 19{
21 if (atomic_dec_and_test(&namespace->count)) 20 if (atomic_dec_and_lock(&namespace->count, &vfsmount_lock))
21 /* releases vfsmount_lock */
22 __put_namespace(namespace); 22 __put_namespace(namespace);
23} 23}
24 24
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/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 3781192ce159..08fe5f7d14a0 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -197,6 +197,9 @@ struct ip_conntrack_expect
197 /* Timer function; deletes the expectation. */ 197 /* Timer function; deletes the expectation. */
198 struct timer_list timeout; 198 struct timer_list timeout;
199 199
200 /* Usage count. */
201 atomic_t use;
202
200#ifdef CONFIG_IP_NF_NAT_NEEDED 203#ifdef CONFIG_IP_NF_NAT_NEEDED
201 /* This is the original per-proto part, used to map the 204 /* This is the original per-proto part, used to map the
202 * expected connection the way the recipient expects. */ 205 * expected connection the way the recipient expects. */
@@ -236,7 +239,7 @@ ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo)
236} 239}
237 240
238/* decrement reference count on a conntrack */ 241/* decrement reference count on a conntrack */
239extern inline void ip_conntrack_put(struct ip_conntrack *ct); 242extern void ip_conntrack_put(struct ip_conntrack *ct);
240 243
241/* call to create an explicit dependency on ip_conntrack. */ 244/* call to create an explicit dependency on ip_conntrack. */
242extern void need_ip_conntrack(void); 245extern void need_ip_conntrack(void);
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
index b1bbba0a12cb..3692daa93dec 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
@@ -30,9 +30,10 @@ extern int ip_conntrack_helper_register(struct ip_conntrack_helper *);
30extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *); 30extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *);
31 31
32/* Allocate space for an expectation: this is mandatory before calling 32/* Allocate space for an expectation: this is mandatory before calling
33 ip_conntrack_expect_related. */ 33 ip_conntrack_expect_related. You will have to call put afterwards. */
34extern struct ip_conntrack_expect *ip_conntrack_expect_alloc(void); 34extern struct ip_conntrack_expect *
35extern void ip_conntrack_expect_free(struct ip_conntrack_expect *exp); 35ip_conntrack_expect_alloc(struct ip_conntrack *master);
36extern void ip_conntrack_expect_put(struct ip_conntrack_expect *exp);
36 37
37/* Add an expected connection: can have more than one per connection */ 38/* Add an expected connection: can have more than one per connection */
38extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp); 39extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp);
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/netlink.h b/include/linux/netlink.h
index 3029cad63a01..6552b71bfa73 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -5,21 +5,20 @@
5#include <linux/types.h> 5#include <linux/types.h>
6 6
7#define NETLINK_ROUTE 0 /* Routing/device hook */ 7#define NETLINK_ROUTE 0 /* Routing/device hook */
8#define NETLINK_SKIP 1 /* Reserved for ENskip */ 8#define NETLINK_W1 1 /* 1-wire subsystem */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Firewalling hook */
11#define NETLINK_TCPDIAG 4 /* TCP socket monitoring */ 11#define NETLINK_TCPDIAG 4 /* TCP socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
14#define NETLINK_SELINUX 7 /* SELinux event notifications */ 14#define NETLINK_SELINUX 7 /* SELinux event notifications */
15#define NETLINK_ARPD 8 15#define NETLINK_ISCSI 8 /* Open-iSCSI */
16#define NETLINK_AUDIT 9 /* auditing */ 16#define NETLINK_AUDIT 9 /* auditing */
17#define NETLINK_FIB_LOOKUP 10 17#define NETLINK_FIB_LOOKUP 10
18#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ 18#define NETLINK_NETFILTER 12 /* netfilter subsystem */
19#define NETLINK_IP6_FW 13 19#define NETLINK_IP6_FW 13
20#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ 20#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
21#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ 21#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
22#define NETLINK_TAPBASE 16 /* 16 to 31 are ethertap */
23 22
24#define MAX_LINKS 32 23#define MAX_LINKS 32
25 24
@@ -168,6 +167,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
168 nlh->nlmsg_flags = flags; 167 nlh->nlmsg_flags = flags;
169 nlh->nlmsg_pid = pid; 168 nlh->nlmsg_pid = pid;
170 nlh->nlmsg_seq = seq; 169 nlh->nlmsg_seq = seq;
170 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
171 return nlh; 171 return nlh;
172} 172}
173 173
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index c0d8b90c5202..5ade54a78dbb 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/netdevice.h> 10#include <linux/netdevice.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/rcupdate.h>
12#include <linux/list.h> 13#include <linux/list.h>
13 14
14struct netpoll; 15struct netpoll;
@@ -16,14 +17,20 @@ struct netpoll;
16struct netpoll { 17struct netpoll {
17 struct net_device *dev; 18 struct net_device *dev;
18 char dev_name[16], *name; 19 char dev_name[16], *name;
19 int rx_flags;
20 void (*rx_hook)(struct netpoll *, int, char *, int); 20 void (*rx_hook)(struct netpoll *, int, char *, int);
21 void (*drop)(struct sk_buff *skb); 21 void (*drop)(struct sk_buff *skb);
22 u32 local_ip, remote_ip; 22 u32 local_ip, remote_ip;
23 u16 local_port, remote_port; 23 u16 local_port, remote_port;
24 unsigned char local_mac[6], remote_mac[6]; 24 unsigned char local_mac[6], remote_mac[6];
25};
26
27struct netpoll_info {
25 spinlock_t poll_lock; 28 spinlock_t poll_lock;
26 int poll_owner; 29 int poll_owner;
30 int tries;
31 int rx_flags;
32 spinlock_t rx_lock;
33 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
27}; 34};
28 35
29void netpoll_poll(struct netpoll *np); 36void netpoll_poll(struct netpoll *np);
@@ -39,28 +46,47 @@ void netpoll_queue(struct sk_buff *skb);
39#ifdef CONFIG_NETPOLL 46#ifdef CONFIG_NETPOLL
40static inline int netpoll_rx(struct sk_buff *skb) 47static inline int netpoll_rx(struct sk_buff *skb)
41{ 48{
42 return skb->dev->np && skb->dev->np->rx_flags && __netpoll_rx(skb); 49 struct netpoll_info *npinfo = skb->dev->npinfo;
50 unsigned long flags;
51 int ret = 0;
52
53 if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags))
54 return 0;
55
56 spin_lock_irqsave(&npinfo->rx_lock, flags);
57 /* check rx_flags again with the lock held */
58 if (npinfo->rx_flags && __netpoll_rx(skb))
59 ret = 1;
60 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
61
62 return ret;
43} 63}
44 64
45static inline void netpoll_poll_lock(struct net_device *dev) 65static inline void *netpoll_poll_lock(struct net_device *dev)
46{ 66{
47 if (dev->np) { 67 rcu_read_lock(); /* deal with race on ->npinfo */
48 spin_lock(&dev->np->poll_lock); 68 if (dev->npinfo) {
49 dev->np->poll_owner = smp_processor_id(); 69 spin_lock(&dev->npinfo->poll_lock);
70 dev->npinfo->poll_owner = smp_processor_id();
71 return dev->npinfo;
50 } 72 }
73 return NULL;
51} 74}
52 75
53static inline void netpoll_poll_unlock(struct net_device *dev) 76static inline void netpoll_poll_unlock(void *have)
54{ 77{
55 if (dev->np) { 78 struct netpoll_info *npi = have;
56 spin_unlock(&dev->np->poll_lock); 79
57 dev->np->poll_owner = -1; 80 if (npi) {
81 npi->poll_owner = -1;
82 spin_unlock(&npi->poll_lock);
58 } 83 }
84 rcu_read_unlock();
59} 85}
60 86
61#else 87#else
62#define netpoll_rx(a) 0 88#define netpoll_rx(a) 0
63#define netpoll_poll_lock(a) 89#define netpoll_poll_lock(a) 0
64#define netpoll_poll_unlock(a) 90#define netpoll_poll_unlock(a)
65#endif 91#endif
66 92
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..9a6047ff1b25 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 */
@@ -121,7 +112,8 @@ struct nfs_inode {
121 /* 112 /*
122 * Various flags 113 * Various flags
123 */ 114 */
124 unsigned int flags; 115 unsigned long flags; /* atomic bit ops */
116 unsigned long cache_validity; /* bit mask */
125 117
126 /* 118 /*
127 * read_cache_jiffies is when we started read-caching this inode, 119 * read_cache_jiffies is when we started read-caching this inode,
@@ -140,7 +132,6 @@ struct nfs_inode {
140 * 132 *
141 * mtime != read_cache_mtime 133 * mtime != read_cache_mtime
142 */ 134 */
143 unsigned long readdir_timestamp;
144 unsigned long read_cache_jiffies; 135 unsigned long read_cache_jiffies;
145 unsigned long attrtimeo; 136 unsigned long attrtimeo;
146 unsigned long attrtimeo_timestamp; 137 unsigned long attrtimeo_timestamp;
@@ -158,6 +149,10 @@ struct nfs_inode {
158 atomic_t data_updates; 149 atomic_t data_updates;
159 150
160 struct nfs_access_entry cache_access; 151 struct nfs_access_entry cache_access;
152#ifdef CONFIG_NFS_V3_ACL
153 struct posix_acl *acl_access;
154 struct posix_acl *acl_default;
155#endif
161 156
162 /* 157 /*
163 * This is the cookie verifier used for NFSv3 readdir 158 * This is the cookie verifier used for NFSv3 readdir
@@ -180,29 +175,33 @@ struct nfs_inode {
180 /* Open contexts for shared mmap writes */ 175 /* Open contexts for shared mmap writes */
181 struct list_head open_files; 176 struct list_head open_files;
182 177
183 wait_queue_head_t nfs_i_wait;
184
185#ifdef CONFIG_NFS_V4 178#ifdef CONFIG_NFS_V4
179 struct nfs4_cached_acl *nfs4_acl;
186 /* NFSv4 state */ 180 /* NFSv4 state */
187 struct list_head open_states; 181 struct list_head open_states;
188 struct nfs_delegation *delegation; 182 struct nfs_delegation *delegation;
189 int delegation_state; 183 int delegation_state;
190 struct rw_semaphore rwsem; 184 struct rw_semaphore rwsem;
191#endif /* CONFIG_NFS_V4*/ 185#endif /* CONFIG_NFS_V4*/
192
193 struct inode vfs_inode; 186 struct inode vfs_inode;
194}; 187};
195 188
196/* 189/*
197 * Legal inode flag values 190 * Cache validity bit flags
191 */
192#define NFS_INO_INVALID_ATTR 0x0001 /* cached attrs are invalid */
193#define NFS_INO_INVALID_DATA 0x0002 /* cached data is invalid */
194#define NFS_INO_INVALID_ATIME 0x0004 /* cached atime is invalid */
195#define NFS_INO_INVALID_ACCESS 0x0008 /* cached access cred invalid */
196#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */
197#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */
198
199/*
200 * Bit offsets in flags field
198 */ 201 */
199#define NFS_INO_STALE 0x0001 /* possible stale inode */ 202#define NFS_INO_REVALIDATING (0) /* revalidating attrs */
200#define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */ 203#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */
201#define NFS_INO_REVALIDATING 0x0004 /* revalidating attrs */ 204#define NFS_INO_STALE (2) /* possible stale inode */
202#define NFS_INO_INVALID_ATTR 0x0008 /* cached attrs are invalid */
203#define NFS_INO_INVALID_DATA 0x0010 /* cached data is invalid */
204#define NFS_INO_INVALID_ATIME 0x0020 /* cached atime is invalid */
205#define NFS_INO_INVALID_ACCESS 0x0040 /* cached access cred invalid */
206 205
207static inline struct nfs_inode *NFS_I(struct inode *inode) 206static inline struct nfs_inode *NFS_I(struct inode *inode)
208{ 207{
@@ -228,8 +227,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
228#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp) 227#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp)
229 228
230#define NFS_FLAGS(inode) (NFS_I(inode)->flags) 229#define NFS_FLAGS(inode) (NFS_I(inode)->flags)
231#define NFS_REVALIDATING(inode) (NFS_FLAGS(inode) & NFS_INO_REVALIDATING) 230#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode)))
232#define NFS_STALE(inode) (NFS_FLAGS(inode) & NFS_INO_STALE)
233 231
234#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 232#define NFS_FILEID(inode) (NFS_I(inode)->fileid)
235 233
@@ -240,8 +238,11 @@ static inline int nfs_caches_unstable(struct inode *inode)
240 238
241static inline void NFS_CACHEINV(struct inode *inode) 239static inline void NFS_CACHEINV(struct inode *inode)
242{ 240{
243 if (!nfs_caches_unstable(inode)) 241 if (!nfs_caches_unstable(inode)) {
244 NFS_FLAGS(inode) |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; 242 spin_lock(&inode->i_lock);
243 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS;
244 spin_unlock(&inode->i_lock);
245 }
245} 246}
246 247
247static inline int nfs_server_capable(struct inode *inode, int cap) 248static inline int nfs_server_capable(struct inode *inode, int cap)
@@ -251,7 +252,7 @@ static inline int nfs_server_capable(struct inode *inode, int cap)
251 252
252static inline int NFS_USE_READDIRPLUS(struct inode *inode) 253static inline int NFS_USE_READDIRPLUS(struct inode *inode)
253{ 254{
254 return NFS_FLAGS(inode) & NFS_INO_ADVISE_RDPLUS; 255 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode));
255} 256}
256 257
257/** 258/**
@@ -294,12 +295,13 @@ extern int nfs_release(struct inode *, struct file *);
294extern int nfs_attribute_timeout(struct inode *inode); 295extern int nfs_attribute_timeout(struct inode *inode);
295extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 296extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
296extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 297extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
298extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
297extern int nfs_setattr(struct dentry *, struct iattr *); 299extern int nfs_setattr(struct dentry *, struct iattr *);
300extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
298extern void nfs_begin_attr_update(struct inode *); 301extern void nfs_begin_attr_update(struct inode *);
299extern void nfs_end_attr_update(struct inode *); 302extern void nfs_end_attr_update(struct inode *);
300extern void nfs_begin_data_update(struct inode *); 303extern void nfs_begin_data_update(struct inode *);
301extern void nfs_end_data_update(struct inode *); 304extern 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); 305extern 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); 306extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
305extern void put_nfs_open_context(struct nfs_open_context *ctx); 307extern void put_nfs_open_context(struct nfs_open_context *ctx);
@@ -314,6 +316,9 @@ extern u32 root_nfs_parse_addr(char *name); /*__init*/
314 * linux/fs/nfs/file.c 316 * linux/fs/nfs/file.c
315 */ 317 */
316extern struct inode_operations nfs_file_inode_operations; 318extern struct inode_operations nfs_file_inode_operations;
319#ifdef CONFIG_NFS_V3
320extern struct inode_operations nfs3_file_inode_operations;
321#endif /* CONFIG_NFS_V3 */
317extern struct file_operations nfs_file_operations; 322extern struct file_operations nfs_file_operations;
318extern struct address_space_operations nfs_file_aops; 323extern struct address_space_operations nfs_file_aops;
319 324
@@ -329,6 +334,22 @@ static inline struct rpc_cred *nfs_file_cred(struct file *file)
329} 334}
330 335
331/* 336/*
337 * linux/fs/nfs/xattr.c
338 */
339#ifdef CONFIG_NFS_V3_ACL
340extern ssize_t nfs3_listxattr(struct dentry *, char *, size_t);
341extern ssize_t nfs3_getxattr(struct dentry *, const char *, void *, size_t);
342extern int nfs3_setxattr(struct dentry *, const char *,
343 const void *, size_t, int);
344extern int nfs3_removexattr (struct dentry *, const char *name);
345#else
346# define nfs3_listxattr NULL
347# define nfs3_getxattr NULL
348# define nfs3_setxattr NULL
349# define nfs3_removexattr NULL
350#endif
351
352/*
332 * linux/fs/nfs/direct.c 353 * linux/fs/nfs/direct.c
333 */ 354 */
334extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, 355extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t,
@@ -342,6 +363,9 @@ extern ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf,
342 * linux/fs/nfs/dir.c 363 * linux/fs/nfs/dir.c
343 */ 364 */
344extern struct inode_operations nfs_dir_inode_operations; 365extern struct inode_operations nfs_dir_inode_operations;
366#ifdef CONFIG_NFS_V3
367extern struct inode_operations nfs3_dir_inode_operations;
368#endif /* CONFIG_NFS_V3 */
345extern struct file_operations nfs_dir_operations; 369extern struct file_operations nfs_dir_operations;
346extern struct dentry_operations nfs_dentry_operations; 370extern struct dentry_operations nfs_dentry_operations;
347 371
@@ -377,10 +401,10 @@ extern void nfs_commit_done(struct rpc_task *);
377 */ 401 */
378extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); 402extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int);
379#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 403#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
380extern int nfs_commit_inode(struct inode *, unsigned long, unsigned int, int); 404extern int nfs_commit_inode(struct inode *, int);
381#else 405#else
382static inline int 406static inline int
383nfs_commit_inode(struct inode *inode, unsigned long idx_start, unsigned int npages, int how) 407nfs_commit_inode(struct inode *inode, int how)
384{ 408{
385 return 0; 409 return 0;
386} 410}
@@ -434,11 +458,6 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
434 mempool_free(p, nfs_wdata_mempool); 458 mempool_free(p, nfs_wdata_mempool);
435} 459}
436 460
437/* Hack for future NFS swap support */
438#ifndef IS_SWAPFILE
439# define IS_SWAPFILE(inode) (0)
440#endif
441
442/* 461/*
443 * linux/fs/nfs/read.c 462 * linux/fs/nfs/read.c
444 */ 463 */
@@ -468,6 +487,29 @@ static inline void nfs_readdata_free(struct nfs_read_data *p)
468extern void nfs_readdata_release(struct rpc_task *task); 487extern void nfs_readdata_release(struct rpc_task *task);
469 488
470/* 489/*
490 * linux/fs/nfs3proc.c
491 */
492#ifdef CONFIG_NFS_V3_ACL
493extern struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type);
494extern int nfs3_proc_setacl(struct inode *inode, int type,
495 struct posix_acl *acl);
496extern int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode,
497 mode_t mode);
498extern void nfs3_forget_cached_acls(struct inode *inode);
499#else
500static inline int nfs3_proc_set_default_acl(struct inode *dir,
501 struct inode *inode,
502 mode_t mode)
503{
504 return 0;
505}
506
507static inline void nfs3_forget_cached_acls(struct inode *inode)
508{
509}
510#endif /* CONFIG_NFS_V3_ACL */
511
512/*
471 * linux/fs/mount_clnt.c 513 * linux/fs/mount_clnt.c
472 * (Used only by nfsroot module) 514 * (Used only by nfsroot module)
473 */ 515 */
@@ -515,230 +557,6 @@ extern void * nfs_root_data(void);
515 557
516#define NFS_JUKEBOX_RETRY_TIME (5 * HZ) 558#define NFS_JUKEBOX_RETRY_TIME (5 * HZ)
517 559
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__ */ 560#endif /* __KERNEL__ */
743 561
744/* 562/*
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..6d5a24f3fc6d 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>
@@ -123,21 +124,41 @@ int nfsd_statfs(struct svc_rqst *, struct svc_fh *,
123 124
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);
127void nfsd_sync_dir(struct dentry *dp);
128
129#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
130#ifdef CONFIG_NFSD_V2_ACL
131extern struct svc_version nfsd_acl_version2;
132#else
133#define nfsd_acl_version2 NULL
134#endif
135#ifdef CONFIG_NFSD_V3_ACL
136extern struct svc_version nfsd_acl_version3;
137#else
138#define nfsd_acl_version3 NULL
139#endif
140struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int);
141int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *);
142#endif
126 143
127 144
128/* 145/*
129 * NFSv4 State 146 * NFSv4 State
130 */ 147 */
131#ifdef CONFIG_NFSD_V4 148#ifdef CONFIG_NFSD_V4
132int nfs4_state_init(void); 149void nfs4_state_init(void);
150int nfs4_state_start(void);
133void nfs4_state_shutdown(void); 151void nfs4_state_shutdown(void);
134time_t nfs4_lease_time(void); 152time_t nfs4_lease_time(void);
135void nfs4_reset_lease(time_t leasetime); 153void nfs4_reset_lease(time_t leasetime);
154int nfs4_reset_recoverydir(char *recdir);
136#else 155#else
137static inline int nfs4_state_init(void){return 0;} 156static inline void nfs4_state_init(void){};
157static inline int nfs4_state_start(void){return 0;}
138static inline void nfs4_state_shutdown(void){} 158static inline void nfs4_state_shutdown(void){}
139static inline time_t nfs4_lease_time(void){return 0;} 159static inline time_t nfs4_lease_time(void){return 0;}
140static inline void nfs4_reset_lease(time_t leasetime){} 160static inline void nfs4_reset_lease(time_t leasetime){}
161static inline int nfs4_reset_recoverydir(char *recdir) {return 0;}
141#endif 162#endif
142 163
143/* 164/*
@@ -210,6 +231,7 @@ void nfsd_lockd_shutdown(void);
210#define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD) 231#define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD)
211#define nfserr_badname __constant_htonl(NFSERR_BADNAME) 232#define nfserr_badname __constant_htonl(NFSERR_BADNAME)
212#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) 233#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN)
234#define nfserr_locked __constant_htonl(NFSERR_LOCKED)
213 235
214/* error codes for internal use */ 236/* error codes for internal use */
215/* if a request fails due to kmalloc failure, it gets dropped. 237/* if a request fails due to kmalloc failure, it gets dropped.
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index b6b2fe1e7c63..8bf23cf8b603 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,15 +195,17 @@ 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 */
206 u32 so_id; 204 u32 so_id;
207 struct nfs4_client * so_client; 205 struct nfs4_client * so_client;
208 u32 so_seqid; 206 /* after increment in ENCODE_SEQID_OP_TAIL, represents the next
207 * sequence id expected from the client: */
208 u32 so_seqid;
209 struct xdr_netobj so_owner; /* open owner name */ 209 struct xdr_netobj so_owner; /* open owner name */
210 int so_confirmed; /* successful OPEN_CONFIRM? */ 210 int so_confirmed; /* successful OPEN_CONFIRM? */
211 struct nfs4_replay so_replay; 211 struct nfs4_replay so_replay;
@@ -217,9 +217,10 @@ struct nfs4_stateowner {
217* share_acces, share_deny on the file. 217* share_acces, share_deny on the file.
218*/ 218*/
219struct nfs4_file { 219struct nfs4_file {
220 struct kref fi_ref;
220 struct list_head fi_hash; /* hash by "struct inode *" */ 221 struct list_head fi_hash; /* hash by "struct inode *" */
221 struct list_head fi_perfile; /* list: nfs4_stateid */ 222 struct list_head fi_stateids;
222 struct list_head fi_del_perfile; /* list: nfs4_delegation */ 223 struct list_head fi_delegations;
223 struct inode *fi_inode; 224 struct inode *fi_inode;
224 u32 fi_id; /* used with stateowner->so_id 225 u32 fi_id; /* used with stateowner->so_id
225 * for stateid_hashtbl hash */ 226 * for stateid_hashtbl hash */
@@ -236,19 +237,24 @@ struct nfs4_file {
236* st_perlockowner: (open stateid) list of lock nfs4_stateowners 237* st_perlockowner: (open stateid) list of lock nfs4_stateowners
237* st_access_bmap: used only for open stateid 238* st_access_bmap: used only for open stateid
238* st_deny_bmap: used only for open stateid 239* st_deny_bmap: used only for open stateid
240* st_openstp: open stateid lock stateid was derived from
241*
242* XXX: open stateids and lock stateids have diverged sufficiently that
243* we should consider defining separate structs for the two cases.
239*/ 244*/
240 245
241struct nfs4_stateid { 246struct nfs4_stateid {
242 struct list_head st_hash; 247 struct list_head st_hash;
243 struct list_head st_perfile; 248 struct list_head st_perfile;
244 struct list_head st_perfilestate; 249 struct list_head st_perstateowner;
245 struct list_head st_perlockowner; 250 struct list_head st_lockowners;
246 struct nfs4_stateowner * st_stateowner; 251 struct nfs4_stateowner * st_stateowner;
247 struct nfs4_file * st_file; 252 struct nfs4_file * st_file;
248 stateid_t st_stateid; 253 stateid_t st_stateid;
249 struct file * st_vfs_file; 254 struct file * st_vfs_file;
250 unsigned long st_access_bmap; 255 unsigned long st_access_bmap;
251 unsigned long st_deny_bmap; 256 unsigned long st_deny_bmap;
257 struct nfs4_stateid * st_openstp;
252}; 258};
253 259
254/* flags for preprocess_seqid_op() */ 260/* flags for preprocess_seqid_op() */
@@ -267,12 +273,9 @@ struct nfs4_stateid {
267 ((err) != nfserr_stale_stateid) && \ 273 ((err) != nfserr_stale_stateid) && \
268 ((err) != nfserr_bad_stateid)) 274 ((err) != nfserr_bad_stateid))
269 275
270extern time_t nfs4_laundromat(void);
271extern int nfsd4_renew(clientid_t *clid); 276extern int nfsd4_renew(clientid_t *clid);
272extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, 277extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh,
273 stateid_t *stateid, int flags, struct file **filp); 278 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); 279extern void nfs4_lock_state(void);
277extern void nfs4_unlock_state(void); 280extern void nfs4_unlock_state(void);
278extern int nfs4_in_grace(void); 281extern int nfs4_in_grace(void);
@@ -282,6 +285,15 @@ extern void nfs4_free_stateowner(struct kref *kref);
282extern void nfsd4_probe_callback(struct nfs4_client *clp); 285extern void nfsd4_probe_callback(struct nfs4_client *clp);
283extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 286extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
284extern void nfs4_put_delegation(struct nfs4_delegation *dp); 287extern void nfs4_put_delegation(struct nfs4_delegation *dp);
288extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
289extern void nfsd4_init_recdir(char *recdir_name);
290extern int nfsd4_recdir_load(void);
291extern void nfsd4_shutdown_recdir(void);
292extern int nfs4_client_to_reclaim(const char *name);
293extern int nfs4_has_reclaimed_state(const char *name);
294extern void nfsd4_recdir_purge_old(void);
295extern int nfsd4_create_clid_dir(struct nfs4_client *clp);
296extern void nfsd4_remove_clid_dir(struct nfs4_client *clp);
285 297
286static inline void 298static inline void
287nfs4_put_stateowner(struct nfs4_stateowner *so) 299nfs4_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/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/pci-dynids.h b/include/linux/pci-dynids.h
deleted file mode 100644
index 183b6b0de81c..000000000000
--- a/include/linux/pci-dynids.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * PCI defines and function prototypes
3 * Copyright 2003 Dell Inc.
4 * by Matt Domsch <Matt_Domsch@dell.com>
5 */
6
7#ifndef LINUX_PCI_DYNIDS_H
8#define LINUX_PCI_DYNIDS_H
9
10#include <linux/list.h>
11#include <linux/mod_devicetable.h>
12
13struct dynid {
14 struct list_head node;
15 struct pci_device_id id;
16};
17
18#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index b5238bd18830..bc4c40000c0d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -556,7 +556,8 @@ struct pci_dev {
556 /* keep track of device state */ 556 /* keep track of device state */
557 unsigned int is_enabled:1; /* pci_enable_device has been called */ 557 unsigned int is_enabled:1; /* pci_enable_device has been called */
558 unsigned int is_busmaster:1; /* device is busmaster */ 558 unsigned int is_busmaster:1; /* device is busmaster */
559 559 unsigned int no_msi:1; /* device may not use msi */
560
560 u32 saved_config_space[16]; /* config space saved at suspend time */ 561 u32 saved_config_space[16]; /* config space saved at suspend time */
561 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ 562 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
562 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 563 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
@@ -586,7 +587,7 @@ struct pci_dev {
586#define PCI_NUM_RESOURCES 11 587#define PCI_NUM_RESOURCES 11
587 588
588#ifndef PCI_BUS_NUM_RESOURCES 589#ifndef PCI_BUS_NUM_RESOURCES
589#define PCI_BUS_NUM_RESOURCES 4 590#define PCI_BUS_NUM_RESOURCES 8
590#endif 591#endif
591 592
592#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ 593#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */
@@ -734,16 +735,20 @@ void pcibios_update_irq(struct pci_dev *, int irq);
734/* Generic PCI functions used internally */ 735/* Generic PCI functions used internally */
735 736
736extern struct pci_bus *pci_find_bus(int domain, int busnr); 737extern struct pci_bus *pci_find_bus(int domain, int busnr);
738void 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); 739struct 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) 740static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata)
739{ 741{
740 return pci_scan_bus_parented(NULL, bus, ops, sysdata); 742 struct pci_bus *root_bus;
743 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata);
744 if (root_bus)
745 pci_bus_add_devices(root_bus);
746 return root_bus;
741} 747}
742int pci_scan_slot(struct pci_bus *bus, int devfn); 748int pci_scan_slot(struct pci_bus *bus, int devfn);
743struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 749struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn);
744unsigned int pci_scan_child_bus(struct pci_bus *bus); 750unsigned int pci_scan_child_bus(struct pci_bus *bus);
745void pci_bus_add_device(struct pci_dev *dev); 751void 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); 752void pci_name_device(struct pci_dev *dev);
748char *pci_class_name(u32 class); 753char *pci_class_name(u32 class);
749void pci_read_bridge_bases(struct pci_bus *child); 754void pci_read_bridge_bases(struct pci_bus *child);
@@ -856,7 +861,8 @@ int pci_register_driver(struct pci_driver *);
856void pci_unregister_driver(struct pci_driver *); 861void pci_unregister_driver(struct pci_driver *);
857void pci_remove_behind_bridge(struct pci_dev *); 862void pci_remove_behind_bridge(struct pci_dev *);
858struct pci_driver *pci_dev_driver(const struct pci_dev *); 863struct pci_driver *pci_dev_driver(const struct pci_dev *);
859const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev); 864const struct pci_device_id *pci_match_device(struct pci_driver *drv, struct pci_dev *dev);
865const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev);
860int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); 866int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass);
861 867
862/* kmem_cache style wrapper around pci_alloc_consistent() */ 868/* kmem_cache style wrapper around pci_alloc_consistent() */
@@ -870,6 +876,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) 876#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) 877#define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr)
872 878
879enum pci_dma_burst_strategy {
880 PCI_DMA_BURST_INFINITY, /* make bursts as large as possible,
881 strategy_parameter is N/A */
882 PCI_DMA_BURST_BOUNDARY, /* disconnect at every strategy_parameter
883 byte boundaries */
884 PCI_DMA_BURST_MULTIPLE, /* disconnect at some multiple of
885 strategy_parameter byte boundaries */
886};
887
873#if defined(CONFIG_ISA) || defined(CONFIG_EISA) 888#if defined(CONFIG_ISA) || defined(CONFIG_EISA)
874extern struct pci_dev *isa_bridge; 889extern struct pci_dev *isa_bridge;
875#endif 890#endif
@@ -957,6 +972,8 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int en
957 972
958#define isa_bridge ((struct pci_dev *)NULL) 973#define isa_bridge ((struct pci_dev *)NULL)
959 974
975#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
976
960#else 977#else
961 978
962/* 979/*
@@ -971,7 +988,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
971 return 0; 988 return 0;
972} 989}
973#endif 990#endif
974
975#endif /* !CONFIG_PCI */ 991#endif /* !CONFIG_PCI */
976 992
977/* these helpers provide future and backwards compatibility 993/* these helpers provide future and backwards compatibility
@@ -1016,6 +1032,20 @@ static inline char *pci_name(struct pci_dev *pdev)
1016#define pci_pretty_name(dev) "" 1032#define pci_pretty_name(dev) ""
1017#endif 1033#endif
1018 1034
1035
1036/* Some archs don't want to expose struct resource to userland as-is
1037 * in sysfs and /proc
1038 */
1039#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER
1040static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
1041 const struct resource *rsrc, u64 *start, u64 *end)
1042{
1043 *start = rsrc->start;
1044 *end = rsrc->end;
1045}
1046#endif /* HAVE_ARCH_PCI_RESOURCE_TO_USER */
1047
1048
1019/* 1049/*
1020 * The world is not perfect and supplies us with broken PCI devices. 1050 * 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 1051 * 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 63e89e47b8e9..927ed487630d 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
@@ -712,8 +714,9 @@
712#define PCI_DEVICE_ID_HP_DIVA_AUX 0x1290 714#define PCI_DEVICE_ID_HP_DIVA_AUX 0x1290
713#define PCI_DEVICE_ID_HP_DIVA_RMP3 0x1301 715#define PCI_DEVICE_ID_HP_DIVA_RMP3 0x1301
714#define PCI_DEVICE_ID_HP_CISSA 0x3220 716#define PCI_DEVICE_ID_HP_CISSA 0x3220
715#define PCI_DEVICE_ID_HP_CISSB 0x3230 717#define PCI_DEVICE_ID_HP_CISSB 0x3222
716#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
717 720
718#define PCI_VENDOR_ID_PCTECH 0x1042 721#define PCI_VENDOR_ID_PCTECH 0x1042
719#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000 722#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000
@@ -878,7 +881,7 @@
878#define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e 881#define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e
879#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 882#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030
880#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 883#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032
881#define PCI_DEVIEC_ID_APPLE_UNI_N_ATA 0x0033 884#define PCI_DEVICE_ID_APPLE_UNI_N_ATA 0x0033
882#define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034 885#define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034
883#define PCI_DEVICE_ID_APPLE_IPID_ATA100 0x003b 886#define PCI_DEVICE_ID_APPLE_IPID_ATA100 0x003b
884#define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e 887#define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e
@@ -908,6 +911,15 @@
908#define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022 911#define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022
909#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 912#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100
910#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 913#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200
914#define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300
915#define PCI_DEVICE_ID_QLOGIC_ISP2312 0x2312
916#define PCI_DEVICE_ID_QLOGIC_ISP2322 0x2322
917#define PCI_DEVICE_ID_QLOGIC_ISP6312 0x6312
918#define PCI_DEVICE_ID_QLOGIC_ISP6322 0x6322
919#define PCI_DEVICE_ID_QLOGIC_ISP2422 0x2422
920#define PCI_DEVICE_ID_QLOGIC_ISP2432 0x2432
921#define PCI_DEVICE_ID_QLOGIC_ISP2512 0x2512
922#define PCI_DEVICE_ID_QLOGIC_ISP2522 0x2522
911 923
912#define PCI_VENDOR_ID_CYRIX 0x1078 924#define PCI_VENDOR_ID_CYRIX 0x1078
913#define PCI_DEVICE_ID_CYRIX_5510 0x0000 925#define PCI_DEVICE_ID_CYRIX_5510 0x0000
@@ -1008,6 +1020,7 @@
1008#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 1020#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103
1009#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 1021#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151
1010#define PCI_DEVICE_ID_PLX_R753 0x1152 1022#define PCI_DEVICE_ID_PLX_R753 0x1152
1023#define PCI_DEVICE_ID_PLX_OLITEC 0x1187
1011#define PCI_DEVICE_ID_PLX_9030 0x9030 1024#define PCI_DEVICE_ID_PLX_9030 0x9030
1012#define PCI_DEVICE_ID_PLX_9050 0x9050 1025#define PCI_DEVICE_ID_PLX_9050 0x9050
1013#define PCI_DEVICE_ID_PLX_9060 0x9060 1026#define PCI_DEVICE_ID_PLX_9060 0x9060
@@ -1235,6 +1248,7 @@
1235#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265 1248#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265
1236#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 1249#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
1237#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 1250#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267
1251#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E
1238#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 1252#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268
1239#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 1253#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269
1240#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B 1254#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B
@@ -1284,6 +1298,8 @@
1284#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348 1298#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348
1285#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C 1299#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C
1286#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E 1300#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E
1301#define PCI_DEVICE_ID_NVIDIA_NVENET_14 0x0372
1302#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373
1287 1303
1288#define PCI_VENDOR_ID_IMS 0x10e0 1304#define PCI_VENDOR_ID_IMS 0x10e0
1289#define PCI_DEVICE_ID_IMS_8849 0x8849 1305#define PCI_DEVICE_ID_IMS_8849 0x8849
@@ -1564,10 +1580,12 @@
1564#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 1580#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211
1565#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 1581#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212
1566#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213 1582#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213
1583#define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214
1567#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 1584#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217
1568#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 1585#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220
1569#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB 1586#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB
1570#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221 1587#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221
1588#define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227
1571#define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225 1589#define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225
1572#define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227 1590#define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227
1573#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 1591#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230
@@ -1811,6 +1829,8 @@
1811#define PCI_VENDOR_ID_ITE 0x1283 1829#define PCI_VENDOR_ID_ITE 0x1283
1812#define PCI_DEVICE_ID_ITE_IT8172G 0x8172 1830#define PCI_DEVICE_ID_ITE_IT8172G 0x8172
1813#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801 1831#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
1832#define PCI_DEVICE_ID_ITE_8211 0x8211
1833#define PCI_DEVICE_ID_ITE_8212 0x8212
1814#define PCI_DEVICE_ID_ITE_8872 0x8872 1834#define PCI_DEVICE_ID_ITE_8872 0x8872
1815#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886 1835#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886
1816 1836
@@ -1863,6 +1883,7 @@
1863#define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 1883#define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001
1864 1884
1865#define PCI_VENDOR_ID_SIIG 0x131f 1885#define PCI_VENDOR_ID_SIIG 0x131f
1886#define PCI_SUBVENDOR_ID_SIIG 0x131f
1866#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 1887#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000
1867#define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001 1888#define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001
1868#define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002 1889#define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002
@@ -1900,6 +1921,7 @@
1900#define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 1921#define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060
1901#define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 1922#define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061
1902#define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 1923#define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062
1924#define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050
1903 1925
1904#define PCI_VENDOR_ID_RADISYS 0x1331 1926#define PCI_VENDOR_ID_RADISYS 0x1331
1905#define PCI_DEVICE_ID_RADISYS_ENP2611 0x0030 1927#define PCI_DEVICE_ID_RADISYS_ENP2611 0x0030
@@ -2087,6 +2109,8 @@
2087#define PCI_DEVICE_ID_TIGON3_5721 0x1659 2109#define PCI_DEVICE_ID_TIGON3_5721 0x1659
2088#define PCI_DEVICE_ID_TIGON3_5705M 0x165d 2110#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
2089#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 2111#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
2112#define PCI_DEVICE_ID_TIGON3_5780 0x166a
2113#define PCI_DEVICE_ID_TIGON3_5780S 0x166b
2090#define PCI_DEVICE_ID_TIGON3_5705F 0x166e 2114#define PCI_DEVICE_ID_TIGON3_5705F 0x166e
2091#define PCI_DEVICE_ID_TIGON3_5750 0x1676 2115#define PCI_DEVICE_ID_TIGON3_5750 0x1676
2092#define PCI_DEVICE_ID_TIGON3_5751 0x1677 2116#define PCI_DEVICE_ID_TIGON3_5751 0x1677
@@ -2161,6 +2185,9 @@
2161#define PCI_VENDOR_ID_SIBYTE 0x166d 2185#define PCI_VENDOR_ID_SIBYTE 0x166d
2162#define PCI_DEVICE_ID_BCM1250_HT 0x0002 2186#define PCI_DEVICE_ID_BCM1250_HT 0x0002
2163 2187
2188#define PCI_VENDOR_ID_NETCELL 0x169c
2189#define PCI_DEVICE_ID_REVOLUTION 0x0044
2190
2164#define PCI_VENDOR_ID_LINKSYS 0x1737 2191#define PCI_VENDOR_ID_LINKSYS 0x1737
2165#define PCI_DEVICE_ID_LINKSYS_EG1032 0x1032 2192#define PCI_DEVICE_ID_LINKSYS_EG1032 0x1032
2166#define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064 2193#define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064
@@ -2258,6 +2285,11 @@
2258#define PCI_VENDOR_ID_INTEL 0x8086 2285#define PCI_VENDOR_ID_INTEL 0x8086
2259#define PCI_DEVICE_ID_INTEL_EESSC 0x0008 2286#define PCI_DEVICE_ID_INTEL_EESSC 0x0008
2260#define PCI_DEVICE_ID_INTEL_21145 0x0039 2287#define PCI_DEVICE_ID_INTEL_21145 0x0039
2288#define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320
2289#define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321
2290#define PCI_DEVICE_ID_INTEL_PXH_0 0x0329
2291#define PCI_DEVICE_ID_INTEL_PXH_1 0x032A
2292#define PCI_DEVICE_ID_INTEL_PXHV 0x032C
2261#define PCI_DEVICE_ID_INTEL_82375 0x0482 2293#define PCI_DEVICE_ID_INTEL_82375 0x0482
2262#define PCI_DEVICE_ID_INTEL_82424 0x0483 2294#define PCI_DEVICE_ID_INTEL_82424 0x0483
2263#define PCI_DEVICE_ID_INTEL_82378 0x0484 2295#define PCI_DEVICE_ID_INTEL_82378 0x0484
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..7aeb208ed713 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
@@ -175,7 +176,7 @@ struct pm_ops {
175}; 176};
176 177
177extern void pm_set_ops(struct pm_ops *); 178extern void pm_set_ops(struct pm_ops *);
178 179extern struct pm_ops *pm_ops;
179extern int pm_suspend(suspend_state_t state); 180extern int pm_suspend(suspend_state_t state);
180 181
181 182
@@ -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
index e24b74b11150..4bf1659f8aa8 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -248,6 +248,7 @@ struct bitmap {
248 248
249/* these are used only by md/bitmap */ 249/* these are used only by md/bitmap */
250int bitmap_create(mddev_t *mddev); 250int bitmap_create(mddev_t *mddev);
251void bitmap_flush(mddev_t *mddev);
251void bitmap_destroy(mddev_t *mddev); 252void bitmap_destroy(mddev_t *mddev);
252int bitmap_active(struct bitmap *bitmap); 253int bitmap_active(struct bitmap *bitmap);
253 254
@@ -262,7 +263,7 @@ void bitmap_write_all(struct bitmap *bitmap);
262int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors); 263int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors);
263void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, 264void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors,
264 int success); 265 int success);
265int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks); 266int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded);
266void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); 267void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
267void bitmap_close_sync(struct bitmap *bitmap); 268void bitmap_close_sync(struct bitmap *bitmap);
268 269
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index d60fafc8bdc5..3b3266ff1a95 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -51,6 +51,26 @@ 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
58/*
59 * Architecture independent implemenations of sys_reboot commands.
60 */
61
62extern void kernel_restart(char *cmd);
63extern void kernel_halt(void);
64extern void kernel_power_off(void);
65extern void kernel_kexec(void);
66
67/*
68 * Emergency restart, callable from an interrupt handler.
69 */
70
71extern void emergency_restart(void);
72#include <asm/emergency-restart.h>
73
54#endif 74#endif
55 75
56#endif /* _LINUX_REBOOT_H */ 76#endif /* _LINUX_REBOOT_H */
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index 2aef9c3f5ce8..0a3605099c44 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -1,33 +1,32 @@
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
7typedef struct { 6typedef struct {
8 __le16 e_tag; 7 __le16 e_tag;
9 __le16 e_perm; 8 __le16 e_perm;
10 __le32 e_id; 9 __le32 e_id;
11} reiserfs_acl_entry; 10} reiserfs_acl_entry;
12 11
13typedef struct { 12typedef struct {
14 __le16 e_tag; 13 __le16 e_tag;
15 __le16 e_perm; 14 __le16 e_perm;
16} reiserfs_acl_entry_short; 15} reiserfs_acl_entry_short;
17 16
18typedef struct { 17typedef struct {
19 __le32 a_version; 18 __le32 a_version;
20} reiserfs_acl_header; 19} reiserfs_acl_header;
21 20
22static inline size_t reiserfs_acl_size(int count) 21static inline size_t reiserfs_acl_size(int count)
23{ 22{
24 if (count <= 4) { 23 if (count <= 4) {
25 return sizeof(reiserfs_acl_header) + 24 return sizeof(reiserfs_acl_header) +
26 count * sizeof(reiserfs_acl_entry_short); 25 count * sizeof(reiserfs_acl_entry_short);
27 } else { 26 } else {
28 return sizeof(reiserfs_acl_header) + 27 return sizeof(reiserfs_acl_header) +
29 4 * sizeof(reiserfs_acl_entry_short) + 28 4 * sizeof(reiserfs_acl_entry_short) +
30 (count - 4) * sizeof(reiserfs_acl_entry); 29 (count - 4) * sizeof(reiserfs_acl_entry);
31 } 30 }
32} 31}
33 32
@@ -47,14 +46,14 @@ static inline int reiserfs_acl_count(size_t size)
47 } 46 }
48} 47}
49 48
50
51#ifdef CONFIG_REISERFS_FS_POSIX_ACL 49#ifdef CONFIG_REISERFS_FS_POSIX_ACL
52struct posix_acl * reiserfs_get_acl(struct inode *inode, int type); 50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
53int reiserfs_acl_chmod (struct inode *inode); 51int reiserfs_acl_chmod(struct inode *inode);
54int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode); 52int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
55int reiserfs_cache_default_acl (struct inode *dir); 53 struct inode *inode);
56extern int reiserfs_xattr_posix_acl_init (void) __init; 54int reiserfs_cache_default_acl(struct inode *dir);
57extern int reiserfs_xattr_posix_acl_exit (void); 55extern int reiserfs_xattr_posix_acl_init(void) __init;
56extern int reiserfs_xattr_posix_acl_exit(void);
58extern struct reiserfs_xattr_handler posix_acl_default_handler; 57extern struct reiserfs_xattr_handler posix_acl_default_handler;
59extern struct reiserfs_xattr_handler posix_acl_access_handler; 58extern struct reiserfs_xattr_handler posix_acl_access_handler;
60#else 59#else
@@ -62,28 +61,26 @@ extern struct reiserfs_xattr_handler posix_acl_access_handler;
62#define reiserfs_get_acl NULL 61#define reiserfs_get_acl NULL
63#define reiserfs_cache_default_acl(inode) 0 62#define reiserfs_cache_default_acl(inode) 0
64 63
65static inline int 64static inline int reiserfs_xattr_posix_acl_init(void)
66reiserfs_xattr_posix_acl_init (void)
67{ 65{
68 return 0; 66 return 0;
69} 67}
70 68
71static inline int 69static inline int reiserfs_xattr_posix_acl_exit(void)
72reiserfs_xattr_posix_acl_exit (void)
73{ 70{
74 return 0; 71 return 0;
75} 72}
76 73
77static inline int 74static inline int reiserfs_acl_chmod(struct inode *inode)
78reiserfs_acl_chmod (struct inode *inode)
79{ 75{
80 return 0; 76 return 0;
81} 77}
82 78
83static inline int 79static inline int
84reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode) 80reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry,
81 struct inode *inode)
85{ 82{
86 return 0; 83 return 0;
87} 84}
88 85
89#endif 86#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 32148625fc2f..17e458e17e2b 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -3,11 +3,10 @@
3 */ 3 */
4 4
5 /* this file has an amazingly stupid 5 /* this file has an amazingly stupid
6 name, yura please fix it to be 6 name, yura please fix it to be
7 reiserfs.h, and merge all the rest 7 reiserfs.h, and merge all the rest
8 of our .h files that are in this 8 of our .h files that are in this
9 directory into it. */ 9 directory into it. */
10
11 10
12#ifndef _LINUX_REISER_FS_H 11#ifndef _LINUX_REISER_FS_H
13#define _LINUX_REISER_FS_H 12#define _LINUX_REISER_FS_H
@@ -74,9 +73,9 @@
74/* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug 73/* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug
75** messages. 74** messages.
76*/ 75*/
77#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ 76#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */
78 77
79void reiserfs_warning (struct super_block *s, const char * fmt, ...); 78void reiserfs_warning(struct super_block *s, const char *fmt, ...);
80/* assertions handling */ 79/* assertions handling */
81 80
82/** always check a condition and panic if it's false. */ 81/** always check a condition and panic if it's false. */
@@ -105,82 +104,78 @@ if( !( cond ) ) \
105 * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs 104 * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs
106 * the version in RAM is part of a larger structure containing fields never written to disk. 105 * the version in RAM is part of a larger structure containing fields never written to disk.
107 */ 106 */
108#define UNSET_HASH 0 // read_super will guess about, what hash names 107#define UNSET_HASH 0 // read_super will guess about, what hash names
109 // in directories were sorted with 108 // in directories were sorted with
110#define TEA_HASH 1 109#define TEA_HASH 1
111#define YURA_HASH 2 110#define YURA_HASH 2
112#define R5_HASH 3 111#define R5_HASH 3
113#define DEFAULT_HASH R5_HASH 112#define DEFAULT_HASH R5_HASH
114 113
115
116struct journal_params { 114struct journal_params {
117 __le32 jp_journal_1st_block; /* where does journal start from on its 115 __le32 jp_journal_1st_block; /* where does journal start from on its
118 * device */ 116 * device */
119 __le32 jp_journal_dev; /* journal device st_rdev */ 117 __le32 jp_journal_dev; /* journal device st_rdev */
120 __le32 jp_journal_size; /* size of the journal */ 118 __le32 jp_journal_size; /* size of the journal */
121 __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */ 119 __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */
122 __le32 jp_journal_magic; /* random value made on fs creation (this 120 __le32 jp_journal_magic; /* random value made on fs creation (this
123 * was sb_journal_block_count) */ 121 * was sb_journal_block_count) */
124 __le32 jp_journal_max_batch; /* max number of blocks to batch into a 122 __le32 jp_journal_max_batch; /* max number of blocks to batch into a
125 * trans */ 123 * trans */
126 __le32 jp_journal_max_commit_age; /* in seconds, how old can an async 124 __le32 jp_journal_max_commit_age; /* in seconds, how old can an async
127 * commit be */ 125 * commit be */
128 __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction 126 __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction
129 * be */ 127 * be */
130}; 128};
131 129
132/* this is the super from 3.5.X, where X >= 10 */ 130/* this is the super from 3.5.X, where X >= 10 */
133struct reiserfs_super_block_v1 131struct reiserfs_super_block_v1 {
134{ 132 __le32 s_block_count; /* blocks count */
135 __le32 s_block_count; /* blocks count */ 133 __le32 s_free_blocks; /* free blocks count */
136 __le32 s_free_blocks; /* free blocks count */ 134 __le32 s_root_block; /* root block number */
137 __le32 s_root_block; /* root block number */ 135 struct journal_params s_journal;
138 struct journal_params s_journal; 136 __le16 s_blocksize; /* block size */
139 __le16 s_blocksize; /* block size */ 137 __le16 s_oid_maxsize; /* max size of object id array, see
140 __le16 s_oid_maxsize; /* max size of object id array, see 138 * get_objectid() commentary */
141 * get_objectid() commentary */ 139 __le16 s_oid_cursize; /* current size of object id array */
142 __le16 s_oid_cursize; /* current size of object id array */ 140 __le16 s_umount_state; /* this is set to 1 when filesystem was
143 __le16 s_umount_state; /* this is set to 1 when filesystem was 141 * umounted, to 2 - when not */
144 * umounted, to 2 - when not */ 142 char s_magic[10]; /* reiserfs magic string indicates that
145 char s_magic[10]; /* reiserfs magic string indicates that 143 * file system is reiserfs:
146 * file system is reiserfs: 144 * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */
147 * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ 145 __le16 s_fs_state; /* it is set to used by fsck to mark which
148 __le16 s_fs_state; /* it is set to used by fsck to mark which 146 * phase of rebuilding is done */
149 * phase of rebuilding is done */ 147 __le32 s_hash_function_code; /* indicate, what hash function is being use
150 __le32 s_hash_function_code; /* indicate, what hash function is being use 148 * to sort names in a directory*/
151 * to sort names in a directory*/ 149 __le16 s_tree_height; /* height of disk tree */
152 __le16 s_tree_height; /* height of disk tree */ 150 __le16 s_bmap_nr; /* amount of bitmap blocks needed to address
153 __le16 s_bmap_nr; /* amount of bitmap blocks needed to address 151 * each block of file system */
154 * each block of file system */ 152 __le16 s_version; /* this field is only reliable on filesystem
155 __le16 s_version; /* this field is only reliable on filesystem 153 * with non-standard journal */
156 * with non-standard journal */ 154 __le16 s_reserved_for_journal; /* size in blocks of journal area on main
157 __le16 s_reserved_for_journal; /* size in blocks of journal area on main 155 * device, we need to keep after
158 * device, we need to keep after 156 * making fs with non-standard journal */
159 * making fs with non-standard journal */
160} __attribute__ ((__packed__)); 157} __attribute__ ((__packed__));
161 158
162#define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) 159#define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1))
163 160
164/* this is the on disk super block */ 161/* this is the on disk super block */
165struct reiserfs_super_block 162struct reiserfs_super_block {
166{ 163 struct reiserfs_super_block_v1 s_v1;
167 struct reiserfs_super_block_v1 s_v1; 164 __le32 s_inode_generation;
168 __le32 s_inode_generation; 165 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */
169 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ 166 unsigned char s_uuid[16]; /* filesystem unique identifier */
170 unsigned char s_uuid[16]; /* filesystem unique identifier */ 167 unsigned char s_label[16]; /* filesystem volume label */
171 unsigned char s_label[16]; /* filesystem volume label */ 168 char s_unused[88]; /* zero filled by mkreiserfs and
172 char s_unused[88] ; /* zero filled by mkreiserfs and 169 * reiserfs_convert_objectid_map_v1()
173 * reiserfs_convert_objectid_map_v1() 170 * so any additions must be updated
174 * so any additions must be updated 171 * there as well. */
175 * there as well. */ 172} __attribute__ ((__packed__));
176} __attribute__ ((__packed__));
177 173
178#define SB_SIZE (sizeof(struct reiserfs_super_block)) 174#define SB_SIZE (sizeof(struct reiserfs_super_block))
179 175
180#define REISERFS_VERSION_1 0 176#define REISERFS_VERSION_1 0
181#define REISERFS_VERSION_2 2 177#define REISERFS_VERSION_2 2
182 178
183
184// on-disk super block fields converted to cpu form 179// on-disk super block fields converted to cpu form
185#define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs) 180#define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs)
186#define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1)) 181#define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1))
@@ -210,13 +205,12 @@ struct reiserfs_super_block
210#define PUT_SB_TREE_HEIGHT(s, val) \ 205#define PUT_SB_TREE_HEIGHT(s, val) \
211 do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0) 206 do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0)
212#define PUT_SB_REISERFS_STATE(s, val) \ 207#define PUT_SB_REISERFS_STATE(s, val) \
213 do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0) 208 do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0)
214#define PUT_SB_VERSION(s, val) \ 209#define PUT_SB_VERSION(s, val) \
215 do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0) 210 do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0)
216#define PUT_SB_BMAP_NR(s, val) \ 211#define PUT_SB_BMAP_NR(s, val) \
217 do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0) 212 do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0)
218 213
219
220#define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal) 214#define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal)
221#define SB_ONDISK_JOURNAL_SIZE(s) \ 215#define SB_ONDISK_JOURNAL_SIZE(s) \
222 le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size)) 216 le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size))
@@ -231,21 +225,19 @@ struct reiserfs_super_block
231 block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ 225 block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \
232 && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \ 226 && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \
233 ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ 227 ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \
234 SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) 228 SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s)))
235
236
237 229
238 /* used by gcc */ 230 /* used by gcc */
239#define REISERFS_SUPER_MAGIC 0x52654973 231#define REISERFS_SUPER_MAGIC 0x52654973
240 /* used by file system utilities that 232 /* used by file system utilities that
241 look at the superblock, etc. */ 233 look at the superblock, etc. */
242#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" 234#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
243#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" 235#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
244#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" 236#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
245 237
246int is_reiserfs_3_5 (struct reiserfs_super_block * rs); 238int is_reiserfs_3_5(struct reiserfs_super_block *rs);
247int is_reiserfs_3_6 (struct reiserfs_super_block * rs); 239int is_reiserfs_3_6(struct reiserfs_super_block *rs);
248int is_reiserfs_jr (struct reiserfs_super_block * rs); 240int is_reiserfs_jr(struct reiserfs_super_block *rs);
249 241
250/* ReiserFS leaves the first 64k unused, so that partition labels have 242/* ReiserFS leaves the first 64k unused, so that partition labels have
251 enough space. If someone wants to write a fancy bootloader that 243 enough space. If someone wants to write a fancy bootloader that
@@ -272,8 +264,8 @@ typedef __u32 b_blocknr_t;
272typedef __le32 unp_t; 264typedef __le32 unp_t;
273 265
274struct unfm_nodeinfo { 266struct unfm_nodeinfo {
275 unp_t unfm_nodenum; 267 unp_t unfm_nodenum;
276 unsigned short unfm_freespace; 268 unsigned short unfm_freespace;
277}; 269};
278 270
279/* there are two formats of keys: 3.5 and 3.6 271/* there are two formats of keys: 3.5 and 3.6
@@ -285,7 +277,6 @@ struct unfm_nodeinfo {
285#define STAT_DATA_V1 0 277#define STAT_DATA_V1 0
286#define STAT_DATA_V2 1 278#define STAT_DATA_V2 1
287 279
288
289static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode) 280static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode)
290{ 281{
291 return container_of(inode, struct reiserfs_inode_info, vfs_inode); 282 return container_of(inode, struct reiserfs_inode_info, vfs_inode);
@@ -343,15 +334,13 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
343 file would fit into one DIRECT item. 334 file would fit into one DIRECT item.
344 Primary intention for this one is to increase performance by decreasing 335 Primary intention for this one is to increase performance by decreasing
345 seeking. 336 seeking.
346*/ 337*/
347#define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \ 338#define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \
348(\ 339(\
349 (!(n_tail_size)) || \ 340 (!(n_tail_size)) || \
350 (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \ 341 (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \
351) 342)
352 343
353
354
355/* 344/*
356 * values for s_umount_state field 345 * values for s_umount_state field
357 */ 346 */
@@ -364,9 +353,9 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
364#define TYPE_STAT_DATA 0 353#define TYPE_STAT_DATA 0
365#define TYPE_INDIRECT 1 354#define TYPE_INDIRECT 1
366#define TYPE_DIRECT 2 355#define TYPE_DIRECT 2
367#define TYPE_DIRENTRY 3 356#define TYPE_DIRENTRY 3
368#define TYPE_MAXTYPE 3 357#define TYPE_MAXTYPE 3
369#define TYPE_ANY 15 // FIXME: comment is required 358#define TYPE_ANY 15 // FIXME: comment is required
370 359
371/***************************************************************************/ 360/***************************************************************************/
372/* KEY & ITEM HEAD */ 361/* KEY & ITEM HEAD */
@@ -376,60 +365,62 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
376// directories use this key as well as old files 365// directories use this key as well as old files
377// 366//
378struct offset_v1 { 367struct offset_v1 {
379 __le32 k_offset; 368 __le32 k_offset;
380 __le32 k_uniqueness; 369 __le32 k_uniqueness;
381} __attribute__ ((__packed__)); 370} __attribute__ ((__packed__));
382 371
383struct offset_v2 { 372struct offset_v2 {
384 __le64 v; 373 __le64 v;
385} __attribute__ ((__packed__)); 374} __attribute__ ((__packed__));
386 375
387static inline __u16 offset_v2_k_type( const struct offset_v2 *v2 ) 376static inline __u16 offset_v2_k_type(const struct offset_v2 *v2)
388{ 377{
389 __u8 type = le64_to_cpu(v2->v) >> 60; 378 __u8 type = le64_to_cpu(v2->v) >> 60;
390 return (type <= TYPE_MAXTYPE)?type:TYPE_ANY; 379 return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY;
391} 380}
392 381
393static inline void set_offset_v2_k_type( struct offset_v2 *v2, int type ) 382static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type)
394{ 383{
395 v2->v = (v2->v & cpu_to_le64(~0ULL>>4)) | cpu_to_le64((__u64)type<<60); 384 v2->v =
385 (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60);
396} 386}
397 387
398static inline loff_t offset_v2_k_offset( const struct offset_v2 *v2 ) 388static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2)
399{ 389{
400 return le64_to_cpu(v2->v) & (~0ULL>>4); 390 return le64_to_cpu(v2->v) & (~0ULL >> 4);
401} 391}
402 392
403static inline void set_offset_v2_k_offset( struct offset_v2 *v2, loff_t offset ){ 393static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset)
404 offset &= (~0ULL>>4); 394{
405 v2->v = (v2->v & cpu_to_le64(15ULL<<60)) | cpu_to_le64(offset); 395 offset &= (~0ULL >> 4);
396 v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
406} 397}
407 398
408/* Key of an item determines its location in the S+tree, and 399/* Key of an item determines its location in the S+tree, and
409 is composed of 4 components */ 400 is composed of 4 components */
410struct reiserfs_key { 401struct reiserfs_key {
411 __le32 k_dir_id; /* packing locality: by default parent 402 __le32 k_dir_id; /* packing locality: by default parent
412 directory object id */ 403 directory object id */
413 __le32 k_objectid; /* object identifier */ 404 __le32 k_objectid; /* object identifier */
414 union { 405 union {
415 struct offset_v1 k_offset_v1; 406 struct offset_v1 k_offset_v1;
416 struct offset_v2 k_offset_v2; 407 struct offset_v2 k_offset_v2;
417 } __attribute__ ((__packed__)) u; 408 } __attribute__ ((__packed__)) u;
418} __attribute__ ((__packed__)); 409} __attribute__ ((__packed__));
419 410
420struct in_core_key { 411struct in_core_key {
421 __u32 k_dir_id; /* packing locality: by default parent 412 __u32 k_dir_id; /* packing locality: by default parent
422 directory object id */ 413 directory object id */
423 __u32 k_objectid; /* object identifier */ 414 __u32 k_objectid; /* object identifier */
424 __u64 k_offset; 415 __u64 k_offset;
425 __u8 k_type; 416 __u8 k_type;
426}; 417};
427 418
428struct cpu_key { 419struct cpu_key {
429 struct in_core_key on_disk_key; 420 struct in_core_key on_disk_key;
430 int version; 421 int version;
431 int key_length; /* 3 in all cases but direct2indirect and 422 int key_length; /* 3 in all cases but direct2indirect and
432 indirect2direct conversion */ 423 indirect2direct conversion */
433}; 424};
434 425
435/* Our function for comparing keys can compare keys of different 426/* Our function for comparing keys can compare keys of different
@@ -475,8 +466,7 @@ struct cpu_key {
475 indirect items) and specifies the location of the item itself 466 indirect items) and specifies the location of the item itself
476 within the block. */ 467 within the block. */
477 468
478struct item_head 469struct item_head {
479{
480 /* Everything in the tree is found by searching for it based on 470 /* Everything in the tree is found by searching for it based on
481 * its key.*/ 471 * its key.*/
482 struct reiserfs_key ih_key; 472 struct reiserfs_key ih_key;
@@ -492,13 +482,13 @@ struct item_head
492 number of directory entries in the directory item. */ 482 number of directory entries in the directory item. */
493 __le16 ih_entry_count; 483 __le16 ih_entry_count;
494 } __attribute__ ((__packed__)) u; 484 } __attribute__ ((__packed__)) u;
495 __le16 ih_item_len; /* total size of the item body */ 485 __le16 ih_item_len; /* total size of the item body */
496 __le16 ih_item_location; /* an offset to the item body 486 __le16 ih_item_location; /* an offset to the item body
497 * within the block */ 487 * within the block */
498 __le16 ih_version; /* 0 for all old items, 2 for new 488 __le16 ih_version; /* 0 for all old items, 2 for new
499 ones. Highest bit is set by fsck 489 ones. Highest bit is set by fsck
500 temporary, cleaned after all 490 temporary, cleaned after all
501 done */ 491 done */
502} __attribute__ ((__packed__)); 492} __attribute__ ((__packed__));
503/* size of item header */ 493/* size of item header */
504#define IH_SIZE (sizeof(struct item_head)) 494#define IH_SIZE (sizeof(struct item_head))
@@ -515,7 +505,6 @@ struct item_head
515#define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0) 505#define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0)
516#define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0) 506#define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0)
517 507
518
519#define unreachable_item(ih) (ih_version(ih) & (1 << 15)) 508#define unreachable_item(ih) (ih_version(ih) & (1 << 15))
520 509
521#define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih)) 510#define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih))
@@ -537,40 +526,48 @@ struct item_head
537#define V1_INDIRECT_UNIQUENESS 0xfffffffe 526#define V1_INDIRECT_UNIQUENESS 0xfffffffe
538#define V1_DIRECT_UNIQUENESS 0xffffffff 527#define V1_DIRECT_UNIQUENESS 0xffffffff
539#define V1_DIRENTRY_UNIQUENESS 500 528#define V1_DIRENTRY_UNIQUENESS 500
540#define V1_ANY_UNIQUENESS 555 // FIXME: comment is required 529#define V1_ANY_UNIQUENESS 555 // FIXME: comment is required
541 530
542// 531//
543// here are conversion routines 532// here are conversion routines
544// 533//
545static inline int uniqueness2type (__u32 uniqueness) CONSTF; 534static inline int uniqueness2type(__u32 uniqueness) CONSTF;
546static inline int uniqueness2type (__u32 uniqueness) 535static inline int uniqueness2type(__u32 uniqueness)
547{ 536{
548 switch ((int)uniqueness) { 537 switch ((int)uniqueness) {
549 case V1_SD_UNIQUENESS: return TYPE_STAT_DATA; 538 case V1_SD_UNIQUENESS:
550 case V1_INDIRECT_UNIQUENESS: return TYPE_INDIRECT; 539 return TYPE_STAT_DATA;
551 case V1_DIRECT_UNIQUENESS: return TYPE_DIRECT; 540 case V1_INDIRECT_UNIQUENESS:
552 case V1_DIRENTRY_UNIQUENESS: return TYPE_DIRENTRY; 541 return TYPE_INDIRECT;
553 default: 542 case V1_DIRECT_UNIQUENESS:
554 reiserfs_warning (NULL, "vs-500: unknown uniqueness %d", 543 return TYPE_DIRECT;
555 uniqueness); 544 case V1_DIRENTRY_UNIQUENESS:
545 return TYPE_DIRENTRY;
546 default:
547 reiserfs_warning(NULL, "vs-500: unknown uniqueness %d",
548 uniqueness);
556 case V1_ANY_UNIQUENESS: 549 case V1_ANY_UNIQUENESS:
557 return TYPE_ANY; 550 return TYPE_ANY;
558 } 551 }
559} 552}
560 553
561static inline __u32 type2uniqueness (int type) CONSTF; 554static inline __u32 type2uniqueness(int type) CONSTF;
562static inline __u32 type2uniqueness (int type) 555static inline __u32 type2uniqueness(int type)
563{ 556{
564 switch (type) { 557 switch (type) {
565 case TYPE_STAT_DATA: return V1_SD_UNIQUENESS; 558 case TYPE_STAT_DATA:
566 case TYPE_INDIRECT: return V1_INDIRECT_UNIQUENESS; 559 return V1_SD_UNIQUENESS;
567 case TYPE_DIRECT: return V1_DIRECT_UNIQUENESS; 560 case TYPE_INDIRECT:
568 case TYPE_DIRENTRY: return V1_DIRENTRY_UNIQUENESS; 561 return V1_INDIRECT_UNIQUENESS;
569 default: 562 case TYPE_DIRECT:
570 reiserfs_warning (NULL, "vs-501: unknown type %d", type); 563 return V1_DIRECT_UNIQUENESS;
564 case TYPE_DIRENTRY:
565 return V1_DIRENTRY_UNIQUENESS;
566 default:
567 reiserfs_warning(NULL, "vs-501: unknown type %d", type);
571 case TYPE_ANY: 568 case TYPE_ANY:
572 return V1_ANY_UNIQUENESS; 569 return V1_ANY_UNIQUENESS;
573 } 570 }
574} 571}
575 572
576// 573//
@@ -578,57 +575,56 @@ static inline __u32 type2uniqueness (int type)
578// there is no way to get version of object from key, so, provide 575// there is no way to get version of object from key, so, provide
579// version to these defines 576// version to these defines
580// 577//
581static inline loff_t le_key_k_offset (int version, const struct reiserfs_key * key) 578static inline loff_t le_key_k_offset(int version,
579 const struct reiserfs_key *key)
582{ 580{
583 return (version == KEY_FORMAT_3_5) ? 581 return (version == KEY_FORMAT_3_5) ?
584 le32_to_cpu( key->u.k_offset_v1.k_offset ) : 582 le32_to_cpu(key->u.k_offset_v1.k_offset) :
585 offset_v2_k_offset( &(key->u.k_offset_v2) ); 583 offset_v2_k_offset(&(key->u.k_offset_v2));
586} 584}
587 585
588static inline loff_t le_ih_k_offset (const struct item_head * ih) 586static inline loff_t le_ih_k_offset(const struct item_head *ih)
589{ 587{
590 return le_key_k_offset (ih_version (ih), &(ih->ih_key)); 588 return le_key_k_offset(ih_version(ih), &(ih->ih_key));
591} 589}
592 590
593static inline loff_t le_key_k_type (int version, const struct reiserfs_key * key) 591static inline loff_t le_key_k_type(int version, const struct reiserfs_key *key)
594{ 592{
595 return (version == KEY_FORMAT_3_5) ? 593 return (version == KEY_FORMAT_3_5) ?
596 uniqueness2type( le32_to_cpu( key->u.k_offset_v1.k_uniqueness)) : 594 uniqueness2type(le32_to_cpu(key->u.k_offset_v1.k_uniqueness)) :
597 offset_v2_k_type( &(key->u.k_offset_v2) ); 595 offset_v2_k_type(&(key->u.k_offset_v2));
598} 596}
599 597
600static inline loff_t le_ih_k_type (const struct item_head * ih) 598static inline loff_t le_ih_k_type(const struct item_head *ih)
601{ 599{
602 return le_key_k_type (ih_version (ih), &(ih->ih_key)); 600 return le_key_k_type(ih_version(ih), &(ih->ih_key));
603} 601}
604 602
605 603static inline void set_le_key_k_offset(int version, struct reiserfs_key *key,
606static inline void set_le_key_k_offset (int version, struct reiserfs_key * key, loff_t offset) 604 loff_t offset)
607{ 605{
608 (version == KEY_FORMAT_3_5) ? 606 (version == KEY_FORMAT_3_5) ? (void)(key->u.k_offset_v1.k_offset = cpu_to_le32(offset)) : /* jdm check */
609 (void)(key->u.k_offset_v1.k_offset = cpu_to_le32 (offset)) : /* jdm check */ 607 (void)(set_offset_v2_k_offset(&(key->u.k_offset_v2), offset));
610 (void)(set_offset_v2_k_offset( &(key->u.k_offset_v2), offset ));
611} 608}
612 609
613 610static inline void set_le_ih_k_offset(struct item_head *ih, loff_t offset)
614static inline void set_le_ih_k_offset (struct item_head * ih, loff_t offset)
615{ 611{
616 set_le_key_k_offset (ih_version (ih), &(ih->ih_key), offset); 612 set_le_key_k_offset(ih_version(ih), &(ih->ih_key), offset);
617} 613}
618 614
619 615static inline void set_le_key_k_type(int version, struct reiserfs_key *key,
620static inline void set_le_key_k_type (int version, struct reiserfs_key * key, int type) 616 int type)
621{ 617{
622 (version == KEY_FORMAT_3_5) ? 618 (version == KEY_FORMAT_3_5) ?
623 (void)(key->u.k_offset_v1.k_uniqueness = cpu_to_le32(type2uniqueness(type))): 619 (void)(key->u.k_offset_v1.k_uniqueness =
624 (void)(set_offset_v2_k_type( &(key->u.k_offset_v2), type )); 620 cpu_to_le32(type2uniqueness(type)))
621 : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type));
625} 622}
626static inline void set_le_ih_k_type (struct item_head * ih, int type) 623static inline void set_le_ih_k_type(struct item_head *ih, int type)
627{ 624{
628 set_le_key_k_type (ih_version (ih), &(ih->ih_key), type); 625 set_le_key_k_type(ih_version(ih), &(ih->ih_key), type);
629} 626}
630 627
631
632#define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) 628#define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY)
633#define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) 629#define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT)
634#define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) 630#define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT)
@@ -642,34 +638,32 @@ static inline void set_le_ih_k_type (struct item_head * ih, int type)
642#define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) 638#define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key))
643#define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) 639#define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key))
644 640
645
646
647// 641//
648// key is pointer to cpu key, result is cpu 642// key is pointer to cpu key, result is cpu
649// 643//
650static inline loff_t cpu_key_k_offset (const struct cpu_key * key) 644static inline loff_t cpu_key_k_offset(const struct cpu_key *key)
651{ 645{
652 return key->on_disk_key.k_offset; 646 return key->on_disk_key.k_offset;
653} 647}
654 648
655static inline loff_t cpu_key_k_type (const struct cpu_key * key) 649static inline loff_t cpu_key_k_type(const struct cpu_key *key)
656{ 650{
657 return key->on_disk_key.k_type; 651 return key->on_disk_key.k_type;
658} 652}
659 653
660static inline void set_cpu_key_k_offset (struct cpu_key * key, loff_t offset) 654static inline void set_cpu_key_k_offset(struct cpu_key *key, loff_t offset)
661{ 655{
662 key->on_disk_key.k_offset = offset; 656 key->on_disk_key.k_offset = offset;
663} 657}
664 658
665static inline void set_cpu_key_k_type (struct cpu_key * key, int type) 659static inline void set_cpu_key_k_type(struct cpu_key *key, int type)
666{ 660{
667 key->on_disk_key.k_type = type; 661 key->on_disk_key.k_type = type;
668} 662}
669 663
670static inline void cpu_key_k_offset_dec (struct cpu_key * key) 664static inline void cpu_key_k_offset_dec(struct cpu_key *key)
671{ 665{
672 key->on_disk_key.k_offset --; 666 key->on_disk_key.k_offset--;
673} 667}
674 668
675#define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY) 669#define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY)
@@ -677,34 +671,25 @@ static inline void cpu_key_k_offset_dec (struct cpu_key * key)
677#define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT) 671#define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT)
678#define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA) 672#define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA)
679 673
680
681/* are these used ? */ 674/* are these used ? */
682#define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key))) 675#define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key)))
683#define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key))) 676#define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key)))
684#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) 677#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key)))
685#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) 678#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key)))
686 679
687
688
689
690
691#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ 680#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \
692 ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ 681 ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \
693 I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) 682 I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) )
694 683
695/* maximal length of item */ 684/* maximal length of item */
696#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) 685#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE)
697#define MIN_ITEM_LEN 1 686#define MIN_ITEM_LEN 1
698 687
699
700/* object identifier for root dir */ 688/* object identifier for root dir */
701#define REISERFS_ROOT_OBJECTID 2 689#define REISERFS_ROOT_OBJECTID 2
702#define REISERFS_ROOT_PARENT_OBJECTID 1 690#define REISERFS_ROOT_PARENT_OBJECTID 1
703extern struct reiserfs_key root_key; 691extern struct reiserfs_key root_key;
704 692
705
706
707
708/* 693/*
709 * Picture represents a leaf of the S+tree 694 * Picture represents a leaf of the S+tree
710 * ______________________________________________________ 695 * ______________________________________________________
@@ -716,13 +701,13 @@ extern struct reiserfs_key root_key;
716 701
717/* Header of a disk block. More precisely, header of a formatted leaf 702/* Header of a disk block. More precisely, header of a formatted leaf
718 or internal node, and not the header of an unformatted node. */ 703 or internal node, and not the header of an unformatted node. */
719struct block_head { 704struct block_head {
720 __le16 blk_level; /* Level of a block in the tree. */ 705 __le16 blk_level; /* Level of a block in the tree. */
721 __le16 blk_nr_item; /* Number of keys/items in a block. */ 706 __le16 blk_nr_item; /* Number of keys/items in a block. */
722 __le16 blk_free_space; /* Block free space in bytes. */ 707 __le16 blk_free_space; /* Block free space in bytes. */
723 __le16 blk_reserved; 708 __le16 blk_reserved;
724 /* dump this in v4/planA */ 709 /* dump this in v4/planA */
725 struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ 710 struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */
726}; 711};
727 712
728#define BLKH_SIZE (sizeof(struct block_head)) 713#define BLKH_SIZE (sizeof(struct block_head))
@@ -741,12 +726,12 @@ struct block_head {
741 * values for blk_level field of the struct block_head 726 * values for blk_level field of the struct block_head
742 */ 727 */
743 728
744#define FREE_LEVEL 0 /* when node gets removed from the tree its 729#define FREE_LEVEL 0 /* when node gets removed from the tree its
745 blk_level is set to FREE_LEVEL. It is then 730 blk_level is set to FREE_LEVEL. It is then
746 used to see whether the node is still in the 731 used to see whether the node is still in the
747 tree */ 732 tree */
748 733
749#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level.*/ 734#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */
750 735
751/* Given the buffer head of a formatted node, resolve to the block head of that node. */ 736/* Given the buffer head of a formatted node, resolve to the block head of that node. */
752#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) 737#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data))
@@ -759,7 +744,6 @@ struct block_head {
759#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) 744#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0)
760#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) 745#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0)
761 746
762
763/* Get right delimiting key. -- little endian */ 747/* Get right delimiting key. -- little endian */
764#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)) 748#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh))
765 749
@@ -770,41 +754,36 @@ struct block_head {
770#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ 754#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \
771 && B_LEVEL(p_s_bh) <= MAX_HEIGHT) 755 && B_LEVEL(p_s_bh) <= MAX_HEIGHT)
772 756
773
774
775
776/***************************************************************************/ 757/***************************************************************************/
777/* STAT DATA */ 758/* STAT DATA */
778/***************************************************************************/ 759/***************************************************************************/
779 760
780
781// 761//
782// old stat data is 32 bytes long. We are going to distinguish new one by 762// old stat data is 32 bytes long. We are going to distinguish new one by
783// different size 763// different size
784// 764//
785struct stat_data_v1 765struct stat_data_v1 {
786{ 766 __le16 sd_mode; /* file type, permissions */
787 __le16 sd_mode; /* file type, permissions */ 767 __le16 sd_nlink; /* number of hard links */
788 __le16 sd_nlink; /* number of hard links */ 768 __le16 sd_uid; /* owner */
789 __le16 sd_uid; /* owner */ 769 __le16 sd_gid; /* group */
790 __le16 sd_gid; /* group */ 770 __le32 sd_size; /* file size */
791 __le32 sd_size; /* file size */ 771 __le32 sd_atime; /* time of last access */
792 __le32 sd_atime; /* time of last access */ 772 __le32 sd_mtime; /* time file was last modified */
793 __le32 sd_mtime; /* time file was last modified */ 773 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
794 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ 774 union {
795 union { 775 __le32 sd_rdev;
796 __le32 sd_rdev; 776 __le32 sd_blocks; /* number of blocks file uses */
797 __le32 sd_blocks; /* number of blocks file uses */ 777 } __attribute__ ((__packed__)) u;
798 } __attribute__ ((__packed__)) u; 778 __le32 sd_first_direct_byte; /* first byte of file which is stored
799 __le32 sd_first_direct_byte; /* first byte of file which is stored 779 in a direct item: except that if it
800 in a direct item: except that if it 780 equals 1 it is a symlink and if it
801 equals 1 it is a symlink and if it 781 equals ~(__u32)0 there is no
802 equals ~(__u32)0 there is no 782 direct item. The existence of this
803 direct item. The existence of this 783 field really grates on me. Let's
804 field really grates on me. Let's 784 replace it with a macro based on
805 replace it with a macro based on 785 sd_size and our tail suppression
806 sd_size and our tail suppression 786 policy. Someday. -Hans */
807 policy. Someday. -Hans */
808} __attribute__ ((__packed__)); 787} __attribute__ ((__packed__));
809 788
810#define SD_V1_SIZE (sizeof(struct stat_data_v1)) 789#define SD_V1_SIZE (sizeof(struct stat_data_v1))
@@ -862,29 +841,29 @@ struct stat_data_v1
862/* Stat Data on disk (reiserfs version of UFS disk inode minus the 841/* Stat Data on disk (reiserfs version of UFS disk inode minus the
863 address blocks) */ 842 address blocks) */
864struct stat_data { 843struct stat_data {
865 __le16 sd_mode; /* file type, permissions */ 844 __le16 sd_mode; /* file type, permissions */
866 __le16 sd_attrs; /* persistent inode flags */ 845 __le16 sd_attrs; /* persistent inode flags */
867 __le32 sd_nlink; /* number of hard links */ 846 __le32 sd_nlink; /* number of hard links */
868 __le64 sd_size; /* file size */ 847 __le64 sd_size; /* file size */
869 __le32 sd_uid; /* owner */ 848 __le32 sd_uid; /* owner */
870 __le32 sd_gid; /* group */ 849 __le32 sd_gid; /* group */
871 __le32 sd_atime; /* time of last access */ 850 __le32 sd_atime; /* time of last access */
872 __le32 sd_mtime; /* time file was last modified */ 851 __le32 sd_mtime; /* time file was last modified */
873 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ 852 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
874 __le32 sd_blocks; 853 __le32 sd_blocks;
875 union { 854 union {
876 __le32 sd_rdev; 855 __le32 sd_rdev;
877 __le32 sd_generation; 856 __le32 sd_generation;
878 //__le32 sd_first_direct_byte; 857 //__le32 sd_first_direct_byte;
879 /* first byte of file which is stored in a 858 /* first byte of file which is stored in a
880 direct item: except that if it equals 1 859 direct item: except that if it equals 1
881 it is a symlink and if it equals 860 it is a symlink and if it equals
882 ~(__u32)0 there is no direct item. The 861 ~(__u32)0 there is no direct item. The
883 existence of this field really grates 862 existence of this field really grates
884 on me. Let's replace it with a macro 863 on me. Let's replace it with a macro
885 based on sd_size and our tail 864 based on sd_size and our tail
886 suppression policy? */ 865 suppression policy? */
887 } __attribute__ ((__packed__)) u; 866 } __attribute__ ((__packed__)) u;
888} __attribute__ ((__packed__)); 867} __attribute__ ((__packed__));
889// 868//
890// this is 44 bytes long 869// this is 44 bytes long
@@ -919,7 +898,6 @@ struct stat_data {
919#define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) 898#define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs))
920#define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) 899#define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v))
921 900
922
923/***************************************************************************/ 901/***************************************************************************/
924/* DIRECTORY STRUCTURE */ 902/* DIRECTORY STRUCTURE */
925/***************************************************************************/ 903/***************************************************************************/
@@ -954,17 +932,14 @@ struct stat_data {
954/* NOT IMPLEMENTED: 932/* NOT IMPLEMENTED:
955 Directory will someday contain stat data of object */ 933 Directory will someday contain stat data of object */
956 934
957 935struct reiserfs_de_head {
958 936 __le32 deh_offset; /* third component of the directory entry key */
959struct reiserfs_de_head 937 __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced
960{ 938 by directory entry */
961 __le32 deh_offset; /* third component of the directory entry key */ 939 __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */
962 __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced 940 __le16 deh_location; /* offset of name in the whole item */
963 by directory entry */ 941 __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether
964 __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ 942 entry is hidden (unlinked) */
965 __le16 deh_location; /* offset of name in the whole item */
966 __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether
967 entry is hidden (unlinked) */
968} __attribute__ ((__packed__)); 943} __attribute__ ((__packed__));
969#define DEH_SIZE sizeof(struct reiserfs_de_head) 944#define DEH_SIZE sizeof(struct reiserfs_de_head)
970#define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset)) 945#define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset))
@@ -986,7 +961,7 @@ struct reiserfs_de_head
986/* old format directories have this size when empty */ 961/* old format directories have this size when empty */
987#define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3) 962#define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3)
988 963
989#define DEH_Statdata 0 /* not used now */ 964#define DEH_Statdata 0 /* not used now */
990#define DEH_Visible 2 965#define DEH_Visible 2
991 966
992/* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ 967/* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */
@@ -1023,10 +998,10 @@ struct reiserfs_de_head
1023#define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) 998#define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
1024#define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) 999#define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
1025 1000
1026extern void make_empty_dir_item_v1 (char * body, __le32 dirid, __le32 objid, 1001extern void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid,
1027 __le32 par_dirid, __le32 par_objid); 1002 __le32 par_dirid, __le32 par_objid);
1028extern void make_empty_dir_item (char * body, __le32 dirid, __le32 objid, 1003extern void make_empty_dir_item(char *body, __le32 dirid, __le32 objid,
1029 __le32 par_dirid, __le32 par_objid); 1004 __le32 par_dirid, __le32 par_objid);
1030 1005
1031/* array of the entry headers */ 1006/* array of the entry headers */
1032 /* get item body */ 1007 /* get item body */
@@ -1043,53 +1018,48 @@ extern void make_empty_dir_item (char * body, __le32 dirid, __le32 objid,
1043#define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \ 1018#define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \
1044((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh)))) 1019((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh))))
1045*/ 1020*/
1046static inline int entry_length (const struct buffer_head * bh, 1021static inline int entry_length(const struct buffer_head *bh,
1047 const struct item_head * ih, int pos_in_item) 1022 const struct item_head *ih, int pos_in_item)
1048{ 1023{
1049 struct reiserfs_de_head * deh; 1024 struct reiserfs_de_head *deh;
1050 1025
1051 deh = B_I_DEH (bh, ih) + pos_in_item; 1026 deh = B_I_DEH(bh, ih) + pos_in_item;
1052 if (pos_in_item) 1027 if (pos_in_item)
1053 return deh_location(deh-1) - deh_location(deh); 1028 return deh_location(deh - 1) - deh_location(deh);
1054 1029
1055 return ih_item_len(ih) - deh_location(deh); 1030 return ih_item_len(ih) - deh_location(deh);
1056} 1031}
1057 1032
1058
1059
1060/* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */ 1033/* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */
1061#define I_ENTRY_COUNT(ih) (ih_entry_count((ih))) 1034#define I_ENTRY_COUNT(ih) (ih_entry_count((ih)))
1062 1035
1063
1064/* name by bh, ih and entry_num */ 1036/* name by bh, ih and entry_num */
1065#define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) 1037#define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num))))
1066 1038
1067// two entries per block (at least) 1039// two entries per block (at least)
1068#define REISERFS_MAX_NAME(block_size) 255 1040#define REISERFS_MAX_NAME(block_size) 255
1069 1041
1070
1071/* this structure is used for operations on directory entries. It is 1042/* this structure is used for operations on directory entries. It is
1072 not a disk structure. */ 1043 not a disk structure. */
1073/* When reiserfs_find_entry or search_by_entry_key find directory 1044/* When reiserfs_find_entry or search_by_entry_key find directory
1074 entry, they return filled reiserfs_dir_entry structure */ 1045 entry, they return filled reiserfs_dir_entry structure */
1075struct reiserfs_dir_entry 1046struct reiserfs_dir_entry {
1076{ 1047 struct buffer_head *de_bh;
1077 struct buffer_head * de_bh; 1048 int de_item_num;
1078 int de_item_num; 1049 struct item_head *de_ih;
1079 struct item_head * de_ih; 1050 int de_entry_num;
1080 int de_entry_num; 1051 struct reiserfs_de_head *de_deh;
1081 struct reiserfs_de_head * de_deh; 1052 int de_entrylen;
1082 int de_entrylen; 1053 int de_namelen;
1083 int de_namelen; 1054 char *de_name;
1084 char * de_name; 1055 char *de_gen_number_bit_string;
1085 char * de_gen_number_bit_string; 1056
1086 1057 __u32 de_dir_id;
1087 __u32 de_dir_id; 1058 __u32 de_objectid;
1088 __u32 de_objectid; 1059
1089 1060 struct cpu_key de_entry_key;
1090 struct cpu_key de_entry_key;
1091}; 1061};
1092 1062
1093/* these defines are useful when a particular member of a reiserfs_dir_entry is needed */ 1063/* these defines are useful when a particular member of a reiserfs_dir_entry is needed */
1094 1064
1095/* pointer to file name, stored in entry */ 1065/* pointer to file name, stored in entry */
@@ -1099,8 +1069,6 @@ struct reiserfs_dir_entry
1099#define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \ 1069#define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \
1100(I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0)) 1070(I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0))
1101 1071
1102
1103
1104/* hash value occupies bits from 7 up to 30 */ 1072/* hash value occupies bits from 7 up to 30 */
1105#define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL) 1073#define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL)
1106/* generation number occupies 7 bits starting from 0 up to 6 */ 1074/* generation number occupies 7 bits starting from 0 up to 6 */
@@ -1109,7 +1077,6 @@ struct reiserfs_dir_entry
1109 1077
1110#define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number)) 1078#define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number))
1111 1079
1112
1113/* 1080/*
1114 * Picture represents an internal node of the reiserfs tree 1081 * Picture represents an internal node of the reiserfs tree
1115 * ______________________________________________________ 1082 * ______________________________________________________
@@ -1125,9 +1092,9 @@ struct reiserfs_dir_entry
1125/* Disk child pointer: The pointer from an internal node of the tree 1092/* Disk child pointer: The pointer from an internal node of the tree
1126 to a node that is on disk. */ 1093 to a node that is on disk. */
1127struct disk_child { 1094struct disk_child {
1128 __le32 dc_block_number; /* Disk child's block number. */ 1095 __le32 dc_block_number; /* Disk child's block number. */
1129 __le16 dc_size; /* Disk child's used space. */ 1096 __le16 dc_size; /* Disk child's used space. */
1130 __le16 dc_reserved; 1097 __le16 dc_reserved;
1131}; 1098};
1132 1099
1133#define DC_SIZE (sizeof(struct disk_child)) 1100#define DC_SIZE (sizeof(struct disk_child))
@@ -1144,7 +1111,7 @@ struct disk_child {
1144#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) 1111#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos)))
1145#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) 1112#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val ))
1146 1113
1147 /* maximal value of field child_size in structure disk_child */ 1114 /* maximal value of field child_size in structure disk_child */
1148 /* child size is the combined size of all items and their headers */ 1115 /* child size is the combined size of all items and their headers */
1149#define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE )) 1116#define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE ))
1150 1117
@@ -1159,7 +1126,6 @@ struct disk_child {
1159/* PATH STRUCTURES AND DEFINES */ 1126/* PATH STRUCTURES AND DEFINES */
1160/***************************************************************************/ 1127/***************************************************************************/
1161 1128
1162
1163/* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the 1129/* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the
1164 key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it 1130 key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it
1165 does not find them in the cache it reads them from disk. For each node search_by_key finds using 1131 does not find them in the cache it reads them from disk. For each node search_by_key finds using
@@ -1168,20 +1134,18 @@ struct disk_child {
1168 is looking through a leaf node bin_search will find the position of the item which has key either 1134 is looking through a leaf node bin_search will find the position of the item which has key either
1169 equal to given key, or which is the maximal key less than the given key. */ 1135 equal to given key, or which is the maximal key less than the given key. */
1170 1136
1171struct path_element { 1137struct path_element {
1172 struct buffer_head * pe_buffer; /* Pointer to the buffer at the path in the tree. */ 1138 struct buffer_head *pe_buffer; /* Pointer to the buffer at the path in the tree. */
1173 int pe_position; /* Position in the tree node which is placed in the */ 1139 int pe_position; /* Position in the tree node which is placed in the */
1174 /* buffer above. */ 1140 /* buffer above. */
1175}; 1141};
1176 1142
1177#define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */ 1143#define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */
1178#define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */ 1144#define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */
1179#define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */ 1145#define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */
1180
1181#define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */
1182#define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */
1183
1184 1146
1147#define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */
1148#define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */
1185 1149
1186/* We need to keep track of who the ancestors of nodes are. When we 1150/* We need to keep track of who the ancestors of nodes are. When we
1187 perform a search we record which nodes were visited while 1151 perform a search we record which nodes were visited while
@@ -1200,14 +1164,14 @@ excessive effort to avoid disturbing the precious VFS code.:-( The
1200gods only know how we are going to SMP the code that uses them. 1164gods only know how we are going to SMP the code that uses them.
1201znodes are the way! */ 1165znodes are the way! */
1202 1166
1203#define PATH_READA 0x1 /* do read ahead */ 1167#define PATH_READA 0x1 /* do read ahead */
1204#define PATH_READA_BACK 0x2 /* read backwards */ 1168#define PATH_READA_BACK 0x2 /* read backwards */
1205 1169
1206struct path { 1170struct path {
1207 int path_length; /* Length of the array above. */ 1171 int path_length; /* Length of the array above. */
1208 int reada; 1172 int reada;
1209 struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */ 1173 struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */
1210 int pos_in_item; 1174 int pos_in_item;
1211}; 1175};
1212 1176
1213#define pos_in_item(path) ((path)->pos_in_item) 1177#define pos_in_item(path) ((path)->pos_in_item)
@@ -1224,25 +1188,23 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1224/* Get position in the element at the path by path and path position. */ 1188/* Get position in the element at the path by path and path position. */
1225#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) 1189#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position)
1226 1190
1227
1228#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) 1191#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length))
1229 /* you know, to the person who didn't 1192 /* you know, to the person who didn't
1230 write this the macro name does not 1193 write this the macro name does not
1231 at first suggest what it does. 1194 at first suggest what it does.
1232 Maybe POSITION_FROM_PATH_END? Or 1195 Maybe POSITION_FROM_PATH_END? Or
1233 maybe we should just focus on 1196 maybe we should just focus on
1234 dumping paths... -Hans */ 1197 dumping paths... -Hans */
1235#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) 1198#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length))
1236 1199
1237
1238#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) 1200#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path))
1239 1201
1240/* in do_balance leaf has h == 0 in contrast with path structure, 1202/* in do_balance leaf has h == 0 in contrast with path structure,
1241 where root has level == 0. That is why we need these defines */ 1203 where root has level == 0. That is why we need these defines */
1242#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ 1204#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */
1243#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ 1205#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */
1244#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) 1206#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h))
1245#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ 1207#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */
1246 1208
1247#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) 1209#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h))
1248 1210
@@ -1253,7 +1215,6 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1253#define item_moved(ih,path) comp_items(ih, path) 1215#define item_moved(ih,path) comp_items(ih, path)
1254#define path_changed(ih,path) comp_items (ih, path) 1216#define path_changed(ih,path) comp_items (ih, path)
1255 1217
1256
1257/***************************************************************************/ 1218/***************************************************************************/
1258/* MISC */ 1219/* MISC */
1259/***************************************************************************/ 1220/***************************************************************************/
@@ -1272,30 +1233,26 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1272// reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset 1233// reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset
1273#define U32_MAX (~(__u32)0) 1234#define U32_MAX (~(__u32)0)
1274 1235
1275static inline loff_t max_reiserfs_offset (struct inode * inode) 1236static inline loff_t max_reiserfs_offset(struct inode *inode)
1276{ 1237{
1277 if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) 1238 if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5)
1278 return (loff_t)U32_MAX; 1239 return (loff_t) U32_MAX;
1279 1240
1280 return (loff_t)((~(__u64)0) >> 4); 1241 return (loff_t) ((~(__u64) 0) >> 4);
1281} 1242}
1282 1243
1283
1284/*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/ 1244/*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/
1285#define MAX_KEY_OBJECTID MAX_UL_INT 1245#define MAX_KEY_OBJECTID MAX_UL_INT
1286 1246
1287
1288#define MAX_B_NUM MAX_UL_INT 1247#define MAX_B_NUM MAX_UL_INT
1289#define MAX_FC_NUM MAX_US_INT 1248#define MAX_FC_NUM MAX_US_INT
1290 1249
1291
1292/* the purpose is to detect overflow of an unsigned short */ 1250/* the purpose is to detect overflow of an unsigned short */
1293#define REISERFS_LINK_MAX (MAX_US_INT - 1000) 1251#define REISERFS_LINK_MAX (MAX_US_INT - 1000)
1294 1252
1295
1296/* The following defines are used in reiserfs_insert_item and reiserfs_append_item */ 1253/* The following defines are used in reiserfs_insert_item and reiserfs_append_item */
1297#define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */ 1254#define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */
1298#define REISERFS_USER_MEM 1 /* reiserfs user memory mode */ 1255#define REISERFS_USER_MEM 1 /* reiserfs user memory mode */
1299 1256
1300#define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) 1257#define fs_generation(s) (REISERFS_SB(s)->s_generation_counter)
1301#define get_generation(s) atomic_read (&fs_generation(s)) 1258#define get_generation(s) atomic_read (&fs_generation(s))
@@ -1303,7 +1260,6 @@ static inline loff_t max_reiserfs_offset (struct inode * inode)
1303#define __fs_changed(gen,s) (gen != get_generation (s)) 1260#define __fs_changed(gen,s) (gen != get_generation (s))
1304#define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);}) 1261#define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);})
1305 1262
1306
1307/***************************************************************************/ 1263/***************************************************************************/
1308/* FIXATE NODES */ 1264/* FIXATE NODES */
1309/***************************************************************************/ 1265/***************************************************************************/
@@ -1324,38 +1280,34 @@ static inline loff_t max_reiserfs_offset (struct inode * inode)
1324 calculating what we can shift to neighbors and how many nodes we 1280 calculating what we can shift to neighbors and how many nodes we
1325 have to have if we do not any shiftings, if we shift to left/right 1281 have to have if we do not any shiftings, if we shift to left/right
1326 neighbor or to both. */ 1282 neighbor or to both. */
1327struct virtual_item 1283struct virtual_item {
1328{ 1284 int vi_index; // index in the array of item operations
1329 int vi_index; // index in the array of item operations 1285 unsigned short vi_type; // left/right mergeability
1330 unsigned short vi_type; // left/right mergeability 1286 unsigned short vi_item_len; /* length of item that it will have after balancing */
1331 unsigned short vi_item_len; /* length of item that it will have after balancing */ 1287 struct item_head *vi_ih;
1332 struct item_head * vi_ih; 1288 const char *vi_item; // body of item (old or new)
1333 const char * vi_item; // body of item (old or new) 1289 const void *vi_new_data; // 0 always but paste mode
1334 const void * vi_new_data; // 0 always but paste mode 1290 void *vi_uarea; // item specific area
1335 void * vi_uarea; // item specific area
1336}; 1291};
1337 1292
1338 1293struct virtual_node {
1339struct virtual_node 1294 char *vn_free_ptr; /* this is a pointer to the free space in the buffer */
1340{ 1295 unsigned short vn_nr_item; /* number of items in virtual node */
1341 char * vn_free_ptr; /* this is a pointer to the free space in the buffer */ 1296 short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */
1342 unsigned short vn_nr_item; /* number of items in virtual node */ 1297 short vn_mode; /* mode of balancing (paste, insert, delete, cut) */
1343 short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */ 1298 short vn_affected_item_num;
1344 short vn_mode; /* mode of balancing (paste, insert, delete, cut) */ 1299 short vn_pos_in_item;
1345 short vn_affected_item_num; 1300 struct item_head *vn_ins_ih; /* item header of inserted item, 0 for other modes */
1346 short vn_pos_in_item; 1301 const void *vn_data;
1347 struct item_head * vn_ins_ih; /* item header of inserted item, 0 for other modes */ 1302 struct virtual_item *vn_vi; /* array of items (including a new one, excluding item to be deleted) */
1348 const void * vn_data;
1349 struct virtual_item * vn_vi; /* array of items (including a new one, excluding item to be deleted) */
1350}; 1303};
1351 1304
1352/* used by directory items when creating virtual nodes */ 1305/* used by directory items when creating virtual nodes */
1353struct direntry_uarea { 1306struct direntry_uarea {
1354 int flags; 1307 int flags;
1355 __u16 entry_count; 1308 __u16 entry_count;
1356 __u16 entry_sizes[1]; 1309 __u16 entry_sizes[1];
1357} __attribute__ ((__packed__)) ; 1310} __attribute__ ((__packed__));
1358
1359 1311
1360/***************************************************************************/ 1312/***************************************************************************/
1361/* TREE BALANCE */ 1313/* TREE BALANCE */
@@ -1378,73 +1330,72 @@ struct direntry_uarea {
1378#define MAX_AMOUNT_NEEDED 2 1330#define MAX_AMOUNT_NEEDED 2
1379 1331
1380/* someday somebody will prefix every field in this struct with tb_ */ 1332/* someday somebody will prefix every field in this struct with tb_ */
1381struct tree_balance 1333struct tree_balance {
1382{ 1334 int tb_mode;
1383 int tb_mode; 1335 int need_balance_dirty;
1384 int need_balance_dirty; 1336 struct super_block *tb_sb;
1385 struct super_block * tb_sb; 1337 struct reiserfs_transaction_handle *transaction_handle;
1386 struct reiserfs_transaction_handle *transaction_handle ; 1338 struct path *tb_path;
1387 struct path * tb_path; 1339 struct buffer_head *L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */
1388 struct buffer_head * L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */ 1340 struct buffer_head *R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path */
1389 struct buffer_head * R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path*/ 1341 struct buffer_head *FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */
1390 struct buffer_head * FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */ 1342 struct buffer_head *FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */
1391 struct buffer_head * FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */ 1343 struct buffer_head *CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */
1392 struct buffer_head * CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */ 1344 struct buffer_head *CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */
1393 struct buffer_head * CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */ 1345
1394 1346 struct buffer_head *FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals
1395 struct buffer_head * FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals 1347 cur_blknum. */
1396 cur_blknum. */ 1348 struct buffer_head *used[MAX_FEB_SIZE];
1397 struct buffer_head * used[MAX_FEB_SIZE]; 1349 struct buffer_head *thrown[MAX_FEB_SIZE];
1398 struct buffer_head * thrown[MAX_FEB_SIZE]; 1350 int lnum[MAX_HEIGHT]; /* array of number of items which must be
1399 int lnum[MAX_HEIGHT]; /* array of number of items which must be 1351 shifted to the left in order to balance the
1400 shifted to the left in order to balance the 1352 current node; for leaves includes item that
1401 current node; for leaves includes item that 1353 will be partially shifted; for internal
1402 will be partially shifted; for internal 1354 nodes, it is the number of child pointers
1403 nodes, it is the number of child pointers 1355 rather than items. It includes the new item
1404 rather than items. It includes the new item 1356 being created. The code sometimes subtracts
1405 being created. The code sometimes subtracts 1357 one to get the number of wholly shifted
1406 one to get the number of wholly shifted 1358 items for other purposes. */
1407 items for other purposes. */ 1359 int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */
1408 int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */ 1360 int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and
1409 int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and 1361 S[h] to its item number within the node CFL[h] */
1410 S[h] to its item number within the node CFL[h] */ 1362 int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */
1411 int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */ 1363 int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from
1412 int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from 1364 S[h]. A negative value means removing. */
1413 S[h]. A negative value means removing. */ 1365 int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after
1414 int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after 1366 balancing on the level h of the tree. If 0 then S is
1415 balancing on the level h of the tree. If 0 then S is 1367 being deleted, if 1 then S is remaining and no new nodes
1416 being deleted, if 1 then S is remaining and no new nodes 1368 are being created, if 2 or 3 then 1 or 2 new nodes is
1417 are being created, if 2 or 3 then 1 or 2 new nodes is 1369 being created */
1418 being created */ 1370
1419 1371 /* fields that are used only for balancing leaves of the tree */
1420 /* fields that are used only for balancing leaves of the tree */ 1372 int cur_blknum; /* number of empty blocks having been already allocated */
1421 int cur_blknum; /* number of empty blocks having been already allocated */ 1373 int s0num; /* number of items that fall into left most node when S[0] splits */
1422 int s0num; /* number of items that fall into left most node when S[0] splits */ 1374 int s1num; /* number of items that fall into first new node when S[0] splits */
1423 int s1num; /* number of items that fall into first new node when S[0] splits */ 1375 int s2num; /* number of items that fall into second new node when S[0] splits */
1424 int s2num; /* number of items that fall into second new node when S[0] splits */ 1376 int lbytes; /* number of bytes which can flow to the left neighbor from the left */
1425 int lbytes; /* number of bytes which can flow to the left neighbor from the left */ 1377 /* most liquid item that cannot be shifted from S[0] entirely */
1426 /* most liquid item that cannot be shifted from S[0] entirely */ 1378 /* if -1 then nothing will be partially shifted */
1427 /* if -1 then nothing will be partially shifted */ 1379 int rbytes; /* number of bytes which will flow to the right neighbor from the right */
1428 int rbytes; /* number of bytes which will flow to the right neighbor from the right */ 1380 /* most liquid item that cannot be shifted from S[0] entirely */
1429 /* most liquid item that cannot be shifted from S[0] entirely */ 1381 /* if -1 then nothing will be partially shifted */
1430 /* if -1 then nothing will be partially shifted */ 1382 int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */
1431 int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */ 1383 /* note: if S[0] splits into 3 nodes, then items do not need to be cut */
1432 /* note: if S[0] splits into 3 nodes, then items do not need to be cut */ 1384 int s2bytes;
1433 int s2bytes; 1385 struct buffer_head *buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */
1434 struct buffer_head * buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */ 1386 char *vn_buf; /* kmalloced memory. Used to create
1435 char * vn_buf; /* kmalloced memory. Used to create
1436 virtual node and keep map of 1387 virtual node and keep map of
1437 dirtied bitmap blocks */ 1388 dirtied bitmap blocks */
1438 int vn_buf_size; /* size of the vn_buf */ 1389 int vn_buf_size; /* size of the vn_buf */
1439 struct virtual_node * tb_vn; /* VN starts after bitmap of bitmap blocks */ 1390 struct virtual_node *tb_vn; /* VN starts after bitmap of bitmap blocks */
1440 1391
1441 int fs_gen; /* saved value of `reiserfs_generation' counter 1392 int fs_gen; /* saved value of `reiserfs_generation' counter
1442 see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ 1393 see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */
1443#ifdef DISPLACE_NEW_PACKING_LOCALITIES 1394#ifdef DISPLACE_NEW_PACKING_LOCALITIES
1444 struct in_core_key key; /* key pointer, to pass to block allocator or 1395 struct in_core_key key; /* key pointer, to pass to block allocator or
1445 another low-level subsystem */ 1396 another low-level subsystem */
1446#endif 1397#endif
1447} ; 1398};
1448 1399
1449/* These are modes of balancing */ 1400/* These are modes of balancing */
1450 1401
@@ -1479,13 +1430,12 @@ struct tree_balance
1479/* used in do_balance for passing parent of node information that has 1430/* used in do_balance for passing parent of node information that has
1480 been gotten from tb struct */ 1431 been gotten from tb struct */
1481struct buffer_info { 1432struct buffer_info {
1482 struct tree_balance * tb; 1433 struct tree_balance *tb;
1483 struct buffer_head * bi_bh; 1434 struct buffer_head *bi_bh;
1484 struct buffer_head * bi_parent; 1435 struct buffer_head *bi_parent;
1485 int bi_position; 1436 int bi_position;
1486}; 1437};
1487 1438
1488
1489/* there are 4 types of items: stat data, directory item, indirect, direct. 1439/* there are 4 types of items: stat data, directory item, indirect, direct.
1490+-------------------+------------+--------------+------------+ 1440+-------------------+------------+--------------+------------+
1491| | k_offset | k_uniqueness | mergeable? | 1441| | k_offset | k_uniqueness | mergeable? |
@@ -1503,24 +1453,24 @@ struct buffer_info {
1503*/ 1453*/
1504 1454
1505struct item_operations { 1455struct item_operations {
1506 int (*bytes_number) (struct item_head * ih, int block_size); 1456 int (*bytes_number) (struct item_head * ih, int block_size);
1507 void (*decrement_key) (struct cpu_key *); 1457 void (*decrement_key) (struct cpu_key *);
1508 int (*is_left_mergeable) (struct reiserfs_key * ih, unsigned long bsize); 1458 int (*is_left_mergeable) (struct reiserfs_key * ih,
1509 void (*print_item) (struct item_head *, char * item); 1459 unsigned long bsize);
1510 void (*check_item) (struct item_head *, char * item); 1460 void (*print_item) (struct item_head *, char *item);
1511 1461 void (*check_item) (struct item_head *, char *item);
1512 int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, 1462
1513 int is_affected, int insert_size); 1463 int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi,
1514 int (*check_left) (struct virtual_item * vi, int free, 1464 int is_affected, int insert_size);
1515 int start_skip, int end_skip); 1465 int (*check_left) (struct virtual_item * vi, int free,
1516 int (*check_right) (struct virtual_item * vi, int free); 1466 int start_skip, int end_skip);
1517 int (*part_size) (struct virtual_item * vi, int from, int to); 1467 int (*check_right) (struct virtual_item * vi, int free);
1518 int (*unit_num) (struct virtual_item * vi); 1468 int (*part_size) (struct virtual_item * vi, int from, int to);
1519 void (*print_vi) (struct virtual_item * vi); 1469 int (*unit_num) (struct virtual_item * vi);
1470 void (*print_vi) (struct virtual_item * vi);
1520}; 1471};
1521 1472
1522 1473extern struct item_operations *item_ops[TYPE_ANY + 1];
1523extern struct item_operations * item_ops [TYPE_ANY + 1];
1524 1474
1525#define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) 1475#define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize)
1526#define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize) 1476#define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize)
@@ -1533,8 +1483,6 @@ extern struct item_operations * item_ops [TYPE_ANY + 1];
1533#define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi) 1483#define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi)
1534#define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi) 1484#define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi)
1535 1485
1536
1537
1538#define COMP_SHORT_KEYS comp_short_keys 1486#define COMP_SHORT_KEYS comp_short_keys
1539 1487
1540/* number of blocks pointed to by the indirect item */ 1488/* number of blocks pointed to by the indirect item */
@@ -1545,8 +1493,7 @@ extern struct item_operations * item_ops [TYPE_ANY + 1];
1545 1493
1546/* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */ 1494/* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */
1547 1495
1548 1496/* get the item header */
1549/* get the item header */
1550#define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) ) 1497#define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) )
1551 1498
1552/* get key */ 1499/* get key */
@@ -1577,9 +1524,9 @@ extern struct item_operations * item_ops [TYPE_ANY + 1];
1577#define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0) 1524#define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0)
1578 1525
1579struct reiserfs_iget_args { 1526struct reiserfs_iget_args {
1580 __u32 objectid ; 1527 __u32 objectid;
1581 __u32 dirid ; 1528 __u32 dirid;
1582} ; 1529};
1583 1530
1584/***************************************************************************/ 1531/***************************************************************************/
1585/* FUNCTION DECLARATIONS */ 1532/* FUNCTION DECLARATIONS */
@@ -1595,11 +1542,11 @@ struct reiserfs_iget_args {
1595 1542
1596/* first block written in a commit. */ 1543/* first block written in a commit. */
1597struct reiserfs_journal_desc { 1544struct reiserfs_journal_desc {
1598 __le32 j_trans_id ; /* id of commit */ 1545 __le32 j_trans_id; /* id of commit */
1599 __le32 j_len ; /* length of commit. len +1 is the commit block */ 1546 __le32 j_len; /* length of commit. len +1 is the commit block */
1600 __le32 j_mount_id ; /* mount id of this trans*/ 1547 __le32 j_mount_id; /* mount id of this trans */
1601 __le32 j_realblock[1] ; /* real locations for each block */ 1548 __le32 j_realblock[1]; /* real locations for each block */
1602} ; 1549};
1603 1550
1604#define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) 1551#define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id)
1605#define get_desc_trans_len(d) le32_to_cpu((d)->j_len) 1552#define get_desc_trans_len(d) le32_to_cpu((d)->j_len)
@@ -1611,10 +1558,10 @@ struct reiserfs_journal_desc {
1611 1558
1612/* last block written in a commit */ 1559/* last block written in a commit */
1613struct reiserfs_journal_commit { 1560struct reiserfs_journal_commit {
1614 __le32 j_trans_id ; /* must match j_trans_id from the desc block */ 1561 __le32 j_trans_id; /* must match j_trans_id from the desc block */
1615 __le32 j_len ; /* ditto */ 1562 __le32 j_len; /* ditto */
1616 __le32 j_realblock[1] ; /* real locations for each block */ 1563 __le32 j_realblock[1]; /* real locations for each block */
1617} ; 1564};
1618 1565
1619#define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) 1566#define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id)
1620#define get_commit_trans_len(c) le32_to_cpu((c)->j_len) 1567#define get_commit_trans_len(c) le32_to_cpu((c)->j_len)
@@ -1628,27 +1575,34 @@ struct reiserfs_journal_commit {
1628** and this transaction does not need to be replayed. 1575** and this transaction does not need to be replayed.
1629*/ 1576*/
1630struct reiserfs_journal_header { 1577struct reiserfs_journal_header {
1631 __le32 j_last_flush_trans_id ; /* id of last fully flushed transaction */ 1578 __le32 j_last_flush_trans_id; /* id of last fully flushed transaction */
1632 __le32 j_first_unflushed_offset ; /* offset in the log of where to start replay after a crash */ 1579 __le32 j_first_unflushed_offset; /* offset in the log of where to start replay after a crash */
1633 __le32 j_mount_id ; 1580 __le32 j_mount_id;
1634 /* 12 */ struct journal_params jh_journal; 1581 /* 12 */ struct journal_params jh_journal;
1635} ; 1582};
1636 1583
1637/* biggest tunable defines are right here */ 1584/* biggest tunable defines are right here */
1638#define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ 1585#define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */
1639#define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ 1586#define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */
1640#define JOURNAL_TRANS_MIN_DEFAULT 256 1587#define JOURNAL_TRANS_MIN_DEFAULT 256
1641#define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */ 1588#define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */
1642#define JOURNAL_MIN_RATIO 2 1589#define JOURNAL_MIN_RATIO 2
1643#define JOURNAL_MAX_COMMIT_AGE 30 1590#define JOURNAL_MAX_COMMIT_AGE 30
1644#define JOURNAL_MAX_TRANS_AGE 30 1591#define JOURNAL_MAX_TRANS_AGE 30
1645#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) 1592#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
1646#ifdef CONFIG_QUOTA 1593#ifdef CONFIG_QUOTA
1647#define REISERFS_QUOTA_TRANS_BLOCKS 2 /* We need to update data and inode (atime) */ 1594/* 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 */ 1595#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0)
1596/* 1 balancing, 1 bitmap, 1 data per write + stat data update */
1597#define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \
1598(DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0)
1599/* same as with INIT */
1600#define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \
1601(DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0)
1649#else 1602#else
1650#define REISERFS_QUOTA_TRANS_BLOCKS 0 1603#define REISERFS_QUOTA_TRANS_BLOCKS(s) 0
1651#define REISERFS_QUOTA_INIT_BLOCKS 0 1604#define REISERFS_QUOTA_INIT_BLOCKS(s) 0
1605#define REISERFS_QUOTA_DEL_BLOCKS(s) 0
1652#endif 1606#endif
1653 1607
1654/* both of these can be as low as 1, or as high as you want. The min is the 1608/* both of these can be as low as 1, or as high as you want. The min is the
@@ -1657,10 +1611,10 @@ struct reiserfs_journal_header {
1657** the current number of nodes is > max, the node is freed, otherwise, 1611** the current number of nodes is > max, the node is freed, otherwise,
1658** it is put on a free list for faster use later. 1612** it is put on a free list for faster use later.
1659*/ 1613*/
1660#define REISERFS_MIN_BITMAP_NODES 10 1614#define REISERFS_MIN_BITMAP_NODES 10
1661#define REISERFS_MAX_BITMAP_NODES 100 1615#define REISERFS_MAX_BITMAP_NODES 100
1662 1616
1663#define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */ 1617#define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */
1664#define JBH_HASH_MASK 8191 1618#define JBH_HASH_MASK 8191
1665 1619
1666#define _jhashfn(sb,block) \ 1620#define _jhashfn(sb,block) \
@@ -1674,14 +1628,14 @@ struct reiserfs_journal_header {
1674#define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) 1628#define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
1675 1629
1676enum reiserfs_bh_state_bits { 1630enum reiserfs_bh_state_bits {
1677 BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */ 1631 BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */
1678 BH_JDirty_wait, 1632 BH_JDirty_wait,
1679 BH_JNew, /* disk block was taken off free list before 1633 BH_JNew, /* disk block was taken off free list before
1680 * being in a finished transaction, or 1634 * being in a finished transaction, or
1681 * written to disk. Can be reused immed. */ 1635 * written to disk. Can be reused immed. */
1682 BH_JPrepared, 1636 BH_JPrepared,
1683 BH_JRestore_dirty, 1637 BH_JRestore_dirty,
1684 BH_JTest, // debugging only will go away 1638 BH_JTest, // debugging only will go away
1685}; 1639};
1686 1640
1687BUFFER_FNS(JDirty, journaled); 1641BUFFER_FNS(JDirty, journaled);
@@ -1701,175 +1655,192 @@ TAS_BUFFER_FNS(JTest, journal_test);
1701** transaction handle which is passed around for all journal calls 1655** transaction handle which is passed around for all journal calls
1702*/ 1656*/
1703struct reiserfs_transaction_handle { 1657struct reiserfs_transaction_handle {
1704 struct super_block *t_super ; /* super for this FS when journal_begin was 1658 struct super_block *t_super; /* super for this FS when journal_begin was
1705 called. saves calls to reiserfs_get_super 1659 called. saves calls to reiserfs_get_super
1706 also used by nested transactions to make 1660 also used by nested transactions to make
1707 sure they are nesting on the right FS 1661 sure they are nesting on the right FS
1708 _must_ be first in the handle 1662 _must_ be first in the handle
1709 */ 1663 */
1710 int t_refcount; 1664 int t_refcount;
1711 int t_blocks_logged ; /* number of blocks this writer has logged */ 1665 int t_blocks_logged; /* number of blocks this writer has logged */
1712 int t_blocks_allocated ; /* number of blocks this writer allocated */ 1666 int t_blocks_allocated; /* number of blocks this writer allocated */
1713 unsigned long t_trans_id ; /* sanity check, equals the current trans id */ 1667 unsigned long t_trans_id; /* sanity check, equals the current trans id */
1714 void *t_handle_save ; /* save existing current->journal_info */ 1668 void *t_handle_save; /* save existing current->journal_info */
1715 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block 1669 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block
1716 should be displaced from others */ 1670 should be displaced from others */
1717 struct list_head t_list; 1671 struct list_head t_list;
1718} ; 1672};
1719 1673
1720/* used to keep track of ordered and tail writes, attached to the buffer 1674/* used to keep track of ordered and tail writes, attached to the buffer
1721 * head through b_journal_head. 1675 * head through b_journal_head.
1722 */ 1676 */
1723struct reiserfs_jh { 1677struct reiserfs_jh {
1724 struct reiserfs_journal_list *jl; 1678 struct reiserfs_journal_list *jl;
1725 struct buffer_head *bh; 1679 struct buffer_head *bh;
1726 struct list_head list; 1680 struct list_head list;
1727}; 1681};
1728 1682
1729void reiserfs_free_jh(struct buffer_head *bh); 1683void reiserfs_free_jh(struct buffer_head *bh);
1730int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); 1684int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh);
1731int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); 1685int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh);
1732int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; 1686int journal_mark_dirty(struct reiserfs_transaction_handle *,
1733 1687 struct super_block *, struct buffer_head *bh);
1734static inline int 1688
1735reiserfs_file_data_log(struct inode *inode) { 1689static inline int reiserfs_file_data_log(struct inode *inode)
1736 if (reiserfs_data_log(inode->i_sb) || 1690{
1737 (REISERFS_I(inode)->i_flags & i_data_log)) 1691 if (reiserfs_data_log(inode->i_sb) ||
1738 return 1 ; 1692 (REISERFS_I(inode)->i_flags & i_data_log))
1739 return 0 ; 1693 return 1;
1694 return 0;
1740} 1695}
1741 1696
1742static inline int reiserfs_transaction_running(struct super_block *s) { 1697static inline int reiserfs_transaction_running(struct super_block *s)
1743 struct reiserfs_transaction_handle *th = current->journal_info ; 1698{
1744 if (th && th->t_super == s) 1699 struct reiserfs_transaction_handle *th = current->journal_info;
1745 return 1 ; 1700 if (th && th->t_super == s)
1746 if (th && th->t_super == NULL) 1701 return 1;
1747 BUG(); 1702 if (th && th->t_super == NULL)
1748 return 0 ; 1703 BUG();
1704 return 0;
1749} 1705}
1750 1706
1751int reiserfs_async_progress_wait(struct super_block *s); 1707int reiserfs_async_progress_wait(struct super_block *s);
1752 1708
1753struct reiserfs_transaction_handle * 1709struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
1754reiserfs_persistent_transaction(struct super_block *, int count); 1710 super_block
1711 *,
1712 int count);
1755int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); 1713int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *);
1756int reiserfs_commit_page(struct inode *inode, struct page *page, 1714int reiserfs_commit_page(struct inode *inode, struct page *page,
1757 unsigned from, unsigned to); 1715 unsigned from, unsigned to);
1758int reiserfs_flush_old_commits(struct super_block *); 1716int reiserfs_flush_old_commits(struct super_block *);
1759int reiserfs_commit_for_inode(struct inode *) ; 1717int reiserfs_commit_for_inode(struct inode *);
1760int reiserfs_inode_needs_commit(struct inode *) ; 1718int reiserfs_inode_needs_commit(struct inode *);
1761void reiserfs_update_inode_transaction(struct inode *) ; 1719void reiserfs_update_inode_transaction(struct inode *);
1762void reiserfs_wait_on_write_block(struct super_block *s) ; 1720void reiserfs_wait_on_write_block(struct super_block *s);
1763void reiserfs_block_writes(struct reiserfs_transaction_handle *th) ; 1721void reiserfs_block_writes(struct reiserfs_transaction_handle *th);
1764void reiserfs_allow_writes(struct super_block *s) ; 1722void reiserfs_allow_writes(struct super_block *s);
1765void reiserfs_check_lock_depth(struct super_block *s, char *caller) ; 1723void reiserfs_check_lock_depth(struct super_block *s, char *caller);
1766int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ; 1724int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh,
1767void reiserfs_restore_prepared_buffer(struct super_block *, struct buffer_head *bh) ; 1725 int wait);
1768int journal_init(struct super_block *, const char * j_dev_name, int old_format, unsigned int) ; 1726void reiserfs_restore_prepared_buffer(struct super_block *,
1769int journal_release(struct reiserfs_transaction_handle*, struct super_block *) ; 1727 struct buffer_head *bh);
1770int journal_release_error(struct reiserfs_transaction_handle*, struct super_block *) ; 1728int journal_init(struct super_block *, const char *j_dev_name, int old_format,
1771int journal_end(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; 1729 unsigned int);
1772int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; 1730int journal_release(struct reiserfs_transaction_handle *, struct super_block *);
1773int journal_mark_freed(struct reiserfs_transaction_handle *, struct super_block *, b_blocknr_t blocknr) ; 1731int journal_release_error(struct reiserfs_transaction_handle *,
1774int journal_transaction_should_end(struct reiserfs_transaction_handle *, int) ; 1732 struct super_block *);
1775int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr, int searchall, b_blocknr_t *next) ; 1733int journal_end(struct reiserfs_transaction_handle *, struct super_block *,
1776int journal_begin(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ; 1734 unsigned long);
1777int journal_join_abort(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ; 1735int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *,
1778void reiserfs_journal_abort (struct super_block *sb, int errno); 1736 unsigned long);
1779void reiserfs_abort (struct super_block *sb, int errno, const char *fmt, ...); 1737int journal_mark_freed(struct reiserfs_transaction_handle *,
1780int reiserfs_allocate_list_bitmaps(struct super_block *s, struct reiserfs_list_bitmap *, int) ; 1738 struct super_block *, b_blocknr_t blocknr);
1781 1739int journal_transaction_should_end(struct reiserfs_transaction_handle *, int);
1782void add_save_link (struct reiserfs_transaction_handle * th, 1740int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr,
1783 struct inode * inode, int truncate); 1741 int searchall, b_blocknr_t * next);
1784int remove_save_link (struct inode * inode, int truncate); 1742int journal_begin(struct reiserfs_transaction_handle *,
1743 struct super_block *p_s_sb, unsigned long);
1744int journal_join_abort(struct reiserfs_transaction_handle *,
1745 struct super_block *p_s_sb, unsigned long);
1746void reiserfs_journal_abort(struct super_block *sb, int errno);
1747void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
1748int reiserfs_allocate_list_bitmaps(struct super_block *s,
1749 struct reiserfs_list_bitmap *, int);
1750
1751void add_save_link(struct reiserfs_transaction_handle *th,
1752 struct inode *inode, int truncate);
1753int remove_save_link(struct inode *inode, int truncate);
1785 1754
1786/* objectid.c */ 1755/* objectid.c */
1787__u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th); 1756__u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th);
1788void reiserfs_release_objectid (struct reiserfs_transaction_handle *th, __u32 objectid_to_release); 1757void reiserfs_release_objectid(struct reiserfs_transaction_handle *th,
1789int reiserfs_convert_objectid_map_v1(struct super_block *) ; 1758 __u32 objectid_to_release);
1759int reiserfs_convert_objectid_map_v1(struct super_block *);
1790 1760
1791/* stree.c */ 1761/* stree.c */
1792int B_IS_IN_TREE(const struct buffer_head *); 1762int B_IS_IN_TREE(const struct buffer_head *);
1793extern void copy_item_head(struct item_head * p_v_to, 1763extern void copy_item_head(struct item_head *p_v_to,
1794 const struct item_head * p_v_from); 1764 const struct item_head *p_v_from);
1795 1765
1796// first key is in cpu form, second - le 1766// first key is in cpu form, second - le
1797extern int comp_short_keys (const struct reiserfs_key * le_key, 1767extern int comp_short_keys(const struct reiserfs_key *le_key,
1798 const struct cpu_key * cpu_key); 1768 const struct cpu_key *cpu_key);
1799extern void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from); 1769extern void le_key2cpu_key(struct cpu_key *to, const struct reiserfs_key *from);
1800 1770
1801// both are in le form 1771// both are in le form
1802extern int comp_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); 1772extern int comp_le_keys(const struct reiserfs_key *,
1803extern int comp_short_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); 1773 const struct reiserfs_key *);
1774extern int comp_short_le_keys(const struct reiserfs_key *,
1775 const struct reiserfs_key *);
1804 1776
1805// 1777//
1806// get key version from on disk key - kludge 1778// get key version from on disk key - kludge
1807// 1779//
1808static inline int le_key_version (const struct reiserfs_key * key) 1780static inline int le_key_version(const struct reiserfs_key *key)
1809{ 1781{
1810 int type; 1782 int type;
1811
1812 type = offset_v2_k_type( &(key->u.k_offset_v2));
1813 if (type != TYPE_DIRECT && type != TYPE_INDIRECT && type != TYPE_DIRENTRY)
1814 return KEY_FORMAT_3_5;
1815
1816 return KEY_FORMAT_3_6;
1817
1818}
1819 1783
1784 type = offset_v2_k_type(&(key->u.k_offset_v2));
1785 if (type != TYPE_DIRECT && type != TYPE_INDIRECT
1786 && type != TYPE_DIRENTRY)
1787 return KEY_FORMAT_3_5;
1788
1789 return KEY_FORMAT_3_6;
1820 1790
1821static inline void copy_key (struct reiserfs_key *to, const struct reiserfs_key *from)
1822{
1823 memcpy (to, from, KEY_SIZE);
1824} 1791}
1825 1792
1793static inline void copy_key(struct reiserfs_key *to,
1794 const struct reiserfs_key *from)
1795{
1796 memcpy(to, from, KEY_SIZE);
1797}
1826 1798
1827int comp_items (const struct item_head * stored_ih, const struct path * p_s_path); 1799int comp_items(const struct item_head *stored_ih, const struct path *p_s_path);
1828const struct reiserfs_key * get_rkey (const struct path * p_s_chk_path, 1800const struct reiserfs_key *get_rkey(const struct path *p_s_chk_path,
1829 const struct super_block * p_s_sb); 1801 const struct super_block *p_s_sb);
1830int search_by_key (struct super_block *, const struct cpu_key *, 1802int search_by_key(struct super_block *, const struct cpu_key *,
1831 struct path *, int); 1803 struct path *, int);
1832#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) 1804#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
1833int search_for_position_by_key (struct super_block * p_s_sb, 1805int search_for_position_by_key(struct super_block *p_s_sb,
1834 const struct cpu_key * p_s_cpu_key, 1806 const struct cpu_key *p_s_cpu_key,
1835 struct path * p_s_search_path); 1807 struct path *p_s_search_path);
1836extern void decrement_bcount (struct buffer_head * p_s_bh); 1808extern void decrement_bcount(struct buffer_head *p_s_bh);
1837void decrement_counters_in_path (struct path * p_s_search_path); 1809void decrement_counters_in_path(struct path *p_s_search_path);
1838void pathrelse (struct path * p_s_search_path); 1810void pathrelse(struct path *p_s_search_path);
1839int reiserfs_check_path(struct path *p) ; 1811int reiserfs_check_path(struct path *p);
1840void pathrelse_and_restore (struct super_block *s, struct path * p_s_search_path); 1812void pathrelse_and_restore(struct super_block *s, struct path *p_s_search_path);
1841 1813
1842int reiserfs_insert_item (struct reiserfs_transaction_handle *th, 1814int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
1843 struct path * path, 1815 struct path *path,
1844 const struct cpu_key * key, 1816 const struct cpu_key *key,
1845 struct item_head * ih, 1817 struct item_head *ih,
1846 struct inode *inode, const char * body); 1818 struct inode *inode, const char *body);
1847 1819
1848int reiserfs_paste_into_item (struct reiserfs_transaction_handle *th, 1820int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th,
1849 struct path * path, 1821 struct path *path,
1850 const struct cpu_key * key, 1822 const struct cpu_key *key,
1851 struct inode *inode, 1823 struct inode *inode,
1852 const char * body, int paste_size); 1824 const char *body, int paste_size);
1853 1825
1854int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th, 1826int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
1855 struct path * path, 1827 struct path *path,
1856 struct cpu_key * key, 1828 struct cpu_key *key,
1857 struct inode * inode, 1829 struct inode *inode,
1858 struct page *page, 1830 struct page *page, loff_t new_file_size);
1859 loff_t new_file_size); 1831
1860 1832int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
1861int reiserfs_delete_item (struct reiserfs_transaction_handle *th, 1833 struct path *path,
1862 struct path * path, 1834 const struct cpu_key *key,
1863 const struct cpu_key * key, 1835 struct inode *inode, struct buffer_head *p_s_un_bh);
1864 struct inode * inode, 1836
1865 struct buffer_head * p_s_un_bh); 1837void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
1866 1838 struct inode *inode, struct reiserfs_key *key);
1867void reiserfs_delete_solid_item (struct reiserfs_transaction_handle *th, 1839int reiserfs_delete_object(struct reiserfs_transaction_handle *th,
1868 struct inode *inode, struct reiserfs_key * key); 1840 struct inode *p_s_inode);
1869int reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inode * p_s_inode); 1841int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
1870int reiserfs_do_truncate (struct reiserfs_transaction_handle *th, 1842 struct inode *p_s_inode, struct page *,
1871 struct inode * p_s_inode, struct page *, 1843 int update_timestamps);
1872 int update_timestamps);
1873 1844
1874#define i_block_size(inode) ((inode)->i_sb->s_blocksize) 1845#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
1875#define file_size(inode) ((inode)->i_size) 1846#define file_size(inode) ((inode)->i_size)
@@ -1878,66 +1849,67 @@ int reiserfs_do_truncate (struct reiserfs_transaction_handle *th,
1878#define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\ 1849#define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\
1879!STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 ) 1850!STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 )
1880 1851
1881void padd_item (char * item, int total_length, int length); 1852void padd_item(char *item, int total_length, int length);
1882 1853
1883/* inode.c */ 1854/* inode.c */
1884/* args for the create parameter of reiserfs_get_block */ 1855/* args for the create parameter of reiserfs_get_block */
1885#define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */ 1856#define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */
1886#define GET_BLOCK_CREATE 1 /* add anything you need to find block */ 1857#define GET_BLOCK_CREATE 1 /* add anything you need to find block */
1887#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ 1858#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */
1888#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ 1859#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */
1889#define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ 1860#define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */
1890#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ 1861#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */
1891 1862
1892int restart_transaction(struct reiserfs_transaction_handle *th, struct inode *inode, struct path *path); 1863int restart_transaction(struct reiserfs_transaction_handle *th,
1893void reiserfs_read_locked_inode(struct inode * inode, struct reiserfs_iget_args *args) ; 1864 struct inode *inode, struct path *path);
1894int reiserfs_find_actor(struct inode * inode, void *p) ; 1865void reiserfs_read_locked_inode(struct inode *inode,
1895int reiserfs_init_locked_inode(struct inode * inode, void *p) ; 1866 struct reiserfs_iget_args *args);
1896void reiserfs_delete_inode (struct inode * inode); 1867int reiserfs_find_actor(struct inode *inode, void *p);
1897int reiserfs_write_inode (struct inode * inode, int) ; 1868int reiserfs_init_locked_inode(struct inode *inode, void *p);
1898int reiserfs_get_block (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create); 1869void reiserfs_delete_inode(struct inode *inode);
1899struct dentry *reiserfs_get_dentry(struct super_block *, void *) ; 1870int reiserfs_write_inode(struct inode *inode, int);
1900struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 *data, 1871int reiserfs_get_block(struct inode *inode, sector_t block,
1901 int len, int fhtype, 1872 struct buffer_head *bh_result, int create);
1902 int (*acceptable)(void *contect, struct dentry *de), 1873struct dentry *reiserfs_get_dentry(struct super_block *, void *);
1903 void *context) ; 1874struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 * data,
1904int reiserfs_encode_fh( struct dentry *dentry, __u32 *data, int *lenp, 1875 int len, int fhtype,
1905 int connectable ); 1876 int (*acceptable) (void *contect,
1906 1877 struct dentry * de),
1907int reiserfs_truncate_file(struct inode *, int update_timestamps) ; 1878 void *context);
1908void make_cpu_key (struct cpu_key * cpu_key, struct inode * inode, loff_t offset, 1879int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp,
1909 int type, int key_length); 1880 int connectable);
1910void make_le_item_head (struct item_head * ih, const struct cpu_key * key, 1881
1911 int version, 1882int reiserfs_truncate_file(struct inode *, int update_timestamps);
1912 loff_t offset, int type, int length, int entry_count); 1883void make_cpu_key(struct cpu_key *cpu_key, struct inode *inode, loff_t offset,
1913struct inode * reiserfs_iget (struct super_block * s, 1884 int type, int key_length);
1914 const struct cpu_key * key); 1885void make_le_item_head(struct item_head *ih, const struct cpu_key *key,
1915 1886 int version,
1916 1887 loff_t offset, int type, int length, int entry_count);
1917int reiserfs_new_inode (struct reiserfs_transaction_handle *th, 1888struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
1918 struct inode * dir, int mode, 1889
1919 const char * symname, loff_t i_size, 1890int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1920 struct dentry *dentry, struct inode *inode); 1891 struct inode *dir, int mode,
1921 1892 const char *symname, loff_t i_size,
1922void reiserfs_update_sd_size (struct reiserfs_transaction_handle *th, 1893 struct dentry *dentry, struct inode *inode);
1923 struct inode * inode, loff_t size); 1894
1895void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
1896 struct inode *inode, loff_t size);
1924 1897
1925static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th, 1898static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th,
1926 struct inode *inode) 1899 struct inode *inode)
1927{ 1900{
1928 reiserfs_update_sd_size(th, inode, inode->i_size) ; 1901 reiserfs_update_sd_size(th, inode, inode->i_size);
1929} 1902}
1930 1903
1931void sd_attrs_to_i_attrs( __u16 sd_attrs, struct inode *inode ); 1904void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode);
1932void i_attrs_to_sd_attrs( struct inode *inode, __u16 *sd_attrs ); 1905void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs);
1933int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); 1906int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
1934 1907
1935/* namei.c */ 1908/* namei.c */
1936void set_de_name_and_namelen (struct reiserfs_dir_entry * de); 1909void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
1937int search_by_entry_key (struct super_block * sb, const struct cpu_key * key, 1910int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
1938 struct path * path, 1911 struct path *path, struct reiserfs_dir_entry *de);
1939 struct reiserfs_dir_entry * de); 1912struct dentry *reiserfs_get_parent(struct dentry *);
1940struct dentry *reiserfs_get_parent(struct dentry *) ;
1941/* procfs.c */ 1913/* procfs.c */
1942 1914
1943#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) 1915#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO )
@@ -1946,15 +1918,15 @@ struct dentry *reiserfs_get_parent(struct dentry *) ;
1946#undef REISERFS_PROC_INFO 1918#undef REISERFS_PROC_INFO
1947#endif 1919#endif
1948 1920
1949int reiserfs_proc_info_init( struct super_block *sb ); 1921int reiserfs_proc_info_init(struct super_block *sb);
1950int reiserfs_proc_info_done( struct super_block *sb ); 1922int reiserfs_proc_info_done(struct super_block *sb);
1951struct proc_dir_entry *reiserfs_proc_register_global( char *name, 1923struct proc_dir_entry *reiserfs_proc_register_global(char *name,
1952 read_proc_t *func ); 1924 read_proc_t * func);
1953void reiserfs_proc_unregister_global( const char *name ); 1925void reiserfs_proc_unregister_global(const char *name);
1954int reiserfs_proc_info_global_init( void ); 1926int reiserfs_proc_info_global_init(void);
1955int reiserfs_proc_info_global_done( void ); 1927int reiserfs_proc_info_global_done(void);
1956int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset, 1928int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1957 int count, int *eof, void *data ); 1929 int count, int *eof, void *data);
1958 1930
1959#if defined( REISERFS_PROC_INFO ) 1931#if defined( REISERFS_PROC_INFO )
1960 1932
@@ -1986,123 +1958,132 @@ extern struct inode_operations reiserfs_special_inode_operations;
1986extern struct file_operations reiserfs_dir_operations; 1958extern struct file_operations reiserfs_dir_operations;
1987 1959
1988/* tail_conversion.c */ 1960/* tail_conversion.c */
1989int direct2indirect (struct reiserfs_transaction_handle *, struct inode *, struct path *, struct buffer_head *, loff_t); 1961int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
1990int indirect2direct (struct reiserfs_transaction_handle *, struct inode *, struct page *, struct path *, const struct cpu_key *, loff_t, char *); 1962 struct path *, struct buffer_head *, loff_t);
1991void reiserfs_unmap_buffer(struct buffer_head *) ; 1963int indirect2direct(struct reiserfs_transaction_handle *, struct inode *,
1992 1964 struct page *, struct path *, const struct cpu_key *,
1965 loff_t, char *);
1966void reiserfs_unmap_buffer(struct buffer_head *);
1993 1967
1994/* file.c */ 1968/* file.c */
1995extern struct inode_operations reiserfs_file_inode_operations; 1969extern struct inode_operations reiserfs_file_inode_operations;
1996extern struct file_operations reiserfs_file_operations; 1970extern struct file_operations reiserfs_file_operations;
1997extern struct address_space_operations reiserfs_address_space_operations ; 1971extern struct address_space_operations reiserfs_address_space_operations;
1998 1972
1999/* fix_nodes.c */ 1973/* fix_nodes.c */
2000#ifdef CONFIG_REISERFS_CHECK 1974#ifdef CONFIG_REISERFS_CHECK
2001void * reiserfs_kmalloc (size_t size, int flags, struct super_block * s); 1975void *reiserfs_kmalloc(size_t size, int flags, struct super_block *s);
2002void reiserfs_kfree (const void * vp, size_t size, struct super_block * s); 1976void reiserfs_kfree(const void *vp, size_t size, struct super_block *s);
2003#else 1977#else
2004static inline void *reiserfs_kmalloc(size_t size, int flags, 1978static inline void *reiserfs_kmalloc(size_t size, int flags,
2005 struct super_block *s) 1979 struct super_block *s)
2006{ 1980{
2007 return kmalloc(size, flags); 1981 return kmalloc(size, flags);
2008} 1982}
2009 1983
2010static inline void reiserfs_kfree(const void *vp, size_t size, 1984static inline void reiserfs_kfree(const void *vp, size_t size,
2011 struct super_block *s) 1985 struct super_block *s)
2012{ 1986{
2013 kfree(vp); 1987 kfree(vp);
2014} 1988}
2015#endif 1989#endif
2016 1990
2017int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb, 1991int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb,
2018 struct item_head * p_s_ins_ih, const void *); 1992 struct item_head *p_s_ins_ih, const void *);
2019void unfix_nodes (struct tree_balance *); 1993void unfix_nodes(struct tree_balance *);
2020
2021 1994
2022/* prints.c */ 1995/* prints.c */
2023void reiserfs_panic (struct super_block * s, const char * fmt, ...) __attribute__ ( ( noreturn ) ); 1996void reiserfs_panic(struct super_block *s, const char *fmt, ...)
2024void reiserfs_info (struct super_block *s, const char * fmt, ...); 1997 __attribute__ ((noreturn));
2025void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...); 1998void reiserfs_info(struct super_block *s, const char *fmt, ...);
2026void print_indirect_item (struct buffer_head * bh, int item_num); 1999void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
2027void store_print_tb (struct tree_balance * tb); 2000void print_indirect_item(struct buffer_head *bh, int item_num);
2028void print_cur_tb (char * mes); 2001void store_print_tb(struct tree_balance *tb);
2029void print_de (struct reiserfs_dir_entry * de); 2002void print_cur_tb(char *mes);
2030void print_bi (struct buffer_info * bi, char * mes); 2003void print_de(struct reiserfs_dir_entry *de);
2031#define PRINT_LEAF_ITEMS 1 /* print all items */ 2004void print_bi(struct buffer_info *bi, char *mes);
2032#define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ 2005#define PRINT_LEAF_ITEMS 1 /* print all items */
2033#define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ 2006#define PRINT_DIRECTORY_ITEMS 2 /* print directory items */
2034void print_block (struct buffer_head * bh, ...); 2007#define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */
2035void print_bmap (struct super_block * s, int silent); 2008void print_block(struct buffer_head *bh, ...);
2036void print_bmap_block (int i, char * data, int size, int silent); 2009void print_bmap(struct super_block *s, int silent);
2010void print_bmap_block(int i, char *data, int size, int silent);
2037/*void print_super_block (struct super_block * s, char * mes);*/ 2011/*void print_super_block (struct super_block * s, char * mes);*/
2038void print_objectid_map (struct super_block * s); 2012void print_objectid_map(struct super_block *s);
2039void print_block_head (struct buffer_head * bh, char * mes); 2013void print_block_head(struct buffer_head *bh, char *mes);
2040void check_leaf (struct buffer_head * bh); 2014void check_leaf(struct buffer_head *bh);
2041void check_internal (struct buffer_head * bh); 2015void check_internal(struct buffer_head *bh);
2042void print_statistics (struct super_block * s); 2016void print_statistics(struct super_block *s);
2043char * reiserfs_hashname(int code); 2017char *reiserfs_hashname(int code);
2044 2018
2045/* lbalance.c */ 2019/* lbalance.c */
2046int leaf_move_items (int shift_mode, struct tree_balance * tb, int mov_num, int mov_bytes, struct buffer_head * Snew); 2020int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num,
2047int leaf_shift_left (struct tree_balance * tb, int shift_num, int shift_bytes); 2021 int mov_bytes, struct buffer_head *Snew);
2048int leaf_shift_right (struct tree_balance * tb, int shift_num, int shift_bytes); 2022int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes);
2049void leaf_delete_items (struct buffer_info * cur_bi, int last_first, int first, int del_num, int del_bytes); 2023int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes);
2050void leaf_insert_into_buf (struct buffer_info * bi, int before, 2024void leaf_delete_items(struct buffer_info *cur_bi, int last_first, int first,
2051 struct item_head * inserted_item_ih, const char * inserted_item_body, int zeros_number); 2025 int del_num, int del_bytes);
2052void leaf_paste_in_buffer (struct buffer_info * bi, int pasted_item_num, 2026void leaf_insert_into_buf(struct buffer_info *bi, int before,
2053 int pos_in_item, int paste_size, const char * body, int zeros_number); 2027 struct item_head *inserted_item_ih,
2054void leaf_cut_from_buffer (struct buffer_info * bi, int cut_item_num, int pos_in_item, 2028 const char *inserted_item_body, int zeros_number);
2055 int cut_size); 2029void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num,
2056void leaf_paste_entries (struct buffer_head * bh, int item_num, int before, 2030 int pos_in_item, int paste_size, const char *body,
2057 int new_entry_count, struct reiserfs_de_head * new_dehs, const char * records, int paste_size); 2031 int zeros_number);
2032void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
2033 int pos_in_item, int cut_size);
2034void leaf_paste_entries(struct buffer_head *bh, int item_num, int before,
2035 int new_entry_count, struct reiserfs_de_head *new_dehs,
2036 const char *records, int paste_size);
2058/* ibalance.c */ 2037/* ibalance.c */
2059int balance_internal (struct tree_balance * , int, int, struct item_head * , 2038int balance_internal(struct tree_balance *, int, int, struct item_head *,
2060 struct buffer_head **); 2039 struct buffer_head **);
2061 2040
2062/* do_balance.c */ 2041/* do_balance.c */
2063void do_balance_mark_leaf_dirty (struct tree_balance * tb, 2042void do_balance_mark_leaf_dirty(struct tree_balance *tb,
2064 struct buffer_head * bh, int flag); 2043 struct buffer_head *bh, int flag);
2065#define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty 2044#define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty
2066#define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty 2045#define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty
2067 2046
2068void do_balance (struct tree_balance * tb, struct item_head * ih, 2047void do_balance(struct tree_balance *tb, struct item_head *ih,
2069 const char * body, int flag); 2048 const char *body, int flag);
2070void reiserfs_invalidate_buffer (struct tree_balance * tb, struct buffer_head * bh); 2049void reiserfs_invalidate_buffer(struct tree_balance *tb,
2050 struct buffer_head *bh);
2071 2051
2072int get_left_neighbor_position (struct tree_balance * tb, int h); 2052int get_left_neighbor_position(struct tree_balance *tb, int h);
2073int get_right_neighbor_position (struct tree_balance * tb, int h); 2053int get_right_neighbor_position(struct tree_balance *tb, int h);
2074void replace_key (struct tree_balance * tb, struct buffer_head *, int, struct buffer_head *, int); 2054void replace_key(struct tree_balance *tb, struct buffer_head *, int,
2075void make_empty_node (struct buffer_info *); 2055 struct buffer_head *, int);
2076struct buffer_head * get_FEB (struct tree_balance *); 2056void make_empty_node(struct buffer_info *);
2057struct buffer_head *get_FEB(struct tree_balance *);
2077 2058
2078/* bitmap.c */ 2059/* bitmap.c */
2079 2060
2080/* structure contains hints for block allocator, and it is a container for 2061/* structure contains hints for block allocator, and it is a container for
2081 * arguments, such as node, search path, transaction_handle, etc. */ 2062 * arguments, such as node, search path, transaction_handle, etc. */
2082 struct __reiserfs_blocknr_hint { 2063struct __reiserfs_blocknr_hint {
2083 struct inode * inode; /* inode passed to allocator, if we allocate unf. nodes */ 2064 struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */
2084 long block; /* file offset, in blocks */ 2065 long block; /* file offset, in blocks */
2085 struct in_core_key key; 2066 struct in_core_key key;
2086 struct path * path; /* search path, used by allocator to deternine search_start by 2067 struct path *path; /* search path, used by allocator to deternine search_start by
2087 * various ways */ 2068 * various ways */
2088 struct reiserfs_transaction_handle * th; /* transaction handle is needed to log super blocks and 2069 struct reiserfs_transaction_handle *th; /* transaction handle is needed to log super blocks and
2089 * bitmap blocks changes */ 2070 * bitmap blocks changes */
2090 b_blocknr_t beg, end; 2071 b_blocknr_t beg, end;
2091 b_blocknr_t search_start; /* a field used to transfer search start value (block number) 2072 b_blocknr_t search_start; /* a field used to transfer search start value (block number)
2092 * between different block allocator procedures 2073 * between different block allocator procedures
2093 * (determine_search_start() and others) */ 2074 * (determine_search_start() and others) */
2094 int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed 2075 int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed
2095 * function that do actual allocation */ 2076 * function that do actual allocation */
2096 2077
2097 unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for 2078 unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for
2098 * formatted/unformatted blocks with/without preallocation */ 2079 * formatted/unformatted blocks with/without preallocation */
2099 unsigned preallocate:1; 2080 unsigned preallocate:1;
2100}; 2081};
2101 2082
2102typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t; 2083typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t;
2103 2084
2104int reiserfs_parse_alloc_options (struct super_block *, char *); 2085int reiserfs_parse_alloc_options(struct super_block *, char *);
2105void reiserfs_init_alloc_options (struct super_block *s); 2086void reiserfs_init_alloc_options(struct super_block *s);
2106 2087
2107/* 2088/*
2108 * given a directory, this will tell you what packing locality 2089 * given a directory, this will tell you what packing locality
@@ -2111,68 +2092,72 @@ void reiserfs_init_alloc_options (struct super_block *s);
2111 */ 2092 */
2112__le32 reiserfs_choose_packing(struct inode *dir); 2093__le32 reiserfs_choose_packing(struct inode *dir);
2113 2094
2114int is_reusable (struct super_block * s, b_blocknr_t block, int bit_value); 2095int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value);
2115void reiserfs_free_block (struct reiserfs_transaction_handle *th, struct inode *, b_blocknr_t, int for_unformatted); 2096void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *,
2116int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t * , int, int); 2097 b_blocknr_t, int for_unformatted);
2117extern inline int reiserfs_new_form_blocknrs (struct tree_balance * tb, 2098int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int,
2118 b_blocknr_t *new_blocknrs, int amount_needed) 2099 int);
2100extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb,
2101 b_blocknr_t * new_blocknrs,
2102 int amount_needed)
2119{ 2103{
2120 reiserfs_blocknr_hint_t hint = { 2104 reiserfs_blocknr_hint_t hint = {
2121 .th = tb->transaction_handle, 2105 .th = tb->transaction_handle,
2122 .path = tb->tb_path, 2106 .path = tb->tb_path,
2123 .inode = NULL, 2107 .inode = NULL,
2124 .key = tb->key, 2108 .key = tb->key,
2125 .block = 0, 2109 .block = 0,
2126 .formatted_node = 1 2110 .formatted_node = 1
2127 }; 2111 };
2128 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed, 0); 2112 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed,
2113 0);
2129} 2114}
2130 2115
2131extern inline int reiserfs_new_unf_blocknrs (struct reiserfs_transaction_handle *th, 2116extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle
2132 struct inode *inode, 2117 *th, struct inode *inode,
2133 b_blocknr_t *new_blocknrs, 2118 b_blocknr_t * new_blocknrs,
2134 struct path * path, long block) 2119 struct path *path, long block)
2135{ 2120{
2136 reiserfs_blocknr_hint_t hint = { 2121 reiserfs_blocknr_hint_t hint = {
2137 .th = th, 2122 .th = th,
2138 .path = path, 2123 .path = path,
2139 .inode = inode, 2124 .inode = inode,
2140 .block = block, 2125 .block = block,
2141 .formatted_node = 0, 2126 .formatted_node = 0,
2142 .preallocate = 0 2127 .preallocate = 0
2143 }; 2128 };
2144 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); 2129 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0);
2145} 2130}
2146 2131
2147#ifdef REISERFS_PREALLOCATE 2132#ifdef REISERFS_PREALLOCATE
2148extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle *th, 2133extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle
2149 struct inode * inode, 2134 *th, struct inode *inode,
2150 b_blocknr_t *new_blocknrs, 2135 b_blocknr_t * new_blocknrs,
2151 struct path * path, long block) 2136 struct path *path, long block)
2152{ 2137{
2153 reiserfs_blocknr_hint_t hint = { 2138 reiserfs_blocknr_hint_t hint = {
2154 .th = th, 2139 .th = th,
2155 .path = path, 2140 .path = path,
2156 .inode = inode, 2141 .inode = inode,
2157 .block = block, 2142 .block = block,
2158 .formatted_node = 0, 2143 .formatted_node = 0,
2159 .preallocate = 1 2144 .preallocate = 1
2160 }; 2145 };
2161 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); 2146 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0);
2162} 2147}
2163 2148
2164void reiserfs_discard_prealloc (struct reiserfs_transaction_handle *th, 2149void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th,
2165 struct inode * inode); 2150 struct inode *inode);
2166void reiserfs_discard_all_prealloc (struct reiserfs_transaction_handle *th); 2151void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th);
2167#endif 2152#endif
2168void reiserfs_claim_blocks_to_be_allocated( struct super_block *sb, int blocks); 2153void reiserfs_claim_blocks_to_be_allocated(struct super_block *sb, int blocks);
2169void reiserfs_release_claimed_blocks( struct super_block *sb, int blocks); 2154void reiserfs_release_claimed_blocks(struct super_block *sb, int blocks);
2170int reiserfs_can_fit_pages(struct super_block *sb); 2155int reiserfs_can_fit_pages(struct super_block *sb);
2171 2156
2172/* hashes.c */ 2157/* hashes.c */
2173__u32 keyed_hash (const signed char *msg, int len); 2158__u32 keyed_hash(const signed char *msg, int len);
2174__u32 yura_hash (const signed char *msg, int len); 2159__u32 yura_hash(const signed char *msg, int len);
2175__u32 r5_hash (const signed char *msg, int len); 2160__u32 r5_hash(const signed char *msg, int len);
2176 2161
2177/* the ext2 bit routines adjust for big or little endian as 2162/* the ext2 bit routines adjust for big or little endian as
2178** appropriate for the arch, so in our laziness we use them rather 2163** appropriate for the arch, so in our laziness we use them rather
@@ -2192,11 +2177,10 @@ __u32 r5_hash (const signed char *msg, int len);
2192 absolutely safe */ 2177 absolutely safe */
2193#define SPARE_SPACE 500 2178#define SPARE_SPACE 500
2194 2179
2195
2196/* prototypes from ioctl.c */ 2180/* prototypes from ioctl.c */
2197int reiserfs_ioctl (struct inode * inode, struct file * filp, 2181int reiserfs_ioctl(struct inode *inode, struct file *filp,
2198 unsigned int cmd, unsigned long arg); 2182 unsigned int cmd, unsigned long arg);
2199 2183
2200/* ioctl's command */ 2184/* ioctl's command */
2201#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) 2185#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
2202/* define following flags to be the same as in ext2, so that chattr(1), 2186/* define following flags to be the same as in ext2, so that chattr(1),
@@ -2211,10 +2195,8 @@ int reiserfs_ioctl (struct inode * inode, struct file * filp,
2211 would evolve into real per-fs locks */ 2195 would evolve into real per-fs locks */
2212#define reiserfs_write_lock( sb ) lock_kernel() 2196#define reiserfs_write_lock( sb ) lock_kernel()
2213#define reiserfs_write_unlock( sb ) unlock_kernel() 2197#define reiserfs_write_unlock( sb ) unlock_kernel()
2214 2198
2215/* xattr stuff */ 2199/* xattr stuff */
2216#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) 2200#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
2217 2201
2218#endif /* _LINUX_REISER_FS_H */ 2202#endif /* _LINUX_REISER_FS_H */
2219
2220
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index e321eb050d65..149be8d9a0c9 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -10,54 +10,53 @@ typedef enum {
10 /** this says what format of key do all items (but stat data) of 10 /** this says what format of key do all items (but stat data) of
11 an object have. If this is set, that format is 3.6 otherwise 11 an object have. If this is set, that format is 3.6 otherwise
12 - 3.5 */ 12 - 3.5 */
13 i_item_key_version_mask = 0x0001, 13 i_item_key_version_mask = 0x0001,
14 /** If this is unset, object has 3.5 stat data, otherwise, it has 14 /** If this is unset, object has 3.5 stat data, otherwise, it has
15 3.6 stat data with 64bit size, 32bit nlink etc. */ 15 3.6 stat data with 64bit size, 32bit nlink etc. */
16 i_stat_data_version_mask = 0x0002, 16 i_stat_data_version_mask = 0x0002,
17 /** file might need tail packing on close */ 17 /** file might need tail packing on close */
18 i_pack_on_close_mask = 0x0004, 18 i_pack_on_close_mask = 0x0004,
19 /** don't pack tail of file */ 19 /** don't pack tail of file */
20 i_nopack_mask = 0x0008, 20 i_nopack_mask = 0x0008,
21 /** If those is set, "safe link" was created for this file during 21 /** If those is set, "safe link" was created for this file during
22 truncate or unlink. Safe link is used to avoid leakage of disk 22 truncate or unlink. Safe link is used to avoid leakage of disk
23 space on crash with some files open, but unlinked. */ 23 space on crash with some files open, but unlinked. */
24 i_link_saved_unlink_mask = 0x0010, 24 i_link_saved_unlink_mask = 0x0010,
25 i_link_saved_truncate_mask = 0x0020, 25 i_link_saved_truncate_mask = 0x0020,
26 i_has_xattr_dir = 0x0040, 26 i_has_xattr_dir = 0x0040,
27 i_data_log = 0x0080, 27 i_data_log = 0x0080,
28} reiserfs_inode_flags; 28} reiserfs_inode_flags;
29 29
30
31struct reiserfs_inode_info { 30struct reiserfs_inode_info {
32 __u32 i_key [4];/* key is still 4 32 bit integers */ 31 __u32 i_key[4]; /* key is still 4 32 bit integers */
33 /** transient inode flags that are never stored on disk. Bitmasks 32 /** transient inode flags that are never stored on disk. Bitmasks
34 for this field are defined above. */ 33 for this field are defined above. */
35 __u32 i_flags; 34 __u32 i_flags;
36 35
37 __u32 i_first_direct_byte; // offset of first byte stored in direct item. 36 __u32 i_first_direct_byte; // offset of first byte stored in direct item.
38 37
39 /* copy of persistent inode flags read from sd_attrs. */ 38 /* copy of persistent inode flags read from sd_attrs. */
40 __u32 i_attrs; 39 __u32 i_attrs;
41 40
42 int i_prealloc_block; /* first unused block of a sequence of unused blocks */ 41 int i_prealloc_block; /* first unused block of a sequence of unused blocks */
43 int i_prealloc_count; /* length of that sequence */ 42 int i_prealloc_count; /* length of that sequence */
44 struct list_head i_prealloc_list; /* per-transaction list of inodes which 43 struct list_head i_prealloc_list; /* per-transaction list of inodes which
45 * have preallocated blocks */ 44 * have preallocated blocks */
46 45
47 unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks 46 unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks
48 * for the contents of this directory should be 47 * for the contents of this directory should be
49 * displaced */ 48 * displaced */
50 49
51 /* we use these for fsync or O_SYNC to decide which transaction 50 /* we use these for fsync or O_SYNC to decide which transaction
52 ** needs to be committed in order for this inode to be properly 51 ** needs to be committed in order for this inode to be properly
53 ** flushed */ 52 ** flushed */
54 unsigned long i_trans_id ; 53 unsigned long i_trans_id;
55 struct reiserfs_journal_list *i_jl; 54 struct reiserfs_journal_list *i_jl;
56 55
57 struct posix_acl *i_acl_access; 56 struct posix_acl *i_acl_access;
58 struct posix_acl *i_acl_default; 57 struct posix_acl *i_acl_default;
59 struct rw_semaphore xattr_sem; 58 struct rw_semaphore xattr_sem;
60 struct inode vfs_inode; 59 struct inode vfs_inode;
61}; 60};
62 61
63#endif 62#endif
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 37a3a7afbec7..3e68592e52e9 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -10,7 +10,7 @@
10#endif 10#endif
11 11
12typedef enum { 12typedef enum {
13 reiserfs_attrs_cleared = 0x00000001, 13 reiserfs_attrs_cleared = 0x00000001,
14} reiserfs_super_block_flags; 14} reiserfs_super_block_flags;
15 15
16/* struct reiserfs_super_block accessors/mutators 16/* struct reiserfs_super_block accessors/mutators
@@ -61,7 +61,7 @@ typedef enum {
61#define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state)) 61#define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state))
62#define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v)) 62#define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v))
63#define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state)) 63#define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state))
64#define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) 64#define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v))
65#define sb_hash_function_code(sbp) \ 65#define sb_hash_function_code(sbp) \
66 (le32_to_cpu((sbp)->s_v1.s_hash_function_code)) 66 (le32_to_cpu((sbp)->s_v1.s_hash_function_code))
67#define set_sb_hash_function_code(sbp,v) \ 67#define set_sb_hash_function_code(sbp,v) \
@@ -103,10 +103,10 @@ typedef enum {
103 103
104/* don't mess with these for a while */ 104/* don't mess with these for a while */
105 /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ 105 /* we have a node size define somewhere in reiserfs_fs.h. -Hans */
106#define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ 106#define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */
107#define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ 107#define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */
108#define JOURNAL_HASH_SIZE 8192 108#define JOURNAL_HASH_SIZE 8192
109#define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ 109#define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */
110 110
111/* One of these for every block in every transaction 111/* One of these for every block in every transaction
112** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a 112** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a
@@ -117,27 +117,27 @@ typedef enum {
117** to a given transaction. 117** to a given transaction.
118*/ 118*/
119struct reiserfs_journal_cnode { 119struct reiserfs_journal_cnode {
120 struct buffer_head *bh ; /* real buffer head */ 120 struct buffer_head *bh; /* real buffer head */
121 struct super_block *sb ; /* dev of real buffer head */ 121 struct super_block *sb; /* dev of real buffer head */
122 __u32 blocknr ; /* block number of real buffer head, == 0 when buffer on disk */ 122 __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */
123 long state ; 123 long state;
124 struct reiserfs_journal_list *jlist ; /* journal list this cnode lives in */ 124 struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */
125 struct reiserfs_journal_cnode *next ; /* next in transaction list */ 125 struct reiserfs_journal_cnode *next; /* next in transaction list */
126 struct reiserfs_journal_cnode *prev ; /* prev in transaction list */ 126 struct reiserfs_journal_cnode *prev; /* prev in transaction list */
127 struct reiserfs_journal_cnode *hprev ; /* prev in hash list */ 127 struct reiserfs_journal_cnode *hprev; /* prev in hash list */
128 struct reiserfs_journal_cnode *hnext ; /* next in hash list */ 128 struct reiserfs_journal_cnode *hnext; /* next in hash list */
129}; 129};
130 130
131struct reiserfs_bitmap_node { 131struct reiserfs_bitmap_node {
132 int id ; 132 int id;
133 char *data ; 133 char *data;
134 struct list_head list ; 134 struct list_head list;
135} ; 135};
136 136
137struct reiserfs_list_bitmap { 137struct reiserfs_list_bitmap {
138 struct reiserfs_journal_list *journal_list ; 138 struct reiserfs_journal_list *journal_list;
139 struct reiserfs_bitmap_node **bitmaps ; 139 struct reiserfs_bitmap_node **bitmaps;
140} ; 140};
141 141
142/* 142/*
143** one of these for each transaction. The most important part here is the j_realblock. 143** one of these for each transaction. The most important part here is the j_realblock.
@@ -146,273 +146,269 @@ struct reiserfs_list_bitmap {
146** and to make sure every real block in a transaction is on disk before allowing the log area 146** and to make sure every real block in a transaction is on disk before allowing the log area
147** to be overwritten */ 147** to be overwritten */
148struct reiserfs_journal_list { 148struct reiserfs_journal_list {
149 unsigned long j_start ; 149 unsigned long j_start;
150 unsigned long j_state; 150 unsigned long j_state;
151 unsigned long j_len ; 151 unsigned long j_len;
152 atomic_t j_nonzerolen ; 152 atomic_t j_nonzerolen;
153 atomic_t j_commit_left ; 153 atomic_t j_commit_left;
154 atomic_t j_older_commits_done ; /* all commits older than this on disk*/ 154 atomic_t j_older_commits_done; /* all commits older than this on disk */
155 struct semaphore j_commit_lock; 155 struct semaphore j_commit_lock;
156 unsigned long j_trans_id ; 156 unsigned long j_trans_id;
157 time_t j_timestamp ; 157 time_t j_timestamp;
158 struct reiserfs_list_bitmap *j_list_bitmap ; 158 struct reiserfs_list_bitmap *j_list_bitmap;
159 struct buffer_head *j_commit_bh ; /* commit buffer head */ 159 struct buffer_head *j_commit_bh; /* commit buffer head */
160 struct reiserfs_journal_cnode *j_realblock ; 160 struct reiserfs_journal_cnode *j_realblock;
161 struct reiserfs_journal_cnode *j_freedlist ; /* list of buffers that were freed during this trans. free each of these on flush */ 161 struct reiserfs_journal_cnode *j_freedlist; /* list of buffers that were freed during this trans. free each of these on flush */
162 /* time ordered list of all active transactions */ 162 /* time ordered list of all active transactions */
163 struct list_head j_list; 163 struct list_head j_list;
164 164
165 /* time ordered list of all transactions we haven't tried to flush yet */ 165 /* time ordered list of all transactions we haven't tried to flush yet */
166 struct list_head j_working_list; 166 struct list_head j_working_list;
167 167
168 /* list of tail conversion targets in need of flush before commit */ 168 /* list of tail conversion targets in need of flush before commit */
169 struct list_head j_tail_bh_list; 169 struct list_head j_tail_bh_list;
170 /* list of data=ordered buffers in need of flush before commit */ 170 /* list of data=ordered buffers in need of flush before commit */
171 struct list_head j_bh_list; 171 struct list_head j_bh_list;
172 int j_refcount; 172 int j_refcount;
173} ; 173};
174 174
175struct reiserfs_journal { 175struct reiserfs_journal {
176 struct buffer_head ** j_ap_blocks ; /* journal blocks on disk */ 176 struct buffer_head **j_ap_blocks; /* journal blocks on disk */
177 struct reiserfs_journal_cnode *j_last ; /* newest journal block */ 177 struct reiserfs_journal_cnode *j_last; /* newest journal block */
178 struct reiserfs_journal_cnode *j_first ; /* oldest journal block. start here for traverse */ 178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */
179 179
180 struct file *j_dev_file; 180 struct file *j_dev_file;
181 struct block_device *j_dev_bd; 181 struct block_device *j_dev_bd;
182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
183 183
184 long j_state ; 184 long j_state;
185 unsigned long j_trans_id ; 185 unsigned long j_trans_id;
186 unsigned long j_mount_id ; 186 unsigned long j_mount_id;
187 unsigned long j_start ; /* start of current waiting commit (index into j_ap_blocks) */ 187 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */
188 unsigned long j_len ; /* lenght of current waiting commit */ 188 unsigned long j_len; /* lenght of current waiting commit */
189 unsigned long j_len_alloc ; /* number of buffers requested by journal_begin() */ 189 unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */
190 atomic_t j_wcount ; /* count of writers for current commit */ 190 atomic_t j_wcount; /* count of writers for current commit */
191 unsigned long j_bcount ; /* batch count. allows turning X transactions into 1 */ 191 unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */
192 unsigned long j_first_unflushed_offset ; /* first unflushed transactions offset */ 192 unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */
193 unsigned long j_last_flush_trans_id ; /* last fully flushed journal timestamp */ 193 unsigned long j_last_flush_trans_id; /* last fully flushed journal timestamp */
194 struct buffer_head *j_header_bh ; 194 struct buffer_head *j_header_bh;
195 195
196 time_t j_trans_start_time ; /* time this transaction started */ 196 time_t j_trans_start_time; /* time this transaction started */
197 struct semaphore j_lock; 197 struct semaphore j_lock;
198 struct semaphore j_flush_sem; 198 struct semaphore j_flush_sem;
199 wait_queue_head_t j_join_wait ; /* wait for current transaction to finish before starting new one */ 199 wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */
200 atomic_t j_jlock ; /* lock for j_join_wait */ 200 atomic_t j_jlock; /* lock for j_join_wait */
201 int j_list_bitmap_index ; /* number of next list bitmap to use */ 201 int j_list_bitmap_index; /* number of next list bitmap to use */
202 int j_must_wait ; /* no more journal begins allowed. MUST sleep on j_join_wait */ 202 int j_must_wait; /* no more journal begins allowed. MUST sleep on j_join_wait */
203 int j_next_full_flush ; /* next journal_end will flush all journal list */ 203 int j_next_full_flush; /* next journal_end will flush all journal list */
204 int j_next_async_flush ; /* next journal_end will flush all async commits */ 204 int j_next_async_flush; /* next journal_end will flush all async commits */
205 205
206 int j_cnode_used ; /* number of cnodes on the used list */ 206 int j_cnode_used; /* number of cnodes on the used list */
207 int j_cnode_free ; /* number of cnodes on the free list */ 207 int j_cnode_free; /* number of cnodes on the free list */
208 208
209 unsigned int j_trans_max ; /* max number of blocks in a transaction. */ 209 unsigned int j_trans_max; /* max number of blocks in a transaction. */
210 unsigned int j_max_batch ; /* max number of blocks to batch into a trans */ 210 unsigned int j_max_batch; /* max number of blocks to batch into a trans */
211 unsigned int j_max_commit_age ; /* in seconds, how old can an async commit be */ 211 unsigned int j_max_commit_age; /* in seconds, how old can an async commit be */
212 unsigned int j_max_trans_age ; /* in seconds, how old can a transaction be */ 212 unsigned int j_max_trans_age; /* in seconds, how old can a transaction be */
213 unsigned int j_default_max_commit_age ; /* the default for the max commit age */ 213 unsigned int j_default_max_commit_age; /* the default for the max commit age */
214 214
215 struct reiserfs_journal_cnode *j_cnode_free_list ; 215 struct reiserfs_journal_cnode *j_cnode_free_list;
216 struct reiserfs_journal_cnode *j_cnode_free_orig ; /* orig pointer returned from vmalloc */ 216 struct reiserfs_journal_cnode *j_cnode_free_orig; /* orig pointer returned from vmalloc */
217 217
218 struct reiserfs_journal_list *j_current_jl; 218 struct reiserfs_journal_list *j_current_jl;
219 int j_free_bitmap_nodes ; 219 int j_free_bitmap_nodes;
220 int j_used_bitmap_nodes ; 220 int j_used_bitmap_nodes;
221 221
222 int j_num_lists; /* total number of active transactions */ 222 int j_num_lists; /* total number of active transactions */
223 int j_num_work_lists; /* number that need attention from kreiserfsd */ 223 int j_num_work_lists; /* number that need attention from kreiserfsd */
224 224
225 /* debugging to make sure things are flushed in order */ 225 /* debugging to make sure things are flushed in order */
226 int j_last_flush_id; 226 int j_last_flush_id;
227 227
228 /* debugging to make sure things are committed in order */ 228 /* debugging to make sure things are committed in order */
229 int j_last_commit_id; 229 int j_last_commit_id;
230 230
231 struct list_head j_bitmap_nodes ; 231 struct list_head j_bitmap_nodes;
232 struct list_head j_dirty_buffers ; 232 struct list_head j_dirty_buffers;
233 spinlock_t j_dirty_buffers_lock ; /* protects j_dirty_buffers */ 233 spinlock_t j_dirty_buffers_lock; /* protects j_dirty_buffers */
234 234
235 /* list of all active transactions */ 235 /* list of all active transactions */
236 struct list_head j_journal_list; 236 struct list_head j_journal_list;
237 /* lists that haven't been touched by writeback attempts */ 237 /* lists that haven't been touched by writeback attempts */
238 struct list_head j_working_list; 238 struct list_head j_working_list;
239 239
240 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS] ; /* array of bitmaps to record the deleted blocks */ 240 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */
241 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for real buffer heads in current trans */ 241 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */
242 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for all the real buffer heads in all 242 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all
243 the transactions */ 243 the transactions */
244 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ 244 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */
245 int j_persistent_trans; 245 int j_persistent_trans;
246 unsigned long j_max_trans_size ; 246 unsigned long j_max_trans_size;
247 unsigned long j_max_batch_size ; 247 unsigned long j_max_batch_size;
248 248
249 int j_errno; 249 int j_errno;
250 250
251 /* when flushing ordered buffers, throttle new ordered writers */ 251 /* when flushing ordered buffers, throttle new ordered writers */
252 struct work_struct j_work; 252 struct work_struct j_work;
253 atomic_t j_async_throttle; 253 atomic_t j_async_throttle;
254}; 254};
255 255
256enum journal_state_bits { 256enum journal_state_bits {
257 J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */ 257 J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */
258 J_WRITERS_QUEUED, /* set when log is full due to too many writers */ 258 J_WRITERS_QUEUED, /* set when log is full due to too many writers */
259 J_ABORTED, /* set when log is aborted */ 259 J_ABORTED, /* set when log is aborted */
260}; 260};
261 261
262#define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */
262 263
263#define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ 264typedef __u32(*hashf_t) (const signed char *, int);
264 265
265typedef __u32 (*hashf_t) (const signed char *, int); 266struct reiserfs_bitmap_info {
266 267 // FIXME: Won't work with block sizes > 8K
267struct reiserfs_bitmap_info 268 __u16 first_zero_hint;
268{ 269 __u16 free_count;
269 // FIXME: Won't work with block sizes > 8K 270 struct buffer_head *bh; /* the actual bitmap */
270 __u16 first_zero_hint;
271 __u16 free_count;
272 struct buffer_head *bh; /* the actual bitmap */
273}; 271};
274 272
275struct proc_dir_entry; 273struct proc_dir_entry;
276 274
277#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) 275#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO )
278typedef unsigned long int stat_cnt_t; 276typedef unsigned long int stat_cnt_t;
279typedef struct reiserfs_proc_info_data 277typedef struct reiserfs_proc_info_data {
280{ 278 spinlock_t lock;
281 spinlock_t lock; 279 int exiting;
282 int exiting; 280 int max_hash_collisions;
283 int max_hash_collisions; 281
284 282 stat_cnt_t breads;
285 stat_cnt_t breads; 283 stat_cnt_t bread_miss;
286 stat_cnt_t bread_miss; 284 stat_cnt_t search_by_key;
287 stat_cnt_t search_by_key; 285 stat_cnt_t search_by_key_fs_changed;
288 stat_cnt_t search_by_key_fs_changed; 286 stat_cnt_t search_by_key_restarted;
289 stat_cnt_t search_by_key_restarted; 287
290 288 stat_cnt_t insert_item_restarted;
291 stat_cnt_t insert_item_restarted; 289 stat_cnt_t paste_into_item_restarted;
292 stat_cnt_t paste_into_item_restarted; 290 stat_cnt_t cut_from_item_restarted;
293 stat_cnt_t cut_from_item_restarted; 291 stat_cnt_t delete_solid_item_restarted;
294 stat_cnt_t delete_solid_item_restarted; 292 stat_cnt_t delete_item_restarted;
295 stat_cnt_t delete_item_restarted; 293
296 294 stat_cnt_t leaked_oid;
297 stat_cnt_t leaked_oid; 295 stat_cnt_t leaves_removable;
298 stat_cnt_t leaves_removable; 296
299 297 /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */
300 /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ 298 stat_cnt_t balance_at[5]; /* XXX */
301 stat_cnt_t balance_at[ 5 ]; /* XXX */ 299 /* sbk == search_by_key */
302 /* sbk == search_by_key */ 300 stat_cnt_t sbk_read_at[5]; /* XXX */
303 stat_cnt_t sbk_read_at[ 5 ]; /* XXX */ 301 stat_cnt_t sbk_fs_changed[5];
304 stat_cnt_t sbk_fs_changed[ 5 ]; 302 stat_cnt_t sbk_restarted[5];
305 stat_cnt_t sbk_restarted[ 5 ]; 303 stat_cnt_t items_at[5]; /* XXX */
306 stat_cnt_t items_at[ 5 ]; /* XXX */ 304 stat_cnt_t free_at[5]; /* XXX */
307 stat_cnt_t free_at[ 5 ]; /* XXX */ 305 stat_cnt_t can_node_be_removed[5]; /* XXX */
308 stat_cnt_t can_node_be_removed[ 5 ]; /* XXX */ 306 long int lnum[5]; /* XXX */
309 long int lnum[ 5 ]; /* XXX */ 307 long int rnum[5]; /* XXX */
310 long int rnum[ 5 ]; /* XXX */ 308 long int lbytes[5]; /* XXX */
311 long int lbytes[ 5 ]; /* XXX */ 309 long int rbytes[5]; /* XXX */
312 long int rbytes[ 5 ]; /* XXX */ 310 stat_cnt_t get_neighbors[5];
313 stat_cnt_t get_neighbors[ 5 ]; 311 stat_cnt_t get_neighbors_restart[5];
314 stat_cnt_t get_neighbors_restart[ 5 ]; 312 stat_cnt_t need_l_neighbor[5];
315 stat_cnt_t need_l_neighbor[ 5 ]; 313 stat_cnt_t need_r_neighbor[5];
316 stat_cnt_t need_r_neighbor[ 5 ]; 314
317 315 stat_cnt_t free_block;
318 stat_cnt_t free_block; 316 struct __scan_bitmap_stats {
319 struct __scan_bitmap_stats { 317 stat_cnt_t call;
320 stat_cnt_t call; 318 stat_cnt_t wait;
321 stat_cnt_t wait; 319 stat_cnt_t bmap;
322 stat_cnt_t bmap; 320 stat_cnt_t retry;
323 stat_cnt_t retry; 321 stat_cnt_t in_journal_hint;
324 stat_cnt_t in_journal_hint; 322 stat_cnt_t in_journal_nohint;
325 stat_cnt_t in_journal_nohint; 323 stat_cnt_t stolen;
326 stat_cnt_t stolen; 324 } scan_bitmap;
327 } scan_bitmap; 325 struct __journal_stats {
328 struct __journal_stats { 326 stat_cnt_t in_journal;
329 stat_cnt_t in_journal; 327 stat_cnt_t in_journal_bitmap;
330 stat_cnt_t in_journal_bitmap; 328 stat_cnt_t in_journal_reusable;
331 stat_cnt_t in_journal_reusable; 329 stat_cnt_t lock_journal;
332 stat_cnt_t lock_journal; 330 stat_cnt_t lock_journal_wait;
333 stat_cnt_t lock_journal_wait; 331 stat_cnt_t journal_being;
334 stat_cnt_t journal_being; 332 stat_cnt_t journal_relock_writers;
335 stat_cnt_t journal_relock_writers; 333 stat_cnt_t journal_relock_wcount;
336 stat_cnt_t journal_relock_wcount; 334 stat_cnt_t mark_dirty;
337 stat_cnt_t mark_dirty; 335 stat_cnt_t mark_dirty_already;
338 stat_cnt_t mark_dirty_already; 336 stat_cnt_t mark_dirty_notjournal;
339 stat_cnt_t mark_dirty_notjournal; 337 stat_cnt_t restore_prepared;
340 stat_cnt_t restore_prepared; 338 stat_cnt_t prepare;
341 stat_cnt_t prepare; 339 stat_cnt_t prepare_retry;
342 stat_cnt_t prepare_retry; 340 } journal;
343 } journal;
344} reiserfs_proc_info_data_t; 341} reiserfs_proc_info_data_t;
345#else 342#else
346typedef struct reiserfs_proc_info_data 343typedef struct reiserfs_proc_info_data {
347{} reiserfs_proc_info_data_t; 344} reiserfs_proc_info_data_t;
348#endif 345#endif
349 346
350/* reiserfs union of in-core super block data */ 347/* reiserfs union of in-core super block data */
351struct reiserfs_sb_info 348struct reiserfs_sb_info {
352{ 349 struct buffer_head *s_sbh; /* Buffer containing the super block */
353 struct buffer_head * s_sbh; /* Buffer containing the super block */ 350 /* both the comment and the choice of
354 /* both the comment and the choice of 351 name are unclear for s_rs -Hans */
355 name are unclear for s_rs -Hans */ 352 struct reiserfs_super_block *s_rs; /* Pointer to the super block in the buffer */
356 struct reiserfs_super_block * s_rs; /* Pointer to the super block in the buffer */ 353 struct reiserfs_bitmap_info *s_ap_bitmap;
357 struct reiserfs_bitmap_info * s_ap_bitmap; 354 struct reiserfs_journal *s_journal; /* pointer to journal information */
358 struct reiserfs_journal *s_journal ; /* pointer to journal information */ 355 unsigned short s_mount_state; /* reiserfs state (valid, invalid) */
359 unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ 356
360 357 /* Comment? -Hans */
361 /* Comment? -Hans */ 358 void (*end_io_handler) (struct buffer_head *, int);
362 void (*end_io_handler)(struct buffer_head *, int); 359 hashf_t s_hash_function; /* pointer to function which is used
363 hashf_t s_hash_function; /* pointer to function which is used 360 to sort names in directory. Set on
364 to sort names in directory. Set on 361 mount */
365 mount */ 362 unsigned long s_mount_opt; /* reiserfs's mount options are set
366 unsigned long s_mount_opt; /* reiserfs's mount options are set 363 here (currently - NOTAIL, NOLOG,
367 here (currently - NOTAIL, NOLOG, 364 REPLAYONLY) */
368 REPLAYONLY) */ 365
369 366 struct { /* This is a structure that describes block allocator options */
370 struct { /* This is a structure that describes block allocator options */ 367 unsigned long bits; /* Bitfield for enable/disable kind of options */
371 unsigned long bits; /* Bitfield for enable/disable kind of options */ 368 unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */
372 unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ 369 int border; /* percentage of disk, border takes */
373 int border; /* percentage of disk, border takes */ 370 int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */
374 int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ 371 int preallocsize; /* Number of blocks we try to prealloc when file
375 int preallocsize; /* Number of blocks we try to prealloc when file 372 reaches preallocmin size (in blocks) or
376 reaches preallocmin size (in blocks) or 373 prealloc_list is empty. */
377 prealloc_list is empty. */ 374 } s_alloc_options;
378 } s_alloc_options; 375
379 376 /* Comment? -Hans */
380 /* Comment? -Hans */ 377 wait_queue_head_t s_wait;
381 wait_queue_head_t s_wait; 378 /* To be obsoleted soon by per buffer seals.. -Hans */
382 /* To be obsoleted soon by per buffer seals.. -Hans */ 379 atomic_t s_generation_counter; // increased by one every time the
383 atomic_t s_generation_counter; // increased by one every time the 380 // tree gets re-balanced
384 // tree gets re-balanced 381 unsigned long s_properties; /* File system properties. Currently holds
385 unsigned long s_properties; /* File system properties. Currently holds 382 on-disk FS format */
386 on-disk FS format */ 383
387 384 /* session statistics */
388 /* session statistics */ 385 int s_kmallocs;
389 int s_kmallocs; 386 int s_disk_reads;
390 int s_disk_reads; 387 int s_disk_writes;
391 int s_disk_writes; 388 int s_fix_nodes;
392 int s_fix_nodes; 389 int s_do_balance;
393 int s_do_balance; 390 int s_unneeded_left_neighbor;
394 int s_unneeded_left_neighbor; 391 int s_good_search_by_key_reada;
395 int s_good_search_by_key_reada; 392 int s_bmaps;
396 int s_bmaps; 393 int s_bmaps_without_search;
397 int s_bmaps_without_search; 394 int s_direct2indirect;
398 int s_direct2indirect; 395 int s_indirect2direct;
399 int s_indirect2direct;
400 /* set up when it's ok for reiserfs_read_inode2() to read from 396 /* set up when it's ok for reiserfs_read_inode2() to read from
401 disk inode with nlink==0. Currently this is only used during 397 disk inode with nlink==0. Currently this is only used during
402 finish_unfinished() processing at mount time */ 398 finish_unfinished() processing at mount time */
403 int s_is_unlinked_ok; 399 int s_is_unlinked_ok;
404 reiserfs_proc_info_data_t s_proc_info_data; 400 reiserfs_proc_info_data_t s_proc_info_data;
405 struct proc_dir_entry *procdir; 401 struct proc_dir_entry *procdir;
406 int reserved_blocks; /* amount of blocks reserved for further allocations */ 402 int reserved_blocks; /* amount of blocks reserved for further allocations */
407 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ 403 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
408 struct dentry *priv_root; /* root of /.reiserfs_priv */ 404 struct dentry *priv_root; /* root of /.reiserfs_priv */
409 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ 405 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */
410 struct rw_semaphore xattr_dir_sem; 406 struct rw_semaphore xattr_dir_sem;
411 407
412 int j_errno; 408 int j_errno;
413#ifdef CONFIG_QUOTA 409#ifdef CONFIG_QUOTA
414 char *s_qf_names[MAXQUOTAS]; 410 char *s_qf_names[MAXQUOTAS];
415 int s_jquota_fmt; 411 int s_jquota_fmt;
416#endif 412#endif
417}; 413};
418 414
@@ -422,14 +418,14 @@ struct reiserfs_sb_info
422 418
423enum reiserfs_mount_options { 419enum reiserfs_mount_options {
424/* Mount options */ 420/* Mount options */
425 REISERFS_LARGETAIL, /* large tails will be created in a session */ 421 REISERFS_LARGETAIL, /* large tails will be created in a session */
426 REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ 422 REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */
427 REPLAYONLY, /* replay journal and return 0. Use by fsck */ 423 REPLAYONLY, /* replay journal and return 0. Use by fsck */
428 REISERFS_CONVERT, /* -o conv: causes conversion of old 424 REISERFS_CONVERT, /* -o conv: causes conversion of old
429 format super block to the new 425 format super block to the new
430 format. If not specified - old 426 format. If not specified - old
431 partition will be dealt with in a 427 partition will be dealt with in a
432 manner of 3.5.x */ 428 manner of 3.5.x */
433 429
434/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 430/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting
435** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option 431** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option
@@ -439,39 +435,41 @@ enum reiserfs_mount_options {
439** the existing hash on the FS, so if you have a tea hash disk, and mount 435** the existing hash on the FS, so if you have a tea hash disk, and mount
440** with -o hash=rupasov, the mount will fail. 436** with -o hash=rupasov, the mount will fail.
441*/ 437*/
442 FORCE_TEA_HASH, /* try to force tea hash on mount */ 438 FORCE_TEA_HASH, /* try to force tea hash on mount */
443 FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ 439 FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */
444 FORCE_R5_HASH, /* try to force rupasov hash on mount */ 440 FORCE_R5_HASH, /* try to force rupasov hash on mount */
445 FORCE_HASH_DETECT, /* try to detect hash function on mount */ 441 FORCE_HASH_DETECT, /* try to detect hash function on mount */
446 442
447 REISERFS_DATA_LOG, 443 REISERFS_DATA_LOG,
448 REISERFS_DATA_ORDERED, 444 REISERFS_DATA_ORDERED,
449 REISERFS_DATA_WRITEBACK, 445 REISERFS_DATA_WRITEBACK,
450 446
451/* used for testing experimental features, makes benchmarking new 447/* used for testing experimental features, makes benchmarking new
452 features with and without more convenient, should never be used by 448 features with and without more convenient, should never be used by
453 users in any code shipped to users (ideally) */ 449 users in any code shipped to users (ideally) */
454 450
455 REISERFS_NO_BORDER, 451 REISERFS_NO_BORDER,
456 REISERFS_NO_UNHASHED_RELOCATION, 452 REISERFS_NO_UNHASHED_RELOCATION,
457 REISERFS_HASHED_RELOCATION, 453 REISERFS_HASHED_RELOCATION,
458 REISERFS_ATTRS, 454 REISERFS_ATTRS,
459 REISERFS_XATTRS, 455 REISERFS_XATTRS,
460 REISERFS_XATTRS_USER, 456 REISERFS_XATTRS_USER,
461 REISERFS_POSIXACL, 457 REISERFS_POSIXACL,
462 REISERFS_BARRIER_NONE, 458 REISERFS_BARRIER_NONE,
463 REISERFS_BARRIER_FLUSH, 459 REISERFS_BARRIER_FLUSH,
464 460
465 /* Actions on error */ 461 /* Actions on error */
466 REISERFS_ERROR_PANIC, 462 REISERFS_ERROR_PANIC,
467 REISERFS_ERROR_RO, 463 REISERFS_ERROR_RO,
468 REISERFS_ERROR_CONTINUE, 464 REISERFS_ERROR_CONTINUE,
469 465
470 REISERFS_TEST1, 466 REISERFS_QUOTA, /* Some quota option specified */
471 REISERFS_TEST2, 467
472 REISERFS_TEST3, 468 REISERFS_TEST1,
473 REISERFS_TEST4, 469 REISERFS_TEST2,
474 REISERFS_UNSUPPORTED_OPT, 470 REISERFS_TEST3,
471 REISERFS_TEST4,
472 REISERFS_UNSUPPORTED_OPT,
475}; 473};
476 474
477#define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) 475#define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH))
@@ -502,18 +500,17 @@ enum reiserfs_mount_options {
502#define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) 500#define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC))
503#define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) 501#define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO))
504 502
505void reiserfs_file_buffer (struct buffer_head * bh, int list); 503void reiserfs_file_buffer(struct buffer_head *bh, int list);
506extern struct file_system_type reiserfs_fs_type; 504extern struct file_system_type reiserfs_fs_type;
507int reiserfs_resize(struct super_block *, unsigned long) ; 505int reiserfs_resize(struct super_block *, unsigned long);
508 506
509#define CARRY_ON 0 507#define CARRY_ON 0
510#define SCHEDULE_OCCURRED 1 508#define SCHEDULE_OCCURRED 1
511 509
512
513#define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) 510#define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh)
514#define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) 511#define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal)
515#define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) 512#define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block)
516#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) 513#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free)
517#define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) 514#define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap)
518 515
519#define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->) 516#define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->)
@@ -523,13 +520,14 @@ int reiserfs_resize(struct super_block *, unsigned long) ;
523 */ 520 */
524static inline char *reiserfs_bdevname(struct super_block *s) 521static inline char *reiserfs_bdevname(struct super_block *s)
525{ 522{
526 return (s == NULL) ? "Null superblock" : s -> s_id; 523 return (s == NULL) ? "Null superblock" : s->s_id;
527} 524}
528 525
529#define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal))) 526#define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal)))
530static inline int __reiserfs_is_journal_aborted (struct reiserfs_journal *journal) 527static inline int __reiserfs_is_journal_aborted(struct reiserfs_journal
528 *journal)
531{ 529{
532 return test_bit (J_ABORTED, &journal->j_state); 530 return test_bit(J_ABORTED, &journal->j_state);
533} 531}
534 532
535#endif /* _LINUX_REISER_FS_SB */ 533#endif /* _LINUX_REISER_FS_SB */
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 9244c5748820..c84354e8374c 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -7,48 +7,48 @@
7#include <linux/xattr.h> 7#include <linux/xattr.h>
8 8
9/* Magic value in header */ 9/* Magic value in header */
10#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ 10#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
11 11
12struct reiserfs_xattr_header { 12struct reiserfs_xattr_header {
13 __le32 h_magic; /* magic number for identification */ 13 __le32 h_magic; /* magic number for identification */
14 __le32 h_hash; /* hash of the value */ 14 __le32 h_hash; /* hash of the value */
15}; 15};
16 16
17#ifdef __KERNEL__ 17#ifdef __KERNEL__
18 18
19struct reiserfs_xattr_handler { 19struct reiserfs_xattr_handler {
20 char *prefix; 20 char *prefix;
21 int (*init)(void); 21 int (*init) (void);
22 void (*exit)(void); 22 void (*exit) (void);
23 int (*get)(struct inode *inode, const char *name, void *buffer, 23 int (*get) (struct inode * inode, const char *name, void *buffer,
24 size_t size); 24 size_t size);
25 int (*set)(struct inode *inode, const char *name, const void *buffer, 25 int (*set) (struct inode * inode, const char *name, const void *buffer,
26 size_t size, int flags); 26 size_t size, int flags);
27 int (*del)(struct inode *inode, const char *name); 27 int (*del) (struct inode * inode, const char *name);
28 int (*list)(struct inode *inode, const char *name, int namelen, char *out); 28 int (*list) (struct inode * inode, const char *name, int namelen,
29 struct list_head handlers; 29 char *out);
30 struct list_head handlers;
30}; 31};
31 32
32
33#ifdef CONFIG_REISERFS_FS_XATTR 33#ifdef CONFIG_REISERFS_FS_XATTR
34#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode) 34#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
35#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 35#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
36ssize_t reiserfs_getxattr (struct dentry *dentry, const char *name, 36ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
37 void *buffer, size_t size); 37 void *buffer, size_t size);
38int reiserfs_setxattr (struct dentry *dentry, const char *name, 38int reiserfs_setxattr(struct dentry *dentry, const char *name,
39 const void *value, size_t size, int flags); 39 const void *value, size_t size, int flags);
40ssize_t reiserfs_listxattr (struct dentry *dentry, char *buffer, size_t size); 40ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
41int reiserfs_removexattr (struct dentry *dentry, const char *name); 41int reiserfs_removexattr(struct dentry *dentry, const char *name);
42int reiserfs_delete_xattrs (struct inode *inode); 42int reiserfs_delete_xattrs(struct inode *inode);
43int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs); 43int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
44int reiserfs_xattr_init (struct super_block *sb, int mount_flags); 44int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
45int reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd); 45int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd);
46int reiserfs_permission_locked (struct inode *inode, int mask, struct nameidata *nd); 46int reiserfs_permission_locked(struct inode *inode, int mask,
47 47 struct nameidata *nd);
48int reiserfs_xattr_del (struct inode *, const char *); 48
49int reiserfs_xattr_get (const struct inode *, const char *, void *, size_t); 49int reiserfs_xattr_del(struct inode *, const char *);
50int reiserfs_xattr_set (struct inode *, const char *, const void *, 50int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
51 size_t, int); 51int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
52 52
53extern struct reiserfs_xattr_handler user_handler; 53extern struct reiserfs_xattr_handler user_handler;
54extern struct reiserfs_xattr_handler trusted_handler; 54extern struct reiserfs_xattr_handler trusted_handler;
@@ -56,57 +56,48 @@ extern struct reiserfs_xattr_handler trusted_handler;
56extern struct reiserfs_xattr_handler security_handler; 56extern struct reiserfs_xattr_handler security_handler;
57#endif 57#endif
58 58
59int reiserfs_xattr_register_handlers (void) __init; 59int reiserfs_xattr_register_handlers(void) __init;
60void reiserfs_xattr_unregister_handlers (void); 60void reiserfs_xattr_unregister_handlers(void);
61 61
62static inline void 62static inline void reiserfs_write_lock_xattrs(struct super_block *sb)
63reiserfs_write_lock_xattrs(struct super_block *sb)
64{ 63{
65 down_write (&REISERFS_XATTR_DIR_SEM(sb)); 64 down_write(&REISERFS_XATTR_DIR_SEM(sb));
66} 65}
67static inline void 66static inline void reiserfs_write_unlock_xattrs(struct super_block *sb)
68reiserfs_write_unlock_xattrs(struct super_block *sb)
69{ 67{
70 up_write (&REISERFS_XATTR_DIR_SEM(sb)); 68 up_write(&REISERFS_XATTR_DIR_SEM(sb));
71} 69}
72static inline void 70static inline void reiserfs_read_lock_xattrs(struct super_block *sb)
73reiserfs_read_lock_xattrs(struct super_block *sb)
74{ 71{
75 down_read (&REISERFS_XATTR_DIR_SEM(sb)); 72 down_read(&REISERFS_XATTR_DIR_SEM(sb));
76} 73}
77 74
78static inline void 75static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
79reiserfs_read_unlock_xattrs(struct super_block *sb)
80{ 76{
81 up_read (&REISERFS_XATTR_DIR_SEM(sb)); 77 up_read(&REISERFS_XATTR_DIR_SEM(sb));
82} 78}
83 79
84static inline void 80static inline void reiserfs_write_lock_xattr_i(struct inode *inode)
85reiserfs_write_lock_xattr_i(struct inode *inode)
86{ 81{
87 down_write (&REISERFS_I(inode)->xattr_sem); 82 down_write(&REISERFS_I(inode)->xattr_sem);
88} 83}
89static inline void 84static inline void reiserfs_write_unlock_xattr_i(struct inode *inode)
90reiserfs_write_unlock_xattr_i(struct inode *inode)
91{ 85{
92 up_write (&REISERFS_I(inode)->xattr_sem); 86 up_write(&REISERFS_I(inode)->xattr_sem);
93} 87}
94static inline void 88static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
95reiserfs_read_lock_xattr_i(struct inode *inode)
96{ 89{
97 down_read (&REISERFS_I(inode)->xattr_sem); 90 down_read(&REISERFS_I(inode)->xattr_sem);
98} 91}
99 92
100static inline void 93static inline void reiserfs_read_unlock_xattr_i(struct inode *inode)
101reiserfs_read_unlock_xattr_i(struct inode *inode)
102{ 94{
103 up_read (&REISERFS_I(inode)->xattr_sem); 95 up_read(&REISERFS_I(inode)->xattr_sem);
104} 96}
105 97
106static inline void 98static inline void reiserfs_mark_inode_private(struct inode *inode)
107reiserfs_mark_inode_private(struct inode *inode)
108{ 99{
109 inode->i_flags |= S_PRIVATE; 100 inode->i_flags |= S_PRIVATE;
110} 101}
111 102
112#else 103#else
@@ -127,13 +118,20 @@ reiserfs_mark_inode_private(struct inode *inode)
127#define reiserfs_xattr_register_handlers() 0 118#define reiserfs_xattr_register_handlers() 0
128#define reiserfs_xattr_unregister_handlers() 119#define reiserfs_xattr_unregister_handlers()
129 120
130static inline int reiserfs_delete_xattrs (struct inode *inode) { return 0; }; 121static inline int reiserfs_delete_xattrs(struct inode *inode)
131static inline int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs) { return 0; }; 122{
132static inline int reiserfs_xattr_init (struct super_block *sb, int mount_flags) 123 return 0;
124};
125static inline int reiserfs_chown_xattrs(struct inode *inode,
126 struct iattr *attrs)
127{
128 return 0;
129};
130static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
133{ 131{
134 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ 132 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
135 return 0; 133 return 0;
136}; 134};
137#endif 135#endif
138 136
139#endif /* __KERNEL__ */ 137#endif /* __KERNEL__ */
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 b58afd97a180..dec5827c7742 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -246,7 +246,7 @@ struct mm_struct {
246 246
247 unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ 247 unsigned long saved_auxv[42]; /* for /proc/PID/auxv */
248 248
249 unsigned dumpable:1; 249 unsigned dumpable:2;
250 cpumask_t cpu_vm_mask; 250 cpumask_t cpu_vm_mask;
251 251
252 /* Architecture-specific MM context */ 252 /* Architecture-specific MM context */
@@ -368,6 +368,11 @@ struct signal_struct {
368#endif 368#endif
369}; 369};
370 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
371/* 376/*
372 * Bits in flags field of signal_struct. 377 * Bits in flags field of signal_struct.
373 */ 378 */
@@ -405,6 +410,10 @@ struct user_struct {
405 atomic_t processes; /* How many processes does this user have? */ 410 atomic_t processes; /* How many processes does this user have? */
406 atomic_t files; /* How many open files does this user have? */ 411 atomic_t files; /* How many open files does this user have? */
407 atomic_t sigpending; /* How many pending signals does this user have? */ 412 atomic_t sigpending; /* How many pending signals does this user have? */
413#ifdef CONFIG_INOTIFY
414 atomic_t inotify_watches; /* How many inotify watches does this user have? */
415 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */
416#endif
408 /* protected by mq_lock */ 417 /* protected by mq_lock */
409 unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */ 418 unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */
410 unsigned long locked_shm; /* How many pages of mlocked shm ? */ 419 unsigned long locked_shm; /* How many pages of mlocked shm ? */
@@ -460,10 +469,11 @@ enum idle_type
460#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ 469#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */
461#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */ 470#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */
462#define SD_BALANCE_EXEC 4 /* Balance on exec */ 471#define SD_BALANCE_EXEC 4 /* Balance on exec */
463#define SD_WAKE_IDLE 8 /* Wake to idle CPU on task wakeup */ 472#define SD_BALANCE_FORK 8 /* Balance on fork, clone */
464#define SD_WAKE_AFFINE 16 /* Wake task to waking CPU */ 473#define SD_WAKE_IDLE 16 /* Wake to idle CPU on task wakeup */
465#define SD_WAKE_BALANCE 32 /* Perform balancing at task wakeup */ 474#define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */
466#define SD_SHARE_CPUPOWER 64 /* Domain members share cpu power */ 475#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */
476#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */
467 477
468struct sched_group { 478struct sched_group {
469 struct sched_group *next; /* Must be a circular list */ 479 struct sched_group *next; /* Must be a circular list */
@@ -488,6 +498,11 @@ struct sched_domain {
488 unsigned long long cache_hot_time; /* Task considered cache hot (ns) */ 498 unsigned long long cache_hot_time; /* Task considered cache hot (ns) */
489 unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */ 499 unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */
490 unsigned int per_cpu_gain; /* CPU % gained by adding domain cpus */ 500 unsigned int per_cpu_gain; /* CPU % gained by adding domain cpus */
501 unsigned int busy_idx;
502 unsigned int idle_idx;
503 unsigned int newidle_idx;
504 unsigned int wake_idx;
505 unsigned int forkexec_idx;
491 int flags; /* See SD_* */ 506 int flags; /* See SD_* */
492 507
493 /* Runtime fields. */ 508 /* Runtime fields. */
@@ -511,10 +526,16 @@ struct sched_domain {
511 unsigned long alb_failed; 526 unsigned long alb_failed;
512 unsigned long alb_pushed; 527 unsigned long alb_pushed;
513 528
514 /* sched_balance_exec() stats */ 529 /* SD_BALANCE_EXEC stats */
515 unsigned long sbe_attempts; 530 unsigned long sbe_cnt;
531 unsigned long sbe_balanced;
516 unsigned long sbe_pushed; 532 unsigned long sbe_pushed;
517 533
534 /* SD_BALANCE_FORK stats */
535 unsigned long sbf_cnt;
536 unsigned long sbf_balanced;
537 unsigned long sbf_pushed;
538
518 /* try_to_wake_up() stats */ 539 /* try_to_wake_up() stats */
519 unsigned long ttwu_wake_remote; 540 unsigned long ttwu_wake_remote;
520 unsigned long ttwu_move_affine; 541 unsigned long ttwu_move_affine;
@@ -522,6 +543,8 @@ struct sched_domain {
522#endif 543#endif
523}; 544};
524 545
546extern void partition_sched_domains(cpumask_t *partition1,
547 cpumask_t *partition2);
525#ifdef ARCH_HAS_SCHED_DOMAIN 548#ifdef ARCH_HAS_SCHED_DOMAIN
526/* Useful helpers that arch setup code may use. Defined in kernel/sched.c */ 549/* Useful helpers that arch setup code may use. Defined in kernel/sched.c */
527extern cpumask_t cpu_isolated_map; 550extern cpumask_t cpu_isolated_map;
@@ -561,9 +584,10 @@ struct group_info {
561 groups_free(group_info); \ 584 groups_free(group_info); \
562} while (0) 585} while (0)
563 586
564struct group_info *groups_alloc(int gidsetsize); 587extern struct group_info *groups_alloc(int gidsetsize);
565void groups_free(struct group_info *group_info); 588extern void groups_free(struct group_info *group_info);
566int set_current_groups(struct group_info *group_info); 589extern int set_current_groups(struct group_info *group_info);
590extern int groups_search(struct group_info *group_info, gid_t grp);
567/* access the groups "array" with this macro */ 591/* access the groups "array" with this macro */
568#define GROUP_AT(gi, i) \ 592#define GROUP_AT(gi, i) \
569 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) 593 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
@@ -581,10 +605,15 @@ struct task_struct {
581 605
582 int lock_depth; /* BKL lock depth */ 606 int lock_depth; /* BKL lock depth */
583 607
608#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
609 int oncpu;
610#endif
584 int prio, static_prio; 611 int prio, static_prio;
585 struct list_head run_list; 612 struct list_head run_list;
586 prio_array_t *array; 613 prio_array_t *array;
587 614
615 unsigned short ioprio;
616
588 unsigned long sleep_avg; 617 unsigned long sleep_avg;
589 unsigned long long timestamp, last_ran; 618 unsigned long long timestamp, last_ran;
590 unsigned long long sched_time; /* sched_clock time spent running */ 619 unsigned long long sched_time; /* sched_clock time spent running */
@@ -660,6 +689,7 @@ struct task_struct {
660 struct user_struct *user; 689 struct user_struct *user;
661#ifdef CONFIG_KEYS 690#ifdef CONFIG_KEYS
662 struct key *thread_keyring; /* keyring private to this thread */ 691 struct key *thread_keyring; /* keyring private to this thread */
692 unsigned char jit_keyring; /* default keyring to attach requested keys to */
663#endif 693#endif
664 int oomkilladj; /* OOM kill score adjustment (bit shift). */ 694 int oomkilladj; /* OOM kill score adjustment (bit shift). */
665 char comm[TASK_COMM_LEN]; /* executable name excluding path 695 char comm[TASK_COMM_LEN]; /* executable name excluding path
@@ -702,8 +732,6 @@ struct task_struct {
702 spinlock_t alloc_lock; 732 spinlock_t alloc_lock;
703/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ 733/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
704 spinlock_t proc_lock; 734 spinlock_t proc_lock;
705/* context-switch lock */
706 spinlock_t switch_lock;
707 735
708/* journalling filesystem info */ 736/* journalling filesystem info */
709 void *journal_info; 737 void *journal_info;
@@ -741,6 +769,7 @@ struct task_struct {
741 nodemask_t mems_allowed; 769 nodemask_t mems_allowed;
742 int cpuset_mems_generation; 770 int cpuset_mems_generation;
743#endif 771#endif
772 atomic_t fs_excl; /* holding fs exclusive resources */
744}; 773};
745 774
746static inline pid_t process_group(struct task_struct *tsk) 775static inline pid_t process_group(struct task_struct *tsk)
@@ -910,7 +939,7 @@ extern void FASTCALL(wake_up_new_task(struct task_struct * tsk,
910#else 939#else
911 static inline void kick_process(struct task_struct *tsk) { } 940 static inline void kick_process(struct task_struct *tsk) { }
912#endif 941#endif
913extern void FASTCALL(sched_fork(task_t * p)); 942extern void FASTCALL(sched_fork(task_t * p, int clone_flags));
914extern void FASTCALL(sched_exit(task_t * p)); 943extern void FASTCALL(sched_exit(task_t * p));
915 944
916extern int in_group_p(gid_t); 945extern int in_group_p(gid_t);
@@ -1090,7 +1119,8 @@ extern void unhash_process(struct task_struct *p);
1090 1119
1091/* 1120/*
1092 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring 1121 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring
1093 * subscriptions and synchronises with wait4(). Also used in procfs. 1122 * subscriptions and synchronises with wait4(). Also used in procfs. Also
1123 * pins the final release of task.io_context.
1094 * 1124 *
1095 * Nests both inside and outside of read_lock(&tasklist_lock). 1125 * Nests both inside and outside of read_lock(&tasklist_lock).
1096 * It must not be nested with write_lock_irq(&tasklist_lock), 1126 * It must not be nested with write_lock_irq(&tasklist_lock),
@@ -1243,33 +1273,78 @@ extern void normalize_rt_tasks(void);
1243 1273
1244#endif 1274#endif
1245 1275
1246/* try_to_freeze
1247 *
1248 * Checks whether we need to enter the refrigerator
1249 * and returns 1 if we did so.
1250 */
1251#ifdef CONFIG_PM 1276#ifdef CONFIG_PM
1252extern void refrigerator(unsigned long); 1277/*
1278 * Check if a process has been frozen
1279 */
1280static inline int frozen(struct task_struct *p)
1281{
1282 return p->flags & PF_FROZEN;
1283}
1284
1285/*
1286 * Check if there is a request to freeze a process
1287 */
1288static inline int freezing(struct task_struct *p)
1289{
1290 return p->flags & PF_FREEZE;
1291}
1292
1293/*
1294 * Request that a process be frozen
1295 * FIXME: SMP problem. We may not modify other process' flags!
1296 */
1297static inline void freeze(struct task_struct *p)
1298{
1299 p->flags |= PF_FREEZE;
1300}
1301
1302/*
1303 * Wake up a frozen process
1304 */
1305static inline int thaw_process(struct task_struct *p)
1306{
1307 if (frozen(p)) {
1308 p->flags &= ~PF_FROZEN;
1309 wake_up_process(p);
1310 return 1;
1311 }
1312 return 0;
1313}
1314
1315/*
1316 * freezing is complete, mark process as frozen
1317 */
1318static inline void frozen_process(struct task_struct *p)
1319{
1320 p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN;
1321}
1322
1323extern void refrigerator(void);
1253extern int freeze_processes(void); 1324extern int freeze_processes(void);
1254extern void thaw_processes(void); 1325extern void thaw_processes(void);
1255 1326
1256static inline int try_to_freeze(unsigned long refrigerator_flags) 1327static inline int try_to_freeze(void)
1257{ 1328{
1258 if (unlikely(current->flags & PF_FREEZE)) { 1329 if (freezing(current)) {
1259 refrigerator(refrigerator_flags); 1330 refrigerator();
1260 return 1; 1331 return 1;
1261 } else 1332 } else
1262 return 0; 1333 return 0;
1263} 1334}
1264#else 1335#else
1265static inline void refrigerator(unsigned long flag) {} 1336static inline int frozen(struct task_struct *p) { return 0; }
1337static inline int freezing(struct task_struct *p) { return 0; }
1338static inline void freeze(struct task_struct *p) { BUG(); }
1339static inline int thaw_process(struct task_struct *p) { return 1; }
1340static inline void frozen_process(struct task_struct *p) { BUG(); }
1341
1342static inline void refrigerator(void) {}
1266static inline int freeze_processes(void) { BUG(); return 0; } 1343static inline int freeze_processes(void) { BUG(); return 0; }
1267static inline void thaw_processes(void) {} 1344static inline void thaw_processes(void) {}
1268 1345
1269static inline int try_to_freeze(unsigned long refrigerator_flags) 1346static inline int try_to_freeze(void) { return 0; }
1270{ 1347
1271 return 0;
1272}
1273#endif /* CONFIG_PM */ 1348#endif /* CONFIG_PM */
1274#endif /* __KERNEL__ */ 1349#endif /* __KERNEL__ */
1275 1350
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.h b/include/linux/serial.h
index 00145822fb74..9f2d85284d0b 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -174,9 +174,11 @@ struct serial_icounter_struct {
174 174
175 175
176#ifdef __KERNEL__ 176#ifdef __KERNEL__
177#include <linux/compiler.h>
178
177/* Export to allow PCMCIA to use this - Dave Hinds */ 179/* Export to allow PCMCIA to use this - Dave Hinds */
178extern int register_serial(struct serial_struct *req); 180extern int __deprecated register_serial(struct serial_struct *req);
179extern void unregister_serial(int line); 181extern void __deprecated unregister_serial(int line);
180 182
181/* Allow architectures to override entries in serial8250_ports[] at run time: */ 183/* Allow architectures to override entries in serial8250_ports[] at run time: */
182struct uart_port; /* forward declaration */ 184struct uart_port; /* forward declaration */
diff --git a/include/linux/serialP.h b/include/linux/serialP.h
index 2307f11d8a6b..2b2f35a64d75 100644
--- a/include/linux/serialP.h
+++ b/include/linux/serialP.h
@@ -19,7 +19,6 @@
19 * For definitions of the flags field, see tty.h 19 * For definitions of the flags field, see tty.h
20 */ 20 */
21 21
22#include <linux/version.h>
23#include <linux/config.h> 22#include <linux/config.h>
24#include <linux/termios.h> 23#include <linux/termios.h>
25#include <linux/workqueue.h> 24#include <linux/workqueue.h>
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/serial_core.h b/include/linux/serial_core.h
index d6025af7efac..f6fca8f2f3ca 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -104,7 +104,7 @@
104#define PORT_MPSC 63 104#define PORT_MPSC 63
105 105
106/* TXX9 type number */ 106/* TXX9 type number */
107#define PORT_TXX9 64 107#define PORT_TXX9 64
108 108
109/* NEC VR4100 series SIU/DSIU */ 109/* NEC VR4100 series SIU/DSIU */
110#define PORT_VR41XX_SIU 65 110#define PORT_VR41XX_SIU 65
@@ -122,6 +122,7 @@
122#ifdef __KERNEL__ 122#ifdef __KERNEL__
123 123
124#include <linux/config.h> 124#include <linux/config.h>
125#include <linux/compiler.h>
125#include <linux/interrupt.h> 126#include <linux/interrupt.h>
126#include <linux/circ_buf.h> 127#include <linux/circ_buf.h>
127#include <linux/spinlock.h> 128#include <linux/spinlock.h>
@@ -359,8 +360,8 @@ struct tty_driver *uart_console_device(struct console *co, int *index);
359 */ 360 */
360int uart_register_driver(struct uart_driver *uart); 361int uart_register_driver(struct uart_driver *uart);
361void uart_unregister_driver(struct uart_driver *uart); 362void uart_unregister_driver(struct uart_driver *uart);
362void uart_unregister_port(struct uart_driver *reg, int line); 363void __deprecated uart_unregister_port(struct uart_driver *reg, int line);
363int uart_register_port(struct uart_driver *reg, struct uart_port *port); 364int __deprecated uart_register_port(struct uart_driver *reg, struct uart_port *port);
364int uart_add_one_port(struct uart_driver *reg, struct uart_port *port); 365int uart_add_one_port(struct uart_driver *reg, struct uart_port *port);
365int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); 366int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
366int uart_match_port(struct uart_port *port1, struct uart_port *port2); 367int uart_match_port(struct uart_port *port1, struct uart_port *port2);
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 d7c839a21842..948527e42a60 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 */
@@ -182,7 +183,6 @@ struct skb_shared_info {
182 * @priority: Packet queueing priority 183 * @priority: Packet queueing priority
183 * @users: User count - see {datagram,tcp}.c 184 * @users: User count - see {datagram,tcp}.c
184 * @protocol: Packet protocol from driver 185 * @protocol: Packet protocol from driver
185 * @security: Security level of packet
186 * @truesize: Buffer size 186 * @truesize: Buffer size
187 * @head: Head of buffer 187 * @head: Head of buffer
188 * @data: Data head pointer 188 * @data: Data head pointer
@@ -248,18 +248,18 @@ struct sk_buff {
248 data_len, 248 data_len,
249 mac_len, 249 mac_len,
250 csum; 250 csum;
251 unsigned char local_df,
252 cloned:1,
253 nohdr:1,
254 pkt_type,
255 ip_summed;
256 __u32 priority; 251 __u32 priority;
257 unsigned short protocol, 252 __u8 local_df:1,
258 security; 253 cloned:1,
254 ip_summed:2,
255 nohdr:1;
256 /* 3 bits spare */
257 __u8 pkt_type;
258 __be16 protocol;
259 259
260 void (*destructor)(struct sk_buff *skb); 260 void (*destructor)(struct sk_buff *skb);
261#ifdef CONFIG_NETFILTER 261#ifdef CONFIG_NETFILTER
262 unsigned long nfmark; 262 unsigned long nfmark;
263 __u32 nfcache; 263 __u32 nfcache;
264 __u32 nfctinfo; 264 __u32 nfctinfo;
265 struct nf_conntrack *nfct; 265 struct nf_conntrack *nfct;
@@ -300,20 +300,26 @@ struct sk_buff {
300#include <asm/system.h> 300#include <asm/system.h>
301 301
302extern void __kfree_skb(struct sk_buff *skb); 302extern void __kfree_skb(struct sk_buff *skb);
303extern struct sk_buff *alloc_skb(unsigned int size, int priority); 303extern struct sk_buff *alloc_skb(unsigned int size,
304 unsigned int __nocast priority);
304extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 305extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
305 unsigned int size, int priority); 306 unsigned int size,
307 unsigned int __nocast priority);
306extern void kfree_skbmem(struct sk_buff *skb); 308extern void kfree_skbmem(struct sk_buff *skb);
307extern struct sk_buff *skb_clone(struct sk_buff *skb, int priority); 309extern struct sk_buff *skb_clone(struct sk_buff *skb,
308extern struct sk_buff *skb_copy(const struct sk_buff *skb, int priority); 310 unsigned int __nocast priority);
309extern struct sk_buff *pskb_copy(struct sk_buff *skb, int gfp_mask); 311extern struct sk_buff *skb_copy(const struct sk_buff *skb,
312 unsigned int __nocast priority);
313extern struct sk_buff *pskb_copy(struct sk_buff *skb,
314 unsigned int __nocast gfp_mask);
310extern int pskb_expand_head(struct sk_buff *skb, 315extern int pskb_expand_head(struct sk_buff *skb,
311 int nhead, int ntail, int gfp_mask); 316 int nhead, int ntail,
317 unsigned int __nocast gfp_mask);
312extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 318extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
313 unsigned int headroom); 319 unsigned int headroom);
314extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 320extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
315 int newheadroom, int newtailroom, 321 int newheadroom, int newtailroom,
316 int priority); 322 unsigned int __nocast priority);
317extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); 323extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad);
318#define dev_kfree_skb(a) kfree_skb(a) 324#define dev_kfree_skb(a) kfree_skb(a)
319extern void skb_over_panic(struct sk_buff *skb, int len, 325extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -321,6 +327,28 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
321extern void skb_under_panic(struct sk_buff *skb, int len, 327extern void skb_under_panic(struct sk_buff *skb, int len,
322 void *here); 328 void *here);
323 329
330struct skb_seq_state
331{
332 __u32 lower_offset;
333 __u32 upper_offset;
334 __u32 frag_idx;
335 __u32 stepped_offset;
336 struct sk_buff *root_skb;
337 struct sk_buff *cur_skb;
338 __u8 *frag_data;
339};
340
341extern void skb_prepare_seq_read(struct sk_buff *skb,
342 unsigned int from, unsigned int to,
343 struct skb_seq_state *st);
344extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
345 struct skb_seq_state *st);
346extern void skb_abort_seq_read(struct skb_seq_state *st);
347
348extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
349 unsigned int to, struct ts_config *config,
350 struct ts_state *state);
351
324/* Internal */ 352/* Internal */
325#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) 353#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end))
326 354
@@ -442,7 +470,8 @@ static inline int skb_shared(const struct sk_buff *skb)
442 * 470 *
443 * NULL is returned on a memory allocation failure. 471 * NULL is returned on a memory allocation failure.
444 */ 472 */
445static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) 473static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
474 unsigned int __nocast pri)
446{ 475{
447 might_sleep_if(pri & __GFP_WAIT); 476 might_sleep_if(pri & __GFP_WAIT);
448 if (skb_shared(skb)) { 477 if (skb_shared(skb)) {
@@ -473,7 +502,8 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri)
473 * 502 *
474 * %NULL is returned on a memory allocation failure. 503 * %NULL is returned on a memory allocation failure.
475 */ 504 */
476static inline struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) 505static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
506 unsigned int __nocast pri)
477{ 507{
478 might_sleep_if(pri & __GFP_WAIT); 508 might_sleep_if(pri & __GFP_WAIT);
479 if (skb_cloned(skb)) { 509 if (skb_cloned(skb)) {
@@ -979,7 +1009,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
979 * %NULL is returned in there is no free memory. 1009 * %NULL is returned in there is no free memory.
980 */ 1010 */
981static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1011static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
982 int gfp_mask) 1012 unsigned int __nocast gfp_mask)
983{ 1013{
984 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); 1014 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask);
985 if (likely(skb)) 1015 if (likely(skb))
@@ -1092,8 +1122,8 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1092 * If there is no free memory -ENOMEM is returned, otherwise zero 1122 * If there is no free memory -ENOMEM is returned, otherwise zero
1093 * is returned and the old skb data released. 1123 * is returned and the old skb data released.
1094 */ 1124 */
1095extern int __skb_linearize(struct sk_buff *skb, int gfp); 1125extern int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp);
1096static inline int skb_linearize(struct sk_buff *skb, int gfp) 1126static inline int skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp)
1097{ 1127{
1098 return __skb_linearize(skb, gfp); 1128 return __skb_linearize(skb, gfp);
1099} 1129}
@@ -1188,7 +1218,7 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1188{ 1218{
1189 int hlen = skb_headlen(skb); 1219 int hlen = skb_headlen(skb);
1190 1220
1191 if (offset + len <= hlen) 1221 if (hlen - offset >= len)
1192 return skb->data + offset; 1222 return skb->data + offset;
1193 1223
1194 if (skb_copy_bits(skb, offset, buffer, len) < 0) 1224 if (skb_copy_bits(skb, offset, buffer, len) < 0)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 76cf7e60216c..80b2dfde2e80 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -65,7 +65,7 @@ extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast);
65extern void kmem_cache_free(kmem_cache_t *, void *); 65extern void kmem_cache_free(kmem_cache_t *, void *);
66extern unsigned int kmem_cache_size(kmem_cache_t *); 66extern unsigned int kmem_cache_size(kmem_cache_t *);
67extern const char *kmem_cache_name(kmem_cache_t *); 67extern const char *kmem_cache_name(kmem_cache_t *);
68extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags); 68extern kmem_cache_t *kmem_find_general_cachep(size_t size, unsigned int __nocast gfpflags);
69 69
70/* Size description struct for general caches. */ 70/* Size description struct for general caches. */
71struct cache_sizes { 71struct cache_sizes {
@@ -105,13 +105,13 @@ extern unsigned int ksize(const void *);
105 105
106#ifdef CONFIG_NUMA 106#ifdef CONFIG_NUMA
107extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node); 107extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node);
108extern void *kmalloc_node(size_t size, int flags, int node); 108extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node);
109#else 109#else
110static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) 110static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node)
111{ 111{
112 return kmem_cache_alloc(cachep, flags); 112 return kmem_cache_alloc(cachep, flags);
113} 113}
114static inline void *kmalloc_node(size_t size, int flags, int node) 114static inline void *kmalloc_node(size_t size, unsigned int __nocast flags, int node)
115{ 115{
116 return kmalloc(size, flags); 116 return kmalloc(size, flags);
117} 117}
diff --git a/include/linux/string.h b/include/linux/string.h
index b9fc59469956..dab2652acbd8 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, unsigned int __nocast 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..23448d0fb5bc 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,23 @@ 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 unsigned int array_maxlen;
181 xdr_xcode_elem_t xcode;
182};
183
184extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base,
185 struct xdr_array2_desc *desc);
186extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
187 struct xdr_array2_desc *desc);
188
171/* 189/*
172 * Provide some simple tools for XDR buffer overflow-checking etc. 190 * Provide some simple tools for XDR buffer overflow-checking etc.
173 */ 191 */
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 2343f999e6e1..bfe3e763ccf2 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -7,6 +7,7 @@
7#include <linux/mmzone.h> 7#include <linux/mmzone.h>
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10
10#include <asm/atomic.h> 11#include <asm/atomic.h>
11#include <asm/page.h> 12#include <asm/page.h>
12 13
@@ -148,7 +149,7 @@ struct swap_list_t {
148#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) 149#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
149 150
150/* linux/mm/oom_kill.c */ 151/* linux/mm/oom_kill.c */
151extern void out_of_memory(unsigned int __nocast gfp_mask); 152extern void out_of_memory(unsigned int __nocast gfp_mask, int order);
152 153
153/* linux/mm/memory.c */ 154/* linux/mm/memory.c */
154extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); 155extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
@@ -253,6 +254,8 @@ static inline void put_swap_token(struct mm_struct *mm)
253 254
254#define si_swapinfo(val) \ 255#define si_swapinfo(val) \
255 do { (val)->freeswap = (val)->totalswap = 0; } while (0) 256 do { (val)->freeswap = (val)->totalswap = 0; } while (0)
257/* only sparc can not include linux/pagemap.h in this file
258 * so leave page_cache_release and release_pages undeclared... */
256#define free_page_and_swap_cache(page) \ 259#define free_page_and_swap_cache(page) \
257 page_cache_release(page) 260 page_cache_release(page)
258#define free_pages_and_swap_cache(pages, nr) \ 261#define free_pages_and_swap_cache(pages, nr) \
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c39f6f72cbbc..425f58c8ea4a 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);
@@ -505,4 +506,7 @@ asmlinkage long sys_request_key(const char __user *_type,
505asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3, 506asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3,
506 unsigned long arg4, unsigned long arg5); 507 unsigned long arg4, unsigned long arg5);
507 508
509asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
510asmlinkage long sys_ioprio_get(int which, int who);
511
508#endif 512#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index a17745c80a91..e82be96d4906 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -70,6 +70,14 @@ enum
70 CTL_BUS_ISA=1 /* ISA */ 70 CTL_BUS_ISA=1 /* ISA */
71}; 71};
72 72
73/* /proc/sys/fs/inotify/ */
74enum
75{
76 INOTIFY_MAX_USER_INSTANCES=1, /* max instances per user */
77 INOTIFY_MAX_USER_WATCHES=2, /* max watches per user */
78 INOTIFY_MAX_QUEUED_EVENTS=3 /* max queued events per instance */
79};
80
73/* CTL_KERN names: */ 81/* CTL_KERN names: */
74enum 82enum
75{ 83{
@@ -136,6 +144,8 @@ enum
136 KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */ 144 KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
137 KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ 145 KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
138 KERN_RANDOMIZE=68, /* int: randomize virtual address space */ 146 KERN_RANDOMIZE=68, /* int: randomize virtual address space */
147 KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
148 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
139}; 149};
140 150
141 151
@@ -242,6 +252,7 @@ enum
242 NET_CORE_MOD_CONG=16, 252 NET_CORE_MOD_CONG=16,
243 NET_CORE_DEV_WEIGHT=17, 253 NET_CORE_DEV_WEIGHT=17,
244 NET_CORE_SOMAXCONN=18, 254 NET_CORE_SOMAXCONN=18,
255 NET_CORE_BUDGET=19,
245}; 256};
246 257
247/* /proc/sys/net/ethernet */ 258/* /proc/sys/net/ethernet */
@@ -332,21 +343,14 @@ enum
332 NET_TCP_FRTO=92, 343 NET_TCP_FRTO=92,
333 NET_TCP_LOW_LATENCY=93, 344 NET_TCP_LOW_LATENCY=93,
334 NET_IPV4_IPFRAG_SECRET_INTERVAL=94, 345 NET_IPV4_IPFRAG_SECRET_INTERVAL=94,
335 NET_TCP_WESTWOOD=95,
336 NET_IPV4_IGMP_MAX_MSF=96, 346 NET_IPV4_IGMP_MAX_MSF=96,
337 NET_TCP_NO_METRICS_SAVE=97, 347 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, 348 NET_TCP_DEFAULT_WIN_SCALE=105,
346 NET_TCP_MODERATE_RCVBUF=106, 349 NET_TCP_MODERATE_RCVBUF=106,
347 NET_TCP_TSO_WIN_DIVISOR=107, 350 NET_TCP_TSO_WIN_DIVISOR=107,
348 NET_TCP_BIC_BETA=108, 351 NET_TCP_BIC_BETA=108,
349 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, 352 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
353 NET_TCP_CONG_CONTROL=110,
350}; 354};
351 355
352enum { 356enum {
@@ -646,6 +650,7 @@ enum {
646 NET_SCTP_ADDIP_ENABLE = 13, 650 NET_SCTP_ADDIP_ENABLE = 13,
647 NET_SCTP_PRSCTP_ENABLE = 14, 651 NET_SCTP_PRSCTP_ENABLE = 14,
648 NET_SCTP_SNDBUF_POLICY = 15, 652 NET_SCTP_SNDBUF_POLICY = 15,
653 NET_SCTP_SACK_TIMEOUT = 16,
649}; 654};
650 655
651/* /proc/sys/net/bridge */ 656/* /proc/sys/net/bridge */
@@ -680,6 +685,7 @@ enum
680 FS_XFS=17, /* struct: control xfs parameters */ 685 FS_XFS=17, /* struct: control xfs parameters */
681 FS_AIO_NR=18, /* current system-wide number of aio requests */ 686 FS_AIO_NR=18, /* current system-wide number of aio requests */
682 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ 687 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */
688 FS_INOTIFY=20, /* inotify submenu */
683}; 689};
684 690
685/* /proc/sys/fs/quota/ */ 691/* /proc/sys/fs/quota/ */
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h
index a6b2cc530af5..081b1ee8516e 100644
--- a/include/linux/tc_ematch/tc_em_meta.h
+++ b/include/linux/tc_ematch/tc_em_meta.h
@@ -41,19 +41,14 @@ enum
41 TCF_META_ID_LOADAVG_1, 41 TCF_META_ID_LOADAVG_1,
42 TCF_META_ID_LOADAVG_2, 42 TCF_META_ID_LOADAVG_2,
43 TCF_META_ID_DEV, 43 TCF_META_ID_DEV,
44 TCF_META_ID_INDEV,
45 TCF_META_ID_REALDEV,
46 TCF_META_ID_PRIORITY, 44 TCF_META_ID_PRIORITY,
47 TCF_META_ID_PROTOCOL, 45 TCF_META_ID_PROTOCOL,
48 TCF_META_ID_SECURITY,
49 TCF_META_ID_PKTTYPE, 46 TCF_META_ID_PKTTYPE,
50 TCF_META_ID_PKTLEN, 47 TCF_META_ID_PKTLEN,
51 TCF_META_ID_DATALEN, 48 TCF_META_ID_DATALEN,
52 TCF_META_ID_MACLEN, 49 TCF_META_ID_MACLEN,
53 TCF_META_ID_NFMARK, 50 TCF_META_ID_NFMARK,
54 TCF_META_ID_TCINDEX, 51 TCF_META_ID_TCINDEX,
55 TCF_META_ID_TCVERDICT,
56 TCF_META_ID_TCCLASSID,
57 TCF_META_ID_RTCLASSID, 52 TCF_META_ID_RTCLASSID,
58 TCF_META_ID_RTIIF, 53 TCF_META_ID_RTIIF,
59 TCF_META_ID_SK_FAMILY, 54 TCF_META_ID_SK_FAMILY,
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..e4fd82e42104 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) */
@@ -292,7 +286,7 @@ struct tcp_sock {
292 __u32 max_window; /* Maximal window ever seen from peer */ 286 __u32 max_window; /* Maximal window ever seen from peer */
293 __u32 pmtu_cookie; /* Last pmtu seen by socket */ 287 __u32 pmtu_cookie; /* Last pmtu seen by socket */
294 __u32 mss_cache; /* Cached effective mss, not including SACKS */ 288 __u32 mss_cache; /* Cached effective mss, not including SACKS */
295 __u16 mss_cache_std; /* Like mss_cache, but without TSO */ 289 __u16 xmit_size_goal; /* Goal for segmenting output packets */
296 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ 290 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */
297 __u8 ca_state; /* State of fast-retransmit machine */ 291 __u8 ca_state; /* State of fast-retransmit machine */
298 __u8 retransmits; /* Number of unrecovered RTO timeouts. */ 292 __u8 retransmits; /* Number of unrecovered RTO timeouts. */
@@ -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/uinput.h b/include/linux/uinput.h
index 4c2c82336d10..84876077027f 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -42,8 +42,7 @@ struct uinput_request {
42 int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ 42 int code; /* UI_FF_UPLOAD, UI_FF_ERASE */
43 43
44 int retval; 44 int retval;
45 wait_queue_head_t waitq; 45 struct completion done;
46 int completed;
47 46
48 union { 47 union {
49 int effect_id; 48 int effect_id;
@@ -62,7 +61,7 @@ struct uinput_device {
62 61
63 struct uinput_request *requests[UINPUT_NUM_REQUESTS]; 62 struct uinput_request *requests[UINPUT_NUM_REQUESTS];
64 wait_queue_head_t requests_waitq; 63 wait_queue_head_t requests_waitq;
65 struct semaphore requests_sem; 64 spinlock_t requests_lock;
66}; 65};
67#endif /* __KERNEL__ */ 66#endif /* __KERNEL__ */
68 67
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 3d508bf08402..724637792996 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -290,7 +290,7 @@ struct usb_bus {
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 struct kref kref; /* handles reference counting this bus */
292 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 */
293#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 293#if defined(CONFIG_USB_MON)
294 struct mon_bus *mon_bus; /* non-null when associated */ 294 struct mon_bus *mon_bus; /* non-null when associated */
295 int monitored; /* non-zero when monitored */ 295 int monitored; /* non-zero when monitored */
296#endif 296#endif
@@ -938,17 +938,17 @@ static inline void usb_fill_int_urb (struct urb *urb,
938} 938}
939 939
940extern void usb_init_urb(struct urb *urb); 940extern void usb_init_urb(struct urb *urb);
941extern struct urb *usb_alloc_urb(int iso_packets, int mem_flags); 941extern struct urb *usb_alloc_urb(int iso_packets, unsigned mem_flags);
942extern void usb_free_urb(struct urb *urb); 942extern void usb_free_urb(struct urb *urb);
943#define usb_put_urb usb_free_urb 943#define usb_put_urb usb_free_urb
944extern struct urb *usb_get_urb(struct urb *urb); 944extern struct urb *usb_get_urb(struct urb *urb);
945extern int usb_submit_urb(struct urb *urb, int mem_flags); 945extern int usb_submit_urb(struct urb *urb, unsigned mem_flags);
946extern int usb_unlink_urb(struct urb *urb); 946extern int usb_unlink_urb(struct urb *urb);
947extern void usb_kill_urb(struct urb *urb); 947extern void usb_kill_urb(struct urb *urb);
948 948
949#define HAVE_USB_BUFFERS 949#define HAVE_USB_BUFFERS
950void *usb_buffer_alloc (struct usb_device *dev, size_t size, 950void *usb_buffer_alloc (struct usb_device *dev, size_t size,
951 int mem_flags, dma_addr_t *dma); 951 unsigned mem_flags, dma_addr_t *dma);
952void usb_buffer_free (struct usb_device *dev, size_t size, 952void usb_buffer_free (struct usb_device *dev, size_t size,
953 void *addr, dma_addr_t dma); 953 void *addr, dma_addr_t dma);
954 954
@@ -1055,7 +1055,7 @@ int usb_sg_init (
1055 struct scatterlist *sg, 1055 struct scatterlist *sg,
1056 int nents, 1056 int nents,
1057 size_t length, 1057 size_t length,
1058 int mem_flags 1058 unsigned mem_flags
1059); 1059);
1060void usb_sg_cancel (struct usb_sg_request *io); 1060void usb_sg_cancel (struct usb_sg_request *io);
1061void usb_sg_wait (struct usb_sg_request *io); 1061void usb_sg_wait (struct usb_sg_request *io);
diff --git a/include/linux/usb_cdc.h b/include/linux/usb_cdc.h
index f22d6beecc73..ba617c372455 100644
--- a/include/linux/usb_cdc.h
+++ b/include/linux/usb_cdc.h
@@ -34,6 +34,7 @@
34#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ 34#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
35#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ 35#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
36#define USB_CDC_COUNTRY_TYPE 0x07 36#define USB_CDC_COUNTRY_TYPE 0x07
37#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
37#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ 38#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
38#define USB_CDC_WHCM_TYPE 0x11 39#define USB_CDC_WHCM_TYPE 0x11
39#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ 40#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
@@ -83,6 +84,18 @@ struct usb_cdc_union_desc {
83 /* ... and there could be other slave interfaces */ 84 /* ... and there could be other slave interfaces */
84} __attribute__ ((packed)); 85} __attribute__ ((packed));
85 86
87/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */
88struct usb_cdc_network_terminal_desc {
89 __u8 bLength;
90 __u8 bDescriptorType;
91 __u8 bDescriptorSubType;
92
93 __u8 bEntityId;
94 __u8 iName;
95 __u8 bChannelIndex;
96 __u8 bPhysicalInterface;
97} __attribute__ ((packed));
98
86/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ 99/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */
87struct usb_cdc_ether_desc { 100struct usb_cdc_ether_desc {
88 __u8 bLength; 101 __u8 bLength;
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..71e608607324 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb_gadget.h
@@ -107,18 +107,18 @@ struct usb_ep_ops {
107 int (*disable) (struct usb_ep *ep); 107 int (*disable) (struct usb_ep *ep);
108 108
109 struct usb_request *(*alloc_request) (struct usb_ep *ep, 109 struct usb_request *(*alloc_request) (struct usb_ep *ep,
110 int gfp_flags); 110 unsigned gfp_flags);
111 void (*free_request) (struct usb_ep *ep, struct usb_request *req); 111 void (*free_request) (struct usb_ep *ep, struct usb_request *req);
112 112
113 void *(*alloc_buffer) (struct usb_ep *ep, unsigned bytes, 113 void *(*alloc_buffer) (struct usb_ep *ep, unsigned bytes,
114 dma_addr_t *dma, int gfp_flags); 114 dma_addr_t *dma, unsigned gfp_flags);
115 void (*free_buffer) (struct usb_ep *ep, void *buf, dma_addr_t dma, 115 void (*free_buffer) (struct usb_ep *ep, void *buf, dma_addr_t dma,
116 unsigned bytes); 116 unsigned bytes);
117 // NOTE: on 2.6, drivers may also use dma_map() and 117 // NOTE: on 2.6, drivers may also use dma_map() and
118 // dma_sync_single_*() to directly manage dma overhead. 118 // dma_sync_single_*() to directly manage dma overhead.
119 119
120 int (*queue) (struct usb_ep *ep, struct usb_request *req, 120 int (*queue) (struct usb_ep *ep, struct usb_request *req,
121 int gfp_flags); 121 unsigned gfp_flags);
122 int (*dequeue) (struct usb_ep *ep, struct usb_request *req); 122 int (*dequeue) (struct usb_ep *ep, struct usb_request *req);
123 123
124 int (*set_halt) (struct usb_ep *ep, int value); 124 int (*set_halt) (struct usb_ep *ep, int value);
@@ -214,7 +214,7 @@ usb_ep_disable (struct usb_ep *ep)
214 * Returns the request, or null if one could not be allocated. 214 * Returns the request, or null if one could not be allocated.
215 */ 215 */
216static inline struct usb_request * 216static inline struct usb_request *
217usb_ep_alloc_request (struct usb_ep *ep, int gfp_flags) 217usb_ep_alloc_request (struct usb_ep *ep, unsigned gfp_flags)
218{ 218{
219 return ep->ops->alloc_request (ep, gfp_flags); 219 return ep->ops->alloc_request (ep, gfp_flags);
220} 220}
@@ -254,7 +254,7 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
254 */ 254 */
255static inline void * 255static inline void *
256usb_ep_alloc_buffer (struct usb_ep *ep, unsigned len, dma_addr_t *dma, 256usb_ep_alloc_buffer (struct usb_ep *ep, unsigned len, dma_addr_t *dma,
257 int gfp_flags) 257 unsigned gfp_flags)
258{ 258{
259 return ep->ops->alloc_buffer (ep, len, dma, gfp_flags); 259 return ep->ops->alloc_buffer (ep, len, dma, gfp_flags);
260} 260}
@@ -330,7 +330,7 @@ usb_ep_free_buffer (struct usb_ep *ep, void *buf, dma_addr_t dma, unsigned len)
330 * reported when the usb peripheral is disconnected. 330 * reported when the usb peripheral is disconnected.
331 */ 331 */
332static inline int 332static inline int
333usb_ep_queue (struct usb_ep *ep, struct usb_request *req, int gfp_flags) 333usb_ep_queue (struct usb_ep *ep, struct usb_request *req, unsigned gfp_flags)
334{ 334{
335 return ep->ops->queue (ep, req, gfp_flags); 335 return ep->ops->queue (ep, req, gfp_flags);
336} 336}
@@ -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_input.h b/include/linux/usb_input.h
new file mode 100644
index 000000000000..716e0cc16043
--- /dev/null
+++ b/include/linux/usb_input.h
@@ -0,0 +1,25 @@
1#ifndef __USB_INPUT_H
2#define __USB_INPUT_H
3
4/*
5 * Copyright (C) 2005 Dmitry Torokhov
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11
12#include <linux/usb.h>
13#include <linux/input.h>
14#include <asm/byteorder.h>
15
16static inline void
17usb_to_input_id(const struct usb_device *dev, struct input_id *id)
18{
19 id->bustype = BUS_USB;
20 id->vendor = le16_to_cpu(dev->descriptor.idVendor);
21 id->product = le16_to_cpu(dev->descriptor.idProduct);
22 id->version = le16_to_cpu(dev->descriptor.bcdDevice);
23}
24
25#endif
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/wanrouter.h b/include/linux/wanrouter.h
index 3e89f0f15f49..1b6b76a4eb54 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -516,8 +516,7 @@ struct wan_device {
516/* Public functions available for device drivers */ 516/* Public functions available for device drivers */
517extern int register_wan_device(struct wan_device *wandev); 517extern int register_wan_device(struct wan_device *wandev);
518extern int unregister_wan_device(char *name); 518extern int unregister_wan_device(char *name);
519unsigned short wanrouter_type_trans(struct sk_buff *skb, 519__be16 wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev);
520 struct net_device *dev);
521int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev, 520int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev,
522 unsigned short type); 521 unsigned short type);
523 522
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 88ba0d29f8c8..1192ed8f4fe8 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -47,4 +47,14 @@ struct watchdog_info {
47#define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ 47#define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */
48#define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ 48#define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */
49 49
50#ifdef __KERNEL__
51
52#ifdef CONFIG_WATCHDOG_NOWAYOUT
53#define WATCHDOG_NOWAYOUT 1
54#else
55#define WATCHDOG_NOWAYOUT 0
56#endif
57
58#endif /* __KERNEL__ */
59
50#endif /* ifndef _LINUX_WATCHDOG_H */ 60#endif /* ifndef _LINUX_WATCHDOG_H */
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/zlib.h b/include/linux/zlib.h
index 850076ea14d3..74f7b78c22d2 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -506,6 +506,11 @@ extern int zlib_deflateReset (z_streamp strm);
506 stream state was inconsistent (such as zalloc or state being NULL). 506 stream state was inconsistent (such as zalloc or state being NULL).
507*/ 507*/
508 508
509static inline unsigned long deflateBound(unsigned long s)
510{
511 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
512}
513
509extern int zlib_deflateParams (z_streamp strm, int level, int strategy); 514extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
510/* 515/*
511 Dynamically update the compression level and compression strategy. The 516 Dynamically update the compression level and compression strategy. The