aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h2
-rw-r--r--include/linux/aio.h12
-rw-r--r--include/linux/amba/bus.h55
-rw-r--r--include/linux/amba/clcd.h271
-rw-r--r--include/linux/amba/kmi.h92
-rw-r--r--include/linux/amba/serial.h161
-rw-r--r--include/linux/atalk.h18
-rw-r--r--include/linux/auxvec.h2
-rw-r--r--include/linux/blkdev.h22
-rw-r--r--include/linux/buffer_head.h3
-rw-r--r--include/linux/byteorder/generic.h2
-rw-r--r--include/linux/byteorder/swab.h2
-rw-r--r--include/linux/byteorder/swabb.h2
-rw-r--r--include/linux/cache.h19
-rw-r--r--include/linux/calc64.h49
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/clk.h124
-rw-r--r--include/linux/compat_ioctl.h34
-rw-r--r--include/linux/compiler-gcc.h17
-rw-r--r--include/linux/compiler-gcc2.h29
-rw-r--r--include/linux/compiler-gcc3.h18
-rw-r--r--include/linux/compiler-gcc4.h18
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/cpuset.h46
-rw-r--r--include/linux/crypto.h5
-rw-r--r--include/linux/cycx_x25.h66
-rw-r--r--include/linux/dcache.h9
-rw-r--r--include/linux/device.h3
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/dvb/frontend.h10
-rw-r--r--include/linux/elevator.h4
-rw-r--r--include/linux/elf.h2
-rw-r--r--include/linux/ext3_fs_i.h2
-rw-r--r--include/linux/fb.h10
-rw-r--r--include/linux/fcntl.h7
-rw-r--r--include/linux/fs.h62
-rw-r--r--include/linux/fsl_devices.h6
-rw-r--r--include/linux/gfp.h5
-rw-r--r--include/linux/hardirq.h4
-rw-r--r--include/linux/hrtimer.h139
-rw-r--r--include/linux/i2c-id.h5
-rw-r--r--include/linux/ide.h12
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_frad.h12
-rw-r--r--include/linux/init.h12
-rw-r--r--include/linux/interrupt.h4
-rw-r--r--include/linux/ioc3.h93
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/isdnif.h70
-rw-r--r--include/linux/isicom.h59
-rw-r--r--include/linux/jffs2_fs_i.h4
-rw-r--r--include/linux/jiffies.h18
-rw-r--r--include/linux/kbd_kern.h2
-rw-r--r--include/linux/kernel.h19
-rw-r--r--include/linux/kexec.h5
-rw-r--r--include/linux/key.h12
-rw-r--r--include/linux/keyctl.h3
-rw-r--r--include/linux/kprobes.h6
-rw-r--r--include/linux/ktime.h284
-rw-r--r--include/linux/libata.h11
-rw-r--r--include/linux/list.h14
-rw-r--r--include/linux/loop.h4
-rw-r--r--include/linux/memory.h8
-rw-r--r--include/linux/mempolicy.h58
-rw-r--r--include/linux/mm.h57
-rw-r--r--include/linux/mm_inline.h1
-rw-r--r--include/linux/mmc/card.h5
-rw-r--r--include/linux/mmc/mmc.h6
-rw-r--r--include/linux/mmzone.h20
-rw-r--r--include/linux/mount.h9
-rw-r--r--include/linux/msdos_fs.h3
-rw-r--r--include/linux/mutex-debug.h23
-rw-r--r--include/linux/mutex.h120
-rw-r--r--include/linux/namei.h9
-rw-r--r--include/linux/ncp.h126
-rw-r--r--include/linux/ncp_fs.h28
-rw-r--r--include/linux/netfilter.h92
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h3
-rw-r--r--include/linux/netfilter/x_tables.h224
-rw-r--r--include/linux/netfilter/xt_CLASSIFY.h8
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h25
-rw-r--r--include/linux/netfilter/xt_MARK.h21
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h16
-rw-r--r--include/linux/netfilter/xt_comment.h10
-rw-r--r--include/linux/netfilter/xt_connbytes.h25
-rw-r--r--include/linux/netfilter/xt_connmark.h18
-rw-r--r--include/linux/netfilter/xt_conntrack.h63
-rw-r--r--include/linux/netfilter/xt_dccp.h23
-rw-r--r--include/linux/netfilter/xt_helper.h8
-rw-r--r--include/linux/netfilter/xt_length.h9
-rw-r--r--include/linux/netfilter/xt_limit.h21
-rw-r--r--include/linux/netfilter/xt_mac.h8
-rw-r--r--include/linux/netfilter/xt_mark.h9
-rw-r--r--include/linux/netfilter/xt_physdev.h24
-rw-r--r--include/linux/netfilter/xt_pkttype.h8
-rw-r--r--include/linux/netfilter/xt_realm.h10
-rw-r--r--include/linux/netfilter/xt_sctp.h107
-rw-r--r--include/linux/netfilter/xt_state.h13
-rw-r--r--include/linux/netfilter/xt_string.h18
-rw-r--r--include/linux/netfilter/xt_tcpmss.h9
-rw-r--r--include/linux/netfilter/xt_tcpudp.h36
-rw-r--r--include/linux/netfilter_arp/arp_tables.h123
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h7
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h217
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLASSIFY.h5
-rw-r--r--include/linux/netfilter_ipv4/ipt_CONNMARK.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_MARK.h22
-rw-r--r--include/linux/netfilter_ipv4/ipt_NFQUEUE.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_comment.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_connbytes.h31
-rw-r--r--include/linux/netfilter_ipv4/ipt_connmark.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_conntrack.h66
-rw-r--r--include/linux/netfilter_ipv4/ipt_dccp.h22
-rw-r--r--include/linux/netfilter_ipv4/ipt_helper.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_length.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_limit.h19
-rw-r--r--include/linux/netfilter_ipv4/ipt_mac.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_mark.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_physdev.h27
-rw-r--r--include/linux/netfilter_ipv4/ipt_pkttype.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h52
-rw-r--r--include/linux/netfilter_ipv4/ipt_realm.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_state.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_string.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_tcpmss.h6
-rw-r--r--include/linux/netfilter_ipv6.h5
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h208
-rw-r--r--include/linux/netfilter_ipv6/ip6t_MARK.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_ah.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_esp.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_frag.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_length.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_limit.h21
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mac.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mark.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_opts.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_physdev.h27
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h52
-rw-r--r--include/linux/netfilter_ipv6/ip6t_rt.h9
-rw-r--r--include/linux/nfsd/nfsd.h2
-rw-r--r--include/linux/nfsd/nfsfh.h6
-rw-r--r--include/linux/nfsd/xdr4.h5
-rw-r--r--include/linux/pagevec.h5
-rw-r--r--include/linux/parport.h4
-rw-r--r--include/linux/pci.h69
-rw-r--r--include/linux/pci_ids.h36
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/percpu.h8
-rw-r--r--include/linux/pfkeyv2.h2
-rw-r--r--include/linux/phy.h3
-rw-r--r--include/linux/pipe_fs_i.h2
-rw-r--r--include/linux/pmu.h8
-rw-r--r--include/linux/poll.h6
-rw-r--r--include/linux/posix-timers.h90
-rw-r--r--include/linux/proc_fs.h5
-rw-r--r--include/linux/ptrace.h4
-rw-r--r--include/linux/radix-tree.h1
-rw-r--r--include/linux/raid_class.h2
-rw-r--r--include/linux/rcupdate.h37
-rw-r--r--include/linux/rcuref.h220
-rw-r--r--include/linux/reboot.h3
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/relayfs_fs.h65
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rtc.h3
-rw-r--r--include/linux/sched.h74
-rw-r--r--include/linux/screen_info.h76
-rw-r--r--include/linux/sdla.h64
-rw-r--r--include/linux/seccomp.h6
-rw-r--r--include/linux/serial_core.h6
-rw-r--r--include/linux/shmem_fs.h2
-rw-r--r--include/linux/signal.h30
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/linux/slab.h35
-rw-r--r--include/linux/smb_fs.h47
-rw-r--r--include/linux/socket.h3
-rw-r--r--include/linux/spi/ads7846.h18
-rw-r--r--include/linux/spi/flash.h31
-rw-r--r--include/linux/spi/spi.h668
-rw-r--r--include/linux/spi/spi_bitbang.h135
-rw-r--r--include/linux/spinlock_types_up.h14
-rw-r--r--include/linux/sunrpc/svc.h1
-rw-r--r--include/linux/swap.h26
-rw-r--r--include/linux/synclink.h9
-rw-r--r--include/linux/syscalls.h24
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/time.h186
-rw-r--r--include/linux/timer.h2
-rw-r--r--include/linux/tipc.h212
-rw-r--r--include/linux/tipc_config.h410
-rw-r--r--include/linux/topology.h10
-rw-r--r--include/linux/tty.h97
-rw-r--r--include/linux/tty_flip.h20
-rw-r--r--include/linux/tty_ldisc.h9
-rw-r--r--include/linux/video_decoder.h2
-rw-r--r--include/linux/videodev2.h16
-rw-r--r--include/linux/wavefront.h36
-rw-r--r--include/linux/workqueue.h1
-rw-r--r--include/linux/writeback.h4
-rw-r--r--include/linux/xattr.h19
-rw-r--r--include/linux/zlib.h11
202 files changed, 5347 insertions, 1946 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 026c3c011dc0..84d3d9f034ce 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -435,7 +435,7 @@ extern int sbf_port ;
435 435
436#endif /* !CONFIG_ACPI */ 436#endif /* !CONFIG_ACPI */
437 437
438int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); 438int acpi_register_gsi (u32 gsi, int triggering, int polarity);
439int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 439int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
440 440
441/* 441/*
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 49fd37629ee4..00c8efa95cc3 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -94,26 +94,27 @@ struct kiocb {
94 ssize_t (*ki_retry)(struct kiocb *); 94 ssize_t (*ki_retry)(struct kiocb *);
95 void (*ki_dtor)(struct kiocb *); 95 void (*ki_dtor)(struct kiocb *);
96 96
97 struct list_head ki_list; /* the aio core uses this
98 * for cancellation */
99
100 union { 97 union {
101 void __user *user; 98 void __user *user;
102 struct task_struct *tsk; 99 struct task_struct *tsk;
103 } ki_obj; 100 } ki_obj;
101
104 __u64 ki_user_data; /* user's data for completion */ 102 __u64 ki_user_data; /* user's data for completion */
103 wait_queue_t ki_wait;
105 loff_t ki_pos; 104 loff_t ki_pos;
105
106 void *private;
106 /* State that we remember to be able to restart/retry */ 107 /* State that we remember to be able to restart/retry */
107 unsigned short ki_opcode; 108 unsigned short ki_opcode;
108 size_t ki_nbytes; /* copy of iocb->aio_nbytes */ 109 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
109 char __user *ki_buf; /* remaining iocb->aio_buf */ 110 char __user *ki_buf; /* remaining iocb->aio_buf */
110 size_t ki_left; /* remaining bytes */ 111 size_t ki_left; /* remaining bytes */
111 wait_queue_t ki_wait;
112 long ki_retried; /* just for testing */ 112 long ki_retried; /* just for testing */
113 long ki_kicked; /* just for testing */ 113 long ki_kicked; /* just for testing */
114 long ki_queued; /* just for testing */ 114 long ki_queued; /* just for testing */
115 115
116 void *private; 116 struct list_head ki_list; /* the aio core uses this
117 * for cancellation */
117}; 118};
118 119
119#define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY) 120#define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY)
@@ -126,6 +127,7 @@ struct kiocb {
126 (x)->ki_filp = (filp); \ 127 (x)->ki_filp = (filp); \
127 (x)->ki_ctx = NULL; \ 128 (x)->ki_ctx = NULL; \
128 (x)->ki_cancel = NULL; \ 129 (x)->ki_cancel = NULL; \
130 (x)->ki_retry = NULL; \
129 (x)->ki_dtor = NULL; \ 131 (x)->ki_dtor = NULL; \
130 (x)->ki_obj.tsk = tsk; \ 132 (x)->ki_obj.tsk = tsk; \
131 (x)->ki_user_data = 0; \ 133 (x)->ki_user_data = 0; \
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
new file mode 100644
index 000000000000..51e6e54b2aa1
--- /dev/null
+++ b/include/linux/amba/bus.h
@@ -0,0 +1,55 @@
1/*
2 * linux/include/asm-arm/hardware/amba.h
3 *
4 * Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef ASMARM_AMBA_H
11#define ASMARM_AMBA_H
12
13#define AMBA_NR_IRQS 2
14
15struct amba_device {
16 struct device dev;
17 struct resource res;
18 u64 dma_mask;
19 unsigned int periphid;
20 unsigned int irq[AMBA_NR_IRQS];
21};
22
23struct amba_id {
24 unsigned int id;
25 unsigned int mask;
26 void *data;
27};
28
29struct amba_driver {
30 struct device_driver drv;
31 int (*probe)(struct amba_device *, void *);
32 int (*remove)(struct amba_device *);
33 void (*shutdown)(struct amba_device *);
34 int (*suspend)(struct amba_device *, pm_message_t);
35 int (*resume)(struct amba_device *);
36 struct amba_id *id_table;
37};
38
39#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
40#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
41
42int amba_driver_register(struct amba_driver *);
43void amba_driver_unregister(struct amba_driver *);
44int amba_device_register(struct amba_device *, struct resource *);
45void amba_device_unregister(struct amba_device *);
46struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
47int amba_request_regions(struct amba_device *, const char *);
48void amba_release_regions(struct amba_device *);
49
50#define amba_config(d) (((d)->periphid >> 24) & 0xff)
51#define amba_rev(d) (((d)->periphid >> 20) & 0x0f)
52#define amba_manf(d) (((d)->periphid >> 12) & 0xff)
53#define amba_part(d) ((d)->periphid & 0xfff)
54
55#endif
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
new file mode 100644
index 000000000000..6b8d73dc1ab0
--- /dev/null
+++ b/include/linux/amba/clcd.h
@@ -0,0 +1,271 @@
1/*
2 * linux/include/asm-arm/hardware/amba_clcd.h -- Integrator LCD panel.
3 *
4 * David A Rusling
5 *
6 * Copyright (C) 2001 ARM Limited
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive
10 * for more details.
11 */
12#include <linux/config.h>
13#include <linux/fb.h>
14
15/*
16 * CLCD Controller Internal Register addresses
17 */
18#define CLCD_TIM0 0x00000000
19#define CLCD_TIM1 0x00000004
20#define CLCD_TIM2 0x00000008
21#define CLCD_TIM3 0x0000000c
22#define CLCD_UBAS 0x00000010
23#define CLCD_LBAS 0x00000014
24
25#if !defined(CONFIG_ARCH_VERSATILE) && !defined(CONFIG_ARCH_REALVIEW)
26#define CLCD_IENB 0x00000018
27#define CLCD_CNTL 0x0000001c
28#else
29/*
30 * Someone rearranged these two registers on the Versatile
31 * platform...
32 */
33#define CLCD_IENB 0x0000001c
34#define CLCD_CNTL 0x00000018
35#endif
36
37#define CLCD_STAT 0x00000020
38#define CLCD_INTR 0x00000024
39#define CLCD_UCUR 0x00000028
40#define CLCD_LCUR 0x0000002C
41#define CLCD_PALL 0x00000200
42#define CLCD_PALETTE 0x00000200
43
44#define TIM2_CLKSEL (1 << 5)
45#define TIM2_IVS (1 << 11)
46#define TIM2_IHS (1 << 12)
47#define TIM2_IPC (1 << 13)
48#define TIM2_IOE (1 << 14)
49#define TIM2_BCD (1 << 26)
50
51#define CNTL_LCDEN (1 << 0)
52#define CNTL_LCDBPP1 (0 << 1)
53#define CNTL_LCDBPP2 (1 << 1)
54#define CNTL_LCDBPP4 (2 << 1)
55#define CNTL_LCDBPP8 (3 << 1)
56#define CNTL_LCDBPP16 (4 << 1)
57#define CNTL_LCDBPP24 (5 << 1)
58#define CNTL_LCDBW (1 << 4)
59#define CNTL_LCDTFT (1 << 5)
60#define CNTL_LCDMONO8 (1 << 6)
61#define CNTL_LCDDUAL (1 << 7)
62#define CNTL_BGR (1 << 8)
63#define CNTL_BEBO (1 << 9)
64#define CNTL_BEPO (1 << 10)
65#define CNTL_LCDPWR (1 << 11)
66#define CNTL_LCDVCOMP(x) ((x) << 12)
67#define CNTL_LDMAFIFOTIME (1 << 15)
68#define CNTL_WATERMARK (1 << 16)
69
70struct clcd_panel {
71 struct fb_videomode mode;
72 signed short width; /* width in mm */
73 signed short height; /* height in mm */
74 u32 tim2;
75 u32 tim3;
76 u32 cntl;
77 unsigned int bpp:8,
78 fixedtimings:1,
79 grayscale:1;
80 unsigned int connector;
81};
82
83struct clcd_regs {
84 u32 tim0;
85 u32 tim1;
86 u32 tim2;
87 u32 tim3;
88 u32 cntl;
89 unsigned long pixclock;
90};
91
92struct clcd_fb;
93
94/*
95 * the board-type specific routines
96 */
97struct clcd_board {
98 const char *name;
99
100 /*
101 * Optional. Check whether the var structure is acceptable
102 * for this display.
103 */
104 int (*check)(struct clcd_fb *fb, struct fb_var_screeninfo *var);
105
106 /*
107 * Compulsary. Decode fb->fb.var into regs->*. In the case of
108 * fixed timing, set regs->* to the register values required.
109 */
110 void (*decode)(struct clcd_fb *fb, struct clcd_regs *regs);
111
112 /*
113 * Optional. Disable any extra display hardware.
114 */
115 void (*disable)(struct clcd_fb *);
116
117 /*
118 * Optional. Enable any extra display hardware.
119 */
120 void (*enable)(struct clcd_fb *);
121
122 /*
123 * Setup platform specific parts of CLCD driver
124 */
125 int (*setup)(struct clcd_fb *);
126
127 /*
128 * mmap the framebuffer memory
129 */
130 int (*mmap)(struct clcd_fb *, struct vm_area_struct *);
131
132 /*
133 * Remove platform specific parts of CLCD driver
134 */
135 void (*remove)(struct clcd_fb *);
136};
137
138struct amba_device;
139struct clk;
140
141/* this data structure describes each frame buffer device we find */
142struct clcd_fb {
143 struct fb_info fb;
144 struct amba_device *dev;
145 struct clk *clk;
146 struct clcd_panel *panel;
147 struct clcd_board *board;
148 void *board_data;
149 void __iomem *regs;
150 u32 clcd_cntl;
151 u32 cmap[16];
152};
153
154static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
155{
156 u32 val, cpl;
157
158 /*
159 * Program the CLCD controller registers and start the CLCD
160 */
161 val = ((fb->fb.var.xres / 16) - 1) << 2;
162 val |= (fb->fb.var.hsync_len - 1) << 8;
163 val |= (fb->fb.var.right_margin - 1) << 16;
164 val |= (fb->fb.var.left_margin - 1) << 24;
165 regs->tim0 = val;
166
167 val = fb->fb.var.yres;
168 if (fb->panel->cntl & CNTL_LCDDUAL)
169 val /= 2;
170 val -= 1;
171 val |= (fb->fb.var.vsync_len - 1) << 10;
172 val |= fb->fb.var.lower_margin << 16;
173 val |= fb->fb.var.upper_margin << 24;
174 regs->tim1 = val;
175
176 val = fb->panel->tim2;
177 val |= fb->fb.var.sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;
178 val |= fb->fb.var.sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;
179
180 cpl = fb->fb.var.xres_virtual;
181 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */
182 /* / 1 */;
183 else if (!fb->fb.var.grayscale) /* STN color */
184 cpl = cpl * 8 / 3;
185 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */
186 cpl /= 8;
187 else /* STN monochrome, 4bit */
188 cpl /= 4;
189
190 regs->tim2 = val | ((cpl - 1) << 16);
191
192 regs->tim3 = fb->panel->tim3;
193
194 val = fb->panel->cntl;
195 if (fb->fb.var.grayscale)
196 val |= CNTL_LCDBW;
197
198 switch (fb->fb.var.bits_per_pixel) {
199 case 1:
200 val |= CNTL_LCDBPP1;
201 break;
202 case 2:
203 val |= CNTL_LCDBPP2;
204 break;
205 case 4:
206 val |= CNTL_LCDBPP4;
207 break;
208 case 8:
209 val |= CNTL_LCDBPP8;
210 break;
211 case 16:
212 val |= CNTL_LCDBPP16;
213 break;
214 case 32:
215 val |= CNTL_LCDBPP24;
216 break;
217 }
218
219 regs->cntl = val;
220 regs->pixclock = fb->fb.var.pixclock;
221}
222
223static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
224{
225 var->xres_virtual = var->xres = (var->xres + 15) & ~15;
226 var->yres_virtual = var->yres = (var->yres + 1) & ~1;
227
228#define CHECK(e,l,h) (var->e < l || var->e > h)
229 if (CHECK(right_margin, (5+1), 256) || /* back porch */
230 CHECK(left_margin, (5+1), 256) || /* front porch */
231 CHECK(hsync_len, (5+1), 256) ||
232 var->xres > 4096 ||
233 var->lower_margin > 255 || /* back porch */
234 var->upper_margin > 255 || /* front porch */
235 var->vsync_len > 32 ||
236 var->yres > 1024)
237 return -EINVAL;
238#undef CHECK
239
240 /* single panel mode: PCD = max(PCD, 1) */
241 /* dual panel mode: PCD = max(PCD, 5) */
242
243 /*
244 * You can't change the grayscale setting, and
245 * we can only do non-interlaced video.
246 */
247 if (var->grayscale != fb->fb.var.grayscale ||
248 (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED)
249 return -EINVAL;
250
251#define CHECK(e) (var->e != fb->fb.var.e)
252 if (fb->panel->fixedtimings &&
253 (CHECK(xres) ||
254 CHECK(yres) ||
255 CHECK(bits_per_pixel) ||
256 CHECK(pixclock) ||
257 CHECK(left_margin) ||
258 CHECK(right_margin) ||
259 CHECK(upper_margin) ||
260 CHECK(lower_margin) ||
261 CHECK(hsync_len) ||
262 CHECK(vsync_len) ||
263 CHECK(sync)))
264 return -EINVAL;
265#undef CHECK
266
267 var->nonstd = 0;
268 var->accel_flags = 0;
269
270 return 0;
271}
diff --git a/include/linux/amba/kmi.h b/include/linux/amba/kmi.h
new file mode 100644
index 000000000000..a39e5be751b3
--- /dev/null
+++ b/include/linux/amba/kmi.h
@@ -0,0 +1,92 @@
1/*
2 * linux/include/asm-arm/hardware/amba_kmi.h
3 *
4 * Internal header file for AMBA KMI ports
5 *
6 * Copyright (C) 2000 Deep Blue Solutions Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 *
23 * ---------------------------------------------------------------------------
24 * From ARM PrimeCell(tm) PS2 Keyboard/Mouse Interface (PL050) Technical
25 * Reference Manual - ARM DDI 0143B - see http://www.arm.com/
26 * ---------------------------------------------------------------------------
27 */
28#ifndef ASM_ARM_HARDWARE_AMBA_KMI_H
29#define ASM_ARM_HARDWARE_AMBA_KMI_H
30
31/*
32 * KMI control register:
33 * KMICR_TYPE 0 = PS2/AT mode, 1 = No line control bit mode
34 * KMICR_RXINTREN 1 = enable RX interrupts
35 * KMICR_TXINTREN 1 = enable TX interrupts
36 * KMICR_EN 1 = enable KMI
37 * KMICR_FD 1 = force KMI data low
38 * KMICR_FC 1 = force KMI clock low
39 */
40#define KMICR (KMI_BASE + 0x00)
41#define KMICR_TYPE (1 << 5)
42#define KMICR_RXINTREN (1 << 4)
43#define KMICR_TXINTREN (1 << 3)
44#define KMICR_EN (1 << 2)
45#define KMICR_FD (1 << 1)
46#define KMICR_FC (1 << 0)
47
48/*
49 * KMI status register:
50 * KMISTAT_TXEMPTY 1 = transmitter register empty
51 * KMISTAT_TXBUSY 1 = currently sending data
52 * KMISTAT_RXFULL 1 = receiver register ready to be read
53 * KMISTAT_RXBUSY 1 = currently receiving data
54 * KMISTAT_RXPARITY parity of last databyte received
55 * KMISTAT_IC current level of KMI clock input
56 * KMISTAT_ID current level of KMI data input
57 */
58#define KMISTAT (KMI_BASE + 0x04)
59#define KMISTAT_TXEMPTY (1 << 6)
60#define KMISTAT_TXBUSY (1 << 5)
61#define KMISTAT_RXFULL (1 << 4)
62#define KMISTAT_RXBUSY (1 << 3)
63#define KMISTAT_RXPARITY (1 << 2)
64#define KMISTAT_IC (1 << 1)
65#define KMISTAT_ID (1 << 0)
66
67/*
68 * KMI data register
69 */
70#define KMIDATA (KMI_BASE + 0x08)
71
72/*
73 * KMI clock divisor: to generate 8MHz internal clock
74 * div = (ref / 8MHz) - 1; 0 <= div <= 15
75 */
76#define KMICLKDIV (KMI_BASE + 0x0c)
77
78/*
79 * KMI interrupt register:
80 * KMIIR_TXINTR 1 = transmit interrupt asserted
81 * KMIIR_RXINTR 1 = receive interrupt asserted
82 */
83#define KMIIR (KMI_BASE + 0x10)
84#define KMIIR_TXINTR (1 << 1)
85#define KMIIR_RXINTR (1 << 0)
86
87/*
88 * The size of the KMI primecell
89 */
90#define KMI_SIZE (0x100)
91
92#endif
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
new file mode 100644
index 000000000000..dc726ffccebd
--- /dev/null
+++ b/include/linux/amba/serial.h
@@ -0,0 +1,161 @@
1/*
2 * linux/include/asm-arm/hardware/serial_amba.h
3 *
4 * Internal header file for AMBA serial ports
5 *
6 * Copyright (C) ARM Limited
7 * Copyright (C) 2000 Deep Blue Solutions Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H
24#define ASM_ARM_HARDWARE_SERIAL_AMBA_H
25
26/* -------------------------------------------------------------------------------
27 * From AMBA UART (PL010) Block Specification
28 * -------------------------------------------------------------------------------
29 * UART Register Offsets.
30 */
31#define UART01x_DR 0x00 /* Data read or written from the interface. */
32#define UART01x_RSR 0x04 /* Receive status register (Read). */
33#define UART01x_ECR 0x04 /* Error clear register (Write). */
34#define UART010_LCRH 0x08 /* Line control register, high byte. */
35#define UART010_LCRM 0x0C /* Line control register, middle byte. */
36#define UART010_LCRL 0x10 /* Line control register, low byte. */
37#define UART010_CR 0x14 /* Control register. */
38#define UART01x_FR 0x18 /* Flag register (Read only). */
39#define UART010_IIR 0x1C /* Interrupt indentification register (Read). */
40#define UART010_ICR 0x1C /* Interrupt clear register (Write). */
41#define UART01x_ILPR 0x20 /* IrDA low power counter register. */
42#define UART011_IBRD 0x24 /* Integer baud rate divisor register. */
43#define UART011_FBRD 0x28 /* Fractional baud rate divisor register. */
44#define UART011_LCRH 0x2c /* Line control register. */
45#define UART011_CR 0x30 /* Control register. */
46#define UART011_IFLS 0x34 /* Interrupt fifo level select. */
47#define UART011_IMSC 0x38 /* Interrupt mask. */
48#define UART011_RIS 0x3c /* Raw interrupt status. */
49#define UART011_MIS 0x40 /* Masked interrupt status. */
50#define UART011_ICR 0x44 /* Interrupt clear register. */
51#define UART011_DMACR 0x48 /* DMA control register. */
52
53#define UART011_DR_OE (1 << 11)
54#define UART011_DR_BE (1 << 10)
55#define UART011_DR_PE (1 << 9)
56#define UART011_DR_FE (1 << 8)
57
58#define UART01x_RSR_OE 0x08
59#define UART01x_RSR_BE 0x04
60#define UART01x_RSR_PE 0x02
61#define UART01x_RSR_FE 0x01
62
63#define UART011_FR_RI 0x100
64#define UART011_FR_TXFE 0x080
65#define UART011_FR_RXFF 0x040
66#define UART01x_FR_TXFF 0x020
67#define UART01x_FR_RXFE 0x010
68#define UART01x_FR_BUSY 0x008
69#define UART01x_FR_DCD 0x004
70#define UART01x_FR_DSR 0x002
71#define UART01x_FR_CTS 0x001
72#define UART01x_FR_TMSK (UART01x_FR_TXFF + UART01x_FR_BUSY)
73
74#define UART011_CR_CTSEN 0x8000 /* CTS hardware flow control */
75#define UART011_CR_RTSEN 0x4000 /* RTS hardware flow control */
76#define UART011_CR_OUT2 0x2000 /* OUT2 */
77#define UART011_CR_OUT1 0x1000 /* OUT1 */
78#define UART011_CR_RTS 0x0800 /* RTS */
79#define UART011_CR_DTR 0x0400 /* DTR */
80#define UART011_CR_RXE 0x0200 /* receive enable */
81#define UART011_CR_TXE 0x0100 /* transmit enable */
82#define UART011_CR_LBE 0x0080 /* loopback enable */
83#define UART010_CR_RTIE 0x0040
84#define UART010_CR_TIE 0x0020
85#define UART010_CR_RIE 0x0010
86#define UART010_CR_MSIE 0x0008
87#define UART01x_CR_IIRLP 0x0004 /* SIR low power mode */
88#define UART01x_CR_SIREN 0x0002 /* SIR enable */
89#define UART01x_CR_UARTEN 0x0001 /* UART enable */
90
91#define UART011_LCRH_SPS 0x80
92#define UART01x_LCRH_WLEN_8 0x60
93#define UART01x_LCRH_WLEN_7 0x40
94#define UART01x_LCRH_WLEN_6 0x20
95#define UART01x_LCRH_WLEN_5 0x00
96#define UART01x_LCRH_FEN 0x10
97#define UART01x_LCRH_STP2 0x08
98#define UART01x_LCRH_EPS 0x04
99#define UART01x_LCRH_PEN 0x02
100#define UART01x_LCRH_BRK 0x01
101
102#define UART010_IIR_RTIS 0x08
103#define UART010_IIR_TIS 0x04
104#define UART010_IIR_RIS 0x02
105#define UART010_IIR_MIS 0x01
106
107#define UART011_IFLS_RX1_8 (0 << 3)
108#define UART011_IFLS_RX2_8 (1 << 3)
109#define UART011_IFLS_RX4_8 (2 << 3)
110#define UART011_IFLS_RX6_8 (3 << 3)
111#define UART011_IFLS_RX7_8 (4 << 3)
112#define UART011_IFLS_TX1_8 (0 << 0)
113#define UART011_IFLS_TX2_8 (1 << 0)
114#define UART011_IFLS_TX4_8 (2 << 0)
115#define UART011_IFLS_TX6_8 (3 << 0)
116#define UART011_IFLS_TX7_8 (4 << 0)
117
118#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */
119#define UART011_BEIM (1 << 9) /* break error interrupt mask */
120#define UART011_PEIM (1 << 8) /* parity error interrupt mask */
121#define UART011_FEIM (1 << 7) /* framing error interrupt mask */
122#define UART011_RTIM (1 << 6) /* receive timeout interrupt mask */
123#define UART011_TXIM (1 << 5) /* transmit interrupt mask */
124#define UART011_RXIM (1 << 4) /* receive interrupt mask */
125#define UART011_DSRMIM (1 << 3) /* DSR interrupt mask */
126#define UART011_DCDMIM (1 << 2) /* DCD interrupt mask */
127#define UART011_CTSMIM (1 << 1) /* CTS interrupt mask */
128#define UART011_RIMIM (1 << 0) /* RI interrupt mask */
129
130#define UART011_OEIS (1 << 10) /* overrun error interrupt status */
131#define UART011_BEIS (1 << 9) /* break error interrupt status */
132#define UART011_PEIS (1 << 8) /* parity error interrupt status */
133#define UART011_FEIS (1 << 7) /* framing error interrupt status */
134#define UART011_RTIS (1 << 6) /* receive timeout interrupt status */
135#define UART011_TXIS (1 << 5) /* transmit interrupt status */
136#define UART011_RXIS (1 << 4) /* receive interrupt status */
137#define UART011_DSRMIS (1 << 3) /* DSR interrupt status */
138#define UART011_DCDMIS (1 << 2) /* DCD interrupt status */
139#define UART011_CTSMIS (1 << 1) /* CTS interrupt status */
140#define UART011_RIMIS (1 << 0) /* RI interrupt status */
141
142#define UART011_OEIC (1 << 10) /* overrun error interrupt clear */
143#define UART011_BEIC (1 << 9) /* break error interrupt clear */
144#define UART011_PEIC (1 << 8) /* parity error interrupt clear */
145#define UART011_FEIC (1 << 7) /* framing error interrupt clear */
146#define UART011_RTIC (1 << 6) /* receive timeout interrupt clear */
147#define UART011_TXIC (1 << 5) /* transmit interrupt clear */
148#define UART011_RXIC (1 << 4) /* receive interrupt clear */
149#define UART011_DSRMIC (1 << 3) /* DSR interrupt clear */
150#define UART011_DCDMIC (1 << 2) /* DCD interrupt clear */
151#define UART011_CTSMIC (1 << 1) /* CTS interrupt clear */
152#define UART011_RIMIC (1 << 0) /* RI interrupt clear */
153
154#define UART011_DMAONERR (1 << 2) /* disable dma on error */
155#define UART011_TXDMAE (1 << 1) /* enable transmit dma */
156#define UART011_RXDMAE (1 << 0) /* enable receive dma */
157
158#define UART01x_RSR_ANY (UART01x_RSR_OE|UART01x_RSR_BE|UART01x_RSR_PE|UART01x_RSR_FE)
159#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD|UART01x_FR_DSR|UART01x_FR_CTS)
160
161#endif
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index 911c09cb9bf9..6ba3aa8a81f4 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -155,15 +155,15 @@ struct elapaarp {
155#define AARP_REQUEST 1 155#define AARP_REQUEST 1
156#define AARP_REPLY 2 156#define AARP_REPLY 2
157#define AARP_PROBE 3 157#define AARP_PROBE 3
158 __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); 158 __u8 hw_src[ETH_ALEN];
159 __u8 pa_src_zero __attribute__ ((packed)); 159 __u8 pa_src_zero;
160 __be16 pa_src_net __attribute__ ((packed)); 160 __be16 pa_src_net;
161 __u8 pa_src_node __attribute__ ((packed)); 161 __u8 pa_src_node;
162 __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); 162 __u8 hw_dst[ETH_ALEN];
163 __u8 pa_dst_zero __attribute__ ((packed)); 163 __u8 pa_dst_zero;
164 __be16 pa_dst_net __attribute__ ((packed)); 164 __be16 pa_dst_net;
165 __u8 pa_dst_node __attribute__ ((packed)); 165 __u8 pa_dst_node;
166}; 166} __attribute__ ((packed));
167 167
168static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) 168static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
169{ 169{
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h
index 9a7b374c9fb4..d2bc0d66e65d 100644
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -26,6 +26,6 @@
26 26
27#define AT_SECURE 23 /* secure mode boolean */ 27#define AT_SECURE 23 /* secure mode boolean */
28 28
29#define AT_VECTOR_SIZE 42 /* Size of auxiliary table. */ 29#define AT_VECTOR_SIZE 44 /* Size of auxiliary table. */
30 30
31#endif /* _LINUX_AUXVEC_H */ 31#endif /* _LINUX_AUXVEC_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index fb0985377421..02a585faa62c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -118,9 +118,9 @@ struct request_list {
118 * try to put the fields that are referenced together in the same cacheline 118 * try to put the fields that are referenced together in the same cacheline
119 */ 119 */
120struct request { 120struct request {
121 struct list_head queuelist; /* looking for ->queue? you must _not_ 121 struct list_head queuelist;
122 * access it directly, use 122 struct list_head donelist;
123 * blkdev_dequeue_request! */ 123
124 unsigned long flags; /* see REQ_ bits below */ 124 unsigned long flags; /* see REQ_ bits below */
125 125
126 /* Maintain bio traversal state for part by part I/O submission. 126 /* Maintain bio traversal state for part by part I/O submission.
@@ -141,6 +141,7 @@ struct request {
141 struct bio *biotail; 141 struct bio *biotail;
142 142
143 void *elevator_private; 143 void *elevator_private;
144 void *completion_data;
144 145
145 unsigned short ioprio; 146 unsigned short ioprio;
146 147
@@ -291,6 +292,7 @@ typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
291typedef void (activity_fn) (void *data, int rw); 292typedef void (activity_fn) (void *data, int rw);
292typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *); 293typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *);
293typedef void (prepare_flush_fn) (request_queue_t *, struct request *); 294typedef void (prepare_flush_fn) (request_queue_t *, struct request *);
295typedef void (softirq_done_fn)(struct request *);
294 296
295enum blk_queue_state { 297enum blk_queue_state {
296 Queue_down, 298 Queue_down,
@@ -332,6 +334,7 @@ struct request_queue
332 activity_fn *activity_fn; 334 activity_fn *activity_fn;
333 issue_flush_fn *issue_flush_fn; 335 issue_flush_fn *issue_flush_fn;
334 prepare_flush_fn *prepare_flush_fn; 336 prepare_flush_fn *prepare_flush_fn;
337 softirq_done_fn *softirq_done_fn;
335 338
336 /* 339 /*
337 * Dispatch queue sorting 340 * Dispatch queue sorting
@@ -592,7 +595,6 @@ extern void generic_make_request(struct bio *bio);
592extern void blk_put_request(struct request *); 595extern void blk_put_request(struct request *);
593extern void __blk_put_request(request_queue_t *, struct request *); 596extern void __blk_put_request(request_queue_t *, struct request *);
594extern void blk_end_sync_rq(struct request *rq, int error); 597extern void blk_end_sync_rq(struct request *rq, int error);
595extern void blk_attempt_remerge(request_queue_t *, struct request *);
596extern struct request *blk_get_request(request_queue_t *, int, gfp_t); 598extern struct request *blk_get_request(request_queue_t *, int, gfp_t);
597extern void blk_insert_request(request_queue_t *, struct request *, int, void *); 599extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
598extern void blk_requeue_request(request_queue_t *, struct request *); 600extern void blk_requeue_request(request_queue_t *, struct request *);
@@ -646,6 +648,17 @@ extern int end_that_request_first(struct request *, int, int);
646extern int end_that_request_chunk(struct request *, int, int); 648extern int end_that_request_chunk(struct request *, int, int);
647extern void end_that_request_last(struct request *, int); 649extern void end_that_request_last(struct request *, int);
648extern void end_request(struct request *req, int uptodate); 650extern void end_request(struct request *req, int uptodate);
651extern void blk_complete_request(struct request *);
652
653static inline int rq_all_done(struct request *rq, unsigned int nr_bytes)
654{
655 if (blk_fs_request(rq))
656 return (nr_bytes >= (rq->hard_nr_sectors << 9));
657 else if (blk_pc_request(rq))
658 return nr_bytes >= rq->data_len;
659
660 return 0;
661}
649 662
650/* 663/*
651 * end_that_request_first/chunk() takes an uptodate argument. we account 664 * end_that_request_first/chunk() takes an uptodate argument. we account
@@ -694,6 +707,7 @@ extern void blk_queue_segment_boundary(request_queue_t *, unsigned long);
694extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn); 707extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn);
695extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *); 708extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *);
696extern void blk_queue_dma_alignment(request_queue_t *, int); 709extern void blk_queue_dma_alignment(request_queue_t *, int);
710extern void blk_queue_softirq_done(request_queue_t *, softirq_done_fn *);
697extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 711extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
698extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *); 712extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *);
699extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); 713extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 1db061bb6b08..9f159baf153f 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -197,7 +197,8 @@ int block_read_full_page(struct page*, get_block_t*);
197int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); 197int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
198int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*, 198int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
199 loff_t *); 199 loff_t *);
200int generic_cont_expand(struct inode *inode, loff_t size) ; 200int generic_cont_expand(struct inode *inode, loff_t size);
201int generic_cont_expand_simple(struct inode *inode, loff_t size);
201int block_commit_write(struct page *page, unsigned from, unsigned to); 202int block_commit_write(struct page *page, unsigned from, unsigned to);
202int block_sync_page(struct page *); 203int block_sync_page(struct page *);
203sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 204sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 04bd756efc67..e86e4a938373 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -156,7 +156,7 @@ extern __be32 htonl(__u32);
156extern __u16 ntohs(__be16); 156extern __u16 ntohs(__be16);
157extern __be16 htons(__u16); 157extern __be16 htons(__u16);
158 158
159#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) 159#if defined(__GNUC__) && defined(__OPTIMIZE__)
160 160
161#define ___htonl(x) __cpu_to_be32(x) 161#define ___htonl(x) __cpu_to_be32(x)
162#define ___htons(x) __cpu_to_be16(x) 162#define ___htons(x) __cpu_to_be16(x)
diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h
index 2f1cb775125a..25f7f32883ec 100644
--- a/include/linux/byteorder/swab.h
+++ b/include/linux/byteorder/swab.h
@@ -110,7 +110,7 @@
110/* 110/*
111 * Allow constant folding 111 * Allow constant folding
112 */ 112 */
113#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) 113#if defined(__GNUC__) && defined(__OPTIMIZE__)
114# define __swab16(x) \ 114# define __swab16(x) \
115(__builtin_constant_p((__u16)(x)) ? \ 115(__builtin_constant_p((__u16)(x)) ? \
116 ___swab16((x)) : \ 116 ___swab16((x)) : \
diff --git a/include/linux/byteorder/swabb.h b/include/linux/byteorder/swabb.h
index d5f2a3205109..ae5e5f914bf4 100644
--- a/include/linux/byteorder/swabb.h
+++ b/include/linux/byteorder/swabb.h
@@ -77,7 +77,7 @@
77/* 77/*
78 * Allow constant folding 78 * Allow constant folding
79 */ 79 */
80#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) 80#if defined(__GNUC__) && defined(__OPTIMIZE__)
81# define __swahw32(x) \ 81# define __swahw32(x) \
82(__builtin_constant_p((__u32)(x)) ? \ 82(__builtin_constant_p((__u32)(x)) ? \
83 ___swahw32((x)) : \ 83 ___swahw32((x)) : \
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 0b7ecf3af78a..d22e632f41fb 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,7 +13,7 @@
13#define SMP_CACHE_BYTES L1_CACHE_BYTES 13#define SMP_CACHE_BYTES L1_CACHE_BYTES
14#endif 14#endif
15 15
16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) 16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) || defined(CONFIG_PARISC)
17#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18#else 18#else
19#define __read_mostly 19#define __read_mostly
@@ -45,12 +45,21 @@
45#endif /* CONFIG_SMP */ 45#endif /* CONFIG_SMP */
46#endif 46#endif
47 47
48#if !defined(____cacheline_maxaligned_in_smp) 48/*
49 * The maximum alignment needed for some critical structures
50 * These could be inter-node cacheline sizes/L3 cacheline
51 * size etc. Define this in asm/cache.h for your arch
52 */
53#ifndef INTERNODE_CACHE_SHIFT
54#define INTERNODE_CACHE_SHIFT L1_CACHE_SHIFT
55#endif
56
57#if !defined(____cacheline_internodealigned_in_smp)
49#if defined(CONFIG_SMP) 58#if defined(CONFIG_SMP)
50#define ____cacheline_maxaligned_in_smp \ 59#define ____cacheline_internodealigned_in_smp \
51 __attribute__((__aligned__(1 << (L1_CACHE_SHIFT_MAX)))) 60 __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT))))
52#else 61#else
53#define ____cacheline_maxaligned_in_smp 62#define ____cacheline_internodealigned_in_smp
54#endif 63#endif
55#endif 64#endif
56 65
diff --git a/include/linux/calc64.h b/include/linux/calc64.h
new file mode 100644
index 000000000000..ebf4b8f38d88
--- /dev/null
+++ b/include/linux/calc64.h
@@ -0,0 +1,49 @@
1#ifndef _LINUX_CALC64_H
2#define _LINUX_CALC64_H
3
4#include <linux/types.h>
5#include <asm/div64.h>
6
7/*
8 * This is a generic macro which is used when the architecture
9 * specific div64.h does not provide a optimized one.
10 *
11 * The 64bit dividend is divided by the divisor (data type long), the
12 * result is returned and the remainder stored in the variable
13 * referenced by remainder (data type long *). In contrast to the
14 * do_div macro the dividend is kept intact.
15 */
16#ifndef div_long_long_rem
17#define div_long_long_rem(dividend, divisor, remainder) \
18 do_div_llr((dividend), divisor, remainder)
19
20static inline unsigned long do_div_llr(const long long dividend,
21 const long divisor, long *remainder)
22{
23 u64 result = dividend;
24
25 *(remainder) = do_div(result, divisor);
26 return (unsigned long) result;
27}
28#endif
29
30/*
31 * Sign aware variation of the above. On some architectures a
32 * negative dividend leads to an divide overflow exception, which
33 * is avoided by the sign check.
34 */
35static inline long div_long_long_rem_signed(const long long dividend,
36 const long divisor, long *remainder)
37{
38 long res;
39
40 if (unlikely(dividend < 0)) {
41 res = -div_long_long_rem(-dividend, divisor, remainder);
42 *remainder = -(*remainder);
43 } else
44 res = div_long_long_rem(dividend, divisor, remainder);
45
46 return res;
47}
48
49#endif
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 6b4618902d3d..5a23ce752629 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -43,6 +43,7 @@ typedef struct __user_cap_data_struct {
43#ifdef __KERNEL__ 43#ifdef __KERNEL__
44 44
45#include <linux/spinlock.h> 45#include <linux/spinlock.h>
46#include <asm/current.h>
46 47
47/* #define STRICT_CAP_T_TYPECHECKS */ 48/* #define STRICT_CAP_T_TYPECHECKS */
48 49
@@ -356,6 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c)
356 357
357#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) 358#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK)
358 359
360extern int capable(int cap);
361
359#endif /* __KERNEL__ */ 362#endif /* __KERNEL__ */
360 363
361#endif /* !_LINUX_CAPABILITY_H */ 364#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/clk.h b/include/linux/clk.h
new file mode 100644
index 000000000000..12848f81bb37
--- /dev/null
+++ b/include/linux/clk.h
@@ -0,0 +1,124 @@
1/*
2 * linux/include/linux/clk.h
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef ASMARM_CLOCK_H
12#define ASMARM_CLOCK_H
13
14struct device;
15
16/*
17 * The base API.
18 */
19
20
21/*
22 * struct clk - an machine class defined object / cookie.
23 */
24struct clk;
25
26/**
27 * clk_get - lookup and obtain a reference to a clock producer.
28 * @dev: device for clock "consumer"
29 * @id: clock comsumer ID
30 *
31 * Returns a struct clk corresponding to the clock producer, or
32 * valid IS_ERR() condition containing errno. The implementation
33 * uses @dev and @id to determine the clock consumer, and thereby
34 * the clock producer. (IOW, @id may be identical strings, but
35 * clk_get may return different clock producers depending on @dev.)
36 *
37 * Drivers must assume that the clock source is not enabled.
38 */
39struct clk *clk_get(struct device *dev, const char *id);
40
41/**
42 * clk_enable - inform the system when the clock source should be running.
43 * @clk: clock source
44 *
45 * If the clock can not be enabled/disabled, this should return success.
46 *
47 * Returns success (0) or negative errno.
48 */
49int clk_enable(struct clk *clk);
50
51/**
52 * clk_disable - inform the system when the clock source is no longer required.
53 * @clk: clock source
54 *
55 * Inform the system that a clock source is no longer required by
56 * a driver and may be shut down.
57 *
58 * Implementation detail: if the clock source is shared between
59 * multiple drivers, clk_enable() calls must be balanced by the
60 * same number of clk_disable() calls for the clock source to be
61 * disabled.
62 */
63void clk_disable(struct clk *clk);
64
65/**
66 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
67 * This is only valid once the clock source has been enabled.
68 * @clk: clock source
69 */
70unsigned long clk_get_rate(struct clk *clk);
71
72/**
73 * clk_put - "free" the clock source
74 * @clk: clock source
75 *
76 * Note: drivers must ensure that all clk_enable calls made on this
77 * clock source are balanced by clk_disable calls prior to calling
78 * this function.
79 */
80void clk_put(struct clk *clk);
81
82
83/*
84 * The remaining APIs are optional for machine class support.
85 */
86
87
88/**
89 * clk_round_rate - adjust a rate to the exact rate a clock can provide
90 * @clk: clock source
91 * @rate: desired clock rate in Hz
92 *
93 * Returns rounded clock rate in Hz, or negative errno.
94 */
95long clk_round_rate(struct clk *clk, unsigned long rate);
96
97/**
98 * clk_set_rate - set the clock rate for a clock source
99 * @clk: clock source
100 * @rate: desired clock rate in Hz
101 *
102 * Returns success (0) or negative errno.
103 */
104int clk_set_rate(struct clk *clk, unsigned long rate);
105
106/**
107 * clk_set_parent - set the parent clock source for this clock
108 * @clk: clock source
109 * @parent: parent clock source
110 *
111 * Returns success (0) or negative errno.
112 */
113int clk_set_parent(struct clk *clk, struct clk *parent);
114
115/**
116 * clk_get_parent - get the parent clock source for this clock
117 * @clk: clock source
118 *
119 * Returns struct clk corresponding to parent clock source, or
120 * valid IS_ERR() condition containing errno.
121 */
122struct clk *clk_get_parent(struct clk *clk);
123
124#endif
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 119f9d064cc6..8fad50f8e389 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -2,14 +2,6 @@
2 * compatible types passed or none at all... Please include 2 * compatible types passed or none at all... Please include
3 * only stuff that is compatible on *all architectures*. 3 * only stuff that is compatible on *all architectures*.
4 */ 4 */
5#ifndef COMPATIBLE_IOCTL /* pointer to compatible structure or no argument */
6#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl)
7#endif
8
9#ifndef ULONG_IOCTL /* argument is an unsigned long integer, not a pointer */
10#define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl)
11#endif
12
13 5
14COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ 6COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */
15COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ 7COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */
@@ -218,32 +210,6 @@ COMPATIBLE_IOCTL(VT_RESIZE)
218COMPATIBLE_IOCTL(VT_RESIZEX) 210COMPATIBLE_IOCTL(VT_RESIZEX)
219COMPATIBLE_IOCTL(VT_LOCKSWITCH) 211COMPATIBLE_IOCTL(VT_LOCKSWITCH)
220COMPATIBLE_IOCTL(VT_UNLOCKSWITCH) 212COMPATIBLE_IOCTL(VT_UNLOCKSWITCH)
221/* Little v */
222/* Little v, the video4linux ioctls (conflict?) */
223COMPATIBLE_IOCTL(VIDIOCGCAP)
224COMPATIBLE_IOCTL(VIDIOCGCHAN)
225COMPATIBLE_IOCTL(VIDIOCSCHAN)
226COMPATIBLE_IOCTL(VIDIOCGPICT)
227COMPATIBLE_IOCTL(VIDIOCSPICT)
228COMPATIBLE_IOCTL(VIDIOCCAPTURE)
229COMPATIBLE_IOCTL(VIDIOCKEY)
230COMPATIBLE_IOCTL(VIDIOCGAUDIO)
231COMPATIBLE_IOCTL(VIDIOCSAUDIO)
232COMPATIBLE_IOCTL(VIDIOCSYNC)
233COMPATIBLE_IOCTL(VIDIOCMCAPTURE)
234COMPATIBLE_IOCTL(VIDIOCGMBUF)
235COMPATIBLE_IOCTL(VIDIOCGUNIT)
236COMPATIBLE_IOCTL(VIDIOCGCAPTURE)
237COMPATIBLE_IOCTL(VIDIOCSCAPTURE)
238/* BTTV specific... */
239COMPATIBLE_IOCTL(_IOW('v', BASE_VIDIOCPRIVATE+0, char [256]))
240COMPATIBLE_IOCTL(_IOR('v', BASE_VIDIOCPRIVATE+1, char [256]))
241COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int))
242COMPATIBLE_IOCTL(_IOW('v' , BASE_VIDIOCPRIVATE+3, char [16])) /* struct bttv_pll_info */
243COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+4, int))
244COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+5, int))
245COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+6, int))
246COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+7, int))
247/* Little p (/dev/rtc, /dev/envctrl, etc.) */ 213/* Little p (/dev/rtc, /dev/envctrl, etc.) */
248COMPATIBLE_IOCTL(RTC_AIE_ON) 214COMPATIBLE_IOCTL(RTC_AIE_ON)
249COMPATIBLE_IOCTL(RTC_AIE_OFF) 215COMPATIBLE_IOCTL(RTC_AIE_OFF)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 152734055403..6e1c44a935d4 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -11,7 +11,22 @@
11 11
12/* This macro obfuscates arithmetic on a variable address so that gcc 12/* This macro obfuscates arithmetic on a variable address so that gcc
13 shouldn't recognize the original var, and make assumptions about it */ 13 shouldn't recognize the original var, and make assumptions about it */
14/*
15 * Versions of the ppc64 compiler before 4.1 had a bug where use of
16 * RELOC_HIDE could trash r30. The bug can be worked around by changing
17 * the inline assembly constraint from =g to =r, in this particular
18 * case either is valid.
19 */
14#define RELOC_HIDE(ptr, off) \ 20#define RELOC_HIDE(ptr, off) \
15 ({ unsigned long __ptr; \ 21 ({ unsigned long __ptr; \
16 __asm__ ("" : "=g"(__ptr) : "0"(ptr)); \ 22 __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
17 (typeof(ptr)) (__ptr + (off)); }) 23 (typeof(ptr)) (__ptr + (off)); })
24
25
26#define inline inline __attribute__((always_inline))
27#define __inline__ __inline__ __attribute__((always_inline))
28#define __inline __inline __attribute__((always_inline))
29#define __deprecated __attribute__((deprecated))
30#define noinline __attribute__((noinline))
31#define __attribute_pure__ __attribute__((pure))
32#define __attribute_const__ __attribute__((__const__))
diff --git a/include/linux/compiler-gcc2.h b/include/linux/compiler-gcc2.h
deleted file mode 100644
index ebed17660c5f..000000000000
--- a/include/linux/compiler-gcc2.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* Never include this file directly. Include <linux/compiler.h> instead. */
2
3/* These definitions are for GCC v2.x. */
4
5/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
6 a mechanism by which the user can annotate likely branch directions and
7 expect the blocks to be reordered appropriately. Define __builtin_expect
8 to nothing for earlier compilers. */
9#include <linux/compiler-gcc.h>
10
11#if __GNUC_MINOR__ < 96
12# define __builtin_expect(x, expected_value) (x)
13#endif
14
15#define __attribute_used__ __attribute__((__unused__))
16
17/*
18 * The attribute `pure' is not implemented in GCC versions earlier
19 * than 2.96.
20 */
21#if __GNUC_MINOR__ >= 96
22# define __attribute_pure__ __attribute__((pure))
23# define __attribute_const__ __attribute__((__const__))
24#endif
25
26/* GCC 2.95.x/2.96 recognize __va_copy, but not va_copy. Actually later GCC's
27 * define both va_copy and __va_copy, but the latter may go away, so limit this
28 * to this header */
29#define va_copy __va_copy
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index a6fa615afab5..1698b845761f 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -3,30 +3,14 @@
3/* These definitions are for GCC v3.x. */ 3/* These definitions are for GCC v3.x. */
4#include <linux/compiler-gcc.h> 4#include <linux/compiler-gcc.h>
5 5
6#if __GNUC_MINOR__ >= 1
7# define inline inline __attribute__((always_inline))
8# define __inline__ __inline__ __attribute__((always_inline))
9# define __inline __inline __attribute__((always_inline))
10#endif
11
12#if __GNUC_MINOR__ > 0
13# define __deprecated __attribute__((deprecated))
14#endif
15
16#if __GNUC_MINOR__ >= 3 6#if __GNUC_MINOR__ >= 3
17# define __attribute_used__ __attribute__((__used__)) 7# define __attribute_used__ __attribute__((__used__))
18#else 8#else
19# define __attribute_used__ __attribute__((__unused__)) 9# define __attribute_used__ __attribute__((__unused__))
20#endif 10#endif
21 11
22#define __attribute_pure__ __attribute__((pure))
23#define __attribute_const__ __attribute__((__const__))
24
25#if __GNUC_MINOR__ >= 1
26#define noinline __attribute__((noinline))
27#endif
28
29#if __GNUC_MINOR__ >= 4 12#if __GNUC_MINOR__ >= 4
30#define __must_check __attribute__((warn_unused_result)) 13#define __must_check __attribute__((warn_unused_result))
31#endif 14#endif
32 15
16#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 53686c037a06..6f5cc6f0e7a6 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -3,14 +3,16 @@
3/* These definitions are for GCC v4.x. */ 3/* These definitions are for GCC v4.x. */
4#include <linux/compiler-gcc.h> 4#include <linux/compiler-gcc.h>
5 5
6#define inline inline __attribute__((always_inline)) 6#ifdef CONFIG_FORCED_INLINING
7#define __inline__ __inline__ __attribute__((always_inline)) 7# undef inline
8#define __inline __inline __attribute__((always_inline)) 8# undef __inline__
9#define __deprecated __attribute__((deprecated)) 9# undef __inline
10# define inline inline __attribute__((always_inline))
11# define __inline__ __inline__ __attribute__((always_inline))
12# define __inline __inline __attribute__((always_inline))
13#endif
14
10#define __attribute_used__ __attribute__((__used__)) 15#define __attribute_used__ __attribute__((__used__))
11#define __attribute_pure__ __attribute__((pure))
12#define __attribute_const__ __attribute__((__const__))
13#define noinline __attribute__((noinline))
14#define __must_check __attribute__((warn_unused_result)) 16#define __must_check __attribute__((warn_unused_result))
15#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 17#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
16 18#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index d7378215b851..f23d3c6fc2c0 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -42,8 +42,6 @@ extern void __chk_io_ptr(void __iomem *);
42# include <linux/compiler-gcc4.h> 42# include <linux/compiler-gcc4.h>
43#elif __GNUC__ == 3 43#elif __GNUC__ == 3
44# include <linux/compiler-gcc3.h> 44# include <linux/compiler-gcc3.h>
45#elif __GNUC__ == 2
46# include <linux/compiler-gcc2.h>
47#else 45#else
48# error Sorry, your compiler is too old/not recognized. 46# error Sorry, your compiler is too old/not recognized.
49#endif 47#endif
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 6e2deef96b34..3bc606927116 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -14,22 +14,46 @@
14 14
15#ifdef CONFIG_CPUSETS 15#ifdef CONFIG_CPUSETS
16 16
17extern int number_of_cpusets; /* How many cpusets are defined in system? */
18
19extern int cpuset_init_early(void);
17extern int cpuset_init(void); 20extern int cpuset_init(void);
18extern void cpuset_init_smp(void); 21extern void cpuset_init_smp(void);
19extern void cpuset_fork(struct task_struct *p); 22extern void cpuset_fork(struct task_struct *p);
20extern void cpuset_exit(struct task_struct *p); 23extern void cpuset_exit(struct task_struct *p);
21extern cpumask_t cpuset_cpus_allowed(const struct task_struct *p); 24extern cpumask_t cpuset_cpus_allowed(struct task_struct *p);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
22void cpuset_init_current_mems_allowed(void); 26void cpuset_init_current_mems_allowed(void);
23void cpuset_update_current_mems_allowed(void); 27void cpuset_update_task_memory_state(void);
24void cpuset_restrict_to_mems_allowed(unsigned long *nodes); 28#define cpuset_nodes_subset_current_mems_allowed(nodes) \
29 nodes_subset((nodes), current->mems_allowed)
25int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); 30int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
26extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask); 31
32extern int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask);
33static int inline cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
34{
35 return number_of_cpusets <= 1 || __cpuset_zone_allowed(z, gfp_mask);
36}
37
27extern int cpuset_excl_nodes_overlap(const struct task_struct *p); 38extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
39
40#define cpuset_memory_pressure_bump() \
41 do { \
42 if (cpuset_memory_pressure_enabled) \
43 __cpuset_memory_pressure_bump(); \
44 } while (0)
45extern int cpuset_memory_pressure_enabled;
46extern void __cpuset_memory_pressure_bump(void);
47
28extern struct file_operations proc_cpuset_operations; 48extern struct file_operations proc_cpuset_operations;
29extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 49extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
30 50
51extern void cpuset_lock(void);
52extern void cpuset_unlock(void);
53
31#else /* !CONFIG_CPUSETS */ 54#else /* !CONFIG_CPUSETS */
32 55
56static inline int cpuset_init_early(void) { return 0; }
33static inline int cpuset_init(void) { return 0; } 57static inline int cpuset_init(void) { return 0; }
34static inline void cpuset_init_smp(void) {} 58static inline void cpuset_init_smp(void) {}
35static inline void cpuset_fork(struct task_struct *p) {} 59static inline void cpuset_fork(struct task_struct *p) {}
@@ -40,9 +64,14 @@ static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p)
40 return cpu_possible_map; 64 return cpu_possible_map;
41} 65}
42 66
67static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
68{
69 return node_possible_map;
70}
71
43static inline void cpuset_init_current_mems_allowed(void) {} 72static inline void cpuset_init_current_mems_allowed(void) {}
44static inline void cpuset_update_current_mems_allowed(void) {} 73static inline void cpuset_update_task_memory_state(void) {}
45static inline void cpuset_restrict_to_mems_allowed(unsigned long *nodes) {} 74#define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
46 75
47static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) 76static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
48{ 77{
@@ -59,12 +88,17 @@ static inline int cpuset_excl_nodes_overlap(const struct task_struct *p)
59 return 1; 88 return 1;
60} 89}
61 90
91static inline void cpuset_memory_pressure_bump(void) {}
92
62static inline char *cpuset_task_status_allowed(struct task_struct *task, 93static inline char *cpuset_task_status_allowed(struct task_struct *task,
63 char *buffer) 94 char *buffer)
64{ 95{
65 return buffer; 96 return buffer;
66} 97}
67 98
99static inline void cpuset_lock(void) {}
100static inline void cpuset_unlock(void) {}
101
68#endif /* !CONFIG_CPUSETS */ 102#endif /* !CONFIG_CPUSETS */
69 103
70#endif /* _LINUX_CPUSET_H */ 104#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 3c89df6e7768..d88bf8aa8b47 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> 4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
5 * Copyright (c) 2002 David S. Miller (davem@redhat.com) 5 * Copyright (c) 2002 David S. Miller (davem@redhat.com)
6 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
6 * 7 *
7 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no> 8 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no>
8 * and Nettle, by Niels Möller. 9 * and Nettle, by Niels Möller.
@@ -126,7 +127,11 @@ struct crypto_alg {
126 unsigned int cra_blocksize; 127 unsigned int cra_blocksize;
127 unsigned int cra_ctxsize; 128 unsigned int cra_ctxsize;
128 unsigned int cra_alignmask; 129 unsigned int cra_alignmask;
130
131 int cra_priority;
132
129 const char cra_name[CRYPTO_MAX_ALG_NAME]; 133 const char cra_name[CRYPTO_MAX_ALG_NAME];
134 const char cra_driver_name[CRYPTO_MAX_ALG_NAME];
130 135
131 union { 136 union {
132 struct cipher_alg cipher; 137 struct cipher_alg cipher;
diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h
index b10a7f3a8cac..f7a906583463 100644
--- a/include/linux/cycx_x25.h
+++ b/include/linux/cycx_x25.h
@@ -38,11 +38,11 @@ extern unsigned int cycx_debug;
38/* Data Structures */ 38/* Data Structures */
39/* X.25 Command Block. */ 39/* X.25 Command Block. */
40struct cycx_x25_cmd { 40struct cycx_x25_cmd {
41 u16 command PACKED; 41 u16 command;
42 u16 link PACKED; /* values: 0 or 1 */ 42 u16 link; /* values: 0 or 1 */
43 u16 len PACKED; /* values: 0 thru 0x205 (517) */ 43 u16 len; /* values: 0 thru 0x205 (517) */
44 u32 buf PACKED; 44 u32 buf;
45}; 45} PACKED;
46 46
47/* Defines for the 'command' field. */ 47/* Defines for the 'command' field. */
48#define X25_CONNECT_REQUEST 0x4401 48#define X25_CONNECT_REQUEST 0x4401
@@ -92,34 +92,34 @@ struct cycx_x25_cmd {
92 * @flags - see dosx25.doc, in portuguese, for details 92 * @flags - see dosx25.doc, in portuguese, for details
93 */ 93 */
94struct cycx_x25_config { 94struct cycx_x25_config {
95 u8 link PACKED; 95 u8 link;
96 u8 speed PACKED; 96 u8 speed;
97 u8 clock PACKED; 97 u8 clock;
98 u8 n2 PACKED; 98 u8 n2;
99 u8 n2win PACKED; 99 u8 n2win;
100 u8 n3win PACKED; 100 u8 n3win;
101 u8 nvc PACKED; 101 u8 nvc;
102 u8 pktlen PACKED; 102 u8 pktlen;
103 u8 locaddr PACKED; 103 u8 locaddr;
104 u8 remaddr PACKED; 104 u8 remaddr;
105 u16 t1 PACKED; 105 u16 t1;
106 u16 t2 PACKED; 106 u16 t2;
107 u8 t21 PACKED; 107 u8 t21;
108 u8 npvc PACKED; 108 u8 npvc;
109 u8 t23 PACKED; 109 u8 t23;
110 u8 flags PACKED; 110 u8 flags;
111}; 111} PACKED;
112 112
113struct cycx_x25_stats { 113struct cycx_x25_stats {
114 u16 rx_crc_errors PACKED; 114 u16 rx_crc_errors;
115 u16 rx_over_errors PACKED; 115 u16 rx_over_errors;
116 u16 n2_tx_frames PACKED; 116 u16 n2_tx_frames;
117 u16 n2_rx_frames PACKED; 117 u16 n2_rx_frames;
118 u16 tx_timeouts PACKED; 118 u16 tx_timeouts;
119 u16 rx_timeouts PACKED; 119 u16 rx_timeouts;
120 u16 n3_tx_packets PACKED; 120 u16 n3_tx_packets;
121 u16 n3_rx_packets PACKED; 121 u16 n3_rx_packets;
122 u16 tx_aborts PACKED; 122 u16 tx_aborts;
123 u16 rx_aborts PACKED; 123 u16 rx_aborts;
124}; 124} PACKED;
125#endif /* _CYCX_X25_H */ 125#endif /* _CYCX_X25_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 46a2ba617595..a3ed5e059d47 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -95,14 +95,19 @@ struct dentry {
95 struct qstr d_name; 95 struct qstr d_name;
96 96
97 struct list_head d_lru; /* LRU list */ 97 struct list_head d_lru; /* LRU list */
98 struct list_head d_child; /* child of parent list */ 98 /*
99 * d_child and d_rcu can share memory
100 */
101 union {
102 struct list_head d_child; /* child of parent list */
103 struct rcu_head d_rcu;
104 } d_u;
99 struct list_head d_subdirs; /* our children */ 105 struct list_head d_subdirs; /* our children */
100 struct list_head d_alias; /* inode alias list */ 106 struct list_head d_alias; /* inode alias list */
101 unsigned long d_time; /* used by d_revalidate */ 107 unsigned long d_time; /* used by d_revalidate */
102 struct dentry_operations *d_op; 108 struct dentry_operations *d_op;
103 struct super_block *d_sb; /* The root of the dentry tree */ 109 struct super_block *d_sb; /* The root of the dentry tree */
104 void *d_fsdata; /* fs-specific data */ 110 void *d_fsdata; /* fs-specific data */
105 struct rcu_head d_rcu;
106 struct dcookie_struct *d_cookie; /* cookie, if any */ 111 struct dcookie_struct *d_cookie; /* cookie, if any */
107 int d_mounted; 112 int d_mounted;
108 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ 113 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
diff --git a/include/linux/device.h b/include/linux/device.h
index 0cdee78e5ce1..58df18d9cd3e 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -49,6 +49,9 @@ struct bus_type {
49 int (*match)(struct device * dev, struct device_driver * drv); 49 int (*match)(struct device * dev, struct device_driver * drv);
50 int (*uevent)(struct device *dev, char **envp, 50 int (*uevent)(struct device *dev, char **envp,
51 int num_envp, char *buffer, int buffer_size); 51 int num_envp, char *buffer, int buffer_size);
52 int (*probe)(struct device * dev);
53 int (*remove)(struct device * dev);
54 void (*shutdown)(struct device * dev);
52 int (*suspend)(struct device * dev, pm_message_t state); 55 int (*suspend)(struct device * dev, pm_message_t state);
53 int (*resume)(struct device * dev); 56 int (*resume)(struct device * dev);
54}; 57};
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 05f4132622fc..2e6bbe014157 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -2,6 +2,7 @@
2#define __DMI_H__ 2#define __DMI_H__
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/config.h>
5 6
6enum dmi_field { 7enum dmi_field {
7 DMI_NONE, 8 DMI_NONE,
@@ -60,12 +61,14 @@ struct dmi_device {
60 void *device_data; /* Type specific data */ 61 void *device_data; /* Type specific data */
61}; 62};
62 63
63#if defined(CONFIG_X86_32) 64#ifdef CONFIG_DMI
64 65
65extern int dmi_check_system(struct dmi_system_id *list); 66extern int dmi_check_system(struct dmi_system_id *list);
66extern char * dmi_get_system_info(int field); 67extern char * dmi_get_system_info(int field);
67extern struct dmi_device * dmi_find_device(int type, const char *name, 68extern struct dmi_device * dmi_find_device(int type, const char *name,
68 struct dmi_device *from); 69 struct dmi_device *from);
70extern void dmi_scan_machine(void);
71
69#else 72#else
70 73
71static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } 74static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index d41df7047ed7..c8cbd90ba375 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -240,6 +240,15 @@ struct dvb_frontend_event {
240}; 240};
241 241
242 242
243/**
244 * When set, this flag will disable any zigzagging or other "normal" tuning
245 * behaviour. Additionally, there will be no automatic monitoring of the lock
246 * status, and hence no frontend events will be generated. If a frontend device
247 * is closed, this flag will be automatically turned off when the device is
248 * reopened read-write.
249 */
250#define FE_TUNE_MODE_ONESHOT 0x01
251
243 252
244#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) 253#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info)
245 254
@@ -260,6 +269,7 @@ struct dvb_frontend_event {
260 269
261#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) 270#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters)
262#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) 271#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters)
272#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */
263#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) 273#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event)
264 274
265#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ 275#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index fb80fa44c4dd..23fe746a1d51 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -66,7 +66,7 @@ struct elevator_type
66}; 66};
67 67
68/* 68/*
69 * each queue has an elevator_queue assoicated with it 69 * each queue has an elevator_queue associated with it
70 */ 70 */
71struct elevator_queue 71struct elevator_queue
72{ 72{
@@ -114,8 +114,6 @@ extern ssize_t elv_iosched_store(request_queue_t *, const char *, size_t);
114extern int elevator_init(request_queue_t *, char *); 114extern int elevator_init(request_queue_t *, char *);
115extern void elevator_exit(elevator_t *); 115extern void elevator_exit(elevator_t *);
116extern int elv_rq_merge_ok(struct request *, struct bio *); 116extern int elv_rq_merge_ok(struct request *, struct bio *);
117extern int elv_try_merge(struct request *, struct bio *);
118extern int elv_try_last_merge(request_queue_t *, struct bio *);
119 117
120/* 118/*
121 * Return values from elevator merger 119 * Return values from elevator merger
diff --git a/include/linux/elf.h b/include/linux/elf.h
index ff955dbf510d..d3bfacb24496 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -151,6 +151,8 @@ typedef __s64 Elf64_Sxword;
151#define STT_FUNC 2 151#define STT_FUNC 2
152#define STT_SECTION 3 152#define STT_SECTION 3
153#define STT_FILE 4 153#define STT_FILE 4
154#define STT_COMMON 5
155#define STT_TLS 6
154 156
155#define ELF_ST_BIND(x) ((x) >> 4) 157#define ELF_ST_BIND(x) ((x) >> 4)
156#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) 158#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 2914f7b07156..e71dd98dbcae 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -87,7 +87,7 @@ struct ext3_inode_info {
87#ifdef CONFIG_EXT3_FS_XATTR 87#ifdef CONFIG_EXT3_FS_XATTR
88 /* 88 /*
89 * Extended attributes can be read independently of the main file 89 * Extended attributes can be read independently of the main file
90 * data. Taking i_sem even when reading would cause contention 90 * data. Taking i_mutex even when reading would cause contention
91 * between readers of EAs and writers of regular file data, so 91 * between readers of EAs and writers of regular file data, so
92 * instead we synchronize on xattr_sem when reading or changing 92 * instead we synchronize on xattr_sem when reading or changing
93 * EAs. 93 * EAs.
diff --git a/include/linux/fb.h b/include/linux/fb.h
index a973be2cfe61..2cb19e6503aa 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -608,15 +608,15 @@ struct fb_ops {
608 int (*fb_sync)(struct fb_info *info); 608 int (*fb_sync)(struct fb_info *info);
609 609
610 /* perform fb specific ioctl (optional) */ 610 /* perform fb specific ioctl (optional) */
611 int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd, 611 int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
612 unsigned long arg, struct fb_info *info); 612 unsigned long arg);
613 613
614 /* Handle 32bit compat ioctl (optional) */ 614 /* Handle 32bit compat ioctl (optional) */
615 long (*fb_compat_ioctl)(struct file *f, unsigned cmd, unsigned long arg, 615 int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,
616 struct fb_info *info); 616 unsigned long arg);
617 617
618 /* perform fb specific mmap */ 618 /* perform fb specific mmap */
619 int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma); 619 int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
620 620
621 /* save current hardware state */ 621 /* save current hardware state */
622 void (*fb_save_state)(struct fb_info *info); 622 void (*fb_save_state)(struct fb_info *info);
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 8a7c82151de9..c52a63755fdd 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -23,6 +23,13 @@
23#define DN_ATTRIB 0x00000020 /* File changed attibutes */ 23#define DN_ATTRIB 0x00000020 /* File changed attibutes */
24#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ 24#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
25 25
26#define AT_FDCWD -100 /* Special value used to indicate
27 openat should use the current
28 working directory. */
29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
30#define AT_REMOVEDIR 0x200 /* Remove directory instead of
31 unlinking file. */
32
26#ifdef __KERNEL__ 33#ifdef __KERNEL__
27 34
28#ifndef force_o_largefile 35#ifndef force_o_largefile
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2c9c48d65630..84bb449b9b01 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -9,7 +9,6 @@
9#include <linux/config.h> 9#include <linux/config.h>
10#include <linux/limits.h> 10#include <linux/limits.h>
11#include <linux/ioctl.h> 11#include <linux/ioctl.h>
12#include <linux/rcuref.h>
13 12
14/* 13/*
15 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -104,19 +103,18 @@ extern int dir_notify_enable;
104#define MS_MOVE 8192 103#define MS_MOVE 8192
105#define MS_REC 16384 104#define MS_REC 16384
106#define MS_VERBOSE 32768 105#define MS_VERBOSE 32768
106#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
107#define MS_UNBINDABLE (1<<17) /* change to unbindable */ 107#define MS_UNBINDABLE (1<<17) /* change to unbindable */
108#define MS_PRIVATE (1<<18) /* change to private */ 108#define MS_PRIVATE (1<<18) /* change to private */
109#define MS_SLAVE (1<<19) /* change to slave */ 109#define MS_SLAVE (1<<19) /* change to slave */
110#define MS_SHARED (1<<20) /* change to shared */ 110#define MS_SHARED (1<<20) /* change to shared */
111#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
112#define MS_ACTIVE (1<<30) 111#define MS_ACTIVE (1<<30)
113#define MS_NOUSER (1<<31) 112#define MS_NOUSER (1<<31)
114 113
115/* 114/*
116 * Superblock flags that can be altered by MS_REMOUNT 115 * Superblock flags that can be altered by MS_REMOUNT
117 */ 116 */
118#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|\ 117#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)
119 MS_NODIRATIME)
120 118
121/* 119/*
122 * Old magic mount flag and mask 120 * Old magic mount flag and mask
@@ -162,8 +160,6 @@ extern int dir_notify_enable;
162#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 160#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
163#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 161#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
164#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) 162#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
165#define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME))
166#define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME)
167#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) 163#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
168 164
169#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) 165#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
@@ -220,11 +216,13 @@ extern int dir_notify_enable;
220#include <linux/prio_tree.h> 216#include <linux/prio_tree.h>
221#include <linux/init.h> 217#include <linux/init.h>
222#include <linux/sched.h> 218#include <linux/sched.h>
219#include <linux/mutex.h>
223 220
224#include <asm/atomic.h> 221#include <asm/atomic.h>
225#include <asm/semaphore.h> 222#include <asm/semaphore.h>
226#include <asm/byteorder.h> 223#include <asm/byteorder.h>
227 224
225struct hd_geometry;
228struct iovec; 226struct iovec;
229struct nameidata; 227struct nameidata;
230struct kiocb; 228struct kiocb;
@@ -234,9 +232,6 @@ struct kstatfs;
234struct vm_area_struct; 232struct vm_area_struct;
235struct vfsmount; 233struct vfsmount;
236 234
237/* Used to be a macro which just called the function, now just a function */
238extern void update_atime (struct inode *);
239
240extern void __init inode_init(unsigned long); 235extern void __init inode_init(unsigned long);
241extern void __init inode_init_early(void); 236extern void __init inode_init_early(void);
242extern void __init mnt_init(unsigned long); 237extern void __init mnt_init(unsigned long);
@@ -484,7 +479,7 @@ struct inode {
484 unsigned long i_blocks; 479 unsigned long i_blocks;
485 unsigned short i_bytes; 480 unsigned short i_bytes;
486 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 481 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
487 struct semaphore i_sem; 482 struct mutex i_mutex;
488 struct rw_semaphore i_alloc_sem; 483 struct rw_semaphore i_alloc_sem;
489 struct inode_operations *i_op; 484 struct inode_operations *i_op;
490 struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 485 struct file_operations *i_fop; /* former ->i_op->default_file_ops */
@@ -653,7 +648,7 @@ extern spinlock_t files_lock;
653#define file_list_lock() spin_lock(&files_lock); 648#define file_list_lock() spin_lock(&files_lock);
654#define file_list_unlock() spin_unlock(&files_lock); 649#define file_list_unlock() spin_unlock(&files_lock);
655 650
656#define get_file(x) rcuref_inc(&(x)->f_count) 651#define get_file(x) atomic_inc(&(x)->f_count)
657#define file_count(x) atomic_read(&(x)->f_count) 652#define file_count(x) atomic_read(&(x)->f_count)
658 653
659#define MAX_NON_LFS ((1UL<<31) - 1) 654#define MAX_NON_LFS ((1UL<<31) - 1)
@@ -808,7 +803,6 @@ struct super_block {
808 struct list_head s_list; /* Keep this first */ 803 struct list_head s_list; /* Keep this first */
809 dev_t s_dev; /* search index; _not_ kdev_t */ 804 dev_t s_dev; /* search index; _not_ kdev_t */
810 unsigned long s_blocksize; 805 unsigned long s_blocksize;
811 unsigned long s_old_blocksize;
812 unsigned char s_blocksize_bits; 806 unsigned char s_blocksize_bits;
813 unsigned char s_dirt; 807 unsigned char s_dirt;
814 unsigned long long s_maxbytes; /* Max file size */ 808 unsigned long long s_maxbytes; /* Max file size */
@@ -821,7 +815,7 @@ struct super_block {
821 unsigned long s_magic; 815 unsigned long s_magic;
822 struct dentry *s_root; 816 struct dentry *s_root;
823 struct rw_semaphore s_umount; 817 struct rw_semaphore s_umount;
824 struct semaphore s_lock; 818 struct mutex s_lock;
825 int s_count; 819 int s_count;
826 int s_syncing; 820 int s_syncing;
827 int s_need_sync_fs; 821 int s_need_sync_fs;
@@ -893,13 +887,13 @@ static inline int has_fs_excl(void)
893static inline void lock_super(struct super_block * sb) 887static inline void lock_super(struct super_block * sb)
894{ 888{
895 get_fs_excl(); 889 get_fs_excl();
896 down(&sb->s_lock); 890 mutex_lock(&sb->s_lock);
897} 891}
898 892
899static inline void unlock_super(struct super_block * sb) 893static inline void unlock_super(struct super_block * sb)
900{ 894{
901 put_fs_excl(); 895 put_fs_excl();
902 up(&sb->s_lock); 896 mutex_unlock(&sb->s_lock);
903} 897}
904 898
905/* 899/*
@@ -963,6 +957,7 @@ struct block_device_operations {
963 int (*direct_access) (struct block_device *, sector_t, unsigned long *); 957 int (*direct_access) (struct block_device *, sector_t, unsigned long *);
964 int (*media_changed) (struct gendisk *); 958 int (*media_changed) (struct gendisk *);
965 int (*revalidate_disk) (struct gendisk *); 959 int (*revalidate_disk) (struct gendisk *);
960 int (*getgeo)(struct block_device *, struct hd_geometry *);
966 struct module *owner; 961 struct module *owner;
967}; 962};
968 963
@@ -1117,12 +1112,7 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1117 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1112 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1118} 1113}
1119 1114
1120static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry) 1115extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1121{
1122 /* per-mountpoint checks will go here */
1123 update_atime(dentry->d_inode);
1124}
1125
1126static inline void file_accessed(struct file *file) 1116static inline void file_accessed(struct file *file)
1127{ 1117{
1128 if (!(file->f_flags & O_NOATIME)) 1118 if (!(file->f_flags & O_NOATIME))
@@ -1191,7 +1181,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1191 * directory. The name should be stored in the @name (with the 1181 * directory. The name should be stored in the @name (with the
1192 * understanding that it is already pointing to a a %NAME_MAX+1 sized 1182 * understanding that it is already pointing to a a %NAME_MAX+1 sized
1193 * buffer. get_name() should return %0 on success, a negative error code 1183 * buffer. get_name() should return %0 on success, a negative error code
1194 * or error. @get_name will be called without @parent->i_sem held. 1184 * or error. @get_name will be called without @parent->i_mutex held.
1195 * 1185 *
1196 * get_parent: 1186 * get_parent:
1197 * @get_parent should find the parent directory for the given @child which 1187 * @get_parent should find the parent directory for the given @child which
@@ -1213,7 +1203,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1213 * nfsd_find_fh_dentry() in either the @obj or @parent parameters. 1203 * nfsd_find_fh_dentry() in either the @obj or @parent parameters.
1214 * 1204 *
1215 * Locking rules: 1205 * Locking rules:
1216 * get_parent is called with child->d_inode->i_sem down 1206 * get_parent is called with child->d_inode->i_mutex down
1217 * get_name is not (which is possibly inconsistent) 1207 * get_name is not (which is possibly inconsistent)
1218 */ 1208 */
1219 1209
@@ -1300,6 +1290,9 @@ extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
1300 1290
1301extern int vfs_statfs(struct super_block *, struct kstatfs *); 1291extern int vfs_statfs(struct super_block *, struct kstatfs *);
1302 1292
1293/* /sys/fs */
1294extern struct subsystem fs_subsys;
1295
1303#define FLOCK_VERIFY_READ 1 1296#define FLOCK_VERIFY_READ 1
1304#define FLOCK_VERIFY_WRITE 2 1297#define FLOCK_VERIFY_WRITE 2
1305 1298
@@ -1345,8 +1338,10 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1345 1338
1346/* fs/open.c */ 1339/* fs/open.c */
1347 1340
1348extern int do_truncate(struct dentry *, loff_t start, struct file *filp); 1341extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
1349extern long do_sys_open(const char __user *filename, int flags, int mode); 1342 struct file *filp);
1343extern long do_sys_open(int fdf, const char __user *filename, int flags,
1344 int mode);
1350extern struct file *filp_open(const char *, int, int); 1345extern struct file *filp_open(const char *, int, int);
1351extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1346extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1352extern int filp_close(struct file *, fl_owner_t id); 1347extern int filp_close(struct file *, fl_owner_t id);
@@ -1392,6 +1387,12 @@ extern int register_chrdev(unsigned int, const char *,
1392extern int unregister_chrdev(unsigned int, const char *); 1387extern int unregister_chrdev(unsigned int, const char *);
1393extern void unregister_chrdev_region(dev_t, unsigned); 1388extern void unregister_chrdev_region(dev_t, unsigned);
1394extern int chrdev_open(struct inode *, struct file *); 1389extern int chrdev_open(struct inode *, struct file *);
1390extern int get_chrdev_list(char *);
1391extern void *acquire_chrdev_list(void);
1392extern int count_chrdev_list(void);
1393extern void *get_next_chrdev(void *);
1394extern int get_chrdev_info(void *, int *, char **);
1395extern void release_chrdev_list(void *);
1395 1396
1396/* fs/block_dev.c */ 1397/* fs/block_dev.c */
1397#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1398#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
@@ -1400,6 +1401,11 @@ extern const char *bdevname(struct block_device *bdev, char *buffer);
1400extern struct block_device *lookup_bdev(const char *); 1401extern struct block_device *lookup_bdev(const char *);
1401extern struct block_device *open_bdev_excl(const char *, int, void *); 1402extern struct block_device *open_bdev_excl(const char *, int, void *);
1402extern void close_bdev_excl(struct block_device *); 1403extern void close_bdev_excl(struct block_device *);
1404extern void *acquire_blkdev_list(void);
1405extern int count_blkdev_list(void);
1406extern void *get_next_blkdev(void *);
1407extern int get_blkdev_info(void *, int *, char **);
1408extern void release_blkdev_list(void *);
1403 1409
1404extern void init_special_inode(struct inode *, umode_t, dev_t); 1410extern void init_special_inode(struct inode *, umode_t, dev_t);
1405 1411
@@ -1474,7 +1480,7 @@ static inline void allow_write_access(struct file *file)
1474} 1480}
1475extern int do_pipe(int *); 1481extern int do_pipe(int *);
1476 1482
1477extern int open_namei(const char *, int, int, struct nameidata *); 1483extern int open_namei(int dfd, const char *, int, int, struct nameidata *);
1478extern int may_open(struct nameidata *, int, int); 1484extern int may_open(struct nameidata *, int, int);
1479 1485
1480extern int kernel_read(struct file *, unsigned long, char *, unsigned long); 1486extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
@@ -1672,6 +1678,8 @@ extern int vfs_readdir(struct file *, filldir_t, void *);
1672 1678
1673extern int vfs_stat(char __user *, struct kstat *); 1679extern int vfs_stat(char __user *, struct kstat *);
1674extern int vfs_lstat(char __user *, struct kstat *); 1680extern int vfs_lstat(char __user *, struct kstat *);
1681extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
1682extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *);
1675extern int vfs_fstat(unsigned int, struct kstat *); 1683extern int vfs_fstat(unsigned int, struct kstat *);
1676 1684
1677extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long); 1685extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long);
@@ -1714,7 +1722,7 @@ extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const vo
1714extern int inode_change_ok(struct inode *, struct iattr *); 1722extern int inode_change_ok(struct inode *, struct iattr *);
1715extern int __must_check inode_setattr(struct inode *, struct iattr *); 1723extern int __must_check inode_setattr(struct inode *, struct iattr *);
1716 1724
1717extern void inode_update_time(struct inode *inode, int ctime_too); 1725extern void file_update_time(struct file *file);
1718 1726
1719static inline ino_t parent_ino(struct dentry *dentry) 1727static inline ino_t parent_ino(struct dentry *dentry)
1720{ 1728{
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 934aa9bda481..a9f1cfd096ff 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -50,14 +50,12 @@ struct gianfar_platform_data {
50 50
51 /* board specific information */ 51 /* board specific information */
52 u32 board_flags; 52 u32 board_flags;
53 const char *bus_id; 53 u32 bus_id;
54 u32 phy_id;
54 u8 mac_addr[6]; 55 u8 mac_addr[6];
55}; 56};
56 57
57struct gianfar_mdio_data { 58struct gianfar_mdio_data {
58 /* device specific information */
59 u32 paddr;
60
61 /* board specific information */ 59 /* board specific information */
62 int irq[32]; 60 int irq[32];
63}; 61};
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 8b2eab90abb6..20f9148e38d9 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -57,6 +57,7 @@ struct vm_area_struct;
57 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 57 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
58 __GFP_NOMEMALLOC|__GFP_HARDWALL) 58 __GFP_NOMEMALLOC|__GFP_HARDWALL)
59 59
60/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
60#define GFP_ATOMIC (__GFP_HIGH) 61#define GFP_ATOMIC (__GFP_HIGH)
61#define GFP_NOIO (__GFP_WAIT) 62#define GFP_NOIO (__GFP_WAIT)
62#define GFP_NOFS (__GFP_WAIT | __GFP_IO) 63#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
@@ -109,6 +110,10 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
109 if (unlikely(order >= MAX_ORDER)) 110 if (unlikely(order >= MAX_ORDER))
110 return NULL; 111 return NULL;
111 112
113 /* Unknown node is current node */
114 if (nid < 0)
115 nid = numa_node_id();
116
112 return __alloc_pages(gfp_mask, order, 117 return __alloc_pages(gfp_mask, order,
113 NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask)); 118 NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
114} 119}
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 71d2b8a723b9..eab537091f2a 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -93,10 +93,6 @@ extern void synchronize_irq(unsigned int irq);
93struct task_struct; 93struct task_struct;
94 94
95#ifndef CONFIG_VIRT_CPU_ACCOUNTING 95#ifndef CONFIG_VIRT_CPU_ACCOUNTING
96static inline void account_user_vtime(struct task_struct *tsk)
97{
98}
99
100static inline void account_system_vtime(struct task_struct *tsk) 96static inline void account_system_vtime(struct task_struct *tsk)
101{ 97{
102} 98}
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
new file mode 100644
index 000000000000..089bfb1fa01a
--- /dev/null
+++ b/include/linux/hrtimer.h
@@ -0,0 +1,139 @@
1/*
2 * include/linux/hrtimer.h
3 *
4 * hrtimers - High-resolution kernel timers
5 *
6 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de>
7 * Copyright(C) 2005, Red Hat, Inc., Ingo Molnar
8 *
9 * data type definitions, declarations, prototypes
10 *
11 * Started by: Thomas Gleixner and Ingo Molnar
12 *
13 * For licencing details see kernel-base/COPYING
14 */
15#ifndef _LINUX_HRTIMER_H
16#define _LINUX_HRTIMER_H
17
18#include <linux/rbtree.h>
19#include <linux/ktime.h>
20#include <linux/init.h>
21#include <linux/list.h>
22#include <linux/wait.h>
23
24/*
25 * Mode arguments of xxx_hrtimer functions:
26 */
27enum hrtimer_mode {
28 HRTIMER_ABS, /* Time value is absolute */
29 HRTIMER_REL, /* Time value is relative to now */
30};
31
32enum hrtimer_restart {
33 HRTIMER_NORESTART,
34 HRTIMER_RESTART,
35};
36
37/*
38 * Timer states:
39 */
40enum hrtimer_state {
41 HRTIMER_INACTIVE, /* Timer is inactive */
42 HRTIMER_EXPIRED, /* Timer is expired */
43 HRTIMER_PENDING, /* Timer is pending */
44};
45
46struct hrtimer_base;
47
48/**
49 * struct hrtimer - the basic hrtimer structure
50 *
51 * @node: red black tree node for time ordered insertion
52 * @expires: the absolute expiry time in the hrtimers internal
53 * representation. The time is related to the clock on
54 * which the timer is based.
55 * @state: state of the timer
56 * @function: timer expiry callback function
57 * @data: argument for the callback function
58 * @base: pointer to the timer base (per cpu and per clock)
59 *
60 * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE()
61 */
62struct hrtimer {
63 struct rb_node node;
64 ktime_t expires;
65 enum hrtimer_state state;
66 int (*function)(void *);
67 void *data;
68 struct hrtimer_base *base;
69};
70
71/**
72 * struct hrtimer_base - the timer base for a specific clock
73 *
74 * @index: clock type index for per_cpu support when moving a timer
75 * to a base on another cpu.
76 * @lock: lock protecting the base and associated timers
77 * @active: red black tree root node for the active timers
78 * @first: pointer to the timer node which expires first
79 * @resolution: the resolution of the clock, in nanoseconds
80 * @get_time: function to retrieve the current time of the clock
81 * @curr_timer: the timer which is executing a callback right now
82 */
83struct hrtimer_base {
84 clockid_t index;
85 spinlock_t lock;
86 struct rb_root active;
87 struct rb_node *first;
88 ktime_t resolution;
89 ktime_t (*get_time)(void);
90 struct hrtimer *curr_timer;
91};
92
93/*
94 * clock_was_set() is a NOP for non- high-resolution systems. The
95 * time-sorted order guarantees that a timer does not expire early and
96 * is expired in the next softirq when the clock was advanced.
97 */
98#define clock_was_set() do { } while (0)
99
100/* Exported timer functions: */
101
102/* Initialize timers: */
103extern void hrtimer_init(struct hrtimer *timer, const clockid_t which_clock);
104extern void hrtimer_rebase(struct hrtimer *timer, const clockid_t which_clock);
105
106
107/* Basic timer operations: */
108extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
109 const enum hrtimer_mode mode);
110extern int hrtimer_cancel(struct hrtimer *timer);
111extern int hrtimer_try_to_cancel(struct hrtimer *timer);
112
113#define hrtimer_restart(timer) hrtimer_start((timer), (timer)->expires, HRTIMER_ABS)
114
115/* Query timers: */
116extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer);
117extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp);
118
119static inline int hrtimer_active(const struct hrtimer *timer)
120{
121 return timer->state == HRTIMER_PENDING;
122}
123
124/* Forward a hrtimer so it expires after now: */
125extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval);
126
127/* Precise sleep: */
128extern long hrtimer_nanosleep(struct timespec *rqtp,
129 struct timespec __user *rmtp,
130 const enum hrtimer_mode mode,
131 const clockid_t clockid);
132
133/* Soft interrupt function to run the hrtimer queues: */
134extern void hrtimer_run_queues(void);
135
136/* Bootup initialization: */
137extern void __init hrtimers_init(void);
138
139#endif
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index fb46f8d56999..474c8f4f5d4f 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -103,6 +103,11 @@
103#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 103#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
104#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ 104#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */
105#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ 105#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
106#define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */
107#define I2C_DRIVERID_WM8739 77 /* wm8739 audio processor */
108#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */
109#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
110#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
106 111
107#define I2C_DRIVERID_I2CDEV 900 112#define I2C_DRIVERID_I2CDEV 900
108#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 113#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 7b6a6a58e465..110b3cfac021 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -18,6 +18,7 @@
18#include <linux/bio.h> 18#include <linux/bio.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include <linux/completion.h>
21#include <asm/byteorder.h> 22#include <asm/byteorder.h>
22#include <asm/system.h> 23#include <asm/system.h>
23#include <asm/io.h> 24#include <asm/io.h>
@@ -638,7 +639,7 @@ typedef struct ide_drive_s {
638 int crc_count; /* crc counter to reduce drive speed */ 639 int crc_count; /* crc counter to reduce drive speed */
639 struct list_head list; 640 struct list_head list;
640 struct device gendev; 641 struct device gendev;
641 struct semaphore gendev_rel_sem; /* to deal with device release() */ 642 struct completion gendev_rel_comp; /* to deal with device release() */
642} ide_drive_t; 643} ide_drive_t;
643 644
644#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) 645#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev)
@@ -794,14 +795,14 @@ typedef struct hwif_s {
794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 795 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
795 796
796 struct device gendev; 797 struct device gendev;
797 struct semaphore gendev_rel_sem; /* To deal with device release() */ 798 struct completion gendev_rel_comp; /* To deal with device release() */
798 799
799 void *hwif_data; /* extra hwif data */ 800 void *hwif_data; /* extra hwif data */
800 801
801 unsigned dma; 802 unsigned dma;
802 803
803 void (*led_act)(void *data, int rw); 804 void (*led_act)(void *data, int rw);
804} ____cacheline_maxaligned_in_smp ide_hwif_t; 805} ____cacheline_internodealigned_in_smp ide_hwif_t;
805 806
806/* 807/*
807 * internal ide interrupt handler type 808 * internal ide interrupt handler type
@@ -982,8 +983,13 @@ typedef struct ide_driver_s {
982 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); 983 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
983 ide_proc_entry_t *proc; 984 ide_proc_entry_t *proc;
984 struct device_driver gen_driver; 985 struct device_driver gen_driver;
986 int (*probe)(ide_drive_t *);
987 void (*remove)(ide_drive_t *);
988 void (*shutdown)(ide_drive_t *);
985} ide_driver_t; 989} ide_driver_t;
986 990
991#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
992
987int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 993int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
988 994
989/* 995/*
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index fe26d431de87..7a92c1ce1457 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -72,6 +72,7 @@
72 * over Ethernet 72 * over Ethernet
73 */ 73 */
74#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 74#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
75#define ETH_P_TIPC 0x88CA /* TIPC */
75 76
76/* 77/*
77 * Non DIX types. Won't clash for 1500 types. 78 * Non DIX types. Won't clash for 1500 types.
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 511999c7eeda..395f0aad9cbf 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -131,17 +131,17 @@ struct frad_conf
131/* these are the fields of an RFC 1490 header */ 131/* these are the fields of an RFC 1490 header */
132struct frhdr 132struct frhdr
133{ 133{
134 unsigned char control __attribute__((packed)); 134 unsigned char control;
135 135
136 /* for IP packets, this can be the NLPID */ 136 /* for IP packets, this can be the NLPID */
137 unsigned char pad __attribute__((packed)); 137 unsigned char pad;
138 138
139 unsigned char NLPID __attribute__((packed)); 139 unsigned char NLPID;
140 unsigned char OUI[3] __attribute__((packed)); 140 unsigned char OUI[3];
141 unsigned short PID __attribute__((packed)); 141 unsigned short PID;
142 142
143#define IP_NLPID pad 143#define IP_NLPID pad
144}; 144} __attribute__((packed));
145 145
146/* see RFC 1490 for the definition of the following */ 146/* see RFC 1490 for the definition of the following */
147#define FRAD_I_UI 0x03 147#define FRAD_I_UI 0x03
diff --git a/include/linux/init.h b/include/linux/init.h
index 59008c3826cf..ff8d8b8632f4 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -241,6 +241,18 @@ void __init parse_early_param(void);
241#define __cpuexitdata __exitdata 241#define __cpuexitdata __exitdata
242#endif 242#endif
243 243
244#ifdef CONFIG_MEMORY_HOTPLUG
245#define __meminit
246#define __meminitdata
247#define __memexit
248#define __memexitdata
249#else
250#define __meminit __init
251#define __meminitdata __initdata
252#define __memexit __exit
253#define __memexitdata __exitdata
254#endif
255
244/* Functions marked as __devexit may be discarded at kernel link time, depending 256/* Functions marked as __devexit may be discarded at kernel link time, depending
245 on config options. Newer versions of binutils detect references from 257 on config options. Newer versions of binutils detect references from
246 retained sections to discarded sections and flag an error. Pointers to 258 retained sections to discarded sections and flag an error. Pointers to
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 41f150a3d2dd..2c08fdc2bdf7 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -79,7 +79,7 @@ static inline void __deprecated save_flags(unsigned long *x)
79{ 79{
80 local_save_flags(*x); 80 local_save_flags(*x);
81} 81}
82#define save_flags(x) save_flags(&x); 82#define save_flags(x) save_flags(&x)
83static inline void __deprecated restore_flags(unsigned long x) 83static inline void __deprecated restore_flags(unsigned long x)
84{ 84{
85 local_irq_restore(x); 85 local_irq_restore(x);
@@ -112,7 +112,7 @@ enum
112 TIMER_SOFTIRQ, 112 TIMER_SOFTIRQ,
113 NET_TX_SOFTIRQ, 113 NET_TX_SOFTIRQ,
114 NET_RX_SOFTIRQ, 114 NET_RX_SOFTIRQ,
115 SCSI_SOFTIRQ, 115 BLOCK_SOFTIRQ,
116 TASKLET_SOFTIRQ 116 TASKLET_SOFTIRQ
117}; 117};
118 118
diff --git a/include/linux/ioc3.h b/include/linux/ioc3.h
new file mode 100644
index 000000000000..e7906a72a4f1
--- /dev/null
+++ b/include/linux/ioc3.h
@@ -0,0 +1,93 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2005 Stanislaw Skowronek <skylark@linux-mips.org>
7 */
8
9#ifndef _LINUX_IOC3_H
10#define _LINUX_IOC3_H
11
12#include <asm/sn/ioc3.h>
13
14#define IOC3_MAX_SUBMODULES 32
15
16#define IOC3_CLASS_NONE 0
17#define IOC3_CLASS_BASE_IP27 1
18#define IOC3_CLASS_BASE_IP30 2
19#define IOC3_CLASS_MENET_123 3
20#define IOC3_CLASS_MENET_4 4
21#define IOC3_CLASS_CADDUO 5
22#define IOC3_CLASS_SERIAL 6
23
24/* One of these per IOC3 */
25struct ioc3_driver_data {
26 struct list_head list;
27 int id; /* IOC3 sequence number */
28 /* PCI mapping */
29 unsigned long pma; /* physical address */
30 struct __iomem ioc3 *vma; /* pointer to registers */
31 struct pci_dev *pdev; /* PCI device */
32 /* IRQ stuff */
33 int dual_irq; /* set if separate IRQs are used */
34 int irq_io, irq_eth; /* IRQ numbers */
35 /* GPIO magic */
36 spinlock_t gpio_lock;
37 unsigned int gpdr_shadow;
38 /* NIC identifiers */
39 char nic_part[32];
40 char nic_serial[16];
41 char nic_mac[6];
42 /* submodule set */
43 int class;
44 void *data[IOC3_MAX_SUBMODULES]; /* for submodule use */
45 int active[IOC3_MAX_SUBMODULES]; /* set if probe succeeds */
46 /* is_ir_lock must be held while
47 * modifying sio_ie values, so
48 * we can be sure that sio_ie is
49 * not changing when we read it
50 * along with sio_ir.
51 */
52 spinlock_t ir_lock; /* SIO_IE[SC] mod lock */
53};
54
55/* One per submodule */
56struct ioc3_submodule {
57 char *name; /* descriptive submodule name */
58 struct module *owner; /* owning kernel module */
59 int ethernet; /* set for ethernet drivers */
60 int (*probe) (struct ioc3_submodule *, struct ioc3_driver_data *);
61 int (*remove) (struct ioc3_submodule *, struct ioc3_driver_data *);
62 int id; /* assigned by IOC3, index for the "data" array */
63 /* IRQ stuff */
64 unsigned int irq_mask; /* IOC3 IRQ mask, leave clear for Ethernet */
65 int reset_mask; /* non-zero if you want the ioc3.c module to reset interrupts */
66 int (*intr) (struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int, struct pt_regs *);
67 /* private submodule data */
68 void *data; /* assigned by submodule */
69};
70
71/**********************************
72 * Functions needed by submodules *
73 **********************************/
74
75#define IOC3_W_IES 0
76#define IOC3_W_IEC 1
77
78/* registers a submodule for all existing and future IOC3 chips */
79extern int ioc3_register_submodule(struct ioc3_submodule *);
80/* unregisters a submodule */
81extern void ioc3_unregister_submodule(struct ioc3_submodule *);
82/* enables IRQs indicated by irq_mask for a specified IOC3 chip */
83extern void ioc3_enable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
84/* ackowledges specified IRQs */
85extern void ioc3_ack(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
86/* disables IRQs indicated by irq_mask for a specified IOC3 chip */
87extern void ioc3_disable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
88/* atomically sets GPCR bits */
89extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int);
90/* general ireg writer */
91extern void ioc3_write_ireg(struct ioc3_driver_data *idd, uint32_t value, int reg);
92
93#endif
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 93bbed5c6cf4..9c8f4c9ed429 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -191,6 +191,10 @@ struct inet6_skb_parm {
191 __u16 srcrt; 191 __u16 srcrt;
192 __u16 dst1; 192 __u16 dst1;
193 __u16 lastopt; 193 __u16 lastopt;
194 __u32 nhoff;
195 __u16 flags;
196
197#define IP6SKB_XFRM_TRANSFORMED 1
194}; 198};
195 199
196#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 200#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index 7a4eacd77cb2..04e10f9f14f8 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -282,43 +282,43 @@ typedef struct setup_parm {
282 282
283typedef struct T30_s { 283typedef struct T30_s {
284 /* session parameters */ 284 /* session parameters */
285 __u8 resolution __attribute__ ((packed)); 285 __u8 resolution;
286 __u8 rate __attribute__ ((packed)); 286 __u8 rate;
287 __u8 width __attribute__ ((packed)); 287 __u8 width;
288 __u8 length __attribute__ ((packed)); 288 __u8 length;
289 __u8 compression __attribute__ ((packed)); 289 __u8 compression;
290 __u8 ecm __attribute__ ((packed)); 290 __u8 ecm;
291 __u8 binary __attribute__ ((packed)); 291 __u8 binary;
292 __u8 scantime __attribute__ ((packed)); 292 __u8 scantime;
293 __u8 id[FAXIDLEN] __attribute__ ((packed)); 293 __u8 id[FAXIDLEN];
294 /* additional parameters */ 294 /* additional parameters */
295 __u8 phase __attribute__ ((packed)); 295 __u8 phase;
296 __u8 direction __attribute__ ((packed)); 296 __u8 direction;
297 __u8 code __attribute__ ((packed)); 297 __u8 code;
298 __u8 badlin __attribute__ ((packed)); 298 __u8 badlin;
299 __u8 badmul __attribute__ ((packed)); 299 __u8 badmul;
300 __u8 bor __attribute__ ((packed)); 300 __u8 bor;
301 __u8 fet __attribute__ ((packed)); 301 __u8 fet;
302 __u8 pollid[FAXIDLEN] __attribute__ ((packed)); 302 __u8 pollid[FAXIDLEN];
303 __u8 cq __attribute__ ((packed)); 303 __u8 cq;
304 __u8 cr __attribute__ ((packed)); 304 __u8 cr;
305 __u8 ctcrty __attribute__ ((packed)); 305 __u8 ctcrty;
306 __u8 minsp __attribute__ ((packed)); 306 __u8 minsp;
307 __u8 phcto __attribute__ ((packed)); 307 __u8 phcto;
308 __u8 rel __attribute__ ((packed)); 308 __u8 rel;
309 __u8 nbc __attribute__ ((packed)); 309 __u8 nbc;
310 /* remote station parameters */ 310 /* remote station parameters */
311 __u8 r_resolution __attribute__ ((packed)); 311 __u8 r_resolution;
312 __u8 r_rate __attribute__ ((packed)); 312 __u8 r_rate;
313 __u8 r_width __attribute__ ((packed)); 313 __u8 r_width;
314 __u8 r_length __attribute__ ((packed)); 314 __u8 r_length;
315 __u8 r_compression __attribute__ ((packed)); 315 __u8 r_compression;
316 __u8 r_ecm __attribute__ ((packed)); 316 __u8 r_ecm;
317 __u8 r_binary __attribute__ ((packed)); 317 __u8 r_binary;
318 __u8 r_scantime __attribute__ ((packed)); 318 __u8 r_scantime;
319 __u8 r_id[FAXIDLEN] __attribute__ ((packed)); 319 __u8 r_id[FAXIDLEN];
320 __u8 r_code __attribute__ ((packed)); 320 __u8 r_code;
321} T30_s; 321} __attribute__((packed)) T30_s;
322 322
323#define ISDN_TTY_FAX_CONN_IN 0 323#define ISDN_TTY_FAX_CONN_IN 0
324#define ISDN_TTY_FAX_CONN_OUT 1 324#define ISDN_TTY_FAX_CONN_OUT 1
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
index 7c6eae7f6ed7..45b3d48f0978 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -4,47 +4,12 @@
4/*#define ISICOM_DEBUG*/ 4/*#define ISICOM_DEBUG*/
5/*#define ISICOM_DEBUG_DTR_RTS*/ 5/*#define ISICOM_DEBUG_DTR_RTS*/
6 6
7
8/*
9 * Firmware Loader definitions ...
10 */
11
12#define __MultiTech ('M'<<8)
13#define MIOCTL_LOAD_FIRMWARE (__MultiTech | 0x01)
14#define MIOCTL_READ_FIRMWARE (__MultiTech | 0x02)
15#define MIOCTL_XFER_CTRL (__MultiTech | 0x03)
16#define MIOCTL_RESET_CARD (__MultiTech | 0x04)
17
18#define DATA_SIZE 16
19
20typedef struct {
21 unsigned short exec_segment;
22 unsigned short exec_addr;
23} exec_record;
24
25typedef struct {
26 int board; /* Board to load */
27 unsigned short addr;
28 unsigned short count;
29} bin_header;
30
31typedef struct {
32 int board; /* Board to load */
33 unsigned short addr;
34 unsigned short count;
35 unsigned short segment;
36 unsigned char bin_data[DATA_SIZE];
37} bin_frame;
38
39#ifdef __KERNEL__ 7#ifdef __KERNEL__
40 8
41#define YES 1 9#define YES 1
42#define NO 0 10#define NO 0
43 11
44#define ISILOAD_MISC_MINOR 155 /* /dev/isctl */ 12/*
45#define ISILOAD_NAME "ISILoad"
46
47/*
48 * ISICOM Driver definitions ... 13 * ISICOM Driver definitions ...
49 * 14 *
50 */ 15 */
@@ -55,8 +20,8 @@ typedef struct {
55 * PCI definitions 20 * PCI definitions
56 */ 21 */
57 22
58 #define DEVID_COUNT 9 23#define DEVID_COUNT 9
59 #define VENDOR_ID 0x10b5 24#define VENDOR_ID 0x10b5
60 25
61/* 26/*
62 * These are now officially allocated numbers 27 * These are now officially allocated numbers
@@ -66,9 +31,9 @@ typedef struct {
66#define ISICOM_CMAJOR 113 /* callout */ 31#define ISICOM_CMAJOR 113 /* callout */
67#define ISICOM_MAGIC (('M' << 8) | 'T') 32#define ISICOM_MAGIC (('M' << 8) | 'T')
68 33
69#define WAKEUP_CHARS 256 /* hard coded for now */ 34#define WAKEUP_CHARS 256 /* hard coded for now */
70#define TX_SIZE 254 35#define TX_SIZE 254
71 36
72#define BOARD_COUNT 4 37#define BOARD_COUNT 4
73#define PORT_COUNT (BOARD_COUNT*16) 38#define PORT_COUNT (BOARD_COUNT*16)
74 39
@@ -98,18 +63,15 @@ typedef struct {
98#define ISICOM_INITIATE_XONXOFF 0x04 63#define ISICOM_INITIATE_XONXOFF 0x04
99#define ISICOM_RESPOND_XONXOFF 0x08 64#define ISICOM_RESPOND_XONXOFF 0x08
100 65
101#define InterruptTheCard(base) (outw(0,(base)+0xc))
102#define ClearInterrupt(base) (inw((base)+0x0a))
103
104#define BOARD(line) (((line) >> 4) & 0x3) 66#define BOARD(line) (((line) >> 4) & 0x3)
105 67
106 /* isi kill queue bitmap */ 68 /* isi kill queue bitmap */
107 69
108#define ISICOM_KILLTX 0x01 70#define ISICOM_KILLTX 0x01
109#define ISICOM_KILLRX 0x02 71#define ISICOM_KILLRX 0x02
110 72
111 /* isi_board status bitmap */ 73 /* isi_board status bitmap */
112 74
113#define FIRMWARE_LOADED 0x0001 75#define FIRMWARE_LOADED 0x0001
114#define BOARD_ACTIVE 0x0002 76#define BOARD_ACTIVE 0x0002
115 77
@@ -123,9 +85,8 @@ typedef struct {
123#define ISI_RTS 0x0200 85#define ISI_RTS 0x0200
124 86
125 87
126#define ISI_TXOK 0x0001 88#define ISI_TXOK 0x0001
127 89
128#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
129 91
130#endif /* ISICOM_H */ 92#endif /* ISICOM_H */
131
diff --git a/include/linux/jffs2_fs_i.h b/include/linux/jffs2_fs_i.h
index ef85ab56302b..ad565bf9dcc1 100644
--- a/include/linux/jffs2_fs_i.h
+++ b/include/linux/jffs2_fs_i.h
@@ -8,11 +8,11 @@
8#include <asm/semaphore.h> 8#include <asm/semaphore.h>
9 9
10struct jffs2_inode_info { 10struct jffs2_inode_info {
11 /* We need an internal semaphore similar to inode->i_sem. 11 /* We need an internal mutex similar to inode->i_mutex.
12 Unfortunately, we can't used the existing one, because 12 Unfortunately, we can't used the existing one, because
13 either the GC would deadlock, or we'd have to release it 13 either the GC would deadlock, or we'd have to release it
14 before letting GC proceed. Or we'd have to put ugliness 14 before letting GC proceed. Or we'd have to put ugliness
15 into the GC code so it didn't attempt to obtain the i_sem 15 into the GC code so it didn't attempt to obtain the i_mutex
16 for the inode(s) which are already locked */ 16 for the inode(s) which are already locked */
17 struct semaphore sem; 17 struct semaphore sem;
18 18
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 6acfdbba734b..99905e180532 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -1,21 +1,12 @@
1#ifndef _LINUX_JIFFIES_H 1#ifndef _LINUX_JIFFIES_H
2#define _LINUX_JIFFIES_H 2#define _LINUX_JIFFIES_H
3 3
4#include <linux/calc64.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/types.h> 6#include <linux/types.h>
6#include <linux/time.h> 7#include <linux/time.h>
7#include <linux/timex.h> 8#include <linux/timex.h>
8#include <asm/param.h> /* for HZ */ 9#include <asm/param.h> /* for HZ */
9#include <asm/div64.h>
10
11#ifndef div_long_long_rem
12#define div_long_long_rem(dividend,divisor,remainder) \
13({ \
14 u64 result = dividend; \
15 *remainder = do_div(result,divisor); \
16 result; \
17})
18#endif
19 10
20/* 11/*
21 * The following defines establish the engineering parameters of the PLL 12 * The following defines establish the engineering parameters of the PLL
@@ -373,8 +364,11 @@ jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
373 * one divide. 364 * one divide.
374 */ 365 */
375 u64 nsec = (u64)jiffies * TICK_NSEC; 366 u64 nsec = (u64)jiffies * TICK_NSEC;
376 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec); 367 long tv_usec;
377 value->tv_usec /= NSEC_PER_USEC; 368
369 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tv_usec);
370 tv_usec /= NSEC_PER_USEC;
371 value->tv_usec = tv_usec;
378} 372}
379 373
380/* 374/*
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 7428198111eb..45f625d7d0b2 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -151,7 +151,7 @@ extern unsigned int keymap_count;
151 151
152static inline void con_schedule_flip(struct tty_struct *t) 152static inline void con_schedule_flip(struct tty_struct *t)
153{ 153{
154 schedule_work(&t->flip.work); 154 schedule_work(&t->buf.work);
155} 155}
156 156
157#endif 157#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index b1e407a4fbda..b49affa0ac5a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -47,6 +47,8 @@ extern int console_printk[];
47#define default_console_loglevel (console_printk[3]) 47#define default_console_loglevel (console_printk[3])
48 48
49struct completion; 49struct completion;
50struct pt_regs;
51struct user;
50 52
51/** 53/**
52 * might_sleep - annotation for functions that can sleep 54 * might_sleep - annotation for functions that can sleep
@@ -123,6 +125,8 @@ extern int __kernel_text_address(unsigned long addr);
123extern int kernel_text_address(unsigned long addr); 125extern int kernel_text_address(unsigned long addr);
124extern int session_of_pgrp(int pgrp); 126extern int session_of_pgrp(int pgrp);
125 127
128extern void dump_thread(struct pt_regs *regs, struct user *dump);
129
126#ifdef CONFIG_PRINTK 130#ifdef CONFIG_PRINTK
127asmlinkage int vprintk(const char *fmt, va_list args) 131asmlinkage int vprintk(const char *fmt, va_list args)
128 __attribute__ ((format (printf, 1, 0))); 132 __attribute__ ((format (printf, 1, 0)));
@@ -181,6 +185,7 @@ extern enum system_states {
181 SYSTEM_HALT, 185 SYSTEM_HALT,
182 SYSTEM_POWER_OFF, 186 SYSTEM_POWER_OFF,
183 SYSTEM_RESTART, 187 SYSTEM_RESTART,
188 SYSTEM_SUSPEND_DISK,
184} system_state; 189} system_state;
185 190
186#define TAINT_PROPRIETARY_MODULE (1<<0) 191#define TAINT_PROPRIETARY_MODULE (1<<0)
@@ -212,6 +217,7 @@ extern void dump_stack(void);
212 ((unsigned char *)&addr)[1], \ 217 ((unsigned char *)&addr)[1], \
213 ((unsigned char *)&addr)[2], \ 218 ((unsigned char *)&addr)[2], \
214 ((unsigned char *)&addr)[3] 219 ((unsigned char *)&addr)[3]
220#define NIPQUAD_FMT "%u.%u.%u.%u"
215 221
216#define NIP6(addr) \ 222#define NIP6(addr) \
217 ntohs((addr).s6_addr16[0]), \ 223 ntohs((addr).s6_addr16[0]), \
@@ -222,6 +228,8 @@ extern void dump_stack(void);
222 ntohs((addr).s6_addr16[5]), \ 228 ntohs((addr).s6_addr16[5]), \
223 ntohs((addr).s6_addr16[6]), \ 229 ntohs((addr).s6_addr16[6]), \
224 ntohs((addr).s6_addr16[7]) 230 ntohs((addr).s6_addr16[7])
231#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
232#define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x"
225 233
226#if defined(__LITTLE_ENDIAN) 234#if defined(__LITTLE_ENDIAN)
227#define HIPQUAD(addr) \ 235#define HIPQUAD(addr) \
@@ -286,6 +294,15 @@ extern void dump_stack(void);
286 1; \ 294 1; \
287}) 295})
288 296
297/*
298 * Check at compile time that 'function' is a certain type, or is a pointer
299 * to that type (needs to use typedef for the function type.)
300 */
301#define typecheck_fn(type,function) \
302({ typeof(type) __tmp = function; \
303 (void)__tmp; \
304})
305
289#endif /* __KERNEL__ */ 306#endif /* __KERNEL__ */
290 307
291#define SI_LOAD_SHIFT 16 308#define SI_LOAD_SHIFT 16
@@ -316,8 +333,6 @@ extern int randomize_va_space;
316#endif 333#endif
317 334
318/* Trap pasters of __FUNCTION__ at compile-time */ 335/* Trap pasters of __FUNCTION__ at compile-time */
319#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
320#define __FUNCTION__ (__func__) 336#define __FUNCTION__ (__func__)
321#endif
322 337
323#endif 338#endif
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index c8468472aec0..a311f58c8a7c 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -41,7 +41,7 @@ typedef unsigned long kimage_entry_t;
41#define IND_DONE 0x4 41#define IND_DONE 0x4
42#define IND_SOURCE 0x8 42#define IND_SOURCE 0x8
43 43
44#define KEXEC_SEGMENT_MAX 8 44#define KEXEC_SEGMENT_MAX 16
45struct kexec_segment { 45struct kexec_segment {
46 void __user *buf; 46 void __user *buf;
47 size_t bufsz; 47 size_t bufsz;
@@ -119,12 +119,15 @@ extern struct kimage *kexec_image;
119#define KEXEC_ARCH_PPC64 (21 << 16) 119#define KEXEC_ARCH_PPC64 (21 << 16)
120#define KEXEC_ARCH_IA_64 (50 << 16) 120#define KEXEC_ARCH_IA_64 (50 << 16)
121#define KEXEC_ARCH_S390 (22 << 16) 121#define KEXEC_ARCH_S390 (22 << 16)
122#define KEXEC_ARCH_SH (42 << 16)
122 123
123#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ 124#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */
124 125
125/* Location of a reserved region to hold the crash kernel. 126/* Location of a reserved region to hold the crash kernel.
126 */ 127 */
127extern struct resource crashk_res; 128extern struct resource crashk_res;
129typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
130extern note_buf_t *crash_notes;
128 131
129#else /* !CONFIG_KEXEC */ 132#else /* !CONFIG_KEXEC */
130struct pt_regs; 133struct pt_regs;
diff --git a/include/linux/key.h b/include/linux/key.h
index 4d189e51bc6c..cbf464ad9589 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -177,6 +177,8 @@ struct key {
177/* 177/*
178 * kernel managed key type definition 178 * kernel managed key type definition
179 */ 179 */
180typedef int (*request_key_actor_t)(struct key *key, struct key *authkey, const char *op);
181
180struct key_type { 182struct key_type {
181 /* name of the type */ 183 /* name of the type */
182 const char *name; 184 const char *name;
@@ -218,6 +220,16 @@ struct key_type {
218 */ 220 */
219 long (*read)(const struct key *key, char __user *buffer, size_t buflen); 221 long (*read)(const struct key *key, char __user *buffer, size_t buflen);
220 222
223 /* handle request_key() for this type instead of invoking
224 * /sbin/request-key (optional)
225 * - key is the key to instantiate
226 * - authkey is the authority to assume when instantiating this key
227 * - op is the operation to be done, usually "create"
228 * - the call must not return until the instantiation process has run
229 * its course
230 */
231 request_key_actor_t request_key;
232
221 /* internal fields */ 233 /* internal fields */
222 struct list_head link; /* link in types list */ 234 struct list_head link; /* link in types list */
223}; 235};
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 8d7c59a29e09..3365945640c9 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -19,6 +19,7 @@
19#define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */ 19#define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */
20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ 20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */
21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ 21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */
22#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */
22 23
23/* request-key default keyrings */ 24/* request-key default keyrings */
24#define KEY_REQKEY_DEFL_NO_CHANGE -1 25#define KEY_REQKEY_DEFL_NO_CHANGE -1
@@ -46,5 +47,7 @@
46#define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ 47#define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */
47#define KEYCTL_NEGATE 13 /* negate a partially constructed key */ 48#define KEYCTL_NEGATE 13 /* negate a partially constructed key */
48#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ 49#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */
50#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */
51#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
49 52
50#endif /* _LINUX_KEYCTL_H */ 53#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index c03f2dc933de..669756bc20a2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -68,6 +68,9 @@ struct kprobe {
68 /* list of kprobes for multi-handler support */ 68 /* list of kprobes for multi-handler support */
69 struct list_head list; 69 struct list_head list;
70 70
71 /* Indicates that the corresponding module has been ref counted */
72 unsigned int mod_refcounted;
73
71 /*count the number of times this probe was temporarily disarmed */ 74 /*count the number of times this probe was temporarily disarmed */
72 unsigned long nmissed; 75 unsigned long nmissed;
73 76
@@ -149,11 +152,10 @@ struct kretprobe_instance {
149}; 152};
150 153
151extern spinlock_t kretprobe_lock; 154extern spinlock_t kretprobe_lock;
155extern struct semaphore kprobe_mutex;
152extern int arch_prepare_kprobe(struct kprobe *p); 156extern int arch_prepare_kprobe(struct kprobe *p);
153extern void arch_copy_kprobe(struct kprobe *p);
154extern void arch_arm_kprobe(struct kprobe *p); 157extern void arch_arm_kprobe(struct kprobe *p);
155extern void arch_disarm_kprobe(struct kprobe *p); 158extern void arch_disarm_kprobe(struct kprobe *p);
156extern void arch_remove_kprobe(struct kprobe *p);
157extern int arch_init_kprobes(void); 159extern int arch_init_kprobes(void);
158extern void show_registers(struct pt_regs *regs); 160extern void show_registers(struct pt_regs *regs);
159extern kprobe_opcode_t *get_insn_slot(void); 161extern kprobe_opcode_t *get_insn_slot(void);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
new file mode 100644
index 000000000000..1bd6552cc341
--- /dev/null
+++ b/include/linux/ktime.h
@@ -0,0 +1,284 @@
1/*
2 * include/linux/ktime.h
3 *
4 * ktime_t - nanosecond-resolution time format.
5 *
6 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de>
7 * Copyright(C) 2005, Red Hat, Inc., Ingo Molnar
8 *
9 * data type definitions, declarations, prototypes and macros.
10 *
11 * Started by: Thomas Gleixner and Ingo Molnar
12 *
13 * For licencing details see kernel-base/COPYING
14 */
15#ifndef _LINUX_KTIME_H
16#define _LINUX_KTIME_H
17
18#include <linux/time.h>
19#include <linux/jiffies.h>
20
21/*
22 * ktime_t:
23 *
24 * On 64-bit CPUs a single 64-bit variable is used to store the hrtimers
25 * internal representation of time values in scalar nanoseconds. The
26 * design plays out best on 64-bit CPUs, where most conversions are
27 * NOPs and most arithmetic ktime_t operations are plain arithmetic
28 * operations.
29 *
30 * On 32-bit CPUs an optimized representation of the timespec structure
31 * is used to avoid expensive conversions from and to timespecs. The
32 * endian-aware order of the tv struct members is choosen to allow
33 * mathematical operations on the tv64 member of the union too, which
34 * for certain operations produces better code.
35 *
36 * For architectures with efficient support for 64/32-bit conversions the
37 * plain scalar nanosecond based representation can be selected by the
38 * config switch CONFIG_KTIME_SCALAR.
39 */
40typedef union {
41 s64 tv64;
42#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
43 struct {
44# ifdef __BIG_ENDIAN
45 s32 sec, nsec;
46# else
47 s32 nsec, sec;
48# endif
49 } tv;
50#endif
51} ktime_t;
52
53#define KTIME_MAX (~((u64)1 << 63))
54
55/*
56 * ktime_t definitions when using the 64-bit scalar representation:
57 */
58
59#if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)
60
61/* Define a ktime_t variable and initialize it to zero: */
62#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
63
64/**
65 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
66 *
67 * @secs: seconds to set
68 * @nsecs: nanoseconds to set
69 *
70 * Return the ktime_t representation of the value
71 */
72static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
73{
74 return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs };
75}
76
77/* Subtract two ktime_t variables. rem = lhs -rhs: */
78#define ktime_sub(lhs, rhs) \
79 ({ (ktime_t){ .tv64 = (lhs).tv64 - (rhs).tv64 }; })
80
81/* Add two ktime_t variables. res = lhs + rhs: */
82#define ktime_add(lhs, rhs) \
83 ({ (ktime_t){ .tv64 = (lhs).tv64 + (rhs).tv64 }; })
84
85/*
86 * Add a ktime_t variable and a scalar nanosecond value.
87 * res = kt + nsval:
88 */
89#define ktime_add_ns(kt, nsval) \
90 ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
91
92/* convert a timespec to ktime_t format: */
93#define timespec_to_ktime(ts) ktime_set((ts).tv_sec, (ts).tv_nsec)
94
95/* convert a timeval to ktime_t format: */
96#define timeval_to_ktime(tv) ktime_set((tv).tv_sec, (tv).tv_usec * 1000)
97
98/* Map the ktime_t to timespec conversion to ns_to_timespec function */
99#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64)
100
101/* Map the ktime_t to timeval conversion to ns_to_timeval function */
102#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
103
104/* Map the ktime_t to clock_t conversion to the inline in jiffies.h: */
105#define ktime_to_clock_t(kt) nsec_to_clock_t((kt).tv64)
106
107/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
108#define ktime_to_ns(kt) ((kt).tv64)
109
110#else
111
112/*
113 * Helper macros/inlines to get the ktime_t math right in the timespec
114 * representation. The macros are sometimes ugly - their actual use is
115 * pretty okay-ish, given the circumstances. We do all this for
116 * performance reasons. The pure scalar nsec_t based code was nice and
117 * simple, but created too many 64-bit / 32-bit conversions and divisions.
118 *
119 * Be especially aware that negative values are represented in a way
120 * that the tv.sec field is negative and the tv.nsec field is greater
121 * or equal to zero but less than nanoseconds per second. This is the
122 * same representation which is used by timespecs.
123 *
124 * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC
125 */
126
127/* Define a ktime_t variable and initialize it to zero: */
128#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
129
130/* Set a ktime_t variable to a value in sec/nsec representation: */
131static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
132{
133 return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
134}
135
136/**
137 * ktime_sub - subtract two ktime_t variables
138 *
139 * @lhs: minuend
140 * @rhs: subtrahend
141 *
142 * Returns the remainder of the substraction
143 */
144static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
145{
146 ktime_t res;
147
148 res.tv64 = lhs.tv64 - rhs.tv64;
149 if (res.tv.nsec < 0)
150 res.tv.nsec += NSEC_PER_SEC;
151
152 return res;
153}
154
155/**
156 * ktime_add - add two ktime_t variables
157 *
158 * @add1: addend1
159 * @add2: addend2
160 *
161 * Returns the sum of addend1 and addend2
162 */
163static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
164{
165 ktime_t res;
166
167 res.tv64 = add1.tv64 + add2.tv64;
168 /*
169 * performance trick: the (u32) -NSEC gives 0x00000000Fxxxxxxx
170 * so we subtract NSEC_PER_SEC and add 1 to the upper 32 bit.
171 *
172 * it's equivalent to:
173 * tv.nsec -= NSEC_PER_SEC
174 * tv.sec ++;
175 */
176 if (res.tv.nsec >= NSEC_PER_SEC)
177 res.tv64 += (u32)-NSEC_PER_SEC;
178
179 return res;
180}
181
182/**
183 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable
184 *
185 * @kt: addend
186 * @nsec: the scalar nsec value to add
187 *
188 * Returns the sum of kt and nsec in ktime_t format
189 */
190extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
191
192/**
193 * timespec_to_ktime - convert a timespec to ktime_t format
194 *
195 * @ts: the timespec variable to convert
196 *
197 * Returns a ktime_t variable with the converted timespec value
198 */
199static inline ktime_t timespec_to_ktime(const struct timespec ts)
200{
201 return (ktime_t) { .tv = { .sec = (s32)ts.tv_sec,
202 .nsec = (s32)ts.tv_nsec } };
203}
204
205/**
206 * timeval_to_ktime - convert a timeval to ktime_t format
207 *
208 * @tv: the timeval variable to convert
209 *
210 * Returns a ktime_t variable with the converted timeval value
211 */
212static inline ktime_t timeval_to_ktime(const struct timeval tv)
213{
214 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
215 .nsec = (s32)tv.tv_usec * 1000 } };
216}
217
218/**
219 * ktime_to_timespec - convert a ktime_t variable to timespec format
220 *
221 * @kt: the ktime_t variable to convert
222 *
223 * Returns the timespec representation of the ktime value
224 */
225static inline struct timespec ktime_to_timespec(const ktime_t kt)
226{
227 return (struct timespec) { .tv_sec = (time_t) kt.tv.sec,
228 .tv_nsec = (long) kt.tv.nsec };
229}
230
231/**
232 * ktime_to_timeval - convert a ktime_t variable to timeval format
233 *
234 * @kt: the ktime_t variable to convert
235 *
236 * Returns the timeval representation of the ktime value
237 */
238static inline struct timeval ktime_to_timeval(const ktime_t kt)
239{
240 return (struct timeval) {
241 .tv_sec = (time_t) kt.tv.sec,
242 .tv_usec = (suseconds_t) (kt.tv.nsec / NSEC_PER_USEC) };
243}
244
245/**
246 * ktime_to_clock_t - convert a ktime_t variable to clock_t format
247 * @kt: the ktime_t variable to convert
248 *
249 * Returns a clock_t variable with the converted value
250 */
251static inline clock_t ktime_to_clock_t(const ktime_t kt)
252{
253 return nsec_to_clock_t( (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec);
254}
255
256/**
257 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
258 * @kt: the ktime_t variable to convert
259 *
260 * Returns the scalar nanoseconds representation of kt
261 */
262static inline u64 ktime_to_ns(const ktime_t kt)
263{
264 return (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
265}
266
267#endif
268
269/*
270 * The resolution of the clocks. The resolution value is returned in
271 * the clock_getres() system call to give application programmers an
272 * idea of the (in)accuracy of timers. Timer values are rounded up to
273 * this resolution values.
274 */
275#define KTIME_REALTIME_RES (ktime_t){ .tv64 = TICK_NSEC }
276#define KTIME_MONOTONIC_RES (ktime_t){ .tv64 = TICK_NSEC }
277
278/* Get the monotonic time in timespec format: */
279extern void ktime_get_ts(struct timespec *ts);
280
281/* Get the real (wall-) time in timespec format: */
282#define ktime_get_real_ts(ts) getnstimeofday(ts)
283
284#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index a43c95f8f968..9e5db2949c58 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -126,16 +126,19 @@ enum {
126 126
127 ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */ 127 ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */
128 128
129 ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */
130 ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */
131
129 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 132 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
130 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 133 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
131 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ 134 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */
132 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, 135 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
133 136
134 /* various lengths of time */ 137 /* various lengths of time */
135 ATA_TMOUT_EDD = 5 * HZ, /* hueristic */ 138 ATA_TMOUT_EDD = 5 * HZ, /* heuristic */
136 ATA_TMOUT_PIO = 30 * HZ, 139 ATA_TMOUT_PIO = 30 * HZ,
137 ATA_TMOUT_BOOT = 30 * HZ, /* hueristic */ 140 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
138 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */ 141 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
139 ATA_TMOUT_CDB = 30 * HZ, 142 ATA_TMOUT_CDB = 30 * HZ,
140 ATA_TMOUT_CDB_QUICK = 5 * HZ, 143 ATA_TMOUT_CDB_QUICK = 5 * HZ,
141 ATA_TMOUT_INTERNAL = 30 * HZ, 144 ATA_TMOUT_INTERNAL = 30 * HZ,
@@ -499,6 +502,8 @@ extern int ata_scsi_slave_config(struct scsi_device *sdev);
499/* 502/*
500 * Timing helpers 503 * Timing helpers
501 */ 504 */
505
506extern unsigned int ata_pio_need_iordy(const struct ata_device *);
502extern int ata_timing_compute(struct ata_device *, unsigned short, 507extern int ata_timing_compute(struct ata_device *, unsigned short,
503 struct ata_timing *, int, int); 508 struct ata_timing *, int, int);
504extern void ata_timing_merge(const struct ata_timing *, 509extern void ata_timing_merge(const struct ata_timing *,
diff --git a/include/linux/list.h b/include/linux/list.h
index 8e3388284530..945daa1f13dd 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -436,6 +436,20 @@ static inline void list_splice_init(struct list_head *list,
436 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 436 pos = n, n = list_entry(n->member.next, typeof(*n), member))
437 437
438/** 438/**
439 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against
440 * removal of list entry
441 * @pos: the type * to use as a loop counter.
442 * @n: another type * to use as temporary storage
443 * @head: the head for your list.
444 * @member: the name of the list_struct within the struct.
445 */
446#define list_for_each_entry_safe_reverse(pos, n, head, member) \
447 for (pos = list_entry((head)->prev, typeof(*pos), member), \
448 n = list_entry(pos->member.prev, typeof(*pos), member); \
449 &pos->member != (head); \
450 pos = n, n = list_entry(n->member.prev, typeof(*n), member))
451
452/**
439 * list_for_each_rcu - iterate over an rcu-protected list 453 * list_for_each_rcu - iterate over an rcu-protected list
440 * @pos: the &struct list_head to use as a loop counter. 454 * @pos: the &struct list_head to use as a loop counter.
441 * @head: the head for your list. 455 * @head: the head for your list.
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 40f63c9879d2..f96506782ebe 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -58,9 +58,9 @@ struct loop_device {
58 struct bio *lo_bio; 58 struct bio *lo_bio;
59 struct bio *lo_biotail; 59 struct bio *lo_biotail;
60 int lo_state; 60 int lo_state;
61 struct semaphore lo_sem; 61 struct completion lo_done;
62 struct completion lo_bh_done;
62 struct semaphore lo_ctl_mutex; 63 struct semaphore lo_ctl_mutex;
63 struct semaphore lo_bh_mutex;
64 int lo_pending; 64 int lo_pending;
65 65
66 request_queue_t *lo_queue; 66 request_queue_t *lo_queue;
diff --git a/include/linux/memory.h b/include/linux/memory.h
index dc4081b6f161..e251dc43d0f5 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -70,21 +70,15 @@ static inline void unregister_memory_notifier(struct notifier_block *nb)
70{ 70{
71} 71}
72#else 72#else
73extern int register_memory(struct memory_block *, struct mem_section *section, struct node *);
74extern int register_new_memory(struct mem_section *); 73extern int register_new_memory(struct mem_section *);
75extern int unregister_memory_section(struct mem_section *); 74extern int unregister_memory_section(struct mem_section *);
76extern int memory_dev_init(void); 75extern int memory_dev_init(void);
77extern int register_memory_notifier(struct notifier_block *nb); 76extern int remove_memory_block(unsigned long, struct mem_section *, int);
78extern void unregister_memory_notifier(struct notifier_block *nb);
79 77
80#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 78#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
81 79
82extern int invalidate_phys_mapping(unsigned long, unsigned long);
83struct notifier_block; 80struct notifier_block;
84 81
85extern int register_memory_notifier(struct notifier_block *nb);
86extern void unregister_memory_notifier(struct notifier_block *nb);
87
88#endif /* CONFIG_MEMORY_HOTPLUG */ 82#endif /* CONFIG_MEMORY_HOTPLUG */
89 83
90#define hotplug_memory_notifier(fn, pri) { \ 84#define hotplug_memory_notifier(fn, pri) { \
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index ed00b278cb93..bbd2221923c3 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -22,6 +22,9 @@
22 22
23/* Flags for mbind */ 23/* Flags for mbind */
24#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ 24#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */
25#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */
26#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
27#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */
25 28
26#ifdef __KERNEL__ 29#ifdef __KERNEL__
27 30
@@ -65,6 +68,7 @@ struct mempolicy {
65 nodemask_t nodes; /* interleave */ 68 nodemask_t nodes; /* interleave */
66 /* undefined for default */ 69 /* undefined for default */
67 } v; 70 } v;
71 nodemask_t cpuset_mems_allowed; /* mempolicy relative to these nodes */
68}; 72};
69 73
70/* 74/*
@@ -128,12 +132,8 @@ struct shared_policy {
128 spinlock_t lock; 132 spinlock_t lock;
129}; 133};
130 134
131static inline void mpol_shared_policy_init(struct shared_policy *info) 135void mpol_shared_policy_init(struct shared_policy *info, int policy,
132{ 136 nodemask_t *nodes);
133 info->root = RB_ROOT;
134 spin_lock_init(&info->lock);
135}
136
137int mpol_set_shared_policy(struct shared_policy *info, 137int mpol_set_shared_policy(struct shared_policy *info,
138 struct vm_area_struct *vma, 138 struct vm_area_struct *vma,
139 struct mempolicy *new); 139 struct mempolicy *new);
@@ -141,15 +141,25 @@ void mpol_free_shared_policy(struct shared_policy *p);
141struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, 141struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
142 unsigned long idx); 142 unsigned long idx);
143 143
144struct mempolicy *get_vma_policy(struct task_struct *task,
145 struct vm_area_struct *vma, unsigned long addr);
146
147extern void numa_default_policy(void); 144extern void numa_default_policy(void);
148extern void numa_policy_init(void); 145extern void numa_policy_init(void);
149extern void numa_policy_rebind(const nodemask_t *old, const nodemask_t *new); 146extern void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *new);
147extern void mpol_rebind_task(struct task_struct *tsk,
148 const nodemask_t *new);
149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x))
151
152#ifdef CONFIG_CPUSET
153#define current_cpuset_is_being_rebound() \
154 (cpuset_being_rebound == current->cpuset)
155#else
156#define current_cpuset_is_being_rebound() 0
157#endif
158
150extern struct mempolicy default_policy; 159extern struct mempolicy default_policy;
151extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 160extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
152 unsigned long addr); 161 unsigned long addr);
162extern unsigned slab_node(struct mempolicy *policy);
153 163
154extern int policy_zone; 164extern int policy_zone;
155 165
@@ -159,6 +169,11 @@ static inline void check_highest_zone(int k)
159 policy_zone = k; 169 policy_zone = k;
160} 170}
161 171
172int do_migrate_pages(struct mm_struct *mm,
173 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags);
174
175extern void *cpuset_being_rebound; /* Trigger mpol_copy vma rebind */
176
162#else 177#else
163 178
164struct mempolicy {}; 179struct mempolicy {};
@@ -193,7 +208,8 @@ static inline int mpol_set_shared_policy(struct shared_policy *info,
193 return -EINVAL; 208 return -EINVAL;
194} 209}
195 210
196static inline void mpol_shared_policy_init(struct shared_policy *info) 211static inline void mpol_shared_policy_init(struct shared_policy *info,
212 int policy, nodemask_t *nodes)
197{ 213{
198} 214}
199 215
@@ -218,17 +234,35 @@ static inline void numa_default_policy(void)
218{ 234{
219} 235}
220 236
221static inline void numa_policy_rebind(const nodemask_t *old, 237static inline void mpol_rebind_policy(struct mempolicy *pol,
238 const nodemask_t *new)
239{
240}
241
242static inline void mpol_rebind_task(struct task_struct *tsk,
222 const nodemask_t *new) 243 const nodemask_t *new)
223{ 244{
224} 245}
225 246
247static inline void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
248{
249}
250
251#define set_cpuset_being_rebound(x) do {} while (0)
252
226static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 253static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
227 unsigned long addr) 254 unsigned long addr)
228{ 255{
229 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER); 256 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER);
230} 257}
231 258
259static inline int do_migrate_pages(struct mm_struct *mm,
260 const nodemask_t *from_nodes,
261 const nodemask_t *to_nodes, int flags)
262{
263 return 0;
264}
265
232static inline void check_highest_zone(int k) 266static inline void check_highest_zone(int k)
233{ 267{
234} 268}
diff --git a/include/linux/mm.h b/include/linux/mm.h
index bc01fff3aa01..85854b867463 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/errno.h> 5#include <linux/errno.h>
6#include <linux/capability.h>
6 7
7#ifdef __KERNEL__ 8#ifdef __KERNEL__
8 9
@@ -13,6 +14,7 @@
13#include <linux/rbtree.h> 14#include <linux/rbtree.h>
14#include <linux/prio_tree.h> 15#include <linux/prio_tree.h>
15#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/mutex.h>
16 18
17struct mempolicy; 19struct mempolicy;
18struct anon_vma; 20struct anon_vma;
@@ -223,24 +225,27 @@ struct page {
223 * & limit reverse map searches. 225 * & limit reverse map searches.
224 */ 226 */
225 union { 227 union {
226 unsigned long private; /* Mapping-private opaque data: 228 struct {
227 * usually used for buffer_heads 229 unsigned long private; /* Mapping-private opaque data:
228 * if PagePrivate set; used for 230 * usually used for buffer_heads
229 * swp_entry_t if PageSwapCache 231 * if PagePrivate set; used for
230 * When page is free, this indicates 232 * swp_entry_t if PageSwapCache.
231 * order in the buddy system. 233 * When page is free, this
232 */ 234 * indicates order in the buddy
235 * system.
236 */
237 struct address_space *mapping; /* If low bit clear, points to
238 * inode address_space, or NULL.
239 * If page mapped as anonymous
240 * memory, low bit is set, and
241 * it points to anon_vma object:
242 * see PAGE_MAPPING_ANON below.
243 */
244 };
233#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 245#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
234 spinlock_t ptl; 246 spinlock_t ptl;
235#endif 247#endif
236 } u; 248 };
237 struct address_space *mapping; /* If low bit clear, points to
238 * inode address_space, or NULL.
239 * If page mapped as anonymous
240 * memory, low bit is set, and
241 * it points to anon_vma object:
242 * see PAGE_MAPPING_ANON below.
243 */
244 pgoff_t index; /* Our offset within mapping. */ 249 pgoff_t index; /* Our offset within mapping. */
245 struct list_head lru; /* Pageout list, eg. active_list 250 struct list_head lru; /* Pageout list, eg. active_list
246 * protected by zone->lru_lock ! 251 * protected by zone->lru_lock !
@@ -261,8 +266,8 @@ struct page {
261#endif /* WANT_PAGE_VIRTUAL */ 266#endif /* WANT_PAGE_VIRTUAL */
262}; 267};
263 268
264#define page_private(page) ((page)->u.private) 269#define page_private(page) ((page)->private)
265#define set_page_private(page, v) ((page)->u.private = (v)) 270#define set_page_private(page, v) ((page)->private = (v))
266 271
267/* 272/*
268 * FIXME: take this include out, include page-flags.h in 273 * FIXME: take this include out, include page-flags.h in
@@ -308,7 +313,7 @@ struct page {
308 */ 313 */
309#define get_page_testone(p) atomic_inc_and_test(&(p)->_count) 314#define get_page_testone(p) atomic_inc_and_test(&(p)->_count)
310 315
311#define set_page_count(p,v) atomic_set(&(p)->_count, v - 1) 316#define set_page_count(p,v) atomic_set(&(p)->_count, (v) - 1)
312#define __put_page(p) atomic_dec(&(p)->_count) 317#define __put_page(p) atomic_dec(&(p)->_count)
313 318
314extern void FASTCALL(__page_cache_release(struct page *)); 319extern void FASTCALL(__page_cache_release(struct page *));
@@ -507,7 +512,7 @@ static inline void set_page_links(struct page *page, unsigned long zone,
507extern struct page *mem_map; 512extern struct page *mem_map;
508#endif 513#endif
509 514
510static inline void *lowmem_page_address(struct page *page) 515static __always_inline void *lowmem_page_address(struct page *page)
511{ 516{
512 return __va(page_to_pfn(page) << PAGE_SHIFT); 517 return __va(page_to_pfn(page) << PAGE_SHIFT);
513} 518}
@@ -815,7 +820,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
815 * overflow into the next struct page (as it might with DEBUG_SPINLOCK). 820 * overflow into the next struct page (as it might with DEBUG_SPINLOCK).
816 * When freeing, reset page->mapping so free_pages_check won't complain. 821 * When freeing, reset page->mapping so free_pages_check won't complain.
817 */ 822 */
818#define __pte_lockptr(page) &((page)->u.ptl) 823#define __pte_lockptr(page) &((page)->ptl)
819#define pte_lock_init(_page) do { \ 824#define pte_lock_init(_page) do { \
820 spin_lock_init(__pte_lockptr(_page)); \ 825 spin_lock_init(__pte_lockptr(_page)); \
821} while (0) 826} while (0)
@@ -1021,6 +1026,9 @@ static inline void vm_stat_account(struct mm_struct *mm,
1021static inline void 1026static inline void
1022kernel_map_pages(struct page *page, int numpages, int enable) 1027kernel_map_pages(struct page *page, int numpages, int enable)
1023{ 1028{
1029 if (!PageHighMem(page) && !enable)
1030 mutex_debug_check_no_locks_freed(page_address(page),
1031 numpages * PAGE_SIZE);
1024} 1032}
1025#endif 1033#endif
1026 1034
@@ -1036,5 +1044,12 @@ int in_gate_area_no_task(unsigned long addr);
1036/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ 1044/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
1037#define OOM_DISABLE -17 1045#define OOM_DISABLE -17
1038 1046
1047int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1048 void __user *, size_t *, loff_t *);
1049int shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1050 unsigned long lru_pages);
1051void drop_pagecache(void);
1052void drop_slab(void);
1053
1039#endif /* __KERNEL__ */ 1054#endif /* __KERNEL__ */
1040#endif /* _LINUX_MM_H */ 1055#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 47762ca695a5..8ac854f7f190 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -38,3 +38,4 @@ del_page_from_lru(struct zone *zone, struct page *page)
38 zone->nr_inactive--; 38 zone->nr_inactive--;
39 } 39 }
40} 40}
41
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 18fc77f682de..30dd978c1ec8 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -30,7 +30,12 @@ struct mmc_csd {
30 unsigned int tacc_ns; 30 unsigned int tacc_ns;
31 unsigned int max_dtr; 31 unsigned int max_dtr;
32 unsigned int read_blkbits; 32 unsigned int read_blkbits;
33 unsigned int write_blkbits;
33 unsigned int capacity; 34 unsigned int capacity;
35 unsigned int read_partial:1,
36 read_misalign:1,
37 write_partial:1,
38 write_misalign:1;
34}; 39};
35 40
36struct sd_scr { 41struct sd_scr {
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index aef6042f8f0b..ccd3e13de1e8 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -27,14 +27,15 @@ struct mmc_command {
27#define MMC_RSP_MASK (3 << 0) 27#define MMC_RSP_MASK (3 << 0)
28#define MMC_RSP_CRC (1 << 3) /* expect valid crc */ 28#define MMC_RSP_CRC (1 << 3) /* expect valid crc */
29#define MMC_RSP_BUSY (1 << 4) /* card may send busy */ 29#define MMC_RSP_BUSY (1 << 4) /* card may send busy */
30#define MMC_RSP_OPCODE (1 << 5) /* response contains opcode */
30 31
31/* 32/*
32 * These are the response types, and correspond to valid bit 33 * These are the response types, and correspond to valid bit
33 * patterns of the above flags. One additional valid pattern 34 * patterns of the above flags. One additional valid pattern
34 * is all zeros, which means we don't expect a response. 35 * is all zeros, which means we don't expect a response.
35 */ 36 */
36#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC) 37#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_OPCODE)
37#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_BUSY) 38#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
38#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC) 39#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC)
39#define MMC_RSP_R3 (MMC_RSP_SHORT) 40#define MMC_RSP_R3 (MMC_RSP_SHORT)
40#define MMC_RSP_R6 (MMC_RSP_SHORT|MMC_RSP_CRC) 41#define MMC_RSP_R6 (MMC_RSP_SHORT|MMC_RSP_CRC)
@@ -64,6 +65,7 @@ struct mmc_data {
64#define MMC_DATA_WRITE (1 << 8) 65#define MMC_DATA_WRITE (1 << 8)
65#define MMC_DATA_READ (1 << 9) 66#define MMC_DATA_READ (1 << 9)
66#define MMC_DATA_STREAM (1 << 10) 67#define MMC_DATA_STREAM (1 << 10)
68#define MMC_DATA_MULTI (1 << 11)
67 69
68 unsigned int bytes_xfered; 70 unsigned int bytes_xfered;
69 71
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index c34f4a2c62f8..93a849f742db 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -38,7 +38,7 @@ struct pglist_data;
38#if defined(CONFIG_SMP) 38#if defined(CONFIG_SMP)
39struct zone_padding { 39struct zone_padding {
40 char x[0]; 40 char x[0];
41} ____cacheline_maxaligned_in_smp; 41} ____cacheline_internodealigned_in_smp;
42#define ZONE_PADDING(name) struct zone_padding name; 42#define ZONE_PADDING(name) struct zone_padding name;
43#else 43#else
44#define ZONE_PADDING(name) 44#define ZONE_PADDING(name)
@@ -98,7 +98,7 @@ struct per_cpu_pageset {
98 98
99/* 99/*
100 * On machines where it is needed (eg PCs) we divide physical memory 100 * On machines where it is needed (eg PCs) we divide physical memory
101 * into multiple physical zones. On a PC we have 4 zones: 101 * into multiple physical zones. On a 32bit PC we have 4 zones:
102 * 102 *
103 * ZONE_DMA < 16 MB ISA DMA capable memory 103 * ZONE_DMA < 16 MB ISA DMA capable memory
104 * ZONE_DMA32 0 MB Empty 104 * ZONE_DMA32 0 MB Empty
@@ -149,15 +149,17 @@ struct zone {
149 unsigned long pages_scanned; /* since last reclaim */ 149 unsigned long pages_scanned; /* since last reclaim */
150 int all_unreclaimable; /* All pages pinned */ 150 int all_unreclaimable; /* All pages pinned */
151 151
152 /*
153 * Does the allocator try to reclaim pages from the zone as soon
154 * as it fails a watermark_ok() in __alloc_pages?
155 */
156 int reclaim_pages;
157 /* A count of how many reclaimers are scanning this zone */ 152 /* A count of how many reclaimers are scanning this zone */
158 atomic_t reclaim_in_progress; 153 atomic_t reclaim_in_progress;
159 154
160 /* 155 /*
156 * timestamp (in jiffies) of the last zone reclaim that did not
157 * result in freeing of pages. This is used to avoid repeated scans
158 * if all memory in the zone is in use.
159 */
160 unsigned long last_unsuccessful_zone_reclaim;
161
162 /*
161 * prev_priority holds the scanning priority for this zone. It is 163 * prev_priority holds the scanning priority for this zone. It is
162 * defined as the scanning priority at which we achieved our reclaim 164 * defined as the scanning priority at which we achieved our reclaim
163 * target at the previous try_to_free_pages() or balance_pgdat() 165 * target at the previous try_to_free_pages() or balance_pgdat()
@@ -233,7 +235,7 @@ struct zone {
233 * rarely used fields: 235 * rarely used fields:
234 */ 236 */
235 char *name; 237 char *name;
236} ____cacheline_maxaligned_in_smp; 238} ____cacheline_internodealigned_in_smp;
237 239
238 240
239/* 241/*
@@ -437,6 +439,8 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *,
437extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1]; 439extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
438int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, 440int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
439 void __user *, size_t *, loff_t *); 441 void __user *, size_t *, loff_t *);
442int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *,
443 void __user *, size_t *, loff_t *);
440 444
441#include <linux/topology.h> 445#include <linux/topology.h>
442/* Returns the number of the current Node. */ 446/* Returns the number of the current Node. */
diff --git a/include/linux/mount.h b/include/linux/mount.h
index dd4e83eba933..b7472ae91fa4 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -20,9 +20,12 @@
20#define MNT_NOSUID 0x01 20#define MNT_NOSUID 0x01
21#define MNT_NODEV 0x02 21#define MNT_NODEV 0x02
22#define MNT_NOEXEC 0x04 22#define MNT_NOEXEC 0x04
23#define MNT_SHARED 0x10 /* if the vfsmount is a shared mount */ 23#define MNT_NOATIME 0x08
24#define MNT_UNBINDABLE 0x20 /* if the vfsmount is a unbindable mount */ 24#define MNT_NODIRATIME 0x10
25#define MNT_PNODE_MASK 0x30 /* propogation flag mask */ 25
26#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
27#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
28#define MNT_PNODE_MASK 0x3000 /* propogation flag mask */
26 29
27struct vfsmount { 30struct vfsmount {
28 struct list_head mnt_hash; 31 struct list_head mnt_hash;
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 941da5c016a0..e933e2a355ad 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -329,7 +329,8 @@ static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len)
329extern void fat_cache_inval_inode(struct inode *inode); 329extern void fat_cache_inval_inode(struct inode *inode);
330extern int fat_get_cluster(struct inode *inode, int cluster, 330extern int fat_get_cluster(struct inode *inode, int cluster,
331 int *fclus, int *dclus); 331 int *fclus, int *dclus);
332extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys); 332extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
333 unsigned long *mapped_blocks);
333 334
334/* fat/dir.c */ 335/* fat/dir.c */
335extern struct file_operations fat_dir_operations; 336extern struct file_operations fat_dir_operations;
diff --git a/include/linux/mutex-debug.h b/include/linux/mutex-debug.h
new file mode 100644
index 000000000000..8b5769f00467
--- /dev/null
+++ b/include/linux/mutex-debug.h
@@ -0,0 +1,23 @@
1#ifndef __LINUX_MUTEX_DEBUG_H
2#define __LINUX_MUTEX_DEBUG_H
3
4#include <linux/linkage.h>
5
6/*
7 * Mutexes - debugging helpers:
8 */
9
10#define __DEBUG_MUTEX_INITIALIZER(lockname) \
11 , .held_list = LIST_HEAD_INIT(lockname.held_list), \
12 .name = #lockname , .magic = &lockname
13
14#define mutex_init(sem) __mutex_init(sem, __FUNCTION__)
15
16extern void FASTCALL(mutex_destroy(struct mutex *lock));
17
18extern void mutex_debug_show_all_locks(void);
19extern void mutex_debug_show_held_locks(struct task_struct *filter);
20extern void mutex_debug_check_no_locks_held(struct task_struct *task);
21extern void mutex_debug_check_no_locks_freed(const void *from, unsigned long len);
22
23#endif
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
new file mode 100644
index 000000000000..f1ac507fa20d
--- /dev/null
+++ b/include/linux/mutex.h
@@ -0,0 +1,120 @@
1/*
2 * Mutexes: blocking mutual exclusion locks
3 *
4 * started by Ingo Molnar:
5 *
6 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 *
8 * This file contains the main data structure and API definitions.
9 */
10#ifndef __LINUX_MUTEX_H
11#define __LINUX_MUTEX_H
12
13#include <linux/list.h>
14#include <linux/spinlock_types.h>
15#include <linux/linkage.h>
16
17#include <asm/atomic.h>
18
19/*
20 * Simple, straightforward mutexes with strict semantics:
21 *
22 * - only one task can hold the mutex at a time
23 * - only the owner can unlock the mutex
24 * - multiple unlocks are not permitted
25 * - recursive locking is not permitted
26 * - a mutex object must be initialized via the API
27 * - a mutex object must not be initialized via memset or copying
28 * - task may not exit with mutex held
29 * - memory areas where held locks reside must not be freed
30 * - held mutexes must not be reinitialized
31 * - mutexes may not be used in irq contexts
32 *
33 * These semantics are fully enforced when DEBUG_MUTEXES is
34 * enabled. Furthermore, besides enforcing the above rules, the mutex
35 * debugging code also implements a number of additional features
36 * that make lock debugging easier and faster:
37 *
38 * - uses symbolic names of mutexes, whenever they are printed in debug output
39 * - point-of-acquire tracking, symbolic lookup of function names
40 * - list of all locks held in the system, printout of them
41 * - owner tracking
42 * - detects self-recursing locks and prints out all relevant info
43 * - detects multi-task circular deadlocks and prints out all affected
44 * locks and tasks (and only those tasks)
45 */
46struct mutex {
47 /* 1: unlocked, 0: locked, negative: locked, possible waiters */
48 atomic_t count;
49 spinlock_t wait_lock;
50 struct list_head wait_list;
51#ifdef CONFIG_DEBUG_MUTEXES
52 struct thread_info *owner;
53 struct list_head held_list;
54 unsigned long acquire_ip;
55 const char *name;
56 void *magic;
57#endif
58};
59
60/*
61 * This is the control structure for tasks blocked on mutex,
62 * which resides on the blocked task's kernel stack:
63 */
64struct mutex_waiter {
65 struct list_head list;
66 struct task_struct *task;
67#ifdef CONFIG_DEBUG_MUTEXES
68 struct mutex *lock;
69 void *magic;
70#endif
71};
72
73#ifdef CONFIG_DEBUG_MUTEXES
74# include <linux/mutex-debug.h>
75#else
76# define __DEBUG_MUTEX_INITIALIZER(lockname)
77# define mutex_init(mutex) __mutex_init(mutex, NULL)
78# define mutex_destroy(mutex) do { } while (0)
79# define mutex_debug_show_all_locks() do { } while (0)
80# define mutex_debug_show_held_locks(p) do { } while (0)
81# define mutex_debug_check_no_locks_held(task) do { } while (0)
82# define mutex_debug_check_no_locks_freed(from, len) do { } while (0)
83#endif
84
85#define __MUTEX_INITIALIZER(lockname) \
86 { .count = ATOMIC_INIT(1) \
87 , .wait_lock = SPIN_LOCK_UNLOCKED \
88 , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \
89 __DEBUG_MUTEX_INITIALIZER(lockname) }
90
91#define DEFINE_MUTEX(mutexname) \
92 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
93
94extern void fastcall __mutex_init(struct mutex *lock, const char *name);
95
96/***
97 * mutex_is_locked - is the mutex locked
98 * @lock: the mutex to be queried
99 *
100 * Returns 1 if the mutex is locked, 0 if unlocked.
101 */
102static inline int fastcall mutex_is_locked(struct mutex *lock)
103{
104 return atomic_read(&lock->count) != 1;
105}
106
107/*
108 * See kernel/mutex.c for detailed documentation of these APIs.
109 * Also see Documentation/mutex-design.txt.
110 */
111extern void fastcall mutex_lock(struct mutex *lock);
112extern int fastcall mutex_lock_interruptible(struct mutex *lock);
113/*
114 * NOTE: mutex_trylock() follows the spin_trylock() convention,
115 * not the down_trylock() convention!
116 */
117extern int fastcall mutex_trylock(struct mutex *lock);
118extern void fastcall mutex_unlock(struct mutex *lock);
119
120#endif
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 455660eafba9..e6698013e4d0 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -56,10 +56,11 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
56#define LOOKUP_ACCESS (0x0400) 56#define LOOKUP_ACCESS (0x0400)
57 57
58extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *)); 58extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
59extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *));
59#define user_path_walk(name,nd) \ 60#define user_path_walk(name,nd) \
60 __user_walk(name, LOOKUP_FOLLOW, nd) 61 __user_walk_fd(AT_FDCWD, name, LOOKUP_FOLLOW, nd)
61#define user_path_walk_link(name,nd) \ 62#define user_path_walk_link(name,nd) \
62 __user_walk(name, 0, nd) 63 __user_walk_fd(AT_FDCWD, name, 0, nd)
63extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); 64extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
64extern int FASTCALL(path_walk(const char *, struct nameidata *)); 65extern int FASTCALL(path_walk(const char *, struct nameidata *));
65extern int FASTCALL(link_path_walk(const char *, struct nameidata *)); 66extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
@@ -67,14 +68,14 @@ extern void path_release(struct nameidata *);
67extern void path_release_on_umount(struct nameidata *); 68extern void path_release_on_umount(struct nameidata *);
68 69
69extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags); 70extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags);
70extern int path_lookup_open(const char *, unsigned lookup_flags, struct nameidata *, int open_flags); 71extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags);
71extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, 72extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
72 int (*open)(struct inode *, struct file *)); 73 int (*open)(struct inode *, struct file *));
73extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); 74extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
74extern void release_open_intent(struct nameidata *); 75extern void release_open_intent(struct nameidata *);
75 76
76extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 77extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
77extern struct dentry * lookup_hash(struct nameidata *); 78extern __deprecated_for_modules struct dentry * lookup_hash(struct nameidata *);
78 79
79extern int follow_down(struct vfsmount **, struct dentry **); 80extern int follow_down(struct vfsmount **, struct dentry **);
80extern int follow_up(struct vfsmount **, struct dentry **); 81extern int follow_up(struct vfsmount **, struct dentry **);
diff --git a/include/linux/ncp.h b/include/linux/ncp.h
index 99f77876b716..99f0adeeb3f3 100644
--- a/include/linux/ncp.h
+++ b/include/linux/ncp.h
@@ -20,29 +20,29 @@
20#define NCP_DEALLOC_SLOT_REQUEST (0x5555) 20#define NCP_DEALLOC_SLOT_REQUEST (0x5555)
21 21
22struct ncp_request_header { 22struct ncp_request_header {
23 __u16 type __attribute__((packed)); 23 __u16 type;
24 __u8 sequence __attribute__((packed)); 24 __u8 sequence;
25 __u8 conn_low __attribute__((packed)); 25 __u8 conn_low;
26 __u8 task __attribute__((packed)); 26 __u8 task;
27 __u8 conn_high __attribute__((packed)); 27 __u8 conn_high;
28 __u8 function __attribute__((packed)); 28 __u8 function;
29 __u8 data[0] __attribute__((packed)); 29 __u8 data[0];
30}; 30} __attribute__((packed));
31 31
32#define NCP_REPLY (0x3333) 32#define NCP_REPLY (0x3333)
33#define NCP_WATCHDOG (0x3E3E) 33#define NCP_WATCHDOG (0x3E3E)
34#define NCP_POSITIVE_ACK (0x9999) 34#define NCP_POSITIVE_ACK (0x9999)
35 35
36struct ncp_reply_header { 36struct ncp_reply_header {
37 __u16 type __attribute__((packed)); 37 __u16 type;
38 __u8 sequence __attribute__((packed)); 38 __u8 sequence;
39 __u8 conn_low __attribute__((packed)); 39 __u8 conn_low;
40 __u8 task __attribute__((packed)); 40 __u8 task;
41 __u8 conn_high __attribute__((packed)); 41 __u8 conn_high;
42 __u8 completion_code __attribute__((packed)); 42 __u8 completion_code;
43 __u8 connection_state __attribute__((packed)); 43 __u8 connection_state;
44 __u8 data[0] __attribute__((packed)); 44 __u8 data[0];
45}; 45} __attribute__((packed));
46 46
47#define NCP_VOLNAME_LEN (16) 47#define NCP_VOLNAME_LEN (16)
48#define NCP_NUMBER_OF_VOLUMES (256) 48#define NCP_NUMBER_OF_VOLUMES (256)
@@ -128,37 +128,37 @@ struct nw_nfs_info {
128}; 128};
129 129
130struct nw_info_struct { 130struct nw_info_struct {
131 __u32 spaceAlloc __attribute__((packed)); 131 __u32 spaceAlloc;
132 __le32 attributes __attribute__((packed)); 132 __le32 attributes;
133 __u16 flags __attribute__((packed)); 133 __u16 flags;
134 __le32 dataStreamSize __attribute__((packed)); 134 __le32 dataStreamSize;
135 __le32 totalStreamSize __attribute__((packed)); 135 __le32 totalStreamSize;
136 __u16 numberOfStreams __attribute__((packed)); 136 __u16 numberOfStreams;
137 __le16 creationTime __attribute__((packed)); 137 __le16 creationTime;
138 __le16 creationDate __attribute__((packed)); 138 __le16 creationDate;
139 __u32 creatorID __attribute__((packed)); 139 __u32 creatorID;
140 __le16 modifyTime __attribute__((packed)); 140 __le16 modifyTime;
141 __le16 modifyDate __attribute__((packed)); 141 __le16 modifyDate;
142 __u32 modifierID __attribute__((packed)); 142 __u32 modifierID;
143 __le16 lastAccessDate __attribute__((packed)); 143 __le16 lastAccessDate;
144 __u16 archiveTime __attribute__((packed)); 144 __u16 archiveTime;
145 __u16 archiveDate __attribute__((packed)); 145 __u16 archiveDate;
146 __u32 archiverID __attribute__((packed)); 146 __u32 archiverID;
147 __u16 inheritedRightsMask __attribute__((packed)); 147 __u16 inheritedRightsMask;
148 __le32 dirEntNum __attribute__((packed)); 148 __le32 dirEntNum;
149 __le32 DosDirNum __attribute__((packed)); 149 __le32 DosDirNum;
150 __u32 volNumber __attribute__((packed)); 150 __u32 volNumber;
151 __u32 EADataSize __attribute__((packed)); 151 __u32 EADataSize;
152 __u32 EAKeyCount __attribute__((packed)); 152 __u32 EAKeyCount;
153 __u32 EAKeySize __attribute__((packed)); 153 __u32 EAKeySize;
154 __u32 NSCreator __attribute__((packed)); 154 __u32 NSCreator;
155 __u8 nameLen __attribute__((packed)); 155 __u8 nameLen;
156 __u8 entryName[256] __attribute__((packed)); 156 __u8 entryName[256];
157 /* libncp may depend on there being nothing after entryName */ 157 /* libncp may depend on there being nothing after entryName */
158#ifdef __KERNEL__ 158#ifdef __KERNEL__
159 struct nw_nfs_info nfs; 159 struct nw_nfs_info nfs;
160#endif 160#endif
161}; 161} __attribute__((packed));
162 162
163/* modify mask - use with MODIFY_DOS_INFO structure */ 163/* modify mask - use with MODIFY_DOS_INFO structure */
164#define DM_ATTRIBUTES (cpu_to_le32(0x02)) 164#define DM_ATTRIBUTES (cpu_to_le32(0x02))
@@ -176,26 +176,26 @@ struct nw_info_struct {
176#define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000)) 176#define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000))
177 177
178struct nw_modify_dos_info { 178struct nw_modify_dos_info {
179 __le32 attributes __attribute__((packed)); 179 __le32 attributes;
180 __le16 creationDate __attribute__((packed)); 180 __le16 creationDate;
181 __le16 creationTime __attribute__((packed)); 181 __le16 creationTime;
182 __u32 creatorID __attribute__((packed)); 182 __u32 creatorID;
183 __le16 modifyDate __attribute__((packed)); 183 __le16 modifyDate;
184 __le16 modifyTime __attribute__((packed)); 184 __le16 modifyTime;
185 __u32 modifierID __attribute__((packed)); 185 __u32 modifierID;
186 __u16 archiveDate __attribute__((packed)); 186 __u16 archiveDate;
187 __u16 archiveTime __attribute__((packed)); 187 __u16 archiveTime;
188 __u32 archiverID __attribute__((packed)); 188 __u32 archiverID;
189 __le16 lastAccessDate __attribute__((packed)); 189 __le16 lastAccessDate;
190 __u16 inheritanceGrantMask __attribute__((packed)); 190 __u16 inheritanceGrantMask;
191 __u16 inheritanceRevokeMask __attribute__((packed)); 191 __u16 inheritanceRevokeMask;
192 __u32 maximumSpace __attribute__((packed)); 192 __u32 maximumSpace;
193}; 193} __attribute__((packed));
194 194
195struct nw_search_sequence { 195struct nw_search_sequence {
196 __u8 volNumber __attribute__((packed)); 196 __u8 volNumber;
197 __u32 dirBase __attribute__((packed)); 197 __u32 dirBase;
198 __u32 sequence __attribute__((packed)); 198 __u32 sequence;
199}; 199} __attribute__((packed));
200 200
201#endif /* _LINUX_NCP_H */ 201#endif /* _LINUX_NCP_H */
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 7297e4372c0f..e01342568530 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -201,34 +201,6 @@ static inline struct ncp_inode_info *NCP_FINFO(struct inode *inode)
201 return container_of(inode, struct ncp_inode_info, vfs_inode); 201 return container_of(inode, struct ncp_inode_info, vfs_inode);
202} 202}
203 203
204#ifdef DEBUG_NCP_MALLOC
205
206#include <linux/slab.h>
207
208extern int ncp_malloced;
209extern int ncp_current_malloced;
210
211static inline void *
212 ncp_kmalloc(unsigned int size, int priority)
213{
214 ncp_malloced += 1;
215 ncp_current_malloced += 1;
216 return kmalloc(size, priority);
217}
218
219static inline void ncp_kfree_s(void *obj, int size)
220{
221 ncp_current_malloced -= 1;
222 kfree(obj);
223}
224
225#else /* DEBUG_NCP_MALLOC */
226
227#define ncp_kmalloc(s,p) kmalloc(s,p)
228#define ncp_kfree_s(o,s) kfree(o)
229
230#endif /* DEBUG_NCP_MALLOC */
231
232/* linux/fs/ncpfs/inode.c */ 204/* linux/fs/ncpfs/inode.c */
233int ncp_notify_change(struct dentry *, struct iattr *); 205int ncp_notify_change(struct dentry *, struct iattr *);
234struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); 206struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index be365e70ee99..4cf6088625c1 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -168,6 +168,37 @@ void nf_log_packet(int pf,
168 const struct net_device *out, 168 const struct net_device *out,
169 struct nf_loginfo *li, 169 struct nf_loginfo *li,
170 const char *fmt, ...); 170 const char *fmt, ...);
171
172int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb,
173 struct net_device *indev, struct net_device *outdev,
174 int (*okfn)(struct sk_buff *), int thresh);
175
176/**
177 * nf_hook_thresh - call a netfilter hook
178 *
179 * Returns 1 if the hook has allowed the packet to pass. The function
180 * okfn must be invoked by the caller in this case. Any other return
181 * value indicates the packet has been consumed by the hook.
182 */
183static inline int nf_hook_thresh(int pf, unsigned int hook,
184 struct sk_buff **pskb,
185 struct net_device *indev,
186 struct net_device *outdev,
187 int (*okfn)(struct sk_buff *), int thresh)
188{
189#ifndef CONFIG_NETFILTER_DEBUG
190 if (list_empty(&nf_hooks[pf][hook]))
191 return 1;
192#endif
193 return nf_hook_slow(pf, hook, pskb, indev, outdev, okfn, thresh);
194}
195
196static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
197 struct net_device *indev, struct net_device *outdev,
198 int (*okfn)(struct sk_buff *))
199{
200 return nf_hook_thresh(pf, hook, pskb, indev, outdev, okfn, INT_MIN);
201}
171 202
172/* Activate hook; either okfn or kfree_skb called, unless a hook 203/* Activate hook; either okfn or kfree_skb called, unless a hook
173 returns NF_STOLEN (in which case, it's up to the hook to deal with 204 returns NF_STOLEN (in which case, it's up to the hook to deal with
@@ -188,35 +219,17 @@ void nf_log_packet(int pf,
188 219
189/* This is gross, but inline doesn't cut it for avoiding the function 220/* This is gross, but inline doesn't cut it for avoiding the function
190 call in fast path: gcc doesn't inline (needs value tracking?). --RR */ 221 call in fast path: gcc doesn't inline (needs value tracking?). --RR */
191#ifdef CONFIG_NETFILTER_DEBUG 222
192#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ 223/* HX: It's slightly less gross now. */
193({int __ret; \ 224
194if ((__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN)) == 1) \
195 __ret = (okfn)(skb); \
196__ret;})
197#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \
198({int __ret; \
199if ((__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1) \
200 __ret = (okfn)(skb); \
201__ret;})
202#else
203#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
204({int __ret; \
205if (list_empty(&nf_hooks[pf][hook]) || \
206 (__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN)) == 1) \
207 __ret = (okfn)(skb); \
208__ret;})
209#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ 225#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \
210({int __ret; \ 226({int __ret; \
211if (list_empty(&nf_hooks[pf][hook]) || \ 227if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1)\
212 (__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1) \
213 __ret = (okfn)(skb); \ 228 __ret = (okfn)(skb); \
214__ret;}) 229__ret;})
215#endif
216 230
217int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb, 231#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
218 struct net_device *indev, struct net_device *outdev, 232 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN)
219 int (*okfn)(struct sk_buff *), int thresh);
220 233
221/* Call setsockopt() */ 234/* Call setsockopt() */
222int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, 235int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt,
@@ -261,6 +274,20 @@ struct nf_queue_rerouter {
261extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer); 274extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer);
262extern int nf_unregister_queue_rerouter(int pf); 275extern int nf_unregister_queue_rerouter(int pf);
263 276
277#include <net/flow.h>
278extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
279
280static inline void
281nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
282{
283#ifdef CONFIG_IP_NF_NAT_NEEDED
284 void (*decodefn)(struct sk_buff *, struct flowi *);
285
286 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL)
287 decodefn(skb, fl);
288#endif
289}
290
264#ifdef CONFIG_PROC_FS 291#ifdef CONFIG_PROC_FS
265#include <linux/proc_fs.h> 292#include <linux/proc_fs.h>
266extern struct proc_dir_entry *proc_net_netfilter; 293extern struct proc_dir_entry *proc_net_netfilter;
@@ -268,7 +295,24 @@ extern struct proc_dir_entry *proc_net_netfilter;
268 295
269#else /* !CONFIG_NETFILTER */ 296#else /* !CONFIG_NETFILTER */
270#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 297#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
298static inline int nf_hook_thresh(int pf, unsigned int hook,
299 struct sk_buff **pskb,
300 struct net_device *indev,
301 struct net_device *outdev,
302 int (*okfn)(struct sk_buff *), int thresh)
303{
304 return okfn(*pskb);
305}
306static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
307 struct net_device *indev, struct net_device *outdev,
308 int (*okfn)(struct sk_buff *))
309{
310 return okfn(*pskb);
311}
271static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 312static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
313struct flowi;
314static inline void
315nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}
272#endif /*CONFIG_NETFILTER*/ 316#endif /*CONFIG_NETFILTER*/
273 317
274#endif /*__KERNEL__*/ 318#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 6d39b518486b..3ff88c878308 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -154,6 +154,9 @@ struct ip_conntrack_stat
154 unsigned int expect_delete; 154 unsigned int expect_delete;
155}; 155};
156 156
157/* call to create an explicit dependency on nf_conntrack. */
158extern void need_conntrack(void);
159
157#endif /* __KERNEL__ */ 160#endif /* __KERNEL__ */
158 161
159#endif /* _NF_CONNTRACK_COMMON_H */ 162#endif /* _NF_CONNTRACK_COMMON_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
new file mode 100644
index 000000000000..59ff6c430cf6
--- /dev/null
+++ b/include/linux/netfilter/x_tables.h
@@ -0,0 +1,224 @@
1#ifndef _X_TABLES_H
2#define _X_TABLES_H
3
4#define XT_FUNCTION_MAXNAMELEN 30
5#define XT_TABLE_MAXNAMELEN 32
6
7/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
8 * kernel supports, if >= revision. */
9struct xt_get_revision
10{
11 char name[XT_FUNCTION_MAXNAMELEN-1];
12
13 u_int8_t revision;
14};
15
16/* CONTINUE verdict for targets */
17#define XT_CONTINUE 0xFFFFFFFF
18
19/* For standard target */
20#define XT_RETURN (-NF_REPEAT - 1)
21
22#define XT_ALIGN(s) (((s) + (__alignof__(u_int64_t)-1)) & ~(__alignof__(u_int64_t)-1))
23
24/* Standard return verdict, or do jump. */
25#define XT_STANDARD_TARGET ""
26/* Error verdict. */
27#define XT_ERROR_TARGET "ERROR"
28
29/*
30 * New IP firewall options for [gs]etsockopt at the RAW IP level.
31 * Unlike BSD Linux inherits IP options so you don't have to use a raw
32 * socket for this. Instead we check rights in the calls. */
33#define XT_BASE_CTL 64 /* base for firewall socket options */
34
35#define XT_SO_SET_REPLACE (XT_BASE_CTL)
36#define XT_SO_SET_ADD_COUNTERS (XT_BASE_CTL + 1)
37#define XT_SO_SET_MAX XT_SO_SET_ADD_COUNTERS
38
39#define XT_SO_GET_INFO (XT_BASE_CTL)
40#define XT_SO_GET_ENTRIES (XT_BASE_CTL + 1)
41#define XT_SO_GET_REVISION_MATCH (XT_BASE_CTL + 2)
42#define XT_SO_GET_REVISION_TARGET (XT_BASE_CTL + 3)
43#define XT_SO_GET_MAX XT_SO_GET_REVISION_TARGET
44
45#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
46#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
47
48struct xt_counters
49{
50 u_int64_t pcnt, bcnt; /* Packet and byte counters */
51};
52
53/* The argument to IPT_SO_ADD_COUNTERS. */
54struct xt_counters_info
55{
56 /* Which table. */
57 char name[XT_TABLE_MAXNAMELEN];
58
59 unsigned int num_counters;
60
61 /* The counters (actually `number' of these). */
62 struct xt_counters counters[0];
63};
64
65#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
66
67#ifdef __KERNEL__
68
69#include <linux/netdevice.h>
70
71#define ASSERT_READ_LOCK(x)
72#define ASSERT_WRITE_LOCK(x)
73#include <linux/netfilter_ipv4/listhelp.h>
74
75struct xt_match
76{
77 struct list_head list;
78
79 const char name[XT_FUNCTION_MAXNAMELEN-1];
80
81 u_int8_t revision;
82
83 /* Return true or false: return FALSE and set *hotdrop = 1 to
84 force immediate packet drop. */
85 /* Arguments changed since 2.6.9, as this must now handle
86 non-linear skb, using skb_header_pointer and
87 skb_ip_make_writable. */
88 int (*match)(const struct sk_buff *skb,
89 const struct net_device *in,
90 const struct net_device *out,
91 const void *matchinfo,
92 int offset,
93 unsigned int protoff,
94 int *hotdrop);
95
96 /* Called when user tries to insert an entry of this type. */
97 /* Should return true or false. */
98 int (*checkentry)(const char *tablename,
99 const void *ip,
100 void *matchinfo,
101 unsigned int matchinfosize,
102 unsigned int hook_mask);
103
104 /* Called when entry of this type deleted. */
105 void (*destroy)(void *matchinfo, unsigned int matchinfosize);
106
107 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
108 struct module *me;
109};
110
111/* Registration hooks for targets. */
112struct xt_target
113{
114 struct list_head list;
115
116 const char name[XT_FUNCTION_MAXNAMELEN-1];
117
118 u_int8_t revision;
119
120 /* Returns verdict. Argument order changed since 2.6.9, as this
121 must now handle non-linear skbs, using skb_copy_bits and
122 skb_ip_make_writable. */
123 unsigned int (*target)(struct sk_buff **pskb,
124 const struct net_device *in,
125 const struct net_device *out,
126 unsigned int hooknum,
127 const void *targinfo,
128 void *userdata);
129
130 /* Called when user tries to insert an entry of this type:
131 hook_mask is a bitmask of hooks from which it can be
132 called. */
133 /* Should return true or false. */
134 int (*checkentry)(const char *tablename,
135 const void *entry,
136 void *targinfo,
137 unsigned int targinfosize,
138 unsigned int hook_mask);
139
140 /* Called when entry of this type deleted. */
141 void (*destroy)(void *targinfo, unsigned int targinfosize);
142
143 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
144 struct module *me;
145};
146
147/* Furniture shopping... */
148struct xt_table
149{
150 struct list_head list;
151
152 /* A unique name... */
153 char name[XT_TABLE_MAXNAMELEN];
154
155 /* What hooks you will enter on */
156 unsigned int valid_hooks;
157
158 /* Lock for the curtain */
159 rwlock_t lock;
160
161 /* Man behind the curtain... */
162 //struct ip6t_table_info *private;
163 void *private;
164
165 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
166 struct module *me;
167
168 int af; /* address/protocol family */
169};
170
171#include <linux/netfilter_ipv4.h>
172
173/* The table itself */
174struct xt_table_info
175{
176 /* Size per table */
177 unsigned int size;
178 /* Number of entries: FIXME. --RR */
179 unsigned int number;
180 /* Initial number of entries. Needed for module usage count */
181 unsigned int initial_entries;
182
183 /* Entry points and underflows */
184 unsigned int hook_entry[NF_IP_NUMHOOKS];
185 unsigned int underflow[NF_IP_NUMHOOKS];
186
187 /* ipt_entry tables: one per CPU */
188 char *entries[NR_CPUS];
189};
190
191extern int xt_register_target(int af, struct xt_target *target);
192extern void xt_unregister_target(int af, struct xt_target *target);
193extern int xt_register_match(int af, struct xt_match *target);
194extern void xt_unregister_match(int af, struct xt_match *target);
195
196extern int xt_register_table(struct xt_table *table,
197 struct xt_table_info *bootstrap,
198 struct xt_table_info *newinfo);
199extern void *xt_unregister_table(struct xt_table *table);
200
201extern struct xt_table_info *xt_replace_table(struct xt_table *table,
202 unsigned int num_counters,
203 struct xt_table_info *newinfo,
204 int *error);
205
206extern struct xt_match *xt_find_match(int af, const char *name, u8 revision);
207extern struct xt_target *xt_find_target(int af, const char *name, u8 revision);
208extern struct xt_target *xt_request_find_target(int af, const char *name,
209 u8 revision);
210extern int xt_find_revision(int af, const char *name, u8 revision, int target,
211 int *err);
212
213extern struct xt_table *xt_find_table_lock(int af, const char *name);
214extern void xt_table_unlock(struct xt_table *t);
215
216extern int xt_proto_init(int af);
217extern void xt_proto_fini(int af);
218
219extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
220extern void xt_free_table_info(struct xt_table_info *info);
221
222#endif /* __KERNEL__ */
223
224#endif /* _X_TABLES_H */
diff --git a/include/linux/netfilter/xt_CLASSIFY.h b/include/linux/netfilter/xt_CLASSIFY.h
new file mode 100644
index 000000000000..58111355255d
--- /dev/null
+++ b/include/linux/netfilter/xt_CLASSIFY.h
@@ -0,0 +1,8 @@
1#ifndef _XT_CLASSIFY_H
2#define _XT_CLASSIFY_H
3
4struct xt_classify_target_info {
5 u_int32_t priority;
6};
7
8#endif /*_XT_CLASSIFY_H */
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
new file mode 100644
index 000000000000..9f744689fffc
--- /dev/null
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -0,0 +1,25 @@
1#ifndef _XT_CONNMARK_H_target
2#define _XT_CONNMARK_H_target
3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13enum {
14 XT_CONNMARK_SET = 0,
15 XT_CONNMARK_SAVE,
16 XT_CONNMARK_RESTORE
17};
18
19struct xt_connmark_target_info {
20 unsigned long mark;
21 unsigned long mask;
22 u_int8_t mode;
23};
24
25#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
new file mode 100644
index 000000000000..b021e93ee5d6
--- /dev/null
+++ b/include/linux/netfilter/xt_MARK.h
@@ -0,0 +1,21 @@
1#ifndef _XT_MARK_H_target
2#define _XT_MARK_H_target
3
4/* Version 0 */
5struct xt_mark_target_info {
6 unsigned long mark;
7};
8
9/* Version 1 */
10enum {
11 XT_MARK_SET=0,
12 XT_MARK_AND,
13 XT_MARK_OR,
14};
15
16struct xt_mark_target_info_v1 {
17 unsigned long mark;
18 u_int8_t mode;
19};
20
21#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
new file mode 100644
index 000000000000..9a9af79f74d2
--- /dev/null
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -0,0 +1,16 @@
1/* iptables module for using NFQUEUE mechanism
2 *
3 * (C) 2005 Harald Welte <laforge@netfilter.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7*/
8#ifndef _XT_NFQ_TARGET_H
9#define _XT_NFQ_TARGET_H
10
11/* target info */
12struct xt_NFQ_info {
13 u_int16_t queuenum;
14};
15
16#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_comment.h b/include/linux/netfilter/xt_comment.h
new file mode 100644
index 000000000000..eacfedc6b5d0
--- /dev/null
+++ b/include/linux/netfilter/xt_comment.h
@@ -0,0 +1,10 @@
1#ifndef _XT_COMMENT_H
2#define _XT_COMMENT_H
3
4#define XT_MAX_COMMENT_LEN 256
5
6struct xt_comment_info {
7 unsigned char comment[XT_MAX_COMMENT_LEN];
8};
9
10#endif /* XT_COMMENT_H */
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/linux/netfilter/xt_connbytes.h
new file mode 100644
index 000000000000..c022c989754d
--- /dev/null
+++ b/include/linux/netfilter/xt_connbytes.h
@@ -0,0 +1,25 @@
1#ifndef _XT_CONNBYTES_H
2#define _XT_CONNBYTES_H
3
4enum xt_connbytes_what {
5 XT_CONNBYTES_PKTS,
6 XT_CONNBYTES_BYTES,
7 XT_CONNBYTES_AVGPKT,
8};
9
10enum xt_connbytes_direction {
11 XT_CONNBYTES_DIR_ORIGINAL,
12 XT_CONNBYTES_DIR_REPLY,
13 XT_CONNBYTES_DIR_BOTH,
14};
15
16struct xt_connbytes_info
17{
18 struct {
19 aligned_u64 from; /* count to be matched */
20 aligned_u64 to; /* count to be matched */
21 } count;
22 u_int8_t what; /* ipt_connbytes_what */
23 u_int8_t direction; /* ipt_connbytes_direction */
24};
25#endif
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
new file mode 100644
index 000000000000..c592f6ae0883
--- /dev/null
+++ b/include/linux/netfilter/xt_connmark.h
@@ -0,0 +1,18 @@
1#ifndef _XT_CONNMARK_H
2#define _XT_CONNMARK_H
3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13struct xt_connmark_info {
14 unsigned long mark, mask;
15 u_int8_t invert;
16};
17
18#endif /*_XT_CONNMARK_H*/
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
new file mode 100644
index 000000000000..34f63cf2e293
--- /dev/null
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -0,0 +1,63 @@
1/* Header file for kernel module to match connection tracking information.
2 * GPL (C) 2001 Marc Boucher (marc@mbsi.ca).
3 */
4
5#ifndef _XT_CONNTRACK_H
6#define _XT_CONNTRACK_H
7
8#include <linux/netfilter/nf_conntrack_tuple_common.h>
9#include <linux/in.h>
10
11#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
12#define XT_CONNTRACK_STATE_INVALID (1 << 0)
13
14#define XT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1))
15#define XT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2))
16#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
17
18/* flags, invflags: */
19#define XT_CONNTRACK_STATE 0x01
20#define XT_CONNTRACK_PROTO 0x02
21#define XT_CONNTRACK_ORIGSRC 0x04
22#define XT_CONNTRACK_ORIGDST 0x08
23#define XT_CONNTRACK_REPLSRC 0x10
24#define XT_CONNTRACK_REPLDST 0x20
25#define XT_CONNTRACK_STATUS 0x40
26#define XT_CONNTRACK_EXPIRES 0x80
27
28/* This is exposed to userspace, so remains frozen in time. */
29struct ip_conntrack_old_tuple
30{
31 struct {
32 __u32 ip;
33 union {
34 __u16 all;
35 } u;
36 } src;
37
38 struct {
39 __u32 ip;
40 union {
41 __u16 all;
42 } u;
43
44 /* The protocol. */
45 u16 protonum;
46 } dst;
47};
48
49struct xt_conntrack_info
50{
51 unsigned int statemask, statusmask;
52
53 struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX];
54 struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX];
55
56 unsigned long expires_min, expires_max;
57
58 /* Flags word */
59 u_int8_t flags;
60 /* Inverse flags */
61 u_int8_t invflags;
62};
63#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_dccp.h b/include/linux/netfilter/xt_dccp.h
new file mode 100644
index 000000000000..e0221b9d32cb
--- /dev/null
+++ b/include/linux/netfilter/xt_dccp.h
@@ -0,0 +1,23 @@
1#ifndef _XT_DCCP_H_
2#define _XT_DCCP_H_
3
4#define XT_DCCP_SRC_PORTS 0x01
5#define XT_DCCP_DEST_PORTS 0x02
6#define XT_DCCP_TYPE 0x04
7#define XT_DCCP_OPTION 0x08
8
9#define XT_DCCP_VALID_FLAGS 0x0f
10
11struct xt_dccp_info {
12 u_int16_t dpts[2]; /* Min, Max */
13 u_int16_t spts[2]; /* Min, Max */
14
15 u_int16_t flags;
16 u_int16_t invflags;
17
18 u_int16_t typemask;
19 u_int8_t option;
20};
21
22#endif /* _XT_DCCP_H_ */
23
diff --git a/include/linux/netfilter/xt_helper.h b/include/linux/netfilter/xt_helper.h
new file mode 100644
index 000000000000..6b42763f999d
--- /dev/null
+++ b/include/linux/netfilter/xt_helper.h
@@ -0,0 +1,8 @@
1#ifndef _XT_HELPER_H
2#define _XT_HELPER_H
3
4struct xt_helper_info {
5 int invert;
6 char name[30];
7};
8#endif /* _XT_HELPER_H */
diff --git a/include/linux/netfilter/xt_length.h b/include/linux/netfilter/xt_length.h
new file mode 100644
index 000000000000..7c2b439f73fe
--- /dev/null
+++ b/include/linux/netfilter/xt_length.h
@@ -0,0 +1,9 @@
1#ifndef _XT_LENGTH_H
2#define _XT_LENGTH_H
3
4struct xt_length_info {
5 u_int16_t min, max;
6 u_int8_t invert;
7};
8
9#endif /*_XT_LENGTH_H*/
diff --git a/include/linux/netfilter/xt_limit.h b/include/linux/netfilter/xt_limit.h
new file mode 100644
index 000000000000..b3ce65375ecb
--- /dev/null
+++ b/include/linux/netfilter/xt_limit.h
@@ -0,0 +1,21 @@
1#ifndef _XT_RATE_H
2#define _XT_RATE_H
3
4/* timings are in milliseconds. */
5#define XT_LIMIT_SCALE 10000
6
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
8 seconds, or one every 59 hours. */
9struct xt_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */
12
13 /* Used internally by the kernel */
14 unsigned long prev;
15 u_int32_t credit;
16 u_int32_t credit_cap, cost;
17
18 /* Ugly, ugly fucker. */
19 struct xt_rateinfo *master;
20};
21#endif /*_XT_RATE_H*/
diff --git a/include/linux/netfilter/xt_mac.h b/include/linux/netfilter/xt_mac.h
new file mode 100644
index 000000000000..b892cdc67e06
--- /dev/null
+++ b/include/linux/netfilter/xt_mac.h
@@ -0,0 +1,8 @@
1#ifndef _XT_MAC_H
2#define _XT_MAC_H
3
4struct xt_mac_info {
5 unsigned char srcaddr[ETH_ALEN];
6 int invert;
7};
8#endif /*_XT_MAC_H*/
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
new file mode 100644
index 000000000000..802dd4842caf
--- /dev/null
+++ b/include/linux/netfilter/xt_mark.h
@@ -0,0 +1,9 @@
1#ifndef _XT_MARK_H
2#define _XT_MARK_H
3
4struct xt_mark_info {
5 unsigned long mark, mask;
6 u_int8_t invert;
7};
8
9#endif /*_XT_MARK_H*/
diff --git a/include/linux/netfilter/xt_physdev.h b/include/linux/netfilter/xt_physdev.h
new file mode 100644
index 000000000000..25a7a1815b5b
--- /dev/null
+++ b/include/linux/netfilter/xt_physdev.h
@@ -0,0 +1,24 @@
1#ifndef _XT_PHYSDEV_H
2#define _XT_PHYSDEV_H
3
4#ifdef __KERNEL__
5#include <linux/if.h>
6#endif
7
8#define XT_PHYSDEV_OP_IN 0x01
9#define XT_PHYSDEV_OP_OUT 0x02
10#define XT_PHYSDEV_OP_BRIDGED 0x04
11#define XT_PHYSDEV_OP_ISIN 0x08
12#define XT_PHYSDEV_OP_ISOUT 0x10
13#define XT_PHYSDEV_OP_MASK (0x20 - 1)
14
15struct xt_physdev_info {
16 char physindev[IFNAMSIZ];
17 char in_mask[IFNAMSIZ];
18 char physoutdev[IFNAMSIZ];
19 char out_mask[IFNAMSIZ];
20 u_int8_t invert;
21 u_int8_t bitmask;
22};
23
24#endif /*_XT_PHYSDEV_H*/
diff --git a/include/linux/netfilter/xt_pkttype.h b/include/linux/netfilter/xt_pkttype.h
new file mode 100644
index 000000000000..f265cf52faea
--- /dev/null
+++ b/include/linux/netfilter/xt_pkttype.h
@@ -0,0 +1,8 @@
1#ifndef _XT_PKTTYPE_H
2#define _XT_PKTTYPE_H
3
4struct xt_pkttype_info {
5 int pkttype;
6 int invert;
7};
8#endif /*_XT_PKTTYPE_H*/
diff --git a/include/linux/netfilter/xt_realm.h b/include/linux/netfilter/xt_realm.h
new file mode 100644
index 000000000000..220e87245716
--- /dev/null
+++ b/include/linux/netfilter/xt_realm.h
@@ -0,0 +1,10 @@
1#ifndef _XT_REALM_H
2#define _XT_REALM_H
3
4struct xt_realm_info {
5 u_int32_t id;
6 u_int32_t mask;
7 u_int8_t invert;
8};
9
10#endif /* _XT_REALM_H */
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
new file mode 100644
index 000000000000..b157897e7792
--- /dev/null
+++ b/include/linux/netfilter/xt_sctp.h
@@ -0,0 +1,107 @@
1#ifndef _XT_SCTP_H_
2#define _XT_SCTP_H_
3
4#define XT_SCTP_SRC_PORTS 0x01
5#define XT_SCTP_DEST_PORTS 0x02
6#define XT_SCTP_CHUNK_TYPES 0x04
7
8#define XT_SCTP_VALID_FLAGS 0x07
9
10#define ELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
11
12
13struct xt_sctp_flag_info {
14 u_int8_t chunktype;
15 u_int8_t flag;
16 u_int8_t flag_mask;
17};
18
19#define XT_NUM_SCTP_FLAGS 4
20
21struct xt_sctp_info {
22 u_int16_t dpts[2]; /* Min, Max */
23 u_int16_t spts[2]; /* Min, Max */
24
25 u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */
26
27#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */
28#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */
29#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */
30
31 u_int32_t chunk_match_type;
32 struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS];
33 int flag_count;
34
35 u_int32_t flags;
36 u_int32_t invflags;
37};
38
39#define bytes(type) (sizeof(type) * 8)
40
41#define SCTP_CHUNKMAP_SET(chunkmap, type) \
42 do { \
43 chunkmap[type / bytes(u_int32_t)] |= \
44 1 << (type % bytes(u_int32_t)); \
45 } while (0)
46
47#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
48 do { \
49 chunkmap[type / bytes(u_int32_t)] &= \
50 ~(1 << (type % bytes(u_int32_t))); \
51 } while (0)
52
53#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
54({ \
55 (chunkmap[type / bytes (u_int32_t)] & \
56 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
57})
58
59#define SCTP_CHUNKMAP_RESET(chunkmap) \
60 do { \
61 int i; \
62 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
63 chunkmap[i] = 0; \
64 } while (0)
65
66#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
67 do { \
68 int i; \
69 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
70 chunkmap[i] = ~0; \
71 } while (0)
72
73#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
74 do { \
75 int i; \
76 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
77 destmap[i] = srcmap[i]; \
78 } while (0)
79
80#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
81({ \
82 int i; \
83 int flag = 1; \
84 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \
85 if (chunkmap[i]) { \
86 flag = 0; \
87 break; \
88 } \
89 } \
90 flag; \
91})
92
93#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
94({ \
95 int i; \
96 int flag = 1; \
97 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \
98 if (chunkmap[i] != ~0) { \
99 flag = 0; \
100 break; \
101 } \
102 } \
103 flag; \
104})
105
106#endif /* _XT_SCTP_H_ */
107
diff --git a/include/linux/netfilter/xt_state.h b/include/linux/netfilter/xt_state.h
new file mode 100644
index 000000000000..c06f32edee07
--- /dev/null
+++ b/include/linux/netfilter/xt_state.h
@@ -0,0 +1,13 @@
1#ifndef _XT_STATE_H
2#define _XT_STATE_H
3
4#define XT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
5#define XT_STATE_INVALID (1 << 0)
6
7#define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1))
8
9struct xt_state_info
10{
11 unsigned int statemask;
12};
13#endif /*_XT_STATE_H*/
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
new file mode 100644
index 000000000000..3b3419f2637d
--- /dev/null
+++ b/include/linux/netfilter/xt_string.h
@@ -0,0 +1,18 @@
1#ifndef _XT_STRING_H
2#define _XT_STRING_H
3
4#define XT_STRING_MAX_PATTERN_SIZE 128
5#define XT_STRING_MAX_ALGO_NAME_SIZE 16
6
7struct xt_string_info
8{
9 u_int16_t from_offset;
10 u_int16_t to_offset;
11 char algo[XT_STRING_MAX_ALGO_NAME_SIZE];
12 char pattern[XT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen;
14 u_int8_t invert;
15 struct ts_config __attribute__((aligned(8))) *config;
16};
17
18#endif /*_XT_STRING_H*/
diff --git a/include/linux/netfilter/xt_tcpmss.h b/include/linux/netfilter/xt_tcpmss.h
new file mode 100644
index 000000000000..e03274c4c790
--- /dev/null
+++ b/include/linux/netfilter/xt_tcpmss.h
@@ -0,0 +1,9 @@
1#ifndef _XT_TCPMSS_MATCH_H
2#define _XT_TCPMSS_MATCH_H
3
4struct xt_tcpmss_match_info {
5 u_int16_t mss_min, mss_max;
6 u_int8_t invert;
7};
8
9#endif /*_XT_TCPMSS_MATCH_H*/
diff --git a/include/linux/netfilter/xt_tcpudp.h b/include/linux/netfilter/xt_tcpudp.h
new file mode 100644
index 000000000000..78bc65f11adf
--- /dev/null
+++ b/include/linux/netfilter/xt_tcpudp.h
@@ -0,0 +1,36 @@
1#ifndef _XT_TCPUDP_H
2#define _XT_TCPUDP_H
3
4/* TCP matching stuff */
5struct xt_tcp
6{
7 u_int16_t spts[2]; /* Source port range. */
8 u_int16_t dpts[2]; /* Destination port range. */
9 u_int8_t option; /* TCP Option iff non-zero*/
10 u_int8_t flg_mask; /* TCP flags mask byte */
11 u_int8_t flg_cmp; /* TCP flags compare byte */
12 u_int8_t invflags; /* Inverse flags */
13};
14
15/* Values for "inv" field in struct ipt_tcp. */
16#define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
17#define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
18#define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */
19#define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */
20#define XT_TCP_INV_MASK 0x0F /* All possible flags. */
21
22/* UDP matching stuff */
23struct xt_udp
24{
25 u_int16_t spts[2]; /* Source port range. */
26 u_int16_t dpts[2]; /* Destination port range. */
27 u_int8_t invflags; /* Inverse flags */
28};
29
30/* Values for "invflags" field in struct ipt_udp. */
31#define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
32#define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
33#define XT_UDP_INV_MASK 0x03 /* All possible flags. */
34
35
36#endif
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index e98a870a20be..fd21796e5131 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -19,8 +19,12 @@
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/netfilter_arp.h> 20#include <linux/netfilter_arp.h>
21 21
22#define ARPT_FUNCTION_MAXNAMELEN 30 22#include <linux/netfilter/x_tables.h>
23#define ARPT_TABLE_MAXNAMELEN 32 23
24#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
25#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
26#define arpt_target xt_target
27#define arpt_table xt_table
24 28
25#define ARPT_DEV_ADDR_LEN_MAX 16 29#define ARPT_DEV_ADDR_LEN_MAX 16
26 30
@@ -91,11 +95,6 @@ struct arpt_standard_target
91 int verdict; 95 int verdict;
92}; 96};
93 97
94struct arpt_counters
95{
96 u_int64_t pcnt, bcnt; /* Packet and byte counters */
97};
98
99/* Values for "flag" field in struct arpt_ip (general arp structure). 98/* Values for "flag" field in struct arpt_ip (general arp structure).
100 * No flags defined yet. 99 * No flags defined yet.
101 */ 100 */
@@ -130,7 +129,7 @@ struct arpt_entry
130 unsigned int comefrom; 129 unsigned int comefrom;
131 130
132 /* Packet and byte counters. */ 131 /* Packet and byte counters. */
133 struct arpt_counters counters; 132 struct xt_counters counters;
134 133
135 /* The matches (if any), then the target. */ 134 /* The matches (if any), then the target. */
136 unsigned char elems[0]; 135 unsigned char elems[0];
@@ -141,23 +140,24 @@ struct arpt_entry
141 * Unlike BSD Linux inherits IP options so you don't have to use a raw 140 * Unlike BSD Linux inherits IP options so you don't have to use a raw
142 * socket for this. Instead we check rights in the calls. 141 * socket for this. Instead we check rights in the calls.
143 */ 142 */
144#define ARPT_BASE_CTL 96 /* base for firewall socket options */ 143#define ARPT_CTL_OFFSET 32
144#define ARPT_BASE_CTL (XT_BASE_CTL+ARPT_CTL_OFFSET)
145 145
146#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) 146#define ARPT_SO_SET_REPLACE (XT_SO_SET_REPLACE+ARPT_CTL_OFFSET)
147#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1) 147#define ARPT_SO_SET_ADD_COUNTERS (XT_SO_SET_ADD_COUNTERS+ARPT_CTL_OFFSET)
148#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS 148#define ARPT_SO_SET_MAX (XT_SO_SET_MAX+ARPT_CTL_OFFSET)
149 149
150#define ARPT_SO_GET_INFO (ARPT_BASE_CTL) 150#define ARPT_SO_GET_INFO (XT_SO_GET_INFO+ARPT_CTL_OFFSET)
151#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) 151#define ARPT_SO_GET_ENTRIES (XT_SO_GET_ENTRIES+ARPT_CTL_OFFSET)
152/* #define ARPT_SO_GET_REVISION_MATCH (ARPT_BASE_CTL + 2)*/ 152/* #define ARPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH */
153#define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3) 153#define ARPT_SO_GET_REVISION_TARGET (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
154#define ARPT_SO_GET_MAX ARPT_SO_GET_REVISION_TARGET 154#define ARPT_SO_GET_MAX (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
155 155
156/* CONTINUE verdict for targets */ 156/* CONTINUE verdict for targets */
157#define ARPT_CONTINUE 0xFFFFFFFF 157#define ARPT_CONTINUE XT_CONTINUE
158 158
159/* For standard target */ 159/* For standard target */
160#define ARPT_RETURN (-NF_REPEAT - 1) 160#define ARPT_RETURN XT_RETURN
161 161
162/* The argument to ARPT_SO_GET_INFO */ 162/* The argument to ARPT_SO_GET_INFO */
163struct arpt_getinfo 163struct arpt_getinfo
@@ -208,23 +208,14 @@ struct arpt_replace
208 /* Number of counters (must be equal to current number of entries). */ 208 /* Number of counters (must be equal to current number of entries). */
209 unsigned int num_counters; 209 unsigned int num_counters;
210 /* The old entries' counters. */ 210 /* The old entries' counters. */
211 struct arpt_counters __user *counters; 211 struct xt_counters __user *counters;
212 212
213 /* The entries (hang off end: not really an array). */ 213 /* The entries (hang off end: not really an array). */
214 struct arpt_entry entries[0]; 214 struct arpt_entry entries[0];
215}; 215};
216 216
217/* The argument to ARPT_SO_ADD_COUNTERS. */ 217/* The argument to ARPT_SO_ADD_COUNTERS. */
218struct arpt_counters_info 218#define arpt_counters_info xt_counters_info
219{
220 /* Which table. */
221 char name[ARPT_TABLE_MAXNAMELEN];
222
223 unsigned int num_counters;
224
225 /* The counters (actually `number' of these). */
226 struct arpt_counters counters[0];
227};
228 219
229/* The argument to ARPT_SO_GET_ENTRIES. */ 220/* The argument to ARPT_SO_GET_ENTRIES. */
230struct arpt_get_entries 221struct arpt_get_entries
@@ -239,19 +230,10 @@ struct arpt_get_entries
239 struct arpt_entry entrytable[0]; 230 struct arpt_entry entrytable[0];
240}; 231};
241 232
242/* The argument to ARPT_SO_GET_REVISION_*. Returns highest revision
243 * kernel supports, if >= revision. */
244struct arpt_get_revision
245{
246 char name[ARPT_FUNCTION_MAXNAMELEN-1];
247
248 u_int8_t revision;
249};
250
251/* Standard return verdict, or do jump. */ 233/* Standard return verdict, or do jump. */
252#define ARPT_STANDARD_TARGET "" 234#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
253/* Error verdict. */ 235/* Error verdict. */
254#define ARPT_ERROR_TARGET "ERROR" 236#define ARPT_ERROR_TARGET XT_ERROR_TARGET
255 237
256/* Helper functions */ 238/* Helper functions */
257static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e) 239static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e)
@@ -281,63 +263,8 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e
281 */ 263 */
282#ifdef __KERNEL__ 264#ifdef __KERNEL__
283 265
284/* Registration hooks for targets. */ 266#define arpt_register_target(tgt) xt_register_target(NF_ARP, tgt)
285struct arpt_target 267#define arpt_unregister_target(tgt) xt_unregister_target(NF_ARP, tgt)
286{
287 struct list_head list;
288
289 const char name[ARPT_FUNCTION_MAXNAMELEN-1];
290
291 u_int8_t revision;
292
293 /* Returns verdict. */
294 unsigned int (*target)(struct sk_buff **pskb,
295 unsigned int hooknum,
296 const struct net_device *in,
297 const struct net_device *out,
298 const void *targinfo,
299 void *userdata);
300
301 /* Called when user tries to insert an entry of this type:
302 hook_mask is a bitmask of hooks from which it can be
303 called. */
304 /* Should return true or false. */
305 int (*checkentry)(const char *tablename,
306 const struct arpt_entry *e,
307 void *targinfo,
308 unsigned int targinfosize,
309 unsigned int hook_mask);
310
311 /* Called when entry of this type deleted. */
312 void (*destroy)(void *targinfo, unsigned int targinfosize);
313
314 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
315 struct module *me;
316};
317
318extern int arpt_register_target(struct arpt_target *target);
319extern void arpt_unregister_target(struct arpt_target *target);
320
321/* Furniture shopping... */
322struct arpt_table
323{
324 struct list_head list;
325
326 /* A unique name... */
327 char name[ARPT_TABLE_MAXNAMELEN];
328
329 /* What hooks you will enter on */
330 unsigned int valid_hooks;
331
332 /* Lock for the curtain */
333 rwlock_t lock;
334
335 /* Man behind the curtain... */
336 struct arpt_table_info *private;
337
338 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
339 struct module *me;
340};
341 268
342extern int arpt_register_table(struct arpt_table *table, 269extern int arpt_register_table(struct arpt_table *table,
343 const struct arpt_replace *repl); 270 const struct arpt_replace *repl);
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index b3432ab59a17..215765f043e6 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -199,9 +199,6 @@ ip_conntrack_put(struct ip_conntrack *ct)
199 nf_conntrack_put(&ct->ct_general); 199 nf_conntrack_put(&ct->ct_general);
200} 200}
201 201
202/* call to create an explicit dependency on ip_conntrack. */
203extern void need_ip_conntrack(void);
204
205extern int invert_tuplepr(struct ip_conntrack_tuple *inverse, 202extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
206 const struct ip_conntrack_tuple *orig); 203 const struct ip_conntrack_tuple *orig);
207 204
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h
index ef63aa991a06..612a43614e7b 100644
--- a/include/linux/netfilter_ipv4/ip_nat_protocol.h
+++ b/include/linux/netfilter_ipv4/ip_nat_protocol.h
@@ -42,13 +42,6 @@ struct ip_nat_protocol
42 enum ip_nat_manip_type maniptype, 42 enum ip_nat_manip_type maniptype,
43 const struct ip_conntrack *conntrack); 43 const struct ip_conntrack *conntrack);
44 44
45 unsigned int (*print)(char *buffer,
46 const struct ip_conntrack_tuple *match,
47 const struct ip_conntrack_tuple *mask);
48
49 unsigned int (*print_range)(char *buffer,
50 const struct ip_nat_range *range);
51
52 int (*range_to_nfattr)(struct sk_buff *skb, 45 int (*range_to_nfattr)(struct sk_buff *skb,
53 const struct ip_nat_range *range); 46 const struct ip_nat_range *range);
54 47
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index d19d65cf4530..76ba24b68515 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -25,8 +25,14 @@
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv4.h> 26#include <linux/netfilter_ipv4.h>
27 27
28#define IPT_FUNCTION_MAXNAMELEN 30 28#include <linux/netfilter/x_tables.h>
29#define IPT_TABLE_MAXNAMELEN 32 29
30#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
31#define IPT_TABLE_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
32#define ipt_match xt_match
33#define ipt_target xt_target
34#define ipt_table xt_table
35#define ipt_get_revision xt_get_revision
30 36
31/* Yes, Virginia, you have to zero the padding. */ 37/* Yes, Virginia, you have to zero the padding. */
32struct ipt_ip { 38struct ipt_ip {
@@ -102,10 +108,7 @@ struct ipt_standard_target
102 int verdict; 108 int verdict;
103}; 109};
104 110
105struct ipt_counters 111#define ipt_counters xt_counters
106{
107 u_int64_t pcnt, bcnt; /* Packet and byte counters */
108};
109 112
110/* Values for "flag" field in struct ipt_ip (general ip structure). */ 113/* Values for "flag" field in struct ipt_ip (general ip structure). */
111#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ 114#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */
@@ -119,7 +122,7 @@ struct ipt_counters
119#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ 122#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
120#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ 123#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
121#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */ 124#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */
122#define IPT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 125#define IPT_INV_PROTO XT_INV_PROTO
123#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */ 126#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */
124 127
125/* This structure defines each of the firewall rules. Consists of 3 128/* This structure defines each of the firewall rules. Consists of 3
@@ -141,7 +144,7 @@ struct ipt_entry
141 unsigned int comefrom; 144 unsigned int comefrom;
142 145
143 /* Packet and byte counters. */ 146 /* Packet and byte counters. */
144 struct ipt_counters counters; 147 struct xt_counters counters;
145 148
146 /* The matches (if any), then the target. */ 149 /* The matches (if any), then the target. */
147 unsigned char elems[0]; 150 unsigned char elems[0];
@@ -151,54 +154,34 @@ struct ipt_entry
151 * New IP firewall options for [gs]etsockopt at the RAW IP level. 154 * New IP firewall options for [gs]etsockopt at the RAW IP level.
152 * Unlike BSD Linux inherits IP options so you don't have to use a raw 155 * Unlike BSD Linux inherits IP options so you don't have to use a raw
153 * socket for this. Instead we check rights in the calls. */ 156 * socket for this. Instead we check rights in the calls. */
154#define IPT_BASE_CTL 64 /* base for firewall socket options */ 157#define IPT_BASE_CTL XT_BASE_CTL
155 158
156#define IPT_SO_SET_REPLACE (IPT_BASE_CTL) 159#define IPT_SO_SET_REPLACE XT_SO_SET_REPLACE
157#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1) 160#define IPT_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS
158#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS 161#define IPT_SO_SET_MAX XT_SO_SET_MAX
159 162
160#define IPT_SO_GET_INFO (IPT_BASE_CTL) 163#define IPT_SO_GET_INFO XT_SO_GET_INFO
161#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) 164#define IPT_SO_GET_ENTRIES XT_SO_GET_ENTRIES
162#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) 165#define IPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH
163#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) 166#define IPT_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET
164#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET 167#define IPT_SO_GET_MAX XT_SO_GET_REVISION_TARGET
165 168
166/* CONTINUE verdict for targets */ 169#define IPT_CONTINUE XT_CONTINUE
167#define IPT_CONTINUE 0xFFFFFFFF 170#define IPT_RETURN XT_RETURN
168 171
169/* For standard target */ 172#include <linux/netfilter/xt_tcpudp.h>
170#define IPT_RETURN (-NF_REPEAT - 1) 173#define ipt_udp xt_udp
174#define ipt_tcp xt_tcp
171 175
172/* TCP matching stuff */ 176#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT
173struct ipt_tcp 177#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT
174{ 178#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS
175 u_int16_t spts[2]; /* Source port range. */ 179#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION
176 u_int16_t dpts[2]; /* Destination port range. */ 180#define IPT_TCP_INV_MASK XT_TCP_INV_MASK
177 u_int8_t option; /* TCP Option iff non-zero*/
178 u_int8_t flg_mask; /* TCP flags mask byte */
179 u_int8_t flg_cmp; /* TCP flags compare byte */
180 u_int8_t invflags; /* Inverse flags */
181};
182
183/* Values for "inv" field in struct ipt_tcp. */
184#define IPT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
185#define IPT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
186#define IPT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */
187#define IPT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */
188#define IPT_TCP_INV_MASK 0x0F /* All possible flags. */
189
190/* UDP matching stuff */
191struct ipt_udp
192{
193 u_int16_t spts[2]; /* Source port range. */
194 u_int16_t dpts[2]; /* Destination port range. */
195 u_int8_t invflags; /* Inverse flags */
196};
197 181
198/* Values for "invflags" field in struct ipt_udp. */ 182#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT
199#define IPT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 183#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT
200#define IPT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 184#define IPT_UDP_INV_MASK XT_UDP_INV_MASK
201#define IPT_UDP_INV_MASK 0x03 /* All possible flags. */
202 185
203/* ICMP matching stuff */ 186/* ICMP matching stuff */
204struct ipt_icmp 187struct ipt_icmp
@@ -260,23 +243,14 @@ struct ipt_replace
260 /* Number of counters (must be equal to current number of entries). */ 243 /* Number of counters (must be equal to current number of entries). */
261 unsigned int num_counters; 244 unsigned int num_counters;
262 /* The old entries' counters. */ 245 /* The old entries' counters. */
263 struct ipt_counters __user *counters; 246 struct xt_counters __user *counters;
264 247
265 /* The entries (hang off end: not really an array). */ 248 /* The entries (hang off end: not really an array). */
266 struct ipt_entry entries[0]; 249 struct ipt_entry entries[0];
267}; 250};
268 251
269/* The argument to IPT_SO_ADD_COUNTERS. */ 252/* The argument to IPT_SO_ADD_COUNTERS. */
270struct ipt_counters_info 253#define ipt_counters_info xt_counters_info
271{
272 /* Which table. */
273 char name[IPT_TABLE_MAXNAMELEN];
274
275 unsigned int num_counters;
276
277 /* The counters (actually `number' of these). */
278 struct ipt_counters counters[0];
279};
280 254
281/* The argument to IPT_SO_GET_ENTRIES. */ 255/* The argument to IPT_SO_GET_ENTRIES. */
282struct ipt_get_entries 256struct ipt_get_entries
@@ -291,19 +265,10 @@ struct ipt_get_entries
291 struct ipt_entry entrytable[0]; 265 struct ipt_entry entrytable[0];
292}; 266};
293 267
294/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
295 * kernel supports, if >= revision. */
296struct ipt_get_revision
297{
298 char name[IPT_FUNCTION_MAXNAMELEN-1];
299
300 u_int8_t revision;
301};
302
303/* Standard return verdict, or do jump. */ 268/* Standard return verdict, or do jump. */
304#define IPT_STANDARD_TARGET "" 269#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
305/* Error verdict. */ 270/* Error verdict. */
306#define IPT_ERROR_TARGET "ERROR" 271#define IPT_ERROR_TARGET XT_ERROR_TARGET
307 272
308/* Helper functions */ 273/* Helper functions */
309static __inline__ struct ipt_entry_target * 274static __inline__ struct ipt_entry_target *
@@ -356,103 +321,18 @@ ipt_get_target(struct ipt_entry *e)
356#include <linux/init.h> 321#include <linux/init.h>
357extern void ipt_init(void) __init; 322extern void ipt_init(void) __init;
358 323
359struct ipt_match 324#define ipt_register_target(tgt) xt_register_target(AF_INET, tgt)
360{ 325#define ipt_unregister_target(tgt) xt_unregister_target(AF_INET, tgt)
361 struct list_head list;
362
363 const char name[IPT_FUNCTION_MAXNAMELEN-1];
364
365 u_int8_t revision;
366
367 /* Return true or false: return FALSE and set *hotdrop = 1 to
368 force immediate packet drop. */
369 /* Arguments changed since 2.4, as this must now handle
370 non-linear skbs, using skb_copy_bits and
371 skb_ip_make_writable. */
372 int (*match)(const struct sk_buff *skb,
373 const struct net_device *in,
374 const struct net_device *out,
375 const void *matchinfo,
376 int offset,
377 int *hotdrop);
378
379 /* Called when user tries to insert an entry of this type. */
380 /* Should return true or false. */
381 int (*checkentry)(const char *tablename,
382 const struct ipt_ip *ip,
383 void *matchinfo,
384 unsigned int matchinfosize,
385 unsigned int hook_mask);
386
387 /* Called when entry of this type deleted. */
388 void (*destroy)(void *matchinfo, unsigned int matchinfosize);
389
390 /* Set this to THIS_MODULE. */
391 struct module *me;
392};
393
394/* Registration hooks for targets. */
395struct ipt_target
396{
397 struct list_head list;
398
399 const char name[IPT_FUNCTION_MAXNAMELEN-1];
400
401 u_int8_t revision;
402
403 /* Called when user tries to insert an entry of this type:
404 hook_mask is a bitmask of hooks from which it can be
405 called. */
406 /* Should return true or false. */
407 int (*checkentry)(const char *tablename,
408 const struct ipt_entry *e,
409 void *targinfo,
410 unsigned int targinfosize,
411 unsigned int hook_mask);
412
413 /* Called when entry of this type deleted. */
414 void (*destroy)(void *targinfo, unsigned int targinfosize);
415
416 /* Returns verdict. Argument order changed since 2.4, as this
417 must now handle non-linear skbs, using skb_copy_bits and
418 skb_ip_make_writable. */
419 unsigned int (*target)(struct sk_buff **pskb,
420 const struct net_device *in,
421 const struct net_device *out,
422 unsigned int hooknum,
423 const void *targinfo,
424 void *userdata);
425
426 /* Set this to THIS_MODULE. */
427 struct module *me;
428};
429 326
430extern int ipt_register_target(struct ipt_target *target); 327#define ipt_register_match(mtch) xt_register_match(AF_INET, mtch)
431extern void ipt_unregister_target(struct ipt_target *target); 328#define ipt_unregister_match(mtch) xt_unregister_match(AF_INET, mtch)
432 329
433extern int ipt_register_match(struct ipt_match *match); 330//#define ipt_register_table(tbl, repl) xt_register_table(AF_INET, tbl, repl)
434extern void ipt_unregister_match(struct ipt_match *match); 331//#define ipt_unregister_table(tbl) xt_unregister_table(AF_INET, tbl)
435 332
436/* Furniture shopping... */ 333extern int ipt_register_table(struct ipt_table *table,
437struct ipt_table 334 const struct ipt_replace *repl);
438{ 335extern void ipt_unregister_table(struct ipt_table *table);
439 struct list_head list;
440
441 /* A unique name... */
442 char name[IPT_TABLE_MAXNAMELEN];
443
444 /* What hooks you will enter on */
445 unsigned int valid_hooks;
446
447 /* Lock for the curtain */
448 rwlock_t lock;
449
450 /* Man behind the curtain... */
451 struct ipt_table_info *private;
452
453 /* Set to THIS_MODULE. */
454 struct module *me;
455};
456 336
457/* net/sched/ipt.c: Gimme access to your targets! Gets target->me. */ 337/* net/sched/ipt.c: Gimme access to your targets! Gets target->me. */
458extern struct ipt_target *ipt_find_target(const char *name, u8 revision); 338extern struct ipt_target *ipt_find_target(const char *name, u8 revision);
@@ -476,9 +356,6 @@ struct ipt_error
476 struct ipt_error_target target; 356 struct ipt_error_target target;
477}; 357};
478 358
479extern int ipt_register_table(struct ipt_table *table,
480 const struct ipt_replace *repl);
481extern void ipt_unregister_table(struct ipt_table *table);
482extern unsigned int ipt_do_table(struct sk_buff **pskb, 359extern unsigned int ipt_do_table(struct sk_buff **pskb,
483 unsigned int hook, 360 unsigned int hook,
484 const struct net_device *in, 361 const struct net_device *in,
@@ -486,6 +363,6 @@ extern unsigned int ipt_do_table(struct sk_buff **pskb,
486 struct ipt_table *table, 363 struct ipt_table *table,
487 void *userdata); 364 void *userdata);
488 365
489#define IPT_ALIGN(s) (((s) + (__alignof__(struct ipt_entry)-1)) & ~(__alignof__(struct ipt_entry)-1)) 366#define IPT_ALIGN(s) XT_ALIGN(s)
490#endif /*__KERNEL__*/ 367#endif /*__KERNEL__*/
491#endif /* _IPTABLES_H */ 368#endif /* _IPTABLES_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
index 7596e3dd00ca..a46d511b5c36 100644
--- a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
+++ b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_CLASSIFY_H 1#ifndef _IPT_CLASSIFY_H
2#define _IPT_CLASSIFY_H 2#define _IPT_CLASSIFY_H
3 3
4struct ipt_classify_target_info { 4#include <linux/netfilter/xt_CLASSIFY.h>
5 u_int32_t priority; 5#define ipt_classify_target_info xt_classify_target_info
6};
7 6
8#endif /*_IPT_CLASSIFY_H */ 7#endif /*_IPT_CLASSIFY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CONNMARK.h b/include/linux/netfilter_ipv4/ipt_CONNMARK.h
index d3c02536fc4c..9ecfee0a9e33 100644
--- a/include/linux/netfilter_ipv4/ipt_CONNMARK.h
+++ b/include/linux/netfilter_ipv4/ipt_CONNMARK.h
@@ -9,17 +9,11 @@
9 * the Free Software Foundation; either version 2 of the License, or 9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version. 10 * (at your option) any later version.
11 */ 11 */
12#include <linux/netfilter/xt_CONNMARK.h>
13#define IPT_CONNMARK_SET XT_CONNMARK_SET
14#define IPT_CONNMARK_SAVE XT_CONNMARK_SAVE
15#define IPT_CONNMARK_RESTORE XT_CONNMARK_RESTORE
12 16
13enum { 17#define ipt_connmark_target_info xt_connmark_target_info
14 IPT_CONNMARK_SET = 0,
15 IPT_CONNMARK_SAVE,
16 IPT_CONNMARK_RESTORE
17};
18
19struct ipt_connmark_target_info {
20 unsigned long mark;
21 unsigned long mask;
22 u_int8_t mode;
23};
24 18
25#endif /*_IPT_CONNMARK_H_target*/ 19#endif /*_IPT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_MARK.h b/include/linux/netfilter_ipv4/ipt_MARK.h
index f47485790ed4..697a486a96d3 100644
--- a/include/linux/netfilter_ipv4/ipt_MARK.h
+++ b/include/linux/netfilter_ipv4/ipt_MARK.h
@@ -1,20 +1,18 @@
1#ifndef _IPT_MARK_H_target 1#ifndef _IPT_MARK_H_target
2#define _IPT_MARK_H_target 2#define _IPT_MARK_H_target
3 3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_MARK.h>
7
4/* Version 0 */ 8/* Version 0 */
5struct ipt_mark_target_info { 9#define ipt_mark_target_info xt_mark_target_info
6 unsigned long mark;
7};
8 10
9/* Version 1 */ 11/* Version 1 */
10enum { 12#define IPT_MARK_SET XT_MARK_SET
11 IPT_MARK_SET=0, 13#define IPT_MARK_AND XT_MARK_AND
12 IPT_MARK_AND, 14#define IPT_MARK_OR XT_MARK_OR
13 IPT_MARK_OR 15
14}; 16#define ipt_mark_target_info_v1 xt_mark_target_info_v1
15 17
16struct ipt_mark_target_info_v1 {
17 unsigned long mark;
18 u_int8_t mode;
19};
20#endif /*_IPT_MARK_H_target*/ 18#endif /*_IPT_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
index b5b2943b0c66..97a2a7557cb9 100644
--- a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
+++ b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
@@ -8,9 +8,9 @@
8#ifndef _IPT_NFQ_TARGET_H 8#ifndef _IPT_NFQ_TARGET_H
9#define _IPT_NFQ_TARGET_H 9#define _IPT_NFQ_TARGET_H
10 10
11/* target info */ 11/* Backwards compatibility for old userspace */
12struct ipt_NFQ_info { 12#include <linux/netfilter/xt_NFQUEUE.h>
13 u_int16_t queuenum; 13
14}; 14#define ipt_NFQ_info xt_NFQ_info
15 15
16#endif /* _IPT_DSCP_TARGET_H */ 16#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_comment.h b/include/linux/netfilter_ipv4/ipt_comment.h
index 85c1123c29ce..ae2afc2f7481 100644
--- a/include/linux/netfilter_ipv4/ipt_comment.h
+++ b/include/linux/netfilter_ipv4/ipt_comment.h
@@ -1,10 +1,10 @@
1#ifndef _IPT_COMMENT_H 1#ifndef _IPT_COMMENT_H
2#define _IPT_COMMENT_H 2#define _IPT_COMMENT_H
3 3
4#define IPT_MAX_COMMENT_LEN 256 4#include <linux/netfilter/xt_comment.h>
5 5
6struct ipt_comment_info { 6#define IPT_MAX_COMMENT_LEN XT_MAX_COMMENT_LEN
7 unsigned char comment[IPT_MAX_COMMENT_LEN]; 7
8}; 8#define ipt_comment_info xt_comment_info
9 9
10#endif /* _IPT_COMMENT_H */ 10#endif /* _IPT_COMMENT_H */
diff --git a/include/linux/netfilter_ipv4/ipt_connbytes.h b/include/linux/netfilter_ipv4/ipt_connbytes.h
index 9e5532f8d8ac..b04dfa3083c9 100644
--- a/include/linux/netfilter_ipv4/ipt_connbytes.h
+++ b/include/linux/netfilter_ipv4/ipt_connbytes.h
@@ -1,25 +1,18 @@
1#ifndef _IPT_CONNBYTES_H 1#ifndef _IPT_CONNBYTES_H
2#define _IPT_CONNBYTES_H 2#define _IPT_CONNBYTES_H
3 3
4enum ipt_connbytes_what { 4#include <net/netfilter/xt_connbytes.h>
5 IPT_CONNBYTES_PKTS, 5#define ipt_connbytes_what xt_connbytes_what
6 IPT_CONNBYTES_BYTES,
7 IPT_CONNBYTES_AVGPKT,
8};
9 6
10enum ipt_connbytes_direction { 7#define IPT_CONNBYTES_PKTS XT_CONNBYTES_PACKETS
11 IPT_CONNBYTES_DIR_ORIGINAL, 8#define IPT_CONNBYTES_BYTES XT_CONNBYTES_BYTES
12 IPT_CONNBYTES_DIR_REPLY, 9#define IPT_CONNBYTES_AVGPKT XT_CONNBYTES_AVGPKT
13 IPT_CONNBYTES_DIR_BOTH, 10
14}; 11#define ipt_connbytes_direction xt_connbytes_direction
12#define IPT_CONNBYTES_DIR_ORIGINAL XT_CONNBYTES_DIR_ORIGINAL
13#define IPT_CONNBYTES_DIR_REPLY XT_CONNBYTES_DIR_REPLY
14#define IPT_CONNBYTES_DIR_BOTH XT_CONNBYTES_DIR_BOTH
15
16#define ipt_connbytes_info xt_connbytes_info
15 17
16struct ipt_connbytes_info
17{
18 struct {
19 aligned_u64 from; /* count to be matched */
20 aligned_u64 to; /* count to be matched */
21 } count;
22 u_int8_t what; /* ipt_connbytes_what */
23 u_int8_t direction; /* ipt_connbytes_direction */
24};
25#endif 18#endif
diff --git a/include/linux/netfilter_ipv4/ipt_connmark.h b/include/linux/netfilter_ipv4/ipt_connmark.h
index 46573270d9aa..c7ba6560d44c 100644
--- a/include/linux/netfilter_ipv4/ipt_connmark.h
+++ b/include/linux/netfilter_ipv4/ipt_connmark.h
@@ -1,18 +1,7 @@
1#ifndef _IPT_CONNMARK_H 1#ifndef _IPT_CONNMARK_H
2#define _IPT_CONNMARK_H 2#define _IPT_CONNMARK_H
3 3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> 4#include <linux/netfilter/xt_connmark.h>
5 * by Henrik Nordstrom <hno@marasystems.com> 5#define ipt_connmark_info xt_connmark_info
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13struct ipt_connmark_info {
14 unsigned long mark, mask;
15 u_int8_t invert;
16};
17 6
18#endif /*_IPT_CONNMARK_H*/ 7#endif /*_IPT_CONNMARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_conntrack.h b/include/linux/netfilter_ipv4/ipt_conntrack.h
index 413c5658bd3a..cde6762949c5 100644
--- a/include/linux/netfilter_ipv4/ipt_conntrack.h
+++ b/include/linux/netfilter_ipv4/ipt_conntrack.h
@@ -5,56 +5,24 @@
5#ifndef _IPT_CONNTRACK_H 5#ifndef _IPT_CONNTRACK_H
6#define _IPT_CONNTRACK_H 6#define _IPT_CONNTRACK_H
7 7
8#define IPT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 8#include <linux/netfilter/xt_conntrack.h>
9#define IPT_CONNTRACK_STATE_INVALID (1 << 0)
10 9
11#define IPT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1)) 10#define IPT_CONNTRACK_STATE_BIT(ctinfo) XT_CONNTRACK_STATE_BIT(ctinfo)
12#define IPT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2)) 11#define IPT_CONNTRACK_STATE_INVALID XT_CONNTRACK_STATE_INVALID
13#define IPT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
14 12
15/* flags, invflags: */ 13#define IPT_CONNTRACK_STATE_SNAT XT_CONNTRACK_STATE_SNAT
16#define IPT_CONNTRACK_STATE 0x01 14#define IPT_CONNTRACK_STATE_DNAT XT_CONNTRACK_STATE_DNAT
17#define IPT_CONNTRACK_PROTO 0x02 15#define IPT_CONNTRACK_STATE_UNTRACKED XT_CONNTRACK_STATE_UNTRACKED
18#define IPT_CONNTRACK_ORIGSRC 0x04
19#define IPT_CONNTRACK_ORIGDST 0x08
20#define IPT_CONNTRACK_REPLSRC 0x10
21#define IPT_CONNTRACK_REPLDST 0x20
22#define IPT_CONNTRACK_STATUS 0x40
23#define IPT_CONNTRACK_EXPIRES 0x80
24
25/* This is exposed to userspace, so remains frozen in time. */
26struct ip_conntrack_old_tuple
27{
28 struct {
29 __u32 ip;
30 union {
31 __u16 all;
32 } u;
33 } src;
34
35 struct {
36 __u32 ip;
37 union {
38 __u16 all;
39 } u;
40
41 /* The protocol. */
42 u16 protonum;
43 } dst;
44};
45 16
46struct ipt_conntrack_info 17/* flags, invflags: */
47{ 18#define IPT_CONNTRACK_STATE XT_CONNTRACK_STATE
48 unsigned int statemask, statusmask; 19#define IPT_CONNTRACK_PROTO XT_CONNTRACK_PROTO
49 20#define IPT_CONNTRACK_ORIGSRC XT_CONNTRACK_ORIGSRC
50 struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX]; 21#define IPT_CONNTRACK_ORIGDST XT_CONNTRACK_ORIGDST
51 struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX]; 22#define IPT_CONNTRACK_REPLSRC XT_CONNTRACK_REPLSRC
52 23#define IPT_CONNTRACK_REPLDST XT_CONNTRACK_REPLDST
53 unsigned long expires_min, expires_max; 24#define IPT_CONNTRACK_STATUS XT_CONNTRACK_STATUS
54 25#define IPT_CONNTRACK_EXPIRES XT_CONNTRACK_EXPIRES
55 /* Flags word */ 26
56 u_int8_t flags; 27#define ipt_conntrack_info xt_conntrack_info
57 /* Inverse flags */
58 u_int8_t invflags;
59};
60#endif /*_IPT_CONNTRACK_H*/ 28#endif /*_IPT_CONNTRACK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_dccp.h b/include/linux/netfilter_ipv4/ipt_dccp.h
index 3cb3a522e62b..e70d11e1f53c 100644
--- a/include/linux/netfilter_ipv4/ipt_dccp.h
+++ b/include/linux/netfilter_ipv4/ipt_dccp.h
@@ -1,23 +1,15 @@
1#ifndef _IPT_DCCP_H_ 1#ifndef _IPT_DCCP_H_
2#define _IPT_DCCP_H_ 2#define _IPT_DCCP_H_
3 3
4#define IPT_DCCP_SRC_PORTS 0x01 4#include <linux/netfilter/xt_dccp.h>
5#define IPT_DCCP_DEST_PORTS 0x02 5#define IPT_DCCP_SRC_PORTS XT_DCCP_SRC_PORTS
6#define IPT_DCCP_TYPE 0x04 6#define IPT_DCCP_DEST_PORTS XT_DCCP_DEST_PORTS
7#define IPT_DCCP_OPTION 0x08 7#define IPT_DCCP_TYPE XT_DCCP_TYPE
8#define IPT_DCCP_OPTION XT_DCCP_OPTION
8 9
9#define IPT_DCCP_VALID_FLAGS 0x0f 10#define IPT_DCCP_VALID_FLAGS XT_DCCP_VALID_FLAGS
10 11
11struct ipt_dccp_info { 12#define ipt_dccp_info xt_dccp_info
12 u_int16_t dpts[2]; /* Min, Max */
13 u_int16_t spts[2]; /* Min, Max */
14
15 u_int16_t flags;
16 u_int16_t invflags;
17
18 u_int16_t typemask;
19 u_int8_t option;
20};
21 13
22#endif /* _IPT_DCCP_H_ */ 14#endif /* _IPT_DCCP_H_ */
23 15
diff --git a/include/linux/netfilter_ipv4/ipt_helper.h b/include/linux/netfilter_ipv4/ipt_helper.h
index 6f12ecb8c93d..80452c218551 100644
--- a/include/linux/netfilter_ipv4/ipt_helper.h
+++ b/include/linux/netfilter_ipv4/ipt_helper.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_HELPER_H 1#ifndef _IPT_HELPER_H
2#define _IPT_HELPER_H 2#define _IPT_HELPER_H
3 3
4struct ipt_helper_info { 4#include <linux/netfilter/xt_helper.h>
5 int invert; 5#define ipt_helper_info xt_helper_info
6 char name[30]; 6
7};
8#endif /* _IPT_HELPER_H */ 7#endif /* _IPT_HELPER_H */
diff --git a/include/linux/netfilter_ipv4/ipt_length.h b/include/linux/netfilter_ipv4/ipt_length.h
index 6e0885229615..9b45206ffcef 100644
--- a/include/linux/netfilter_ipv4/ipt_length.h
+++ b/include/linux/netfilter_ipv4/ipt_length.h
@@ -1,9 +1,7 @@
1#ifndef _IPT_LENGTH_H 1#ifndef _IPT_LENGTH_H
2#define _IPT_LENGTH_H 2#define _IPT_LENGTH_H
3 3
4struct ipt_length_info { 4#include <linux/netfilter/xt_length.h>
5 u_int16_t min, max; 5#define ipt_length_info xt_length_info
6 u_int8_t invert;
7};
8 6
9#endif /*_IPT_LENGTH_H*/ 7#endif /*_IPT_LENGTH_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_limit.h b/include/linux/netfilter_ipv4/ipt_limit.h
index 256453409e21..92f5cd07bbc4 100644
--- a/include/linux/netfilter_ipv4/ipt_limit.h
+++ b/include/linux/netfilter_ipv4/ipt_limit.h
@@ -1,21 +1,8 @@
1#ifndef _IPT_RATE_H 1#ifndef _IPT_RATE_H
2#define _IPT_RATE_H 2#define _IPT_RATE_H
3 3
4/* timings are in milliseconds. */ 4#include <linux/netfilter/xt_limit.h>
5#define IPT_LIMIT_SCALE 10000 5#define IPT_LIMIT_SCALE XT_LIMIT_SCALE
6#define ipt_rateinfo xt_rateinfo
6 7
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
8 seconds, or one every 59 hours. */
9struct ipt_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */
12
13 /* Used internally by the kernel */
14 unsigned long prev;
15 u_int32_t credit;
16 u_int32_t credit_cap, cost;
17
18 /* Ugly, ugly fucker. */
19 struct ipt_rateinfo *master;
20};
21#endif /*_IPT_RATE_H*/ 8#endif /*_IPT_RATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mac.h b/include/linux/netfilter_ipv4/ipt_mac.h
index f8d5b8e7ccdb..b186008a3c47 100644
--- a/include/linux/netfilter_ipv4/ipt_mac.h
+++ b/include/linux/netfilter_ipv4/ipt_mac.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_MAC_H 1#ifndef _IPT_MAC_H
2#define _IPT_MAC_H 2#define _IPT_MAC_H
3 3
4struct ipt_mac_info { 4#include <linux/netfilter/xt_mac.h>
5 unsigned char srcaddr[ETH_ALEN]; 5#define ipt_mac_info xt_mac_info
6 int invert; 6
7};
8#endif /*_IPT_MAC_H*/ 7#endif /*_IPT_MAC_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mark.h b/include/linux/netfilter_ipv4/ipt_mark.h
index f3952b563d4c..bfde67c61224 100644
--- a/include/linux/netfilter_ipv4/ipt_mark.h
+++ b/include/linux/netfilter_ipv4/ipt_mark.h
@@ -1,9 +1,9 @@
1#ifndef _IPT_MARK_H 1#ifndef _IPT_MARK_H
2#define _IPT_MARK_H 2#define _IPT_MARK_H
3 3
4struct ipt_mark_info { 4/* Backwards compatibility for old userspace */
5 unsigned long mark, mask; 5#include <linux/netfilter/xt_mark.h>
6 u_int8_t invert; 6
7}; 7#define ipt_mark_info xt_mark_info
8 8
9#endif /*_IPT_MARK_H*/ 9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_physdev.h b/include/linux/netfilter_ipv4/ipt_physdev.h
index 7538c8655ec0..2400e7140f26 100644
--- a/include/linux/netfilter_ipv4/ipt_physdev.h
+++ b/include/linux/netfilter_ipv4/ipt_physdev.h
@@ -1,24 +1,17 @@
1#ifndef _IPT_PHYSDEV_H 1#ifndef _IPT_PHYSDEV_H
2#define _IPT_PHYSDEV_H 2#define _IPT_PHYSDEV_H
3 3
4#ifdef __KERNEL__ 4/* Backwards compatibility for old userspace */
5#include <linux/if.h>
6#endif
7 5
8#define IPT_PHYSDEV_OP_IN 0x01 6#include <linux/netfilter/xt_physdev.h>
9#define IPT_PHYSDEV_OP_OUT 0x02
10#define IPT_PHYSDEV_OP_BRIDGED 0x04
11#define IPT_PHYSDEV_OP_ISIN 0x08
12#define IPT_PHYSDEV_OP_ISOUT 0x10
13#define IPT_PHYSDEV_OP_MASK (0x20 - 1)
14 7
15struct ipt_physdev_info { 8#define IPT_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
16 char physindev[IFNAMSIZ]; 9#define IPT_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
17 char in_mask[IFNAMSIZ]; 10#define IPT_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
18 char physoutdev[IFNAMSIZ]; 11#define IPT_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
19 char out_mask[IFNAMSIZ]; 12#define IPT_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
20 u_int8_t invert; 13#define IPT_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
21 u_int8_t bitmask; 14
22}; 15#define ipt_physdev_info xt_physdev_info
23 16
24#endif /*_IPT_PHYSDEV_H*/ 17#endif /*_IPT_PHYSDEV_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_pkttype.h b/include/linux/netfilter_ipv4/ipt_pkttype.h
index d53a65848683..ff1fbc949a0c 100644
--- a/include/linux/netfilter_ipv4/ipt_pkttype.h
+++ b/include/linux/netfilter_ipv4/ipt_pkttype.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_PKTTYPE_H 1#ifndef _IPT_PKTTYPE_H
2#define _IPT_PKTTYPE_H 2#define _IPT_PKTTYPE_H
3 3
4struct ipt_pkttype_info { 4#include <linux/netfilter/xt_pkttype.h>
5 int pkttype; 5#define ipt_pkttype_info xt_pkttype_info
6 int invert; 6
7};
8#endif /*_IPT_PKTTYPE_H*/ 7#endif /*_IPT_PKTTYPE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
new file mode 100644
index 000000000000..7fd1bec453f1
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_policy.h
@@ -0,0 +1,52 @@
1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H
3
4#define IPT_POLICY_MAX_ELEM 4
5
6enum ipt_policy_flags
7{
8 IPT_POLICY_MATCH_IN = 0x1,
9 IPT_POLICY_MATCH_OUT = 0x2,
10 IPT_POLICY_MATCH_NONE = 0x4,
11 IPT_POLICY_MATCH_STRICT = 0x8,
12};
13
14enum ipt_policy_modes
15{
16 IPT_POLICY_MODE_TRANSPORT,
17 IPT_POLICY_MODE_TUNNEL
18};
19
20struct ipt_policy_spec
21{
22 u_int8_t saddr:1,
23 daddr:1,
24 proto:1,
25 mode:1,
26 spi:1,
27 reqid:1;
28};
29
30struct ipt_policy_elem
31{
32 u_int32_t saddr;
33 u_int32_t smask;
34 u_int32_t daddr;
35 u_int32_t dmask;
36 u_int32_t spi;
37 u_int32_t reqid;
38 u_int8_t proto;
39 u_int8_t mode;
40
41 struct ipt_policy_spec match;
42 struct ipt_policy_spec invert;
43};
44
45struct ipt_policy_info
46{
47 struct ipt_policy_elem pol[IPT_POLICY_MAX_ELEM];
48 u_int16_t flags;
49 u_int16_t len;
50};
51
52#endif /* _IPT_POLICY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_realm.h b/include/linux/netfilter_ipv4/ipt_realm.h
index a4d6698723ac..b3996eaa0188 100644
--- a/include/linux/netfilter_ipv4/ipt_realm.h
+++ b/include/linux/netfilter_ipv4/ipt_realm.h
@@ -1,10 +1,7 @@
1#ifndef _IPT_REALM_H 1#ifndef _IPT_REALM_H
2#define _IPT_REALM_H 2#define _IPT_REALM_H
3 3
4struct ipt_realm_info { 4#include <linux/netfilter/xt_realm.h>
5 u_int32_t id; 5#define ipt_realm_info xt_realm_info
6 u_int32_t mask;
7 u_int8_t invert;
8};
9 6
10#endif /* _IPT_REALM_H */ 7#endif /* _IPT_REALM_H */
diff --git a/include/linux/netfilter_ipv4/ipt_state.h b/include/linux/netfilter_ipv4/ipt_state.h
index 5df37868933d..a44a99cc28cc 100644
--- a/include/linux/netfilter_ipv4/ipt_state.h
+++ b/include/linux/netfilter_ipv4/ipt_state.h
@@ -1,13 +1,15 @@
1#ifndef _IPT_STATE_H 1#ifndef _IPT_STATE_H
2#define _IPT_STATE_H 2#define _IPT_STATE_H
3 3
4#define IPT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 4/* Backwards compatibility for old userspace */
5#define IPT_STATE_INVALID (1 << 0)
6 5
7#define IPT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) 6#include <linux/netfilter/xt_state.h>
7
8#define IPT_STATE_BIT XT_STATE_BIT
9#define IPT_STATE_INVALID XT_STATE_INVALID
10
11#define IPT_STATE_UNTRACKED XT_STATE_UNTRACKED
12
13#define ipt_state_info xt_state_info
8 14
9struct ipt_state_info
10{
11 unsigned int statemask;
12};
13#endif /*_IPT_STATE_H*/ 15#endif /*_IPT_STATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_string.h b/include/linux/netfilter_ipv4/ipt_string.h
index a265f6e44eab..c26de3059903 100644
--- a/include/linux/netfilter_ipv4/ipt_string.h
+++ b/include/linux/netfilter_ipv4/ipt_string.h
@@ -1,18 +1,10 @@
1#ifndef _IPT_STRING_H 1#ifndef _IPT_STRING_H
2#define _IPT_STRING_H 2#define _IPT_STRING_H
3 3
4#define IPT_STRING_MAX_PATTERN_SIZE 128 4#include <linux/netfilter/xt_string.h>
5#define IPT_STRING_MAX_ALGO_NAME_SIZE 16
6 5
7struct ipt_string_info 6#define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE
8{ 7#define IPT_STRING_MAX_ALGO_NAME_SIZE XT_STRING_MAX_ALGO_NAME_SIZE
9 u_int16_t from_offset; 8#define ipt_string_info xt_string_info
10 u_int16_t to_offset;
11 char algo[IPT_STRING_MAX_ALGO_NAME_SIZE];
12 char pattern[IPT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen;
14 u_int8_t invert;
15 struct ts_config __attribute__((aligned(8))) *config;
16};
17 9
18#endif /*_IPT_STRING_H*/ 10#endif /*_IPT_STRING_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_tcpmss.h b/include/linux/netfilter_ipv4/ipt_tcpmss.h
index e2b14397f701..18bbc8e8e009 100644
--- a/include/linux/netfilter_ipv4/ipt_tcpmss.h
+++ b/include/linux/netfilter_ipv4/ipt_tcpmss.h
@@ -1,9 +1,7 @@
1#ifndef _IPT_TCPMSS_MATCH_H 1#ifndef _IPT_TCPMSS_MATCH_H
2#define _IPT_TCPMSS_MATCH_H 2#define _IPT_TCPMSS_MATCH_H
3 3
4struct ipt_tcpmss_match_info { 4#include <linux/netfilter/xt_tcpmss.h>
5 u_int16_t mss_min, mss_max; 5#define ipt_tcpmss_match_info xt_tcpmss_match_info
6 u_int8_t invert;
7};
8 6
9#endif /*_IPT_TCPMSS_MATCH_H*/ 7#endif /*_IPT_TCPMSS_MATCH_H*/
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 53b2983f6278..14f2bd010884 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -72,7 +72,12 @@ enum nf_ip6_hook_priorities {
72 NF_IP6_PRI_LAST = INT_MAX, 72 NF_IP6_PRI_LAST = INT_MAX,
73}; 73};
74 74
75#ifdef CONFIG_NETFILTER
75extern int ipv6_netfilter_init(void); 76extern int ipv6_netfilter_init(void);
76extern void ipv6_netfilter_fini(void); 77extern void ipv6_netfilter_fini(void);
78#else /* CONFIG_NETFILTER */
79static inline int ipv6_netfilter_init(void) { return 0; }
80static inline void ipv6_netfilter_fini(void) { return; }
81#endif /* CONFIG_NETFILTER */
77 82
78#endif /*__LINUX_IP6_NETFILTER_H*/ 83#endif /*__LINUX_IP6_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index c163ba31aab7..f249b574f0fa 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -25,8 +25,15 @@
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv6.h> 26#include <linux/netfilter_ipv6.h>
27 27
28#define IP6T_FUNCTION_MAXNAMELEN 30 28#include <linux/netfilter/x_tables.h>
29#define IP6T_TABLE_MAXNAMELEN 32 29
30#define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
31#define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
32
33#define ip6t_match xt_match
34#define ip6t_target xt_target
35#define ip6t_table xt_table
36#define ip6t_get_revision xt_get_revision
30 37
31/* Yes, Virginia, you have to zero the padding. */ 38/* Yes, Virginia, you have to zero the padding. */
32struct ip6t_ip6 { 39struct ip6t_ip6 {
@@ -104,10 +111,7 @@ struct ip6t_standard_target
104 int verdict; 111 int verdict;
105}; 112};
106 113
107struct ip6t_counters 114#define ip6t_counters xt_counters
108{
109 u_int64_t pcnt, bcnt; /* Packet and byte counters */
110};
111 115
112/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */ 116/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
113#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper 117#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper
@@ -123,7 +127,7 @@ struct ip6t_counters
123#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ 127#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
124#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ 128#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
125#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */ 129#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */
126#define IP6T_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 130#define IP6T_INV_PROTO XT_INV_PROTO
127#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */ 131#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */
128 132
129/* This structure defines each of the firewall rules. Consists of 3 133/* This structure defines each of the firewall rules. Consists of 3
@@ -145,7 +149,7 @@ struct ip6t_entry
145 unsigned int comefrom; 149 unsigned int comefrom;
146 150
147 /* Packet and byte counters. */ 151 /* Packet and byte counters. */
148 struct ip6t_counters counters; 152 struct xt_counters counters;
149 153
150 /* The matches (if any), then the target. */ 154 /* The matches (if any), then the target. */
151 unsigned char elems[0]; 155 unsigned char elems[0];
@@ -155,54 +159,41 @@ struct ip6t_entry
155 * New IP firewall options for [gs]etsockopt at the RAW IP level. 159 * New IP firewall options for [gs]etsockopt at the RAW IP level.
156 * Unlike BSD Linux inherits IP options so you don't have to use 160 * Unlike BSD Linux inherits IP options so you don't have to use
157 * a raw socket for this. Instead we check rights in the calls. */ 161 * a raw socket for this. Instead we check rights in the calls. */
158#define IP6T_BASE_CTL 64 /* base for firewall socket options */ 162#define IP6T_BASE_CTL XT_BASE_CTL
159 163
160#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL) 164#define IP6T_SO_SET_REPLACE XT_SO_SET_REPLACE
161#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1) 165#define IP6T_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS
162#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS 166#define IP6T_SO_SET_MAX XT_SO_SET_MAX
163 167
164#define IP6T_SO_GET_INFO (IP6T_BASE_CTL) 168#define IP6T_SO_GET_INFO XT_SO_GET_INFO
165#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1) 169#define IP6T_SO_GET_ENTRIES XT_SO_GET_ENTRIES
166#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 2) 170#define IP6T_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH
167#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 3) 171#define IP6T_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET
168#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET 172#define IP6T_SO_GET_MAX XT_SO_GET_REVISION_TARGET
169 173
170/* CONTINUE verdict for targets */ 174/* CONTINUE verdict for targets */
171#define IP6T_CONTINUE 0xFFFFFFFF 175#define IP6T_CONTINUE XT_CONTINUE
172 176
173/* For standard target */ 177/* For standard target */
174#define IP6T_RETURN (-NF_REPEAT - 1) 178#define IP6T_RETURN XT_RETURN
175 179
176/* TCP matching stuff */ 180/* TCP/UDP matching stuff */
177struct ip6t_tcp 181#include <linux/netfilter/xt_tcpudp.h>
178{ 182
179 u_int16_t spts[2]; /* Source port range. */ 183#define ip6t_tcp xt_tcp
180 u_int16_t dpts[2]; /* Destination port range. */ 184#define ip6t_udp xt_udp
181 u_int8_t option; /* TCP Option iff non-zero*/
182 u_int8_t flg_mask; /* TCP flags mask byte */
183 u_int8_t flg_cmp; /* TCP flags compare byte */
184 u_int8_t invflags; /* Inverse flags */
185};
186 185
187/* Values for "inv" field in struct ipt_tcp. */ 186/* Values for "inv" field in struct ipt_tcp. */
188#define IP6T_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 187#define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT
189#define IP6T_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 188#define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT
190#define IP6T_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ 189#define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS
191#define IP6T_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ 190#define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION
192#define IP6T_TCP_INV_MASK 0x0F /* All possible flags. */ 191#define IP6T_TCP_INV_MASK XT_TCP_INV_MASK
193
194/* UDP matching stuff */
195struct ip6t_udp
196{
197 u_int16_t spts[2]; /* Source port range. */
198 u_int16_t dpts[2]; /* Destination port range. */
199 u_int8_t invflags; /* Inverse flags */
200};
201 192
202/* Values for "invflags" field in struct ipt_udp. */ 193/* Values for "invflags" field in struct ipt_udp. */
203#define IP6T_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 194#define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT
204#define IP6T_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 195#define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT
205#define IP6T_UDP_INV_MASK 0x03 /* All possible flags. */ 196#define IP6T_UDP_INV_MASK XT_UDP_INV_MASK
206 197
207/* ICMP matching stuff */ 198/* ICMP matching stuff */
208struct ip6t_icmp 199struct ip6t_icmp
@@ -264,23 +255,14 @@ struct ip6t_replace
264 /* Number of counters (must be equal to current number of entries). */ 255 /* Number of counters (must be equal to current number of entries). */
265 unsigned int num_counters; 256 unsigned int num_counters;
266 /* The old entries' counters. */ 257 /* The old entries' counters. */
267 struct ip6t_counters __user *counters; 258 struct xt_counters __user *counters;
268 259
269 /* The entries (hang off end: not really an array). */ 260 /* The entries (hang off end: not really an array). */
270 struct ip6t_entry entries[0]; 261 struct ip6t_entry entries[0];
271}; 262};
272 263
273/* The argument to IP6T_SO_ADD_COUNTERS. */ 264/* The argument to IP6T_SO_ADD_COUNTERS. */
274struct ip6t_counters_info 265#define ip6t_counters_info xt_counters_info
275{
276 /* Which table. */
277 char name[IP6T_TABLE_MAXNAMELEN];
278
279 unsigned int num_counters;
280
281 /* The counters (actually `number' of these). */
282 struct ip6t_counters counters[0];
283};
284 266
285/* The argument to IP6T_SO_GET_ENTRIES. */ 267/* The argument to IP6T_SO_GET_ENTRIES. */
286struct ip6t_get_entries 268struct ip6t_get_entries
@@ -295,19 +277,10 @@ struct ip6t_get_entries
295 struct ip6t_entry entrytable[0]; 277 struct ip6t_entry entrytable[0];
296}; 278};
297 279
298/* The argument to IP6T_SO_GET_REVISION_*. Returns highest revision
299 * kernel supports, if >= revision. */
300struct ip6t_get_revision
301{
302 char name[IP6T_FUNCTION_MAXNAMELEN-1];
303
304 u_int8_t revision;
305};
306
307/* Standard return verdict, or do jump. */ 280/* Standard return verdict, or do jump. */
308#define IP6T_STANDARD_TARGET "" 281#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
309/* Error verdict. */ 282/* Error verdict. */
310#define IP6T_ERROR_TARGET "ERROR" 283#define IP6T_ERROR_TARGET XT_ERROR_TARGET
311 284
312/* Helper functions */ 285/* Helper functions */
313static __inline__ struct ip6t_entry_target * 286static __inline__ struct ip6t_entry_target *
@@ -361,104 +334,11 @@ ip6t_get_target(struct ip6t_entry *e)
361#include <linux/init.h> 334#include <linux/init.h>
362extern void ip6t_init(void) __init; 335extern void ip6t_init(void) __init;
363 336
364struct ip6t_match 337#define ip6t_register_target(tgt) xt_register_target(AF_INET6, tgt)
365{ 338#define ip6t_unregister_target(tgt) xt_unregister_target(AF_INET6, tgt)
366 struct list_head list;
367
368 const char name[IP6T_FUNCTION_MAXNAMELEN-1];
369
370 u_int8_t revision;
371
372 /* Return true or false: return FALSE and set *hotdrop = 1 to
373 force immediate packet drop. */
374 /* Arguments changed since 2.6.9, as this must now handle
375 non-linear skb, using skb_header_pointer and
376 skb_ip_make_writable. */
377 int (*match)(const struct sk_buff *skb,
378 const struct net_device *in,
379 const struct net_device *out,
380 const void *matchinfo,
381 int offset,
382 unsigned int protoff,
383 int *hotdrop);
384
385 /* Called when user tries to insert an entry of this type. */
386 /* Should return true or false. */
387 int (*checkentry)(const char *tablename,
388 const struct ip6t_ip6 *ip,
389 void *matchinfo,
390 unsigned int matchinfosize,
391 unsigned int hook_mask);
392
393 /* Called when entry of this type deleted. */
394 void (*destroy)(void *matchinfo, unsigned int matchinfosize);
395
396 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
397 struct module *me;
398};
399
400/* Registration hooks for targets. */
401struct ip6t_target
402{
403 struct list_head list;
404
405 const char name[IP6T_FUNCTION_MAXNAMELEN-1];
406
407 u_int8_t revision;
408
409 /* Returns verdict. Argument order changed since 2.6.9, as this
410 must now handle non-linear skbs, using skb_copy_bits and
411 skb_ip_make_writable. */
412 unsigned int (*target)(struct sk_buff **pskb,
413 const struct net_device *in,
414 const struct net_device *out,
415 unsigned int hooknum,
416 const void *targinfo,
417 void *userdata);
418
419 /* Called when user tries to insert an entry of this type:
420 hook_mask is a bitmask of hooks from which it can be
421 called. */
422 /* Should return true or false. */
423 int (*checkentry)(const char *tablename,
424 const struct ip6t_entry *e,
425 void *targinfo,
426 unsigned int targinfosize,
427 unsigned int hook_mask);
428
429 /* Called when entry of this type deleted. */
430 void (*destroy)(void *targinfo, unsigned int targinfosize);
431
432 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
433 struct module *me;
434};
435
436extern int ip6t_register_target(struct ip6t_target *target);
437extern void ip6t_unregister_target(struct ip6t_target *target);
438
439extern int ip6t_register_match(struct ip6t_match *match);
440extern void ip6t_unregister_match(struct ip6t_match *match);
441 339
442/* Furniture shopping... */ 340#define ip6t_register_match(match) xt_register_match(AF_INET6, match)
443struct ip6t_table 341#define ip6t_unregister_match(match) xt_unregister_match(AF_INET6, match)
444{
445 struct list_head list;
446
447 /* A unique name... */
448 char name[IP6T_TABLE_MAXNAMELEN];
449
450 /* What hooks you will enter on */
451 unsigned int valid_hooks;
452
453 /* Lock for the curtain */
454 rwlock_t lock;
455
456 /* Man behind the curtain... */
457 struct ip6t_table_info *private;
458
459 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
460 struct module *me;
461};
462 342
463extern int ip6t_register_table(struct ip6t_table *table, 343extern int ip6t_register_table(struct ip6t_table *table,
464 const struct ip6t_replace *repl); 344 const struct ip6t_replace *repl);
diff --git a/include/linux/netfilter_ipv6/ip6t_MARK.h b/include/linux/netfilter_ipv6/ip6t_MARK.h
index 7ade8d8f5246..7cf629a8ab92 100644
--- a/include/linux/netfilter_ipv6/ip6t_MARK.h
+++ b/include/linux/netfilter_ipv6/ip6t_MARK.h
@@ -1,8 +1,9 @@
1#ifndef _IP6T_MARK_H_target 1#ifndef _IP6T_MARK_H_target
2#define _IP6T_MARK_H_target 2#define _IP6T_MARK_H_target
3 3
4struct ip6t_mark_target_info { 4/* Backwards compatibility for old userspace */
5 unsigned long mark; 5#include <linux/netfilter/xt_MARK.h>
6};
7 6
8#endif /*_IPT_MARK_H_target*/ 7#define ip6t_mark_target_info xt_mark_target_info
8
9#endif /*_IP6T_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/linux/netfilter_ipv6/ip6t_ah.h
index c4f0793a0a98..8531879eb464 100644
--- a/include/linux/netfilter_ipv6/ip6t_ah.h
+++ b/include/linux/netfilter_ipv6/ip6t_ah.h
@@ -18,13 +18,4 @@ struct ip6t_ah
18#define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */ 18#define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */
19#define IP6T_AH_INV_MASK 0x03 /* All possible flags. */ 19#define IP6T_AH_INV_MASK 0x03 /* All possible flags. */
20 20
21#define MASK_HOPOPTS 128
22#define MASK_DSTOPTS 64
23#define MASK_ROUTING 32
24#define MASK_FRAGMENT 16
25#define MASK_AH 8
26#define MASK_ESP 4
27#define MASK_NONE 2
28#define MASK_PROTO 1
29
30#endif /*_IP6T_AH_H*/ 21#endif /*_IP6T_AH_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_esp.h b/include/linux/netfilter_ipv6/ip6t_esp.h
index 01142b98a231..a91b6abc8079 100644
--- a/include/linux/netfilter_ipv6/ip6t_esp.h
+++ b/include/linux/netfilter_ipv6/ip6t_esp.h
@@ -7,15 +7,6 @@ struct ip6t_esp
7 u_int8_t invflags; /* Inverse flags */ 7 u_int8_t invflags; /* Inverse flags */
8}; 8};
9 9
10#define MASK_HOPOPTS 128
11#define MASK_DSTOPTS 64
12#define MASK_ROUTING 32
13#define MASK_FRAGMENT 16
14#define MASK_AH 8
15#define MASK_ESP 4
16#define MASK_NONE 2
17#define MASK_PROTO 1
18
19/* Values for "invflags" field in struct ip6t_esp. */ 10/* Values for "invflags" field in struct ip6t_esp. */
20#define IP6T_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ 11#define IP6T_ESP_INV_SPI 0x01 /* Invert the sense of spi. */
21#define IP6T_ESP_INV_MASK 0x01 /* All possible flags. */ 12#define IP6T_ESP_INV_MASK 0x01 /* All possible flags. */
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/linux/netfilter_ipv6/ip6t_frag.h
index 449a57eca7dd..66070a0d6dfc 100644
--- a/include/linux/netfilter_ipv6/ip6t_frag.h
+++ b/include/linux/netfilter_ipv6/ip6t_frag.h
@@ -21,13 +21,4 @@ struct ip6t_frag
21#define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */ 21#define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */
22#define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */ 22#define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */
23 23
24#define MASK_HOPOPTS 128
25#define MASK_DSTOPTS 64
26#define MASK_ROUTING 32
27#define MASK_FRAGMENT 16
28#define MASK_AH 8
29#define MASK_ESP 4
30#define MASK_NONE 2
31#define MASK_PROTO 1
32
33#endif /*_IP6T_FRAG_H*/ 24#endif /*_IP6T_FRAG_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_length.h b/include/linux/netfilter_ipv6/ip6t_length.h
index 7fc09f9f9d63..9e9689d03ed7 100644
--- a/include/linux/netfilter_ipv6/ip6t_length.h
+++ b/include/linux/netfilter_ipv6/ip6t_length.h
@@ -1,10 +1,8 @@
1#ifndef _IP6T_LENGTH_H 1#ifndef _IP6T_LENGTH_H
2#define _IP6T_LENGTH_H 2#define _IP6T_LENGTH_H
3 3
4struct ip6t_length_info { 4#include <linux/netfilter/xt_length.h>
5 u_int16_t min, max; 5#define ip6t_length_info xt_length_info
6 u_int8_t invert;
7};
8 6
9#endif /*_IP6T_LENGTH_H*/ 7#endif /*_IP6T_LENGTH_H*/
10 8
diff --git a/include/linux/netfilter_ipv6/ip6t_limit.h b/include/linux/netfilter_ipv6/ip6t_limit.h
index f2866e50f3b4..487e5ea342c6 100644
--- a/include/linux/netfilter_ipv6/ip6t_limit.h
+++ b/include/linux/netfilter_ipv6/ip6t_limit.h
@@ -1,21 +1,8 @@
1#ifndef _IP6T_RATE_H 1#ifndef _IP6T_RATE_H
2#define _IP6T_RATE_H 2#define _IP6T_RATE_H
3 3
4/* timings are in milliseconds. */ 4#include <linux/netfilter/xt_limit.h>
5#define IP6T_LIMIT_SCALE 10000 5#define IP6T_LIMIT_SCALE XT_LIMIT_SCALE
6#define ip6t_rateinfo xt_rateinfo
6 7
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 8#endif /*_IP6T_RATE_H*/
8 seconds, or one every 59 hours. */
9struct ip6t_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */
12
13 /* Used internally by the kernel */
14 unsigned long prev;
15 u_int32_t credit;
16 u_int32_t credit_cap, cost;
17
18 /* Ugly, ugly fucker. */
19 struct ip6t_rateinfo *master;
20};
21#endif /*_IPT_RATE_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mac.h b/include/linux/netfilter_ipv6/ip6t_mac.h
index 87c088c21848..ac58e83e9423 100644
--- a/include/linux/netfilter_ipv6/ip6t_mac.h
+++ b/include/linux/netfilter_ipv6/ip6t_mac.h
@@ -1,8 +1,7 @@
1#ifndef _IP6T_MAC_H 1#ifndef _IP6T_MAC_H
2#define _IP6T_MAC_H 2#define _IP6T_MAC_H
3 3
4struct ip6t_mac_info { 4#include <linux/netfilter/xt_mac.h>
5 unsigned char srcaddr[ETH_ALEN]; 5#define ip6t_mac_info xt_mac_info
6 int invert; 6
7}; 7#endif /*_IP6T_MAC_H*/
8#endif /*_IPT_MAC_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mark.h b/include/linux/netfilter_ipv6/ip6t_mark.h
index a734441e1c19..ff204951ddc3 100644
--- a/include/linux/netfilter_ipv6/ip6t_mark.h
+++ b/include/linux/netfilter_ipv6/ip6t_mark.h
@@ -1,9 +1,9 @@
1#ifndef _IP6T_MARK_H 1#ifndef _IP6T_MARK_H
2#define _IP6T_MARK_H 2#define _IP6T_MARK_H
3 3
4struct ip6t_mark_info { 4/* Backwards compatibility for old userspace */
5 unsigned long mark, mask; 5#include <linux/netfilter/xt_mark.h>
6 u_int8_t invert; 6
7}; 7#define ip6t_mark_info xt_mark_info
8 8
9#endif /*_IPT_MARK_H*/ 9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/linux/netfilter_ipv6/ip6t_opts.h
index e259b6275bd2..a07e36380ae8 100644
--- a/include/linux/netfilter_ipv6/ip6t_opts.h
+++ b/include/linux/netfilter_ipv6/ip6t_opts.h
@@ -20,13 +20,4 @@ struct ip6t_opts
20#define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */ 20#define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */
21#define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */ 21#define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */
22 22
23#define MASK_HOPOPTS 128
24#define MASK_DSTOPTS 64
25#define MASK_ROUTING 32
26#define MASK_FRAGMENT 16
27#define MASK_AH 8
28#define MASK_ESP 4
29#define MASK_NONE 2
30#define MASK_PROTO 1
31
32#endif /*_IP6T_OPTS_H*/ 23#endif /*_IP6T_OPTS_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_physdev.h b/include/linux/netfilter_ipv6/ip6t_physdev.h
index c234731cd66b..c161c0a81b55 100644
--- a/include/linux/netfilter_ipv6/ip6t_physdev.h
+++ b/include/linux/netfilter_ipv6/ip6t_physdev.h
@@ -1,24 +1,17 @@
1#ifndef _IP6T_PHYSDEV_H 1#ifndef _IP6T_PHYSDEV_H
2#define _IP6T_PHYSDEV_H 2#define _IP6T_PHYSDEV_H
3 3
4#ifdef __KERNEL__ 4/* Backwards compatibility for old userspace */
5#include <linux/if.h>
6#endif
7 5
8#define IP6T_PHYSDEV_OP_IN 0x01 6#include <linux/netfilter/xt_physdev.h>
9#define IP6T_PHYSDEV_OP_OUT 0x02
10#define IP6T_PHYSDEV_OP_BRIDGED 0x04
11#define IP6T_PHYSDEV_OP_ISIN 0x08
12#define IP6T_PHYSDEV_OP_ISOUT 0x10
13#define IP6T_PHYSDEV_OP_MASK (0x20 - 1)
14 7
15struct ip6t_physdev_info { 8#define IP6T_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
16 char physindev[IFNAMSIZ]; 9#define IP6T_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
17 char in_mask[IFNAMSIZ]; 10#define IP6T_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
18 char physoutdev[IFNAMSIZ]; 11#define IP6T_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
19 char out_mask[IFNAMSIZ]; 12#define IP6T_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
20 u_int8_t invert; 13#define IP6T_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
21 u_int8_t bitmask; 14
22}; 15#define ip6t_physdev_info xt_physdev_info
23 16
24#endif /*_IP6T_PHYSDEV_H*/ 17#endif /*_IP6T_PHYSDEV_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
new file mode 100644
index 000000000000..5a93afcd2ff1
--- /dev/null
+++ b/include/linux/netfilter_ipv6/ip6t_policy.h
@@ -0,0 +1,52 @@
1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H
3
4#define IP6T_POLICY_MAX_ELEM 4
5
6enum ip6t_policy_flags
7{
8 IP6T_POLICY_MATCH_IN = 0x1,
9 IP6T_POLICY_MATCH_OUT = 0x2,
10 IP6T_POLICY_MATCH_NONE = 0x4,
11 IP6T_POLICY_MATCH_STRICT = 0x8,
12};
13
14enum ip6t_policy_modes
15{
16 IP6T_POLICY_MODE_TRANSPORT,
17 IP6T_POLICY_MODE_TUNNEL
18};
19
20struct ip6t_policy_spec
21{
22 u_int8_t saddr:1,
23 daddr:1,
24 proto:1,
25 mode:1,
26 spi:1,
27 reqid:1;
28};
29
30struct ip6t_policy_elem
31{
32 struct in6_addr saddr;
33 struct in6_addr smask;
34 struct in6_addr daddr;
35 struct in6_addr dmask;
36 u_int32_t spi;
37 u_int32_t reqid;
38 u_int8_t proto;
39 u_int8_t mode;
40
41 struct ip6t_policy_spec match;
42 struct ip6t_policy_spec invert;
43};
44
45struct ip6t_policy_info
46{
47 struct ip6t_policy_elem pol[IP6T_POLICY_MAX_ELEM];
48 u_int16_t flags;
49 u_int16_t len;
50};
51
52#endif /* _IP6T_POLICY_H */
diff --git a/include/linux/netfilter_ipv6/ip6t_rt.h b/include/linux/netfilter_ipv6/ip6t_rt.h
index f1070fbf2757..52156023e8db 100644
--- a/include/linux/netfilter_ipv6/ip6t_rt.h
+++ b/include/linux/netfilter_ipv6/ip6t_rt.h
@@ -30,13 +30,4 @@ struct ip6t_rt
30#define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */ 30#define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */
31#define IP6T_RT_INV_MASK 0x07 /* All possible flags. */ 31#define IP6T_RT_INV_MASK 0x07 /* All possible flags. */
32 32
33#define MASK_HOPOPTS 128
34#define MASK_DSTOPTS 64
35#define MASK_ROUTING 32
36#define MASK_FRAGMENT 16
37#define MASK_AH 8
38#define MASK_ESP 4
39#define MASK_NONE 2
40#define MASK_PROTO 1
41
42#endif /*_IP6T_RT_H*/ 33#endif /*_IP6T_RT_H*/
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 51c231a1e5a6..ec7c2e872d72 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -124,7 +124,7 @@ int nfsd_statfs(struct svc_rqst *, struct svc_fh *,
124 124
125int nfsd_notify_change(struct inode *, struct iattr *); 125int nfsd_notify_change(struct inode *, struct iattr *);
126int nfsd_permission(struct svc_export *, struct dentry *, int); 126int nfsd_permission(struct svc_export *, struct dentry *, int);
127void nfsd_sync_dir(struct dentry *dp); 127int nfsd_sync_dir(struct dentry *dp);
128 128
129#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 129#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
130#ifdef CONFIG_NFSD_V2_ACL 130#ifdef CONFIG_NFSD_V2_ACL
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index bb842ea41033..0798b7781a6e 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -294,7 +294,7 @@ fill_post_wcc(struct svc_fh *fhp)
294/* 294/*
295 * Lock a file handle/inode 295 * Lock a file handle/inode
296 * NOTE: both fh_lock and fh_unlock are done "by hand" in 296 * NOTE: both fh_lock and fh_unlock are done "by hand" in
297 * vfs.c:nfsd_rename as it needs to grab 2 i_sem's at once 297 * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once
298 * so, any changes here should be reflected there. 298 * so, any changes here should be reflected there.
299 */ 299 */
300static inline void 300static inline void
@@ -317,7 +317,7 @@ fh_lock(struct svc_fh *fhp)
317 } 317 }
318 318
319 inode = dentry->d_inode; 319 inode = dentry->d_inode;
320 down(&inode->i_sem); 320 mutex_lock(&inode->i_mutex);
321 fill_pre_wcc(fhp); 321 fill_pre_wcc(fhp);
322 fhp->fh_locked = 1; 322 fhp->fh_locked = 1;
323} 323}
@@ -333,7 +333,7 @@ fh_unlock(struct svc_fh *fhp)
333 333
334 if (fhp->fh_locked) { 334 if (fhp->fh_locked) {
335 fill_post_wcc(fhp); 335 fill_post_wcc(fhp);
336 up(&fhp->fh_dentry->d_inode->i_sem); 336 mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex);
337 fhp->fh_locked = 0; 337 fhp->fh_locked = 0;
338 } 338 }
339} 339}
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 8903688890ce..77adba7d2281 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -145,8 +145,9 @@ struct nfsd4_lock {
145 } ok; 145 } ok;
146 struct nfsd4_lock_denied denied; 146 struct nfsd4_lock_denied denied;
147 } u; 147 } u;
148 148 /* The lk_replay_owner is the open owner in the open_to_lock_owner
149 struct nfs4_stateowner *lk_stateowner; 149 * case and the lock owner otherwise: */
150 struct nfs4_stateowner *lk_replay_owner;
150}; 151};
151#define lk_new_open_seqid v.new.open_seqid 152#define lk_new_open_seqid v.new.open_seqid
152#define lk_new_open_stateid v.new.open_stateid 153#define lk_new_open_stateid v.new.open_stateid
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index def32c5715be..8eb7fa76c1d0 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -5,6 +5,9 @@
5 * pages. A pagevec is a multipage container which is used for that. 5 * pages. A pagevec is a multipage container which is used for that.
6 */ 6 */
7 7
8#ifndef _LINUX_PAGEVEC_H
9#define _LINUX_PAGEVEC_H
10
8/* 14 pointers + two long's align the pagevec structure to a power of two */ 11/* 14 pointers + two long's align the pagevec structure to a power of two */
9#define PAGEVEC_SIZE 14 12#define PAGEVEC_SIZE 14
10 13
@@ -83,3 +86,5 @@ static inline void pagevec_lru_add(struct pagevec *pvec)
83 if (pagevec_count(pvec)) 86 if (pagevec_count(pvec))
84 __pagevec_lru_add(pvec); 87 __pagevec_lru_add(pvec);
85} 88}
89
90#endif /* _LINUX_PAGEVEC_H */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index f7ff0b0c4031..f67f838a3a1f 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -236,12 +236,14 @@ struct pardevice {
236 236
237/* IEEE1284 information */ 237/* IEEE1284 information */
238 238
239/* IEEE1284 phases */ 239/* IEEE1284 phases. These are exposed to userland through ppdev IOCTL
240 * PP[GS]ETPHASE, so do not change existing values. */
240enum ieee1284_phase { 241enum ieee1284_phase {
241 IEEE1284_PH_FWD_DATA, 242 IEEE1284_PH_FWD_DATA,
242 IEEE1284_PH_FWD_IDLE, 243 IEEE1284_PH_FWD_IDLE,
243 IEEE1284_PH_TERMINATE, 244 IEEE1284_PH_TERMINATE,
244 IEEE1284_PH_NEGOTIATION, 245 IEEE1284_PH_NEGOTIATION,
246 IEEE1284_PH_HBUSY_DNA,
245 IEEE1284_PH_REV_IDLE, 247 IEEE1284_PH_REV_IDLE,
246 IEEE1284_PH_HBUSY_DAVAIL, 248 IEEE1284_PH_HBUSY_DAVAIL,
247 IEEE1284_PH_REV_DATA, 249 IEEE1284_PH_REV_DATA,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index de690ca73d58..0a44072383ec 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -78,6 +78,23 @@ typedef int __bitwise pci_power_t;
78#define PCI_UNKNOWN ((pci_power_t __force) 5) 78#define PCI_UNKNOWN ((pci_power_t __force) 5)
79#define PCI_POWER_ERROR ((pci_power_t __force) -1) 79#define PCI_POWER_ERROR ((pci_power_t __force) -1)
80 80
81/** The pci_channel state describes connectivity between the CPU and
82 * the pci device. If some PCI bus between here and the pci device
83 * has crashed or locked up, this info is reflected here.
84 */
85typedef unsigned int __bitwise pci_channel_state_t;
86
87enum pci_channel_state {
88 /* I/O channel is in normal state */
89 pci_channel_io_normal = (__force pci_channel_state_t) 1,
90
91 /* I/O to channel is blocked */
92 pci_channel_io_frozen = (__force pci_channel_state_t) 2,
93
94 /* PCI card is dead */
95 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
96};
97
81/* 98/*
82 * The pci_dev structure is used to describe PCI devices. 99 * The pci_dev structure is used to describe PCI devices.
83 */ 100 */
@@ -98,6 +115,7 @@ struct pci_dev {
98 unsigned int class; /* 3 bytes: (base,sub,prog-if) */ 115 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
99 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 116 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
100 u8 rom_base_reg; /* which config register controls the ROM */ 117 u8 rom_base_reg; /* which config register controls the ROM */
118 u8 pin; /* which interrupt pin this device uses */
101 119
102 struct pci_driver *driver; /* which driver has allocated this device */ 120 struct pci_driver *driver; /* which driver has allocated this device */
103 u64 dma_mask; /* Mask of the bits of bus address this 121 u64 dma_mask; /* Mask of the bits of bus address this
@@ -110,6 +128,7 @@ struct pci_dev {
110 this is D0-D3, D0 being fully functional, 128 this is D0-D3, D0 being fully functional,
111 and D3 being off. */ 129 and D3 being off. */
112 130
131 pci_channel_state_t error_state; /* current connectivity state */
113 struct device dev; /* Generic device interface */ 132 struct device dev; /* Generic device interface */
114 133
115 /* device is compatible with these IDs */ 134 /* device is compatible with these IDs */
@@ -232,6 +251,54 @@ struct pci_dynids {
232 unsigned int use_driver_data:1; /* pci_driver->driver_data is used */ 251 unsigned int use_driver_data:1; /* pci_driver->driver_data is used */
233}; 252};
234 253
254/* ---------------------------------------------------------------- */
255/** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
256 * a set fof callbacks in struct pci_error_handlers, then that device driver
257 * will be notified of PCI bus errors, and will be driven to recovery
258 * when an error occurs.
259 */
260
261typedef unsigned int __bitwise pci_ers_result_t;
262
263enum pci_ers_result {
264 /* no result/none/not supported in device driver */
265 PCI_ERS_RESULT_NONE = (__force pci_ers_result_t) 1,
266
267 /* Device driver can recover without slot reset */
268 PCI_ERS_RESULT_CAN_RECOVER = (__force pci_ers_result_t) 2,
269
270 /* Device driver wants slot to be reset. */
271 PCI_ERS_RESULT_NEED_RESET = (__force pci_ers_result_t) 3,
272
273 /* Device has completely failed, is unrecoverable */
274 PCI_ERS_RESULT_DISCONNECT = (__force pci_ers_result_t) 4,
275
276 /* Device driver is fully recovered and operational */
277 PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5,
278};
279
280/* PCI bus error event callbacks */
281struct pci_error_handlers
282{
283 /* PCI bus error detected on this device */
284 pci_ers_result_t (*error_detected)(struct pci_dev *dev,
285 enum pci_channel_state error);
286
287 /* MMIO has been re-enabled, but not DMA */
288 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
289
290 /* PCI Express link has been reset */
291 pci_ers_result_t (*link_reset)(struct pci_dev *dev);
292
293 /* PCI slot has been reset */
294 pci_ers_result_t (*slot_reset)(struct pci_dev *dev);
295
296 /* Device driver may resume normal operations */
297 void (*resume)(struct pci_dev *dev);
298};
299
300/* ---------------------------------------------------------------- */
301
235struct module; 302struct module;
236struct pci_driver { 303struct pci_driver {
237 struct list_head node; 304 struct list_head node;
@@ -244,6 +311,7 @@ struct pci_driver {
244 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ 311 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
245 void (*shutdown) (struct pci_dev *dev); 312 void (*shutdown) (struct pci_dev *dev);
246 313
314 struct pci_error_handlers *err_handler;
247 struct device_driver driver; 315 struct device_driver driver;
248 struct pci_dynids dynids; 316 struct pci_dynids dynids;
249}; 317};
@@ -448,6 +516,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
448 516
449void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 517void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
450 void *userdata); 518 void *userdata);
519int pci_cfg_space_size(struct pci_dev *dev);
451 520
452/* kmem_cache style wrapper around pci_alloc_consistent() */ 521/* kmem_cache style wrapper around pci_alloc_consistent() */
453 522
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index a213e999de31..ecc1fc1f0f04 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -181,6 +181,7 @@
181#define PCI_DEVICE_ID_LSI_FC929X 0x0626 181#define PCI_DEVICE_ID_LSI_FC929X 0x0626
182#define PCI_DEVICE_ID_LSI_FC939X 0x0642 182#define PCI_DEVICE_ID_LSI_FC939X 0x0642
183#define PCI_DEVICE_ID_LSI_FC949X 0x0640 183#define PCI_DEVICE_ID_LSI_FC949X 0x0640
184#define PCI_DEVICE_ID_LSI_FC949ES 0x0646
184#define PCI_DEVICE_ID_LSI_FC919X 0x0628 185#define PCI_DEVICE_ID_LSI_FC919X 0x0628
185#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701 186#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701
186#define PCI_DEVICE_ID_LSI_61C102 0x0901 187#define PCI_DEVICE_ID_LSI_61C102 0x0901
@@ -377,6 +378,7 @@
377#define PCI_DEVICE_ID_NS_87560_USB 0x0012 378#define PCI_DEVICE_ID_NS_87560_USB 0x0012
378#define PCI_DEVICE_ID_NS_83815 0x0020 379#define PCI_DEVICE_ID_NS_83815 0x0020
379#define PCI_DEVICE_ID_NS_83820 0x0022 380#define PCI_DEVICE_ID_NS_83820 0x0022
381#define PCI_DEVICE_ID_NS_CS5535_ISA 0x002b
380#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d 382#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
381#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e 383#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
382#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f 384#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
@@ -500,6 +502,14 @@
500#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d 502#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d
501#define PCI_DEVICE_ID_AMD_8151_0 0x7454 503#define PCI_DEVICE_ID_AMD_8151_0 0x7454
502#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 504#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450
505#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
506#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
507#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093
508#define PCI_DEVICE_ID_AMD_CS5536_OHC 0x2094
509#define PCI_DEVICE_ID_AMD_CS5536_EHC 0x2095
510#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096
511#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097
512#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
503 513
504#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 514#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
505 515
@@ -1041,6 +1051,11 @@
1041#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6 1051#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6
1042#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea 1052#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea
1043#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee 1053#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee
1054#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0
1055#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1 0x00f1
1056#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2
1057#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3
1058#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9
1044#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 1059#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
1045#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 1060#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
1046#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 1061#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103
@@ -1583,6 +1598,23 @@
1583#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009 1598#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009
1584#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A 1599#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A
1585#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B 1600#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B
1601#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ 0x000C
1602#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_PTM 0x000D
1603#define PCI_SUBDEVICE_ID_CONNECT_TECH_NT960PCI 0x0100
1604#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2 0x0201
1605#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4 0x0202
1606#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232 0x0300
1607#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232 0x0301
1608#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232 0x0302
1609#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1 0x0310
1610#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2 0x0311
1611#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4 0x0312
1612#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2 0x0320
1613#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4 0x0321
1614#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8 0x0322
1615#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485 0x0330
1616#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 0x0331
1617#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 0x0332
1586 1618
1587 1619
1588#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 1620#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2
@@ -1960,6 +1992,7 @@
1960#define PCI_VENDOR_ID_DCI 0x6666 1992#define PCI_VENDOR_ID_DCI 0x6666
1961#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 1993#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001
1962#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 1994#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002
1995#define PCI_DEVICE_ID_DCI_PCCOM2 0x0004
1963 1996
1964#define PCI_VENDOR_ID_INTEL 0x8086 1997#define PCI_VENDOR_ID_INTEL 0x8086
1965#define PCI_DEVICE_ID_INTEL_EESSC 0x0008 1998#define PCI_DEVICE_ID_INTEL_EESSC 0x0008
@@ -2121,6 +2154,9 @@
2121#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 2154#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004
2122#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 2155#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
2123 2156
2157#define PCI_VENDOR_ID_SCALEMP 0x8686
2158#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
2159
2124#define PCI_VENDOR_ID_COMPUTONE 0x8e0e 2160#define PCI_VENDOR_ID_COMPUTONE 0x8e0e
2125#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 2161#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291
2126#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 2162#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index e2a089b051ed..d27a78b71297 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -196,6 +196,7 @@
196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ 196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
199#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */
199#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 200#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
200#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 201#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
201#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 202#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index fb8d2d24e4bb..cb9039a21f2a 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -19,7 +19,6 @@
19 19
20struct percpu_data { 20struct percpu_data {
21 void *ptrs[NR_CPUS]; 21 void *ptrs[NR_CPUS];
22 void *blkp;
23}; 22};
24 23
25/* 24/*
@@ -33,14 +32,14 @@ struct percpu_data {
33 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 32 (__typeof__(ptr))__p->ptrs[(cpu)]; \
34}) 33})
35 34
36extern void *__alloc_percpu(size_t size, size_t align); 35extern void *__alloc_percpu(size_t size);
37extern void free_percpu(const void *); 36extern void free_percpu(const void *);
38 37
39#else /* CONFIG_SMP */ 38#else /* CONFIG_SMP */
40 39
41#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 40#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
42 41
43static inline void *__alloc_percpu(size_t size, size_t align) 42static inline void *__alloc_percpu(size_t size)
44{ 43{
45 void *ret = kmalloc(size, GFP_KERNEL); 44 void *ret = kmalloc(size, GFP_KERNEL);
46 if (ret) 45 if (ret)
@@ -55,7 +54,6 @@ static inline void free_percpu(const void *ptr)
55#endif /* CONFIG_SMP */ 54#endif /* CONFIG_SMP */
56 55
57/* Simple wrapper for the common case: zeros memory. */ 56/* Simple wrapper for the common case: zeros memory. */
58#define alloc_percpu(type) \ 57#define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type))))
59 ((type *)(__alloc_percpu(sizeof(type), __alignof__(type))))
60 58
61#endif /* __LINUX_PERCPU_H */ 59#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 6351c4055ace..bac0fb389cf1 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -104,7 +104,7 @@ struct sadb_prop {
104/* followed by: 104/* followed by:
105 struct sadb_comb sadb_combs[(sadb_prop_len + 105 struct sadb_comb sadb_combs[(sadb_prop_len +
106 sizeof(uint64_t) - sizeof(struct sadb_prop)) / 106 sizeof(uint64_t) - sizeof(struct sadb_prop)) /
107 sizeof(strut sadb_comb)]; */ 107 sizeof(struct sadb_comb)]; */
108 108
109struct sadb_comb { 109struct sadb_comb {
110 uint8_t sadb_comb_auth; 110 uint8_t sadb_comb_auth;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 92a9696fdebe..331521a10a2d 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -53,6 +53,9 @@
53 53
54#define PHY_MAX_ADDR 32 54#define PHY_MAX_ADDR 32
55 55
56/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
57#define PHY_ID_FMT "%x:%02x"
58
56/* The Bus class for PHYs. Devices which provide access to 59/* The Bus class for PHYs. Devices which provide access to
57 * PHYs should register using this structure */ 60 * PHYs should register using this structure */
58struct mii_bus { 61struct mii_bus {
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 1767073df26f..b12e59c75752 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -37,7 +37,7 @@ struct pipe_inode_info {
37 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ 37 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
38#define PIPE_SIZE PAGE_SIZE 38#define PIPE_SIZE PAGE_SIZE
39 39
40#define PIPE_SEM(inode) (&(inode).i_sem) 40#define PIPE_MUTEX(inode) (&(inode).i_mutex)
41#define PIPE_WAIT(inode) (&(inode).i_pipe->wait) 41#define PIPE_WAIT(inode) (&(inode).i_pipe->wait)
42#define PIPE_READERS(inode) ((inode).i_pipe->readers) 42#define PIPE_READERS(inode) ((inode).i_pipe->readers)
43#define PIPE_WRITERS(inode) ((inode).i_pipe->writers) 43#define PIPE_WRITERS(inode) ((inode).i_pipe->writers)
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index 373bd3b9b330..217d3daf7336 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -140,7 +140,7 @@ extern int find_via_pmu(void);
140 140
141extern int pmu_request(struct adb_request *req, 141extern int pmu_request(struct adb_request *req,
142 void (*done)(struct adb_request *), int nbytes, ...); 142 void (*done)(struct adb_request *), int nbytes, ...);
143 143extern int pmu_queue_request(struct adb_request *req);
144extern void pmu_poll(void); 144extern void pmu_poll(void);
145extern void pmu_poll_adb(void); /* For use by xmon */ 145extern void pmu_poll_adb(void); /* For use by xmon */
146extern void pmu_wait_complete(struct adb_request *req); 146extern void pmu_wait_complete(struct adb_request *req);
@@ -160,12 +160,6 @@ extern void pmu_unlock(void);
160extern int pmu_present(void); 160extern int pmu_present(void);
161extern int pmu_get_model(void); 161extern int pmu_get_model(void);
162 162
163extern int pmu_i2c_combined_read(int bus, int addr, int subaddr, u8* data, int len);
164extern int pmu_i2c_stdsub_write(int bus, int addr, int subaddr, u8* data, int len);
165extern int pmu_i2c_simple_read(int bus, int addr, u8* data, int len);
166extern int pmu_i2c_simple_write(int bus, int addr, u8* data, int len);
167
168
169#ifdef CONFIG_PM 163#ifdef CONFIG_PM
170/* 164/*
171 * Stuff for putting the powerbook to sleep and waking it again. 165 * Stuff for putting the powerbook to sleep and waking it again.
diff --git a/include/linux/poll.h b/include/linux/poll.h
index f6da702088f4..8e8f6098508a 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -92,7 +92,11 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset)
92 memset(fdset, 0, FDS_BYTES(nr)); 92 memset(fdset, 0, FDS_BYTES(nr));
93} 93}
94 94
95extern int do_select(int n, fd_set_bits *fds, long *timeout); 95#define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1)
96
97extern int do_select(int n, fd_set_bits *fds, s64 *timeout);
98extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
99 s64 *timeout);
96 100
97#endif /* KERNEL */ 101#endif /* KERNEL */
98 102
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index f942e2bad8e3..54faf5236da0 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -42,7 +42,7 @@ struct k_itimer {
42 timer_t it_id; /* timer id */ 42 timer_t it_id; /* timer id */
43 int it_overrun; /* overrun on pending signal */ 43 int it_overrun; /* overrun on pending signal */
44 int it_overrun_last; /* overrun on last delivered signal */ 44 int it_overrun_last; /* overrun on last delivered signal */
45 int it_requeue_pending; /* waiting to requeue this timer */ 45 int it_requeue_pending; /* waiting to requeue this timer */
46#define REQUEUE_PENDING 1 46#define REQUEUE_PENDING 1
47 int it_sigev_notify; /* notify word of sigevent struct */ 47 int it_sigev_notify; /* notify word of sigevent struct */
48 int it_sigev_signo; /* signo word of sigevent struct */ 48 int it_sigev_signo; /* signo word of sigevent struct */
@@ -51,10 +51,8 @@ struct k_itimer {
51 struct sigqueue *sigq; /* signal queue entry. */ 51 struct sigqueue *sigq; /* signal queue entry. */
52 union { 52 union {
53 struct { 53 struct {
54 struct timer_list timer; 54 struct hrtimer timer;
55 struct list_head abs_timer_entry; /* clock abs_timer_list */ 55 ktime_t interval;
56 struct timespec wall_to_prev; /* wall_to_monotonic used when set */
57 unsigned long incr; /* interval in jiffies */
58 } real; 56 } real;
59 struct cpu_timer_list cpu; 57 struct cpu_timer_list cpu;
60 struct { 58 struct {
@@ -66,18 +64,14 @@ struct k_itimer {
66 } it; 64 } it;
67}; 65};
68 66
69struct k_clock_abs {
70 struct list_head list;
71 spinlock_t lock;
72};
73struct k_clock { 67struct k_clock {
74 int res; /* in nano seconds */ 68 int res; /* in nanoseconds */
75 int (*clock_getres) (clockid_t which_clock, struct timespec *tp); 69 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
76 struct k_clock_abs *abs_struct; 70 int (*clock_set) (const clockid_t which_clock, struct timespec * tp);
77 int (*clock_set) (clockid_t which_clock, struct timespec * tp); 71 int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
78 int (*clock_get) (clockid_t which_clock, struct timespec * tp);
79 int (*timer_create) (struct k_itimer *timer); 72 int (*timer_create) (struct k_itimer *timer);
80 int (*nsleep) (clockid_t which_clock, int flags, struct timespec *); 73 int (*nsleep) (const clockid_t which_clock, int flags,
74 struct timespec *, struct timespec __user *);
81 int (*timer_set) (struct k_itimer * timr, int flags, 75 int (*timer_set) (struct k_itimer * timr, int flags,
82 struct itimerspec * new_setting, 76 struct itimerspec * new_setting,
83 struct itimerspec * old_setting); 77 struct itimerspec * old_setting);
@@ -87,53 +81,35 @@ struct k_clock {
87 struct itimerspec * cur_setting); 81 struct itimerspec * cur_setting);
88}; 82};
89 83
90void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock); 84void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock);
91 85
92/* Error handlers for timer_create, nanosleep and settime */ 86/* error handlers for timer_create, nanosleep and settime */
93int do_posix_clock_notimer_create(struct k_itimer *timer); 87int do_posix_clock_notimer_create(struct k_itimer *timer);
94int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *); 88int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *,
95int do_posix_clock_nosettime(clockid_t, struct timespec *tp); 89 struct timespec __user *);
90int do_posix_clock_nosettime(const clockid_t, struct timespec *tp);
96 91
97/* function to call to trigger timer event */ 92/* function to call to trigger timer event */
98int posix_timer_event(struct k_itimer *timr, int si_private); 93int posix_timer_event(struct k_itimer *timr, int si_private);
99 94
100struct now_struct { 95int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *ts);
101 unsigned long jiffies; 96int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *ts);
102}; 97int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts);
103 98int posix_cpu_timer_create(struct k_itimer *timer);
104#define posix_get_now(now) (now)->jiffies = jiffies; 99int posix_cpu_nsleep(const clockid_t which_clock, int flags,
105#define posix_time_before(timer, now) \ 100 struct timespec *rqtp, struct timespec __user *rmtp);
106 time_before((timer)->expires, (now)->jiffies) 101int posix_cpu_timer_set(struct k_itimer *timer, int flags,
107 102 struct itimerspec *new, struct itimerspec *old);
108#define posix_bump_timer(timr, now) \ 103int posix_cpu_timer_del(struct k_itimer *timer);
109 do { \ 104void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp);
110 long delta, orun; \ 105
111 delta = now.jiffies - (timr)->it.real.timer.expires; \ 106void posix_cpu_timer_schedule(struct k_itimer *timer);
112 if (delta >= 0) { \ 107
113 orun = 1 + (delta / (timr)->it.real.incr); \ 108void run_posix_cpu_timers(struct task_struct *task);
114 (timr)->it.real.timer.expires += \ 109void posix_cpu_timers_exit(struct task_struct *task);
115 orun * (timr)->it.real.incr; \ 110void posix_cpu_timers_exit_group(struct task_struct *task);
116 (timr)->it_overrun += orun; \ 111
117 } \ 112void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
118 }while (0) 113 cputime_t *newval, cputime_t *oldval);
119
120int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *);
121int posix_cpu_clock_get(clockid_t which_clock, struct timespec *);
122int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp);
123int posix_cpu_timer_create(struct k_itimer *);
124int posix_cpu_nsleep(clockid_t, int, struct timespec *);
125int posix_cpu_timer_set(struct k_itimer *, int,
126 struct itimerspec *, struct itimerspec *);
127int posix_cpu_timer_del(struct k_itimer *);
128void posix_cpu_timer_get(struct k_itimer *, struct itimerspec *);
129
130void posix_cpu_timer_schedule(struct k_itimer *);
131
132void run_posix_cpu_timers(struct task_struct *);
133void posix_cpu_timers_exit(struct task_struct *);
134void posix_cpu_timers_exit_group(struct task_struct *);
135
136void set_process_cpu_timer(struct task_struct *, unsigned int,
137 cputime_t *, cputime_t *);
138 114
139#endif 115#endif
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 74488e49166d..aa6322d45198 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -146,6 +146,11 @@ struct property;
146extern void proc_device_tree_init(void); 146extern void proc_device_tree_init(void);
147extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); 147extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
148extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); 148extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
149extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
150 struct property *prop);
151extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
152 struct property *newprop,
153 struct property *oldprop);
149#endif /* CONFIG_PROC_DEVICETREE */ 154#endif /* CONFIG_PROC_DEVICETREE */
150 155
151extern struct proc_dir_entry *proc_symlink(const char *, 156extern struct proc_dir_entry *proc_symlink(const char *,
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index b2b3dba1298d..9d5cd106b344 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -20,8 +20,6 @@
20#define PTRACE_DETACH 0x11 20#define PTRACE_DETACH 0x11
21 21
22#define PTRACE_SYSCALL 24 22#define PTRACE_SYSCALL 24
23#define PTRACE_SYSEMU 31
24#define PTRACE_SYSEMU_SINGLESTEP 32
25 23
26/* 0x4200-0x4300 are reserved for architecture-independent additions. */ 24/* 0x4200-0x4300 are reserved for architecture-independent additions. */
27#define PTRACE_SETOPTIONS 0x4200 25#define PTRACE_SETOPTIONS 0x4200
@@ -80,6 +78,8 @@
80 78
81 79
82extern long arch_ptrace(struct task_struct *child, long request, long addr, long data); 80extern long arch_ptrace(struct task_struct *child, long request, long addr, long data);
81extern struct task_struct *ptrace_get_task_struct(pid_t pid);
82extern int ptrace_traceme(void);
83extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 83extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
84extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 84extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
85extern int ptrace_attach(struct task_struct *tsk); 85extern int ptrace_attach(struct task_struct *tsk);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 36e5d269612f..c57ff2fcb30a 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -19,6 +19,7 @@
19#ifndef _LINUX_RADIX_TREE_H 19#ifndef _LINUX_RADIX_TREE_H
20#define _LINUX_RADIX_TREE_H 20#define _LINUX_RADIX_TREE_H
21 21
22#include <linux/sched.h>
22#include <linux/preempt.h> 23#include <linux/preempt.h>
23#include <linux/types.h> 24#include <linux/types.h>
24 25
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
index 48831eac2910..d0dd38b3a2fd 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -31,9 +31,11 @@ enum raid_level {
31 RAID_LEVEL_LINEAR, 31 RAID_LEVEL_LINEAR,
32 RAID_LEVEL_0, 32 RAID_LEVEL_0,
33 RAID_LEVEL_1, 33 RAID_LEVEL_1,
34 RAID_LEVEL_10,
34 RAID_LEVEL_3, 35 RAID_LEVEL_3,
35 RAID_LEVEL_4, 36 RAID_LEVEL_4,
36 RAID_LEVEL_5, 37 RAID_LEVEL_5,
38 RAID_LEVEL_50,
37 RAID_LEVEL_6, 39 RAID_LEVEL_6,
38}; 40};
39 41
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index a471f3bb713e..981f9aa43353 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -65,7 +65,11 @@ struct rcu_ctrlblk {
65 long cur; /* Current batch number. */ 65 long cur; /* Current batch number. */
66 long completed; /* Number of the last completed batch */ 66 long completed; /* Number of the last completed batch */
67 int next_pending; /* Is the next batch already waiting? */ 67 int next_pending; /* Is the next batch already waiting? */
68} ____cacheline_maxaligned_in_smp; 68
69 spinlock_t lock ____cacheline_internodealigned_in_smp;
70 cpumask_t cpumask; /* CPUs that need to switch in order */
71 /* for current batch to proceed. */
72} ____cacheline_internodealigned_in_smp;
69 73
70/* Is batch a before batch b ? */ 74/* Is batch a before batch b ? */
71static inline int rcu_batch_before(long a, long b) 75static inline int rcu_batch_before(long a, long b)
@@ -125,36 +129,7 @@ static inline void rcu_bh_qsctr_inc(int cpu)
125 rdp->passed_quiesc = 1; 129 rdp->passed_quiesc = 1;
126} 130}
127 131
128static inline int __rcu_pending(struct rcu_ctrlblk *rcp, 132extern int rcu_pending(int cpu);
129 struct rcu_data *rdp)
130{
131 /* This cpu has pending rcu entries and the grace period
132 * for them has completed.
133 */
134 if (rdp->curlist && !rcu_batch_before(rcp->completed, rdp->batch))
135 return 1;
136
137 /* This cpu has no pending entries, but there are new entries */
138 if (!rdp->curlist && rdp->nxtlist)
139 return 1;
140
141 /* This cpu has finished callbacks to invoke */
142 if (rdp->donelist)
143 return 1;
144
145 /* The rcu core waits for a quiescent state from the cpu */
146 if (rdp->quiescbatch != rcp->cur || rdp->qs_pending)
147 return 1;
148
149 /* nothing to do */
150 return 0;
151}
152
153static inline int rcu_pending(int cpu)
154{
155 return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) ||
156 __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu));
157}
158 133
159/** 134/**
160 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 135 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
diff --git a/include/linux/rcuref.h b/include/linux/rcuref.h
deleted file mode 100644
index e1adbba14b67..000000000000
--- a/include/linux/rcuref.h
+++ /dev/null
@@ -1,220 +0,0 @@
1/*
2 * rcuref.h
3 *
4 * Reference counting for elements of lists/arrays protected by
5 * RCU.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * Copyright (C) IBM Corporation, 2005
22 *
23 * Author: Dipankar Sarma <dipankar@in.ibm.com>
24 * Ravikiran Thirumalai <kiran_th@gmail.com>
25 *
26 * See Documentation/RCU/rcuref.txt for detailed user guide.
27 *
28 */
29
30#ifndef _RCUREF_H_
31#define _RCUREF_H_
32
33#ifdef __KERNEL__
34
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/spinlock.h>
38#include <asm/atomic.h>
39
40/*
41 * These APIs work on traditional atomic_t counters used in the
42 * kernel for reference counting. Under special circumstances
43 * where a lock-free get() operation races with a put() operation
44 * these APIs can be used. See Documentation/RCU/rcuref.txt.
45 */
46
47#ifdef __HAVE_ARCH_CMPXCHG
48
49/**
50 * rcuref_inc - increment refcount for object.
51 * @rcuref: reference counter in the object in question.
52 *
53 * This should be used only for objects where we use RCU and
54 * use the rcuref_inc_lf() api to acquire a reference
55 * in a lock-free reader-side critical section.
56 */
57static inline void rcuref_inc(atomic_t *rcuref)
58{
59 atomic_inc(rcuref);
60}
61
62/**
63 * rcuref_dec - decrement refcount for object.
64 * @rcuref: reference counter in the object in question.
65 *
66 * This should be used only for objects where we use RCU and
67 * use the rcuref_inc_lf() api to acquire a reference
68 * in a lock-free reader-side critical section.
69 */
70static inline void rcuref_dec(atomic_t *rcuref)
71{
72 atomic_dec(rcuref);
73}
74
75/**
76 * rcuref_dec_and_test - decrement refcount for object and test
77 * @rcuref: reference counter in the object.
78 * @release: pointer to the function that will clean up the object
79 * when the last reference to the object is released.
80 * This pointer is required.
81 *
82 * Decrement the refcount, and if 0, return 1. Else return 0.
83 *
84 * This should be used only for objects where we use RCU and
85 * use the rcuref_inc_lf() api to acquire a reference
86 * in a lock-free reader-side critical section.
87 */
88static inline int rcuref_dec_and_test(atomic_t *rcuref)
89{
90 return atomic_dec_and_test(rcuref);
91}
92
93/*
94 * cmpxchg is needed on UP too, if deletions to the list/array can happen
95 * in interrupt context.
96 */
97
98/**
99 * rcuref_inc_lf - Take reference to an object in a read-side
100 * critical section protected by RCU.
101 * @rcuref: reference counter in the object in question.
102 *
103 * Try and increment the refcount by 1. The increment might fail if
104 * the reference counter has been through a 1 to 0 transition and
105 * is no longer part of the lock-free list.
106 * Returns non-zero on successful increment and zero otherwise.
107 */
108static inline int rcuref_inc_lf(atomic_t *rcuref)
109{
110 int c, old;
111 c = atomic_read(rcuref);
112 while (c && (old = cmpxchg(&rcuref->counter, c, c + 1)) != c)
113 c = old;
114 return c;
115}
116
117#else /* !__HAVE_ARCH_CMPXCHG */
118
119extern spinlock_t __rcuref_hash[];
120
121/*
122 * Use a hash table of locks to protect the reference count
123 * since cmpxchg is not available in this arch.
124 */
125#ifdef CONFIG_SMP
126#define RCUREF_HASH_SIZE 4
127#define RCUREF_HASH(k) \
128 (&__rcuref_hash[(((unsigned long)k)>>8) & (RCUREF_HASH_SIZE-1)])
129#else
130#define RCUREF_HASH_SIZE 1
131#define RCUREF_HASH(k) &__rcuref_hash[0]
132#endif /* CONFIG_SMP */
133
134/**
135 * rcuref_inc - increment refcount for object.
136 * @rcuref: reference counter in the object in question.
137 *
138 * This should be used only for objects where we use RCU and
139 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
140 * reader-side critical section.
141 */
142static inline void rcuref_inc(atomic_t *rcuref)
143{
144 unsigned long flags;
145 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
146 rcuref->counter += 1;
147 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
148}
149
150/**
151 * rcuref_dec - decrement refcount for object.
152 * @rcuref: reference counter in the object in question.
153 *
154 * This should be used only for objects where we use RCU and
155 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
156 * reader-side critical section.
157 */
158static inline void rcuref_dec(atomic_t *rcuref)
159{
160 unsigned long flags;
161 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
162 rcuref->counter -= 1;
163 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
164}
165
166/**
167 * rcuref_dec_and_test - decrement refcount for object and test
168 * @rcuref: reference counter in the object.
169 * @release: pointer to the function that will clean up the object
170 * when the last reference to the object is released.
171 * This pointer is required.
172 *
173 * Decrement the refcount, and if 0, return 1. Else return 0.
174 *
175 * This should be used only for objects where we use RCU and
176 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
177 * reader-side critical section.
178 */
179static inline int rcuref_dec_and_test(atomic_t *rcuref)
180{
181 unsigned long flags;
182 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
183 rcuref->counter--;
184 if (!rcuref->counter) {
185 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
186 return 1;
187 } else {
188 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
189 return 0;
190 }
191}
192
193/**
194 * rcuref_inc_lf - Take reference to an object of a lock-free collection
195 * by traversing a lock-free list/array.
196 * @rcuref: reference counter in the object in question.
197 *
198 * Try and increment the refcount by 1. The increment might fail if
199 * the reference counter has been through a 1 to 0 transition and
200 * object is no longer part of the lock-free list.
201 * Returns non-zero on successful increment and zero otherwise.
202 */
203static inline int rcuref_inc_lf(atomic_t *rcuref)
204{
205 int ret;
206 unsigned long flags;
207 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
208 if (rcuref->counter)
209 ret = rcuref->counter++;
210 else
211 ret = 0;
212 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
213 return ret;
214}
215
216
217#endif /* !__HAVE_ARCH_CMPXCHG */
218
219#endif /* __KERNEL__ */
220#endif /* _RCUREF_H_ */
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 7ab2cdb83ef0..015297ff73fa 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -60,8 +60,7 @@ extern void machine_crash_shutdown(struct pt_regs *);
60 */ 60 */
61 61
62extern void kernel_restart_prepare(char *cmd); 62extern void kernel_restart_prepare(char *cmd);
63extern void kernel_halt_prepare(void); 63extern void kernel_shutdown_prepare(enum system_states state);
64extern void kernel_power_off_prepare(void);
65 64
66extern void kernel_restart(char *cmd); 65extern void kernel_restart(char *cmd);
67extern void kernel_halt(void); 66extern void kernel_halt(void);
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 001ab82df051..e276c5ba2bb7 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1857,7 +1857,7 @@ void padd_item(char *item, int total_length, int length);
1857#define GET_BLOCK_CREATE 1 /* add anything you need to find block */ 1857#define GET_BLOCK_CREATE 1 /* add anything you need to find block */
1858#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ 1858#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */
1859#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ 1859#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */
1860#define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ 1860#define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */
1861#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ 1861#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */
1862 1862
1863int restart_transaction(struct reiserfs_transaction_handle *th, 1863int restart_transaction(struct reiserfs_transaction_handle *th,
diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h
index fb7e80737325..7342e66247fb 100644
--- a/include/linux/relayfs_fs.h
+++ b/include/linux/relayfs_fs.h
@@ -65,20 +65,6 @@ struct rchan
65}; 65};
66 66
67/* 67/*
68 * Relayfs inode
69 */
70struct relayfs_inode_info
71{
72 struct inode vfs_inode;
73 struct rchan_buf *buf;
74};
75
76static inline struct relayfs_inode_info *RELAYFS_I(struct inode *inode)
77{
78 return container_of(inode, struct relayfs_inode_info, vfs_inode);
79}
80
81/*
82 * Relay channel client callbacks 68 * Relay channel client callbacks
83 */ 69 */
84struct rchan_callbacks 70struct rchan_callbacks
@@ -124,6 +110,46 @@ struct rchan_callbacks
124 */ 110 */
125 void (*buf_unmapped)(struct rchan_buf *buf, 111 void (*buf_unmapped)(struct rchan_buf *buf,
126 struct file *filp); 112 struct file *filp);
113 /*
114 * create_buf_file - create file to represent a relayfs channel buffer
115 * @filename: the name of the file to create
116 * @parent: the parent of the file to create
117 * @mode: the mode of the file to create
118 * @buf: the channel buffer
119 * @is_global: outparam - set non-zero if the buffer should be global
120 *
121 * Called during relay_open(), once for each per-cpu buffer,
122 * to allow the client to create a file to be used to
123 * represent the corresponding channel buffer. If the file is
124 * created outside of relayfs, the parent must also exist in
125 * that filesystem.
126 *
127 * The callback should return the dentry of the file created
128 * to represent the relay buffer.
129 *
130 * Setting the is_global outparam to a non-zero value will
131 * cause relay_open() to create a single global buffer rather
132 * than the default set of per-cpu buffers.
133 *
134 * See Documentation/filesystems/relayfs.txt for more info.
135 */
136 struct dentry *(*create_buf_file)(const char *filename,
137 struct dentry *parent,
138 int mode,
139 struct rchan_buf *buf,
140 int *is_global);
141
142 /*
143 * remove_buf_file - remove file representing a relayfs channel buffer
144 * @dentry: the dentry of the file to remove
145 *
146 * Called during relay_close(), once for each per-cpu buffer,
147 * to allow the client to remove a file used to represent a
148 * channel buffer.
149 *
150 * The callback should return 0 if successful, negative if not.
151 */
152 int (*remove_buf_file)(struct dentry *dentry);
127}; 153};
128 154
129/* 155/*
@@ -148,6 +174,12 @@ extern size_t relay_switch_subbuf(struct rchan_buf *buf,
148extern struct dentry *relayfs_create_dir(const char *name, 174extern struct dentry *relayfs_create_dir(const char *name,
149 struct dentry *parent); 175 struct dentry *parent);
150extern int relayfs_remove_dir(struct dentry *dentry); 176extern int relayfs_remove_dir(struct dentry *dentry);
177extern struct dentry *relayfs_create_file(const char *name,
178 struct dentry *parent,
179 int mode,
180 struct file_operations *fops,
181 void *data);
182extern int relayfs_remove_file(struct dentry *dentry);
151 183
152/** 184/**
153 * relay_write - write data into the channel 185 * relay_write - write data into the channel
@@ -247,10 +279,9 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf,
247} 279}
248 280
249/* 281/*
250 * exported relayfs file operations, fs/relayfs/inode.c 282 * exported relay file operations, fs/relayfs/inode.c
251 */ 283 */
252 284extern struct file_operations relay_file_operations;
253extern struct file_operations relayfs_file_operations;
254 285
255#endif /* _LINUX_RELAYFS_FS_H */ 286#endif /* _LINUX_RELAYFS_FS_H */
256 287
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 3bd7cce19e26..f54772d0e7f8 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -21,6 +21,7 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/string.h>
24#include <linux/rio.h> 25#include <linux/rio.h>
25 26
26extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset, 27extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset,
@@ -336,8 +337,8 @@ static inline void rio_init_dbell_res(struct resource *res, u16 start, u16 end)
336 337
337/** 338/**
338 * RIO_DEVICE - macro used to describe a specific RIO device 339 * RIO_DEVICE - macro used to describe a specific RIO device
339 * @vid: the 16 bit RIO vendor ID 340 * @dev: the 16 bit RIO device ID
340 * @did: the 16 bit RIO device ID 341 * @ven: the 16 bit RIO vendor ID
341 * 342 *
342 * This macro is used to create a struct rio_device_id that matches a 343 * This macro is used to create a struct rio_device_id that matches a
343 * specific device. The assembly vendor and assembly device fields 344 * specific device. The assembly vendor and assembly device fields
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index e1aaf1fac8e0..0b2ba67ff13c 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -11,6 +11,8 @@
11#ifndef _LINUX_RTC_H_ 11#ifndef _LINUX_RTC_H_
12#define _LINUX_RTC_H_ 12#define _LINUX_RTC_H_
13 13
14#include <linux/interrupt.h>
15
14/* 16/*
15 * The struct used to pass data via the following ioctl. Similar to the 17 * The struct used to pass data via the following ioctl. Similar to the
16 * struct tm in <time.h>, but it needs to be here so that the kernel 18 * struct tm in <time.h>, but it needs to be here so that the kernel
@@ -102,6 +104,7 @@ int rtc_register(rtc_task_t *task);
102int rtc_unregister(rtc_task_t *task); 104int rtc_unregister(rtc_task_t *task);
103int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 105int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
104void rtc_get_rtc_time(struct rtc_time *rtc_tm); 106void rtc_get_rtc_time(struct rtc_time *rtc_tm);
107irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
105 108
106#endif /* __KERNEL__ */ 109#endif /* __KERNEL__ */
107 110
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7da33619d5d0..0cfcd1c7865e 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -34,6 +34,7 @@
34#include <linux/percpu.h> 34#include <linux/percpu.h>
35#include <linux/topology.h> 35#include <linux/topology.h>
36#include <linux/seccomp.h> 36#include <linux/seccomp.h>
37#include <linux/rcupdate.h>
37 38
38#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ 39#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */
39 40
@@ -104,6 +105,7 @@ extern unsigned long nr_iowait(void);
104#include <linux/param.h> 105#include <linux/param.h>
105#include <linux/resource.h> 106#include <linux/resource.h>
106#include <linux/timer.h> 107#include <linux/timer.h>
108#include <linux/hrtimer.h>
107 109
108#include <asm/processor.h> 110#include <asm/processor.h>
109 111
@@ -158,6 +160,7 @@ extern unsigned long nr_iowait(void);
158#define SCHED_NORMAL 0 160#define SCHED_NORMAL 0
159#define SCHED_FIFO 1 161#define SCHED_FIFO 1
160#define SCHED_RR 2 162#define SCHED_RR 2
163#define SCHED_BATCH 3
161 164
162struct sched_param { 165struct sched_param {
163 int sched_priority; 166 int sched_priority;
@@ -350,8 +353,16 @@ struct sighand_struct {
350 atomic_t count; 353 atomic_t count;
351 struct k_sigaction action[_NSIG]; 354 struct k_sigaction action[_NSIG];
352 spinlock_t siglock; 355 spinlock_t siglock;
356 struct rcu_head rcu;
353}; 357};
354 358
359extern void sighand_free_cb(struct rcu_head *rhp);
360
361static inline void sighand_free(struct sighand_struct *sp)
362{
363 call_rcu(&sp->rcu, sighand_free_cb);
364}
365
355/* 366/*
356 * NOTE! "signal_struct" does not have it's own 367 * NOTE! "signal_struct" does not have it's own
357 * locking, because a shared signal_struct always 368 * locking, because a shared signal_struct always
@@ -389,8 +400,8 @@ struct signal_struct {
389 struct list_head posix_timers; 400 struct list_head posix_timers;
390 401
391 /* ITIMER_REAL timer for the process */ 402 /* ITIMER_REAL timer for the process */
392 struct timer_list real_timer; 403 struct hrtimer real_timer;
393 unsigned long it_real_value, it_real_incr; 404 ktime_t it_real_incr;
394 405
395 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 406 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
396 cputime_t it_prof_expires, it_virt_expires; 407 cputime_t it_prof_expires, it_virt_expires;
@@ -460,9 +471,9 @@ struct signal_struct {
460 471
461/* 472/*
462 * Priority of a process goes from 0..MAX_PRIO-1, valid RT 473 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
463 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL tasks are 474 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
464 * in the range MAX_RT_PRIO..MAX_PRIO-1. Priority values 475 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
465 * are inverted: lower p->prio value means higher priority. 476 * values are inverted: lower p->prio value means higher priority.
466 * 477 *
467 * The MAX_USER_RT_PRIO value allows the actual maximum 478 * The MAX_USER_RT_PRIO value allows the actual maximum
468 * RT priority to be separate from the value exported to 479 * RT priority to be separate from the value exported to
@@ -621,7 +632,14 @@ struct sched_domain {
621 632
622extern void partition_sched_domains(cpumask_t *partition1, 633extern void partition_sched_domains(cpumask_t *partition1,
623 cpumask_t *partition2); 634 cpumask_t *partition2);
624#endif /* CONFIG_SMP */ 635
636/*
637 * Maximum cache size the migration-costs auto-tuning code will
638 * search from:
639 */
640extern unsigned int max_cache_size;
641
642#endif /* CONFIG_SMP */
625 643
626 644
627struct io_context; /* See blkdev.h */ 645struct io_context; /* See blkdev.h */
@@ -679,9 +697,12 @@ struct task_struct {
679 697
680 int lock_depth; /* BKL lock depth */ 698 int lock_depth; /* BKL lock depth */
681 699
682#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) 700#if defined(CONFIG_SMP)
701 int last_waker_cpu; /* CPU that last woke this task up */
702#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
683 int oncpu; 703 int oncpu;
684#endif 704#endif
705#endif
685 int prio, static_prio; 706 int prio, static_prio;
686 struct list_head run_list; 707 struct list_head run_list;
687 prio_array_t *array; 708 prio_array_t *array;
@@ -762,6 +783,7 @@ struct task_struct {
762 unsigned keep_capabilities:1; 783 unsigned keep_capabilities:1;
763 struct user_struct *user; 784 struct user_struct *user;
764#ifdef CONFIG_KEYS 785#ifdef CONFIG_KEYS
786 struct key *request_key_auth; /* assumed request_key authority */
765 struct key *thread_keyring; /* keyring private to this thread */ 787 struct key *thread_keyring; /* keyring private to this thread */
766 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 788 unsigned char jit_keyring; /* default keyring to attach requested keys to */
767#endif 789#endif
@@ -787,6 +809,7 @@ struct task_struct {
787 struct sighand_struct *sighand; 809 struct sighand_struct *sighand;
788 810
789 sigset_t blocked, real_blocked; 811 sigset_t blocked, real_blocked;
812 sigset_t saved_sigmask; /* To be restored with TIF_RESTORE_SIGMASK */
790 struct sigpending pending; 813 struct sigpending pending;
791 814
792 unsigned long sas_ss_sp; 815 unsigned long sas_ss_sp;
@@ -807,6 +830,11 @@ struct task_struct {
807/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ 830/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
808 spinlock_t proc_lock; 831 spinlock_t proc_lock;
809 832
833#ifdef CONFIG_DEBUG_MUTEXES
834 /* mutex deadlock detection */
835 struct mutex_waiter *blocked_on;
836#endif
837
810/* journalling filesystem info */ 838/* journalling filesystem info */
811 void *journal_info; 839 void *journal_info;
812 840
@@ -844,6 +872,7 @@ struct task_struct {
844 int cpuset_mems_generation; 872 int cpuset_mems_generation;
845#endif 873#endif
846 atomic_t fs_excl; /* holding fs exclusive resources */ 874 atomic_t fs_excl; /* holding fs exclusive resources */
875 struct rcu_head rcu;
847}; 876};
848 877
849static inline pid_t process_group(struct task_struct *tsk) 878static inline pid_t process_group(struct task_struct *tsk)
@@ -867,8 +896,14 @@ static inline int pid_alive(struct task_struct *p)
867extern void free_task(struct task_struct *tsk); 896extern void free_task(struct task_struct *tsk);
868extern void __put_task_struct(struct task_struct *tsk); 897extern void __put_task_struct(struct task_struct *tsk);
869#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 898#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
870#define put_task_struct(tsk) \ 899
871do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) 900extern void __put_task_struct_cb(struct rcu_head *rhp);
901
902static inline void put_task_struct(struct task_struct *t)
903{
904 if (atomic_dec_and_test(&t->usage))
905 call_rcu(&t->rcu, __put_task_struct_cb);
906}
872 907
873/* 908/*
874 * Per process flags 909 * Per process flags
@@ -895,6 +930,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
895#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ 930#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */
896#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ 931#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */
897#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 932#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */
933#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */
898 934
899/* 935/*
900 * Only the _current_ task can read/write to tsk->flags, but other 936 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1088,21 +1124,6 @@ static inline int sas_ss_flags(unsigned long sp)
1088 : on_sig_stack(sp) ? SS_ONSTACK : 0); 1124 : on_sig_stack(sp) ? SS_ONSTACK : 0);
1089} 1125}
1090 1126
1091
1092#ifdef CONFIG_SECURITY
1093/* code is in security.c */
1094extern int capable(int cap);
1095#else
1096static inline int capable(int cap)
1097{
1098 if (cap_raised(current->cap_effective, cap)) {
1099 current->flags |= PF_SUPERPRIV;
1100 return 1;
1101 }
1102 return 0;
1103}
1104#endif
1105
1106/* 1127/*
1107 * Routines for handling mm_structs 1128 * Routines for handling mm_structs
1108 */ 1129 */
@@ -1221,6 +1242,7 @@ static inline void task_unlock(struct task_struct *p)
1221#ifndef __HAVE_THREAD_FUNCTIONS 1242#ifndef __HAVE_THREAD_FUNCTIONS
1222 1243
1223#define task_thread_info(task) (task)->thread_info 1244#define task_thread_info(task) (task)->thread_info
1245#define task_stack_page(task) ((void*)((task)->thread_info))
1224 1246
1225static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org) 1247static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org)
1226{ 1248{
@@ -1366,12 +1388,8 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm)
1366extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); 1388extern long sched_setaffinity(pid_t pid, cpumask_t new_mask);
1367extern long sched_getaffinity(pid_t pid, cpumask_t *mask); 1389extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
1368 1390
1369#ifdef CONFIG_MAGIC_SYSRQ
1370
1371extern void normalize_rt_tasks(void); 1391extern void normalize_rt_tasks(void);
1372 1392
1373#endif
1374
1375#ifdef CONFIG_PM 1393#ifdef CONFIG_PM
1376/* 1394/*
1377 * Check if a process has been frozen 1395 * Check if a process has been frozen
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
new file mode 100644
index 000000000000..6336987dae62
--- /dev/null
+++ b/include/linux/screen_info.h
@@ -0,0 +1,76 @@
1#ifndef _SCREEN_INFO_H
2#define _SCREEN_INFO_H
3
4#include <linux/types.h>
5
6/*
7 * These are set up by the setup-routine at boot-time:
8 */
9
10struct screen_info {
11 u8 orig_x; /* 0x00 */
12 u8 orig_y; /* 0x01 */
13 u16 dontuse1; /* 0x02 -- EXT_MEM_K sits here */
14 u16 orig_video_page; /* 0x04 */
15 u8 orig_video_mode; /* 0x06 */
16 u8 orig_video_cols; /* 0x07 */
17 u16 unused2; /* 0x08 */
18 u16 orig_video_ega_bx; /* 0x0a */
19 u16 unused3; /* 0x0c */
20 u8 orig_video_lines; /* 0x0e */
21 u8 orig_video_isVGA; /* 0x0f */
22 u16 orig_video_points; /* 0x10 */
23
24 /* VESA graphic mode -- linear frame buffer */
25 u16 lfb_width; /* 0x12 */
26 u16 lfb_height; /* 0x14 */
27 u16 lfb_depth; /* 0x16 */
28 u32 lfb_base; /* 0x18 */
29 u32 lfb_size; /* 0x1c */
30 u16 dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
31 u16 lfb_linelength; /* 0x24 */
32 u8 red_size; /* 0x26 */
33 u8 red_pos; /* 0x27 */
34 u8 green_size; /* 0x28 */
35 u8 green_pos; /* 0x29 */
36 u8 blue_size; /* 0x2a */
37 u8 blue_pos; /* 0x2b */
38 u8 rsvd_size; /* 0x2c */
39 u8 rsvd_pos; /* 0x2d */
40 u16 vesapm_seg; /* 0x2e */
41 u16 vesapm_off; /* 0x30 */
42 u16 pages; /* 0x32 */
43 u16 vesa_attributes; /* 0x34 */
44 /* 0x36 -- 0x3f reserved for future expansion */
45};
46
47extern struct screen_info screen_info;
48
49#define ORIG_X (screen_info.orig_x)
50#define ORIG_Y (screen_info.orig_y)
51#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
52#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
53#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
54#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
55#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
56#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
57
58#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
59#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
60#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
61#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */
62#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */
63#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
64
65#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */
66#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */
67#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */
68
69#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */
70
71#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */
72#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */
73
74#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
75
76#endif /* _SCREEN_INFO_H */
diff --git a/include/linux/sdla.h b/include/linux/sdla.h
index 3b6afb8caa42..564acd3a71c1 100644
--- a/include/linux/sdla.h
+++ b/include/linux/sdla.h
@@ -293,46 +293,46 @@ void sdla(void *cfg_info, char *dev, struct frad_conf *conf, int quiet);
293#define SDLA_S508_INTEN 0x10 293#define SDLA_S508_INTEN 0x10
294 294
295struct sdla_cmd { 295struct sdla_cmd {
296 char opp_flag __attribute__((packed)); 296 char opp_flag;
297 char cmd __attribute__((packed)); 297 char cmd;
298 short length __attribute__((packed)); 298 short length;
299 char retval __attribute__((packed)); 299 char retval;
300 short dlci __attribute__((packed)); 300 short dlci;
301 char flags __attribute__((packed)); 301 char flags;
302 short rxlost_int __attribute__((packed)); 302 short rxlost_int;
303 long rxlost_app __attribute__((packed)); 303 long rxlost_app;
304 char reserve[2] __attribute__((packed)); 304 char reserve[2];
305 char data[SDLA_MAX_DATA] __attribute__((packed)); /* transfer data buffer */ 305 char data[SDLA_MAX_DATA]; /* transfer data buffer */
306}; 306} __attribute__((packed));
307 307
308struct intr_info { 308struct intr_info {
309 char flags __attribute__((packed)); 309 char flags;
310 short txlen __attribute__((packed)); 310 short txlen;
311 char irq __attribute__((packed)); 311 char irq;
312 char flags2 __attribute__((packed)); 312 char flags2;
313 short timeout __attribute__((packed)); 313 short timeout;
314}; 314} __attribute__((packed));
315 315
316/* found in the 508's control window at RXBUF_INFO */ 316/* found in the 508's control window at RXBUF_INFO */
317struct buf_info { 317struct buf_info {
318 unsigned short rse_num __attribute__((packed)); 318 unsigned short rse_num;
319 unsigned long rse_base __attribute__((packed)); 319 unsigned long rse_base;
320 unsigned long rse_next __attribute__((packed)); 320 unsigned long rse_next;
321 unsigned long buf_base __attribute__((packed)); 321 unsigned long buf_base;
322 unsigned short reserved __attribute__((packed)); 322 unsigned short reserved;
323 unsigned long buf_top __attribute__((packed)); 323 unsigned long buf_top;
324}; 324} __attribute__((packed));
325 325
326/* structure pointed to by rse_base in RXBUF_INFO struct */ 326/* structure pointed to by rse_base in RXBUF_INFO struct */
327struct buf_entry { 327struct buf_entry {
328 char opp_flag __attribute__((packed)); 328 char opp_flag;
329 short length __attribute__((packed)); 329 short length;
330 short dlci __attribute__((packed)); 330 short dlci;
331 char flags __attribute__((packed)); 331 char flags;
332 short timestamp __attribute__((packed)); 332 short timestamp;
333 short reserved[2] __attribute__((packed)); 333 short reserved[2];
334 long buf_addr __attribute__((packed)); 334 long buf_addr;
335}; 335} __attribute__((packed));
336 336
337#endif 337#endif
338 338
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index dc89116bb1ca..cd2773b29a64 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -26,11 +26,7 @@ static inline int has_secure_computing(struct thread_info *ti)
26 26
27#else /* CONFIG_SECCOMP */ 27#else /* CONFIG_SECCOMP */
28 28
29#if (__GNUC__ > 2) 29typedef struct { } seccomp_t;
30 typedef struct { } seccomp_t;
31#else
32 typedef struct { int gcc_is_buggy; } seccomp_t;
33#endif
34 30
35#define secure_computing(x) do { } while (0) 31#define secure_computing(x) do { } while (0)
36/* static inline to preserve typechecking */ 32/* static inline to preserve typechecking */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index e3710d7e260a..ec351005bf9d 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -67,6 +67,9 @@
67/* Parisc type numbers. */ 67/* Parisc type numbers. */
68#define PORT_MUX 48 68#define PORT_MUX 48
69 69
70/* Atmel AT91RM9200 SoC */
71#define PORT_AT91RM9200 49
72
70/* Macintosh Zilog type numbers */ 73/* Macintosh Zilog type numbers */
71#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ 74#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
72#define PORT_PMAC_ZILOG 51 75#define PORT_PMAC_ZILOG 51
@@ -133,6 +136,7 @@
133#include <linux/spinlock.h> 136#include <linux/spinlock.h>
134#include <linux/sched.h> 137#include <linux/sched.h>
135#include <linux/tty.h> 138#include <linux/tty.h>
139#include <linux/mutex.h>
136 140
137struct uart_port; 141struct uart_port;
138struct uart_info; 142struct uart_info;
@@ -281,7 +285,7 @@ struct uart_state {
281 struct uart_info *info; 285 struct uart_info *info;
282 struct uart_port *port; 286 struct uart_port *port;
283 287
284 struct semaphore sem; 288 struct mutex mutex;
285}; 289};
286 290
287#define UART_XMIT_SIZE PAGE_SIZE 291#define UART_XMIT_SIZE PAGE_SIZE
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index c3e598276e78..c057f0b32318 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -26,6 +26,8 @@ struct shmem_sb_info {
26 unsigned long free_blocks; /* How many are left for allocation */ 26 unsigned long free_blocks; /* How many are left for allocation */
27 unsigned long max_inodes; /* How many inodes are allowed */ 27 unsigned long max_inodes; /* How many inodes are allowed */
28 unsigned long free_inodes; /* How many are left for allocation */ 28 unsigned long free_inodes; /* How many are left for allocation */
29 int policy; /* Default NUMA memory alloc policy */
30 nodemask_t policy_nodes; /* nodemask for preferred and bind */
29 spinlock_t stat_lock; 31 spinlock_t stat_lock;
30}; 32};
31 33
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 5dd5f02c5c5f..b7d093520bb6 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -18,6 +18,19 @@
18#define SA_PROBE SA_ONESHOT 18#define SA_PROBE SA_ONESHOT
19#define SA_SAMPLE_RANDOM SA_RESTART 19#define SA_SAMPLE_RANDOM SA_RESTART
20#define SA_SHIRQ 0x04000000 20#define SA_SHIRQ 0x04000000
21/*
22 * As above, these correspond to the IORESOURCE_IRQ_* defines in
23 * linux/ioport.h to select the interrupt line behaviour. When
24 * requesting an interrupt without specifying a SA_TRIGGER, the
25 * setting should be assumed to be "as already configured", which
26 * may be as per machine or firmware initialisation.
27 */
28#define SA_TRIGGER_LOW 0x00000008
29#define SA_TRIGGER_HIGH 0x00000004
30#define SA_TRIGGER_FALLING 0x00000002
31#define SA_TRIGGER_RISING 0x00000001
32#define SA_TRIGGER_MASK (SA_TRIGGER_HIGH|SA_TRIGGER_LOW|\
33 SA_TRIGGER_RISING|SA_TRIGGER_FALLING)
21 34
22/* 35/*
23 * Real Time signals may be queued. 36 * Real Time signals may be queued.
@@ -81,6 +94,23 @@ static inline int sigfindinword(unsigned long word)
81 94
82#endif /* __HAVE_ARCH_SIG_BITOPS */ 95#endif /* __HAVE_ARCH_SIG_BITOPS */
83 96
97static inline int sigisemptyset(sigset_t *set)
98{
99 extern void _NSIG_WORDS_is_unsupported_size(void);
100 switch (_NSIG_WORDS) {
101 case 4:
102 return (set->sig[3] | set->sig[2] |
103 set->sig[1] | set->sig[0]) == 0;
104 case 2:
105 return (set->sig[1] | set->sig[0]) == 0;
106 case 1:
107 return set->sig[0] == 0;
108 default:
109 _NSIG_WORDS_is_unsupported_size();
110 return 0;
111 }
112}
113
84#define sigmask(sig) (1UL << ((sig) - 1)) 114#define sigmask(sig) (1UL << ((sig) - 1))
85 115
86#ifndef __HAVE_ARCH_SIG_SETOPS 116#ifndef __HAVE_ARCH_SIG_SETOPS
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 483cfc47ec34..ad7cc22bd424 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -251,7 +251,7 @@ struct sk_buff {
251 * want to keep them across layers you have to do a skb_clone() 251 * want to keep them across layers you have to do a skb_clone()
252 * first. This is owned by whoever has the skb queued ATM. 252 * first. This is owned by whoever has the skb queued ATM.
253 */ 253 */
254 char cb[40]; 254 char cb[48];
255 255
256 unsigned int len, 256 unsigned int len,
257 data_len, 257 data_len,
@@ -926,7 +926,7 @@ static inline int skb_tailroom(const struct sk_buff *skb)
926 * Increase the headroom of an empty &sk_buff by reducing the tail 926 * Increase the headroom of an empty &sk_buff by reducing the tail
927 * room. This is only allowed for an empty buffer. 927 * room. This is only allowed for an empty buffer.
928 */ 928 */
929static inline void skb_reserve(struct sk_buff *skb, unsigned int len) 929static inline void skb_reserve(struct sk_buff *skb, int len)
930{ 930{
931 skb->data += len; 931 skb->data += len;
932 skb->tail += len; 932 skb->tail += len;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index d1ea4051b996..1fb77a9cc148 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -53,6 +53,8 @@ typedef struct kmem_cache kmem_cache_t;
53#define SLAB_CTOR_ATOMIC 0x002UL /* tell constructor it can't sleep */ 53#define SLAB_CTOR_ATOMIC 0x002UL /* tell constructor it can't sleep */
54#define SLAB_CTOR_VERIFY 0x004UL /* tell constructor it's a verify call */ 54#define SLAB_CTOR_VERIFY 0x004UL /* tell constructor it's a verify call */
55 55
56#ifndef CONFIG_SLOB
57
56/* prototypes */ 58/* prototypes */
57extern void __init kmem_cache_init(void); 59extern void __init kmem_cache_init(void);
58 60
@@ -134,6 +136,39 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
134extern int FASTCALL(kmem_cache_reap(int)); 136extern int FASTCALL(kmem_cache_reap(int));
135extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr)); 137extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr));
136 138
139#else /* CONFIG_SLOB */
140
141/* SLOB allocator routines */
142
143void kmem_cache_init(void);
144struct kmem_cache *kmem_find_general_cachep(size_t, gfp_t gfpflags);
145struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
146 unsigned long,
147 void (*)(void *, struct kmem_cache *, unsigned long),
148 void (*)(void *, struct kmem_cache *, unsigned long));
149int kmem_cache_destroy(struct kmem_cache *c);
150void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
151void kmem_cache_free(struct kmem_cache *c, void *b);
152const char *kmem_cache_name(struct kmem_cache *);
153void *kmalloc(size_t size, gfp_t flags);
154void *kzalloc(size_t size, gfp_t flags);
155void kfree(const void *m);
156unsigned int ksize(const void *m);
157unsigned int kmem_cache_size(struct kmem_cache *c);
158
159static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
160{
161 return kzalloc(n * size, flags);
162}
163
164#define kmem_cache_shrink(d) (0)
165#define kmem_cache_reap(a)
166#define kmem_ptr_validate(a, b) (0)
167#define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f)
168#define kmalloc_node(s, f, n) kmalloc(s, f)
169
170#endif /* CONFIG_SLOB */
171
137/* System wide caches */ 172/* System wide caches */
138extern kmem_cache_t *vm_area_cachep; 173extern kmem_cache_t *vm_area_cachep;
139extern kmem_cache_t *names_cachep; 174extern kmem_cache_t *names_cachep;
diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h
index c4153120ade6..621a3d3662f3 100644
--- a/include/linux/smb_fs.h
+++ b/include/linux/smb_fs.h
@@ -58,53 +58,6 @@ static inline struct smb_inode_info *SMB_I(struct inode *inode)
58/* where to find the base of the SMB packet proper */ 58/* where to find the base of the SMB packet proper */
59#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) 59#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4))
60 60
61#ifdef DEBUG_SMB_MALLOC
62
63#include <linux/slab.h>
64
65extern int smb_malloced;
66extern int smb_current_vmalloced;
67extern int smb_current_kmalloced;
68
69static inline void *
70smb_vmalloc(unsigned int size)
71{
72 smb_malloced += 1;
73 smb_current_vmalloced += 1;
74 return vmalloc(size);
75}
76
77static inline void
78smb_vfree(void *obj)
79{
80 smb_current_vmalloced -= 1;
81 vfree(obj);
82}
83
84static inline void *
85smb_kmalloc(size_t size, int flags)
86{
87 smb_malloced += 1;
88 smb_current_kmalloced += 1;
89 return kmalloc(size, flags);
90}
91
92static inline void
93smb_kfree(void *obj)
94{
95 smb_current_kmalloced -= 1;
96 kfree(obj);
97}
98
99#else /* DEBUG_SMB_MALLOC */
100
101#define smb_kmalloc(s,p) kmalloc(s,p)
102#define smb_kfree(o) kfree(o)
103#define smb_vmalloc(s) vmalloc(s)
104#define smb_vfree(o) vfree(o)
105
106#endif /* DEBUG_SMB_MALLOC */
107
108/* 61/*
109 * Flags for the in-memory inode 62 * Flags for the in-memory inode
110 */ 63 */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 9f4019156fd8..b02dda4ee83d 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -186,6 +186,7 @@ struct ucred {
186#define AF_PPPOX 24 /* PPPoX sockets */ 186#define AF_PPPOX 24 /* PPPoX sockets */
187#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 187#define AF_WANPIPE 25 /* Wanpipe API Sockets */
188#define AF_LLC 26 /* Linux LLC */ 188#define AF_LLC 26 /* Linux LLC */
189#define AF_TIPC 30 /* TIPC sockets */
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 190#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_MAX 32 /* For now.. */ 191#define AF_MAX 32 /* For now.. */
191 192
@@ -218,6 +219,7 @@ struct ucred {
218#define PF_PPPOX AF_PPPOX 219#define PF_PPPOX AF_PPPOX
219#define PF_WANPIPE AF_WANPIPE 220#define PF_WANPIPE AF_WANPIPE
220#define PF_LLC AF_LLC 221#define PF_LLC AF_LLC
222#define PF_TIPC AF_TIPC
221#define PF_BLUETOOTH AF_BLUETOOTH 223#define PF_BLUETOOTH AF_BLUETOOTH
222#define PF_MAX AF_MAX 224#define PF_MAX AF_MAX
223 225
@@ -279,6 +281,7 @@ struct ucred {
279#define SOL_LLC 268 281#define SOL_LLC 268
280#define SOL_DCCP 269 282#define SOL_DCCP 269
281#define SOL_NETLINK 270 283#define SOL_NETLINK 270
284#define SOL_TIPC 271
282 285
283/* IPX options */ 286/* IPX options */
284#define IPX_TYPE 1 287#define IPX_TYPE 1
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
new file mode 100644
index 000000000000..72261e0f2ac1
--- /dev/null
+++ b/include/linux/spi/ads7846.h
@@ -0,0 +1,18 @@
1/* linux/spi/ads7846.h */
2
3/* Touchscreen characteristics vary between boards and models. The
4 * platform_data for the device's "struct device" holds this information.
5 *
6 * It's OK if the min/max values are zero.
7 */
8struct ads7846_platform_data {
9 u16 model; /* 7843, 7845, 7846. */
10 u16 vref_delay_usecs; /* 0 for external vref; etc */
11 u16 x_plate_ohms;
12 u16 y_plate_ohms;
13
14 u16 x_min, x_max;
15 u16 y_min, y_max;
16 u16 pressure_min, pressure_max;
17};
18
diff --git a/include/linux/spi/flash.h b/include/linux/spi/flash.h
new file mode 100644
index 000000000000..3f22932e67a4
--- /dev/null
+++ b/include/linux/spi/flash.h
@@ -0,0 +1,31 @@
1#ifndef LINUX_SPI_FLASH_H
2#define LINUX_SPI_FLASH_H
3
4struct mtd_partition;
5
6/**
7 * struct flash_platform_data: board-specific flash data
8 * @name: optional flash device name (eg, as used with mtdparts=)
9 * @parts: optional array of mtd_partitions for static partitioning
10 * @nr_parts: number of mtd_partitions for static partitoning
11 * @type: optional flash device type (e.g. m25p80 vs m25p64), for use
12 * with chips that can't be queried for JEDEC or other IDs
13 *
14 * Board init code (in arch/.../mach-xxx/board-yyy.c files) can
15 * provide information about SPI flash parts (such as DataFlash) to
16 * help set up the device and its appropriate default partitioning.
17 *
18 * Note that for DataFlash, sizes for pages, blocks, and sectors are
19 * rarely powers of two; and partitions should be sector-aligned.
20 */
21struct flash_platform_data {
22 char *name;
23 struct mtd_partition *parts;
24 unsigned int nr_parts;
25
26 char *type;
27
28 /* we'll likely add more ... use JEDEC IDs, etc */
29};
30
31#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
new file mode 100644
index 000000000000..b05f1463a267
--- /dev/null
+++ b/include/linux/spi/spi.h
@@ -0,0 +1,668 @@
1/*
2 * Copyright (C) 2005 David Brownell
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __LINUX_SPI_H
20#define __LINUX_SPI_H
21
22/*
23 * INTERFACES between SPI master-side drivers and SPI infrastructure.
24 * (There's no SPI slave support for Linux yet...)
25 */
26extern struct bus_type spi_bus_type;
27
28/**
29 * struct spi_device - Master side proxy for an SPI slave device
30 * @dev: Driver model representation of the device.
31 * @master: SPI controller used with the device.
32 * @max_speed_hz: Maximum clock rate to be used with this chip
33 * (on this board); may be changed by the device's driver.
34 * @chip-select: Chipselect, distinguishing chips handled by "master".
35 * @mode: The spi mode defines how data is clocked out and in.
36 * This may be changed by the device's driver.
37 * @bits_per_word: Data transfers involve one or more words; word sizes
38 * like eight or 12 bits are common. In-memory wordsizes are
39 * powers of two bytes (e.g. 20 bit samples use 32 bits).
40 * This may be changed by the device's driver.
41 * @irq: Negative, or the number passed to request_irq() to receive
42 * interrupts from this device.
43 * @controller_state: Controller's runtime state
44 * @controller_data: Board-specific definitions for controller, such as
45 * FIFO initialization parameters; from board_info.controller_data
46 *
47 * An spi_device is used to interchange data between an SPI slave
48 * (usually a discrete chip) and CPU memory.
49 *
50 * In "dev", the platform_data is used to hold information about this
51 * device that's meaningful to the device's protocol driver, but not
52 * to its controller. One example might be an identifier for a chip
53 * variant with slightly different functionality.
54 */
55struct spi_device {
56 struct device dev;
57 struct spi_master *master;
58 u32 max_speed_hz;
59 u8 chip_select;
60 u8 mode;
61#define SPI_CPHA 0x01 /* clock phase */
62#define SPI_CPOL 0x02 /* clock polarity */
63#define SPI_MODE_0 (0|0) /* (original MicroWire) */
64#define SPI_MODE_1 (0|SPI_CPHA)
65#define SPI_MODE_2 (SPI_CPOL|0)
66#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
67#define SPI_CS_HIGH 0x04 /* chipselect active high? */
68 u8 bits_per_word;
69 int irq;
70 void *controller_state;
71 void *controller_data;
72 const char *modalias;
73
74 // likely need more hooks for more protocol options affecting how
75 // the controller talks to each chip, like:
76 // - bit order (default is wordwise msb-first)
77 // - memory packing (12 bit samples into low bits, others zeroed)
78 // - priority
79 // - drop chipselect after each word
80 // - chipselect delays
81 // - ...
82};
83
84static inline struct spi_device *to_spi_device(struct device *dev)
85{
86 return dev ? container_of(dev, struct spi_device, dev) : NULL;
87}
88
89/* most drivers won't need to care about device refcounting */
90static inline struct spi_device *spi_dev_get(struct spi_device *spi)
91{
92 return (spi && get_device(&spi->dev)) ? spi : NULL;
93}
94
95static inline void spi_dev_put(struct spi_device *spi)
96{
97 if (spi)
98 put_device(&spi->dev);
99}
100
101/* ctldata is for the bus_master driver's runtime state */
102static inline void *spi_get_ctldata(struct spi_device *spi)
103{
104 return spi->controller_state;
105}
106
107static inline void spi_set_ctldata(struct spi_device *spi, void *state)
108{
109 spi->controller_state = state;
110}
111
112
113struct spi_message;
114
115
116
117struct spi_driver {
118 int (*probe)(struct spi_device *spi);
119 int (*remove)(struct spi_device *spi);
120 void (*shutdown)(struct spi_device *spi);
121 int (*suspend)(struct spi_device *spi, pm_message_t mesg);
122 int (*resume)(struct spi_device *spi);
123 struct device_driver driver;
124};
125
126static inline struct spi_driver *to_spi_driver(struct device_driver *drv)
127{
128 return drv ? container_of(drv, struct spi_driver, driver) : NULL;
129}
130
131extern int spi_register_driver(struct spi_driver *sdrv);
132
133static inline void spi_unregister_driver(struct spi_driver *sdrv)
134{
135 if (!sdrv)
136 return;
137 driver_unregister(&sdrv->driver);
138}
139
140
141
142/**
143 * struct spi_master - interface to SPI master controller
144 * @cdev: class interface to this driver
145 * @bus_num: board-specific (and often SOC-specific) identifier for a
146 * given SPI controller.
147 * @num_chipselect: chipselects are used to distinguish individual
148 * SPI slaves, and are numbered from zero to num_chipselects.
149 * each slave has a chipselect signal, but it's common that not
150 * every chipselect is connected to a slave.
151 * @setup: updates the device mode and clocking records used by a
152 * device's SPI controller; protocol code may call this.
153 * @transfer: adds a message to the controller's transfer queue.
154 * @cleanup: frees controller-specific state
155 *
156 * Each SPI master controller can communicate with one or more spi_device
157 * children. These make a small bus, sharing MOSI, MISO and SCK signals
158 * but not chip select signals. Each device may be configured to use a
159 * different clock rate, since those shared signals are ignored unless
160 * the chip is selected.
161 *
162 * The driver for an SPI controller manages access to those devices through
163 * a queue of spi_message transactions, copyin data between CPU memory and
164 * an SPI slave device). For each such message it queues, it calls the
165 * message's completion function when the transaction completes.
166 */
167struct spi_master {
168 struct class_device cdev;
169
170 /* other than zero (== assign one dynamically), bus_num is fully
171 * board-specific. usually that simplifies to being SOC-specific.
172 * example: one SOC has three SPI controllers, numbered 1..3,
173 * and one board's schematics might show it using SPI-2. software
174 * would normally use bus_num=2 for that controller.
175 */
176 u16 bus_num;
177
178 /* chipselects will be integral to many controllers; some others
179 * might use board-specific GPIOs.
180 */
181 u16 num_chipselect;
182
183 /* setup mode and clock, etc (spi driver may call many times) */
184 int (*setup)(struct spi_device *spi);
185
186 /* bidirectional bulk transfers
187 *
188 * + The transfer() method may not sleep; its main role is
189 * just to add the message to the queue.
190 * + For now there's no remove-from-queue operation, or
191 * any other request management
192 * + To a given spi_device, message queueing is pure fifo
193 *
194 * + The master's main job is to process its message queue,
195 * selecting a chip then transferring data
196 * + If there are multiple spi_device children, the i/o queue
197 * arbitration algorithm is unspecified (round robin, fifo,
198 * priority, reservations, preemption, etc)
199 *
200 * + Chipselect stays active during the entire message
201 * (unless modified by spi_transfer.cs_change != 0).
202 * + The message transfers use clock and SPI mode parameters
203 * previously established by setup() for this device
204 */
205 int (*transfer)(struct spi_device *spi,
206 struct spi_message *mesg);
207
208 /* called on release() to free memory provided by spi_master */
209 void (*cleanup)(const struct spi_device *spi);
210};
211
212static inline void *spi_master_get_devdata(struct spi_master *master)
213{
214 return class_get_devdata(&master->cdev);
215}
216
217static inline void spi_master_set_devdata(struct spi_master *master, void *data)
218{
219 class_set_devdata(&master->cdev, data);
220}
221
222static inline struct spi_master *spi_master_get(struct spi_master *master)
223{
224 if (!master || !class_device_get(&master->cdev))
225 return NULL;
226 return master;
227}
228
229static inline void spi_master_put(struct spi_master *master)
230{
231 if (master)
232 class_device_put(&master->cdev);
233}
234
235
236/* the spi driver core manages memory for the spi_master classdev */
237extern struct spi_master *
238spi_alloc_master(struct device *host, unsigned size);
239
240extern int spi_register_master(struct spi_master *master);
241extern void spi_unregister_master(struct spi_master *master);
242
243extern struct spi_master *spi_busnum_to_master(u16 busnum);
244
245/*---------------------------------------------------------------------------*/
246
247/*
248 * I/O INTERFACE between SPI controller and protocol drivers
249 *
250 * Protocol drivers use a queue of spi_messages, each transferring data
251 * between the controller and memory buffers.
252 *
253 * The spi_messages themselves consist of a series of read+write transfer
254 * segments. Those segments always read the same number of bits as they
255 * write; but one or the other is easily ignored by passing a null buffer
256 * pointer. (This is unlike most types of I/O API, because SPI hardware
257 * is full duplex.)
258 *
259 * NOTE: Allocation of spi_transfer and spi_message memory is entirely
260 * up to the protocol driver, which guarantees the integrity of both (as
261 * well as the data buffers) for as long as the message is queued.
262 */
263
264/**
265 * struct spi_transfer - a read/write buffer pair
266 * @tx_buf: data to be written (dma-safe memory), or NULL
267 * @rx_buf: data to be read (dma-safe memory), or NULL
268 * @tx_dma: DMA address of tx_buf, if spi_message.is_dma_mapped
269 * @rx_dma: DMA address of rx_buf, if spi_message.is_dma_mapped
270 * @len: size of rx and tx buffers (in bytes)
271 * @cs_change: affects chipselect after this transfer completes
272 * @delay_usecs: microseconds to delay after this transfer before
273 * (optionally) changing the chipselect status, then starting
274 * the next transfer or completing this spi_message.
275 * @transfer_list: transfers are sequenced through spi_message.transfers
276 *
277 * SPI transfers always write the same number of bytes as they read.
278 * Protocol drivers should always provide rx_buf and/or tx_buf.
279 * In some cases, they may also want to provide DMA addresses for
280 * the data being transferred; that may reduce overhead, when the
281 * underlying driver uses dma.
282 *
283 * If the transmit buffer is null, undefined data will be shifted out
284 * while filling rx_buf. If the receive buffer is null, the data
285 * shifted in will be discarded. Only "len" bytes shift out (or in).
286 * It's an error to try to shift out a partial word. (For example, by
287 * shifting out three bytes with word size of sixteen or twenty bits;
288 * the former uses two bytes per word, the latter uses four bytes.)
289 *
290 * All SPI transfers start with the relevant chipselect active. Normally
291 * it stays selected until after the last transfer in a message. Drivers
292 * can affect the chipselect signal using cs_change:
293 *
294 * (i) If the transfer isn't the last one in the message, this flag is
295 * used to make the chipselect briefly go inactive in the middle of the
296 * message. Toggling chipselect in this way may be needed to terminate
297 * a chip command, letting a single spi_message perform all of group of
298 * chip transactions together.
299 *
300 * (ii) When the transfer is the last one in the message, the chip may
301 * stay selected until the next transfer. This is purely a performance
302 * hint; the controller driver may need to select a different device
303 * for the next message.
304 *
305 * The code that submits an spi_message (and its spi_transfers)
306 * to the lower layers is responsible for managing its memory.
307 * Zero-initialize every field you don't set up explicitly, to
308 * insulate against future API updates. After you submit a message
309 * and its transfers, ignore them until its completion callback.
310 */
311struct spi_transfer {
312 /* it's ok if tx_buf == rx_buf (right?)
313 * for MicroWire, one buffer must be null
314 * buffers must work with dma_*map_single() calls, unless
315 * spi_message.is_dma_mapped reports a pre-existing mapping
316 */
317 const void *tx_buf;
318 void *rx_buf;
319 unsigned len;
320
321 dma_addr_t tx_dma;
322 dma_addr_t rx_dma;
323
324 unsigned cs_change:1;
325 u16 delay_usecs;
326
327 struct list_head transfer_list;
328};
329
330/**
331 * struct spi_message - one multi-segment SPI transaction
332 * @transfers: list of transfer segments in this transaction
333 * @spi: SPI device to which the transaction is queued
334 * @is_dma_mapped: if true, the caller provided both dma and cpu virtual
335 * addresses for each transfer buffer
336 * @complete: called to report transaction completions
337 * @context: the argument to complete() when it's called
338 * @actual_length: the total number of bytes that were transferred in all
339 * successful segments
340 * @status: zero for success, else negative errno
341 * @queue: for use by whichever driver currently owns the message
342 * @state: for use by whichever driver currently owns the message
343 *
344 * An spi_message is used to execute an atomic sequence of data transfers,
345 * each represented by a struct spi_transfer. The sequence is "atomic"
346 * in the sense that no other spi_message may use that SPI bus until that
347 * sequence completes. On some systems, many such sequences can execute as
348 * as single programmed DMA transfer. On all systems, these messages are
349 * queued, and might complete after transactions to other devices. Messages
350 * sent to a given spi_device are alway executed in FIFO order.
351 *
352 * The code that submits an spi_message (and its spi_transfers)
353 * to the lower layers is responsible for managing its memory.
354 * Zero-initialize every field you don't set up explicitly, to
355 * insulate against future API updates. After you submit a message
356 * and its transfers, ignore them until its completion callback.
357 */
358struct spi_message {
359 struct list_head transfers;
360
361 struct spi_device *spi;
362
363 unsigned is_dma_mapped:1;
364
365 /* REVISIT: we might want a flag affecting the behavior of the
366 * last transfer ... allowing things like "read 16 bit length L"
367 * immediately followed by "read L bytes". Basically imposing
368 * a specific message scheduling algorithm.
369 *
370 * Some controller drivers (message-at-a-time queue processing)
371 * could provide that as their default scheduling algorithm. But
372 * others (with multi-message pipelines) could need a flag to
373 * tell them about such special cases.
374 */
375
376 /* completion is reported through a callback */
377 void (*complete)(void *context);
378 void *context;
379 unsigned actual_length;
380 int status;
381
382 /* for optional use by whatever driver currently owns the
383 * spi_message ... between calls to spi_async and then later
384 * complete(), that's the spi_master controller driver.
385 */
386 struct list_head queue;
387 void *state;
388};
389
390static inline void spi_message_init(struct spi_message *m)
391{
392 memset(m, 0, sizeof *m);
393 INIT_LIST_HEAD(&m->transfers);
394}
395
396static inline void
397spi_message_add_tail(struct spi_transfer *t, struct spi_message *m)
398{
399 list_add_tail(&t->transfer_list, &m->transfers);
400}
401
402static inline void
403spi_transfer_del(struct spi_transfer *t)
404{
405 list_del(&t->transfer_list);
406}
407
408/* It's fine to embed message and transaction structures in other data
409 * structures so long as you don't free them while they're in use.
410 */
411
412static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags)
413{
414 struct spi_message *m;
415
416 m = kzalloc(sizeof(struct spi_message)
417 + ntrans * sizeof(struct spi_transfer),
418 flags);
419 if (m) {
420 int i;
421 struct spi_transfer *t = (struct spi_transfer *)(m + 1);
422
423 INIT_LIST_HEAD(&m->transfers);
424 for (i = 0; i < ntrans; i++, t++)
425 spi_message_add_tail(t, m);
426 }
427 return m;
428}
429
430static inline void spi_message_free(struct spi_message *m)
431{
432 kfree(m);
433}
434
435/**
436 * spi_setup -- setup SPI mode and clock rate
437 * @spi: the device whose settings are being modified
438 *
439 * SPI protocol drivers may need to update the transfer mode if the
440 * device doesn't work with the mode 0 default. They may likewise need
441 * to update clock rates or word sizes from initial values. This function
442 * changes those settings, and must be called from a context that can sleep.
443 * The changes take effect the next time the device is selected and data
444 * is transferred to or from it.
445 */
446static inline int
447spi_setup(struct spi_device *spi)
448{
449 return spi->master->setup(spi);
450}
451
452
453/**
454 * spi_async -- asynchronous SPI transfer
455 * @spi: device with which data will be exchanged
456 * @message: describes the data transfers, including completion callback
457 *
458 * This call may be used in_irq and other contexts which can't sleep,
459 * as well as from task contexts which can sleep.
460 *
461 * The completion callback is invoked in a context which can't sleep.
462 * Before that invocation, the value of message->status is undefined.
463 * When the callback is issued, message->status holds either zero (to
464 * indicate complete success) or a negative error code. After that
465 * callback returns, the driver which issued the transfer request may
466 * deallocate the associated memory; it's no longer in use by any SPI
467 * core or controller driver code.
468 *
469 * Note that although all messages to a spi_device are handled in
470 * FIFO order, messages may go to different devices in other orders.
471 * Some device might be higher priority, or have various "hard" access
472 * time requirements, for example.
473 *
474 * On detection of any fault during the transfer, processing of
475 * the entire message is aborted, and the device is deselected.
476 * Until returning from the associated message completion callback,
477 * no other spi_message queued to that device will be processed.
478 * (This rule applies equally to all the synchronous transfer calls,
479 * which are wrappers around this core asynchronous primitive.)
480 */
481static inline int
482spi_async(struct spi_device *spi, struct spi_message *message)
483{
484 message->spi = spi;
485 return spi->master->transfer(spi, message);
486}
487
488/*---------------------------------------------------------------------------*/
489
490/* All these synchronous SPI transfer routines are utilities layered
491 * over the core async transfer primitive. Here, "synchronous" means
492 * they will sleep uninterruptibly until the async transfer completes.
493 */
494
495extern int spi_sync(struct spi_device *spi, struct spi_message *message);
496
497/**
498 * spi_write - SPI synchronous write
499 * @spi: device to which data will be written
500 * @buf: data buffer
501 * @len: data buffer size
502 *
503 * This writes the buffer and returns zero or a negative error code.
504 * Callable only from contexts that can sleep.
505 */
506static inline int
507spi_write(struct spi_device *spi, const u8 *buf, size_t len)
508{
509 struct spi_transfer t = {
510 .tx_buf = buf,
511 .len = len,
512 };
513 struct spi_message m;
514
515 spi_message_init(&m);
516 spi_message_add_tail(&t, &m);
517 return spi_sync(spi, &m);
518}
519
520/**
521 * spi_read - SPI synchronous read
522 * @spi: device from which data will be read
523 * @buf: data buffer
524 * @len: data buffer size
525 *
526 * This writes the buffer and returns zero or a negative error code.
527 * Callable only from contexts that can sleep.
528 */
529static inline int
530spi_read(struct spi_device *spi, u8 *buf, size_t len)
531{
532 struct spi_transfer t = {
533 .rx_buf = buf,
534 .len = len,
535 };
536 struct spi_message m;
537
538 spi_message_init(&m);
539 spi_message_add_tail(&t, &m);
540 return spi_sync(spi, &m);
541}
542
543/* this copies txbuf and rxbuf data; for small transfers only! */
544extern int spi_write_then_read(struct spi_device *spi,
545 const u8 *txbuf, unsigned n_tx,
546 u8 *rxbuf, unsigned n_rx);
547
548/**
549 * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read
550 * @spi: device with which data will be exchanged
551 * @cmd: command to be written before data is read back
552 *
553 * This returns the (unsigned) eight bit number returned by the
554 * device, or else a negative error code. Callable only from
555 * contexts that can sleep.
556 */
557static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)
558{
559 ssize_t status;
560 u8 result;
561
562 status = spi_write_then_read(spi, &cmd, 1, &result, 1);
563
564 /* return negative errno or unsigned value */
565 return (status < 0) ? status : result;
566}
567
568/**
569 * spi_w8r16 - SPI synchronous 8 bit write followed by 16 bit read
570 * @spi: device with which data will be exchanged
571 * @cmd: command to be written before data is read back
572 *
573 * This returns the (unsigned) sixteen bit number returned by the
574 * device, or else a negative error code. Callable only from
575 * contexts that can sleep.
576 *
577 * The number is returned in wire-order, which is at least sometimes
578 * big-endian.
579 */
580static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
581{
582 ssize_t status;
583 u16 result;
584
585 status = spi_write_then_read(spi, &cmd, 1, (u8 *) &result, 2);
586
587 /* return negative errno or unsigned value */
588 return (status < 0) ? status : result;
589}
590
591/*---------------------------------------------------------------------------*/
592
593/*
594 * INTERFACE between board init code and SPI infrastructure.
595 *
596 * No SPI driver ever sees these SPI device table segments, but
597 * it's how the SPI core (or adapters that get hotplugged) grows
598 * the driver model tree.
599 *
600 * As a rule, SPI devices can't be probed. Instead, board init code
601 * provides a table listing the devices which are present, with enough
602 * information to bind and set up the device's driver. There's basic
603 * support for nonstatic configurations too; enough to handle adding
604 * parport adapters, or microcontrollers acting as USB-to-SPI bridges.
605 */
606
607/* board-specific information about each SPI device */
608struct spi_board_info {
609 /* the device name and module name are coupled, like platform_bus;
610 * "modalias" is normally the driver name.
611 *
612 * platform_data goes to spi_device.dev.platform_data,
613 * controller_data goes to spi_device.controller_data,
614 * irq is copied too
615 */
616 char modalias[KOBJ_NAME_LEN];
617 const void *platform_data;
618 void *controller_data;
619 int irq;
620
621 /* slower signaling on noisy or low voltage boards */
622 u32 max_speed_hz;
623
624
625 /* bus_num is board specific and matches the bus_num of some
626 * spi_master that will probably be registered later.
627 *
628 * chip_select reflects how this chip is wired to that master;
629 * it's less than num_chipselect.
630 */
631 u16 bus_num;
632 u16 chip_select;
633
634 /* ... may need additional spi_device chip config data here.
635 * avoid stuff protocol drivers can set; but include stuff
636 * needed to behave without being bound to a driver:
637 * - chipselect polarity
638 * - quirks like clock rate mattering when not selected
639 */
640};
641
642#ifdef CONFIG_SPI
643extern int
644spi_register_board_info(struct spi_board_info const *info, unsigned n);
645#else
646/* board init code may ignore whether SPI is configured or not */
647static inline int
648spi_register_board_info(struct spi_board_info const *info, unsigned n)
649 { return 0; }
650#endif
651
652
653/* If you're hotplugging an adapter with devices (parport, usb, etc)
654 * use spi_new_device() to describe each device. You can also call
655 * spi_unregister_device() to start making that device vanish, but
656 * normally that would be handled by spi_unregister_master().
657 */
658extern struct spi_device *
659spi_new_device(struct spi_master *, struct spi_board_info *);
660
661static inline void
662spi_unregister_device(struct spi_device *spi)
663{
664 if (spi)
665 device_unregister(&spi->dev);
666}
667
668#endif /* __LINUX_SPI_H */
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
new file mode 100644
index 000000000000..c961fe9bf3eb
--- /dev/null
+++ b/include/linux/spi/spi_bitbang.h
@@ -0,0 +1,135 @@
1#ifndef __SPI_BITBANG_H
2#define __SPI_BITBANG_H
3
4/*
5 * Mix this utility code with some glue code to get one of several types of
6 * simple SPI master driver. Two do polled word-at-a-time I/O:
7 *
8 * - GPIO/parport bitbangers. Provide chipselect() and txrx_word[](),
9 * expanding the per-word routines from the inline templates below.
10 *
11 * - Drivers for controllers resembling bare shift registers. Provide
12 * chipselect() and txrx_word[](), with custom setup()/cleanup() methods
13 * that use your controller's clock and chipselect registers.
14 *
15 * Some hardware works well with requests at spi_transfer scope:
16 *
17 * - Drivers leveraging smarter hardware, with fifos or DMA; or for half
18 * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(),
19 * and custom setup()/cleanup() methods.
20 */
21struct spi_bitbang {
22 struct workqueue_struct *workqueue;
23 struct work_struct work;
24
25 spinlock_t lock;
26 struct list_head queue;
27 u8 busy;
28 u8 shutdown;
29 u8 use_dma;
30
31 struct spi_master *master;
32
33 void (*chipselect)(struct spi_device *spi, int is_on);
34#define BITBANG_CS_ACTIVE 1 /* normally nCS, active low */
35#define BITBANG_CS_INACTIVE 0
36
37 /* txrx_bufs() may handle dma mapping for transfers that don't
38 * already have one (transfer.{tx,rx}_dma is zero), or use PIO
39 */
40 int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
41
42 /* txrx_word[SPI_MODE_*]() just looks like a shift register */
43 u32 (*txrx_word[4])(struct spi_device *spi,
44 unsigned nsecs,
45 u32 word, u8 bits);
46};
47
48/* you can call these default bitbang->master methods from your custom
49 * methods, if you like.
50 */
51extern int spi_bitbang_setup(struct spi_device *spi);
52extern void spi_bitbang_cleanup(const struct spi_device *spi);
53extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m);
54
55/* start or stop queue processing */
56extern int spi_bitbang_start(struct spi_bitbang *spi);
57extern int spi_bitbang_stop(struct spi_bitbang *spi);
58
59#endif /* __SPI_BITBANG_H */
60
61/*-------------------------------------------------------------------------*/
62
63#ifdef EXPAND_BITBANG_TXRX
64
65/*
66 * The code that knows what GPIO pins do what should have declared four
67 * functions, ideally as inlines, before #defining EXPAND_BITBANG_TXRX
68 * and including this header:
69 *
70 * void setsck(struct spi_device *, int is_on);
71 * void setmosi(struct spi_device *, int is_on);
72 * int getmiso(struct spi_device *);
73 * void spidelay(unsigned);
74 *
75 * A non-inlined routine would call bitbang_txrx_*() routines. The
76 * main loop could easily compile down to a handful of instructions,
77 * especially if the delay is a NOP (to run at peak speed).
78 *
79 * Since this is software, the timings may not be exactly what your board's
80 * chips need ... there may be several reasons you'd need to tweak timings
81 * in these routines, not just make to make it faster or slower to match a
82 * particular CPU clock rate.
83 */
84
85static inline u32
86bitbang_txrx_be_cpha0(struct spi_device *spi,
87 unsigned nsecs, unsigned cpol,
88 u32 word, u8 bits)
89{
90 /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
91
92 /* clock starts at inactive polarity */
93 for (word <<= (32 - bits); likely(bits); bits--) {
94
95 /* setup MSB (to slave) on trailing edge */
96 setmosi(spi, word & (1 << 31));
97 spidelay(nsecs); /* T(setup) */
98
99 setsck(spi, !cpol);
100 spidelay(nsecs);
101
102 /* sample MSB (from slave) on leading edge */
103 word <<= 1;
104 word |= getmiso(spi);
105 setsck(spi, cpol);
106 }
107 return word;
108}
109
110static inline u32
111bitbang_txrx_be_cpha1(struct spi_device *spi,
112 unsigned nsecs, unsigned cpol,
113 u32 word, u8 bits)
114{
115 /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */
116
117 /* clock starts at inactive polarity */
118 for (word <<= (32 - bits); likely(bits); bits--) {
119
120 /* setup MSB (to slave) on leading edge */
121 setsck(spi, !cpol);
122 setmosi(spi, word & (1 << 31));
123 spidelay(nsecs); /* T(setup) */
124
125 setsck(spi, cpol);
126 spidelay(nsecs);
127
128 /* sample MSB (from slave) on trailing edge */
129 word <<= 1;
130 word |= getmiso(spi);
131 }
132 return word;
133}
134
135#endif /* EXPAND_BITBANG_TXRX */
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h
index def2d173a8db..04135b0e198e 100644
--- a/include/linux/spinlock_types_up.h
+++ b/include/linux/spinlock_types_up.h
@@ -22,30 +22,16 @@ typedef struct {
22 22
23#else 23#else
24 24
25/*
26 * All gcc 2.95 versions and early versions of 2.96 have a nasty bug
27 * with empty initializers.
28 */
29#if (__GNUC__ > 2)
30typedef struct { } raw_spinlock_t; 25typedef struct { } raw_spinlock_t;
31 26
32#define __RAW_SPIN_LOCK_UNLOCKED { } 27#define __RAW_SPIN_LOCK_UNLOCKED { }
33#else
34typedef struct { int gcc_is_buggy; } raw_spinlock_t;
35#define __RAW_SPIN_LOCK_UNLOCKED (raw_spinlock_t) { 0 }
36#endif
37 28
38#endif 29#endif
39 30
40#if (__GNUC__ > 2)
41typedef struct { 31typedef struct {
42 /* no debug version on UP */ 32 /* no debug version on UP */
43} raw_rwlock_t; 33} raw_rwlock_t;
44 34
45#define __RAW_RW_LOCK_UNLOCKED { } 35#define __RAW_RW_LOCK_UNLOCKED { }
46#else
47typedef struct { int gcc_is_buggy; } raw_rwlock_t;
48#define __RAW_RW_LOCK_UNLOCKED (raw_rwlock_t) { 0 }
49#endif
50 36
51#endif /* __LINUX_SPINLOCK_TYPES_UP_H */ 37#endif /* __LINUX_SPINLOCK_TYPES_UP_H */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index e4086ec8b952..50cab2a09f28 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -246,6 +246,7 @@ struct svc_deferred_req {
246 u32 prot; /* protocol (UDP or TCP) */ 246 u32 prot; /* protocol (UDP or TCP) */
247 struct sockaddr_in addr; 247 struct sockaddr_in addr;
248 struct svc_sock *svsk; /* where reply must go */ 248 struct svc_sock *svsk; /* where reply must go */
249 u32 daddr; /* where reply must come from */
249 struct cache_deferred_req handle; 250 struct cache_deferred_req handle;
250 int argslen; 251 int argslen;
251 u32 args[0]; 252 u32 args[0];
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 556617bcf7ac..4a99e4a7fbf3 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -167,6 +167,7 @@ extern void FASTCALL(lru_cache_add_active(struct page *));
167extern void FASTCALL(activate_page(struct page *)); 167extern void FASTCALL(activate_page(struct page *));
168extern void FASTCALL(mark_page_accessed(struct page *)); 168extern void FASTCALL(mark_page_accessed(struct page *));
169extern void lru_add_drain(void); 169extern void lru_add_drain(void);
170extern int lru_add_drain_all(void);
170extern int rotate_reclaimable_page(struct page *page); 171extern int rotate_reclaimable_page(struct page *page);
171extern void swap_setup(void); 172extern void swap_setup(void);
172 173
@@ -175,6 +176,29 @@ extern int try_to_free_pages(struct zone **, gfp_t);
175extern int shrink_all_memory(int); 176extern int shrink_all_memory(int);
176extern int vm_swappiness; 177extern int vm_swappiness;
177 178
179#ifdef CONFIG_NUMA
180extern int zone_reclaim_mode;
181extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
182#else
183#define zone_reclaim_mode 0
184static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
185{
186 return 0;
187}
188#endif
189
190#ifdef CONFIG_MIGRATION
191extern int isolate_lru_page(struct page *p);
192extern int putback_lru_pages(struct list_head *l);
193extern int migrate_pages(struct list_head *l, struct list_head *t,
194 struct list_head *moved, struct list_head *failed);
195#else
196static inline int isolate_lru_page(struct page *p) { return -ENOSYS; }
197static inline int putback_lru_pages(struct list_head *l) { return 0; }
198static inline int migrate_pages(struct list_head *l, struct list_head *t,
199 struct list_head *moved, struct list_head *failed) { return -ENOSYS; }
200#endif
201
178#ifdef CONFIG_MMU 202#ifdef CONFIG_MMU
179/* linux/mm/shmem.c */ 203/* linux/mm/shmem.c */
180extern int shmem_unuse(swp_entry_t entry, struct page *page); 204extern int shmem_unuse(swp_entry_t entry, struct page *page);
@@ -192,7 +216,7 @@ extern int rw_swap_page_sync(int, swp_entry_t, struct page *);
192extern struct address_space swapper_space; 216extern struct address_space swapper_space;
193#define total_swapcache_pages swapper_space.nrpages 217#define total_swapcache_pages swapper_space.nrpages
194extern void show_swap_cache_info(void); 218extern void show_swap_cache_info(void);
195extern int add_to_swap(struct page *); 219extern int add_to_swap(struct page *, gfp_t);
196extern void __delete_from_swap_cache(struct page *); 220extern void __delete_from_swap_cache(struct page *);
197extern void delete_from_swap_cache(struct page *); 221extern void delete_from_swap_cache(struct page *);
198extern int move_to_swap_cache(struct page *, swp_entry_t); 222extern int move_to_swap_cache(struct page *, swp_entry_t);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 763bd290f28d..1b7cd8d1a71b 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * SyncLink Multiprotocol Serial Adapter Driver 2 * SyncLink Multiprotocol Serial Adapter Driver
3 * 3 *
4 * $Id: synclink.h,v 3.6 2002/02/20 21:58:20 paulkf Exp $ 4 * $Id: synclink.h,v 3.10 2005/11/08 19:50:54 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -128,10 +128,14 @@
128#define MGSL_BUS_TYPE_EISA 2 128#define MGSL_BUS_TYPE_EISA 2
129#define MGSL_BUS_TYPE_PCI 5 129#define MGSL_BUS_TYPE_PCI 5
130 130
131#define MGSL_INTERFACE_MASK 0xf
131#define MGSL_INTERFACE_DISABLE 0 132#define MGSL_INTERFACE_DISABLE 0
132#define MGSL_INTERFACE_RS232 1 133#define MGSL_INTERFACE_RS232 1
133#define MGSL_INTERFACE_V35 2 134#define MGSL_INTERFACE_V35 2
134#define MGSL_INTERFACE_RS422 3 135#define MGSL_INTERFACE_RS422 3
136#define MGSL_INTERFACE_RTS_EN 0x10
137#define MGSL_INTERFACE_LL 0x20
138#define MGSL_INTERFACE_RL 0x40
135 139
136typedef struct _MGSL_PARAMS 140typedef struct _MGSL_PARAMS
137{ 141{
@@ -163,6 +167,9 @@ typedef struct _MGSL_PARAMS
163#define SYNCLINK_DEVICE_ID 0x0010 167#define SYNCLINK_DEVICE_ID 0x0010
164#define MGSCC_DEVICE_ID 0x0020 168#define MGSCC_DEVICE_ID 0x0020
165#define SYNCLINK_SCA_DEVICE_ID 0x0030 169#define SYNCLINK_SCA_DEVICE_ID 0x0030
170#define SYNCLINK_GT_DEVICE_ID 0x0070
171#define SYNCLINK_GT4_DEVICE_ID 0x0080
172#define SYNCLINK_AC_DEVICE_ID 0x0090
166#define MGSL_MAX_SERIAL_NUMBER 30 173#define MGSL_MAX_SERIAL_NUMBER 30
167 174
168/* 175/*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c7007b1db91d..e666d6070569 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -510,6 +510,28 @@ asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3,
510asmlinkage long sys_ioprio_set(int which, int who, int ioprio); 510asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
511asmlinkage long sys_ioprio_get(int which, int who); 511asmlinkage long sys_ioprio_get(int which, int who);
512asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask, 512asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
513 unsigned long maxnode); 513 unsigned long maxnode);
514asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
515 const unsigned long __user *from,
516 const unsigned long __user *to);
517asmlinkage long sys_mbind(unsigned long start, unsigned long len,
518 unsigned long mode,
519 unsigned long __user *nmask,
520 unsigned long maxnode,
521 unsigned flags);
522asmlinkage long sys_get_mempolicy(int __user *policy,
523 unsigned long __user *nmask,
524 unsigned long maxnode,
525 unsigned long addr, unsigned long flags);
526
527asmlinkage long sys_inotify_init(void);
528asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
529 u32 mask);
530asmlinkage long sys_inotify_rm_watch(int fd, u32 wd);
531
532asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
533 __u32 __user *ustatus);
534asmlinkage long sys_spu_create(const char __user *name,
535 unsigned int flags, mode_t mode);
514 536
515#endif 537#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index a9b80fc7f0f3..8352a7ce5895 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -180,6 +180,9 @@ enum
180 VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */ 180 VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */
181 VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */ 181 VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */
182 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */ 182 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */
183 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */
184 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
185 VM_ZONE_RECLAIM_MODE=31,/* reclaim local zone memory before going off node */
183}; 186};
184 187
185 188
diff --git a/include/linux/time.h b/include/linux/time.h
index 797ccd813bb0..614dd8465839 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -4,7 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7#include <linux/seqlock.h> 7# include <linux/seqlock.h>
8#endif 8#endif
9 9
10#ifndef _STRUCT_TIMESPEC 10#ifndef _STRUCT_TIMESPEC
@@ -13,7 +13,7 @@ struct timespec {
13 time_t tv_sec; /* seconds */ 13 time_t tv_sec; /* seconds */
14 long tv_nsec; /* nanoseconds */ 14 long tv_nsec; /* nanoseconds */
15}; 15};
16#endif /* _STRUCT_TIMESPEC */ 16#endif
17 17
18struct timeval { 18struct timeval {
19 time_t tv_sec; /* seconds */ 19 time_t tv_sec; /* seconds */
@@ -27,93 +27,103 @@ struct timezone {
27 27
28#ifdef __KERNEL__ 28#ifdef __KERNEL__
29 29
30/* Parameters used to convert the timespec values */ 30/* Parameters used to convert the timespec values: */
31#define MSEC_PER_SEC (1000L) 31#define MSEC_PER_SEC 1000L
32#define USEC_PER_SEC (1000000L) 32#define USEC_PER_SEC 1000000L
33#define NSEC_PER_SEC (1000000000L) 33#define NSEC_PER_SEC 1000000000L
34#define NSEC_PER_USEC (1000L) 34#define NSEC_PER_USEC 1000L
35 35
36static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) 36static __inline__ int timespec_equal(struct timespec *a, struct timespec *b)
37{ 37{
38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); 38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
39} 39}
40 40
41/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. 41extern unsigned long mktime(const unsigned int year, const unsigned int mon,
42 * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 42 const unsigned int day, const unsigned int hour,
43 * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. 43 const unsigned int min, const unsigned int sec);
44 * 44
45 * [For the Julian calendar (which was used in Russia before 1917, 45extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
46 * Britain & colonies before 1752, anywhere else before 1582, 46
47 * and is still in use by some communities) leave out the 47/*
48 * -year/100+year/400 terms, and add 10.] 48 * Returns true if the timespec is norm, false if denorm:
49 *
50 * This algorithm was first published by Gauss (I think).
51 *
52 * WARNING: this function will overflow on 2106-02-07 06:28:16 on
53 * machines were long is 32-bit! (However, as time_t is signed, we
54 * will already get problems at other places on 2038-01-19 03:14:08)
55 */ 49 */
56static inline unsigned long 50#define timespec_valid(ts) \
57mktime (unsigned int year, unsigned int mon, 51 (((ts)->tv_sec >= 0) && (((unsigned) (ts)->tv_nsec) < NSEC_PER_SEC))
58 unsigned int day, unsigned int hour, 52
59 unsigned int min, unsigned int sec) 53/*
60{ 54 * 64-bit nanosec type. Large enough to span 292+ years in nanosecond
61 if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ 55 * resolution. Ought to be enough for a while.
62 mon += 12; /* Puts Feb last since it has leap day */ 56 */
63 year -= 1; 57typedef s64 nsec_t;
64 }
65
66 return (((
67 (unsigned long) (year/4 - year/100 + year/400 + 367*mon/12 + day) +
68 year*365 - 719499
69 )*24 + hour /* now have hours */
70 )*60 + min /* now have minutes */
71 )*60 + sec; /* finally seconds */
72}
73 58
74extern struct timespec xtime; 59extern struct timespec xtime;
75extern struct timespec wall_to_monotonic; 60extern struct timespec wall_to_monotonic;
76extern seqlock_t xtime_lock; 61extern seqlock_t xtime_lock;
77 62
78static inline unsigned long get_seconds(void) 63static inline unsigned long get_seconds(void)
79{ 64{
80 return xtime.tv_sec; 65 return xtime.tv_sec;
81} 66}
82 67
83struct timespec current_kernel_time(void); 68struct timespec current_kernel_time(void);
84 69
85#define CURRENT_TIME (current_kernel_time()) 70#define CURRENT_TIME (current_kernel_time())
86#define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 }) 71#define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 })
87 72
88extern void do_gettimeofday(struct timeval *tv); 73extern void do_gettimeofday(struct timeval *tv);
89extern int do_settimeofday(struct timespec *tv); 74extern int do_settimeofday(struct timespec *tv);
90extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 75extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz);
91extern void clock_was_set(void); // call when ever the clock is set 76#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
92extern int do_posix_clock_monotonic_gettime(struct timespec *tp); 77extern long do_utimes(int dfd, char __user *filename, struct timeval *times);
93extern long do_utimes(char __user * filename, struct timeval * times);
94struct itimerval; 78struct itimerval;
95extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue); 79extern int do_setitimer(int which, struct itimerval *value,
80 struct itimerval *ovalue);
96extern int do_getitimer(int which, struct itimerval *value); 81extern int do_getitimer(int which, struct itimerval *value);
97extern void getnstimeofday (struct timespec *tv); 82extern void getnstimeofday(struct timespec *tv);
98extern void getnstimestamp(struct timespec *ts);
99 83
100extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 84extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
101 85
102static inline void 86/**
103set_normalized_timespec (struct timespec *ts, time_t sec, long nsec) 87 * timespec_to_ns - Convert timespec to nanoseconds
88 * @ts: pointer to the timespec variable to be converted
89 *
90 * Returns the scalar nanosecond representation of the timespec
91 * parameter.
92 */
93static inline nsec_t timespec_to_ns(const struct timespec *ts)
104{ 94{
105 while (nsec >= NSEC_PER_SEC) { 95 return ((nsec_t) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
106 nsec -= NSEC_PER_SEC;
107 ++sec;
108 }
109 while (nsec < 0) {
110 nsec += NSEC_PER_SEC;
111 --sec;
112 }
113 ts->tv_sec = sec;
114 ts->tv_nsec = nsec;
115} 96}
116 97
98/**
99 * timeval_to_ns - Convert timeval to nanoseconds
100 * @ts: pointer to the timeval variable to be converted
101 *
102 * Returns the scalar nanosecond representation of the timeval
103 * parameter.
104 */
105static inline nsec_t timeval_to_ns(const struct timeval *tv)
106{
107 return ((nsec_t) tv->tv_sec * NSEC_PER_SEC) +
108 tv->tv_usec * NSEC_PER_USEC;
109}
110
111/**
112 * ns_to_timespec - Convert nanoseconds to timespec
113 * @nsec: the nanoseconds value to be converted
114 *
115 * Returns the timespec representation of the nsec parameter.
116 */
117extern struct timespec ns_to_timespec(const nsec_t nsec);
118
119/**
120 * ns_to_timeval - Convert nanoseconds to timeval
121 * @nsec: the nanoseconds value to be converted
122 *
123 * Returns the timeval representation of the nsec parameter.
124 */
125extern struct timeval ns_to_timeval(const nsec_t nsec);
126
117#endif /* __KERNEL__ */ 127#endif /* __KERNEL__ */
118 128
119#define NFDBITS __NFDBITS 129#define NFDBITS __NFDBITS
@@ -126,49 +136,41 @@ set_normalized_timespec (struct timespec *ts, time_t sec, long nsec)
126 136
127/* 137/*
128 * Names of the interval timers, and structure 138 * Names of the interval timers, and structure
129 * defining a timer setting. 139 * defining a timer setting:
130 */ 140 */
131#define ITIMER_REAL 0 141#define ITIMER_REAL 0
132#define ITIMER_VIRTUAL 1 142#define ITIMER_VIRTUAL 1
133#define ITIMER_PROF 2 143#define ITIMER_PROF 2
134 144
135struct itimerspec { 145struct itimerspec {
136 struct timespec it_interval; /* timer period */ 146 struct timespec it_interval; /* timer period */
137 struct timespec it_value; /* timer expiration */ 147 struct timespec it_value; /* timer expiration */
138}; 148};
139 149
140struct itimerval { 150struct itimerval {
141 struct timeval it_interval; /* timer interval */ 151 struct timeval it_interval; /* timer interval */
142 struct timeval it_value; /* current value */ 152 struct timeval it_value; /* current value */
143}; 153};
144 154
145
146/* 155/*
147 * The IDs of the various system clocks (for POSIX.1b interval timers). 156 * The IDs of the various system clocks (for POSIX.1b interval timers):
148 */ 157 */
149#define CLOCK_REALTIME 0 158#define CLOCK_REALTIME 0
150#define CLOCK_MONOTONIC 1 159#define CLOCK_MONOTONIC 1
151#define CLOCK_PROCESS_CPUTIME_ID 2 160#define CLOCK_PROCESS_CPUTIME_ID 2
152#define CLOCK_THREAD_CPUTIME_ID 3 161#define CLOCK_THREAD_CPUTIME_ID 3
153#define CLOCK_REALTIME_HR 4
154#define CLOCK_MONOTONIC_HR 5
155 162
156/* 163/*
157 * The IDs of various hardware clocks 164 * The IDs of various hardware clocks:
158 */ 165 */
159 166#define CLOCK_SGI_CYCLE 10
160 167#define MAX_CLOCKS 16
161#define CLOCK_SGI_CYCLE 10 168#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
162#define MAX_CLOCKS 16 169#define CLOCKS_MONO CLOCK_MONOTONIC
163#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC | \
164 CLOCK_REALTIME_HR | CLOCK_MONOTONIC_HR)
165#define CLOCKS_MONO (CLOCK_MONOTONIC & CLOCK_MONOTONIC_HR)
166 170
167/* 171/*
168 * The various flags for setting POSIX.1b interval timers. 172 * The various flags for setting POSIX.1b interval timers:
169 */ 173 */
170 174#define TIMER_ABSTIME 0x01
171#define TIMER_ABSTIME 0x01
172
173 175
174#endif 176#endif
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 72f3a7781106..9b9877fd2505 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -96,6 +96,6 @@ static inline void add_timer(struct timer_list *timer)
96 96
97extern void init_timers(void); 97extern void init_timers(void);
98extern void run_local_timers(void); 98extern void run_local_timers(void);
99extern void it_real_fn(unsigned long); 99extern int it_real_fn(void *);
100 100
101#endif 101#endif
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
new file mode 100644
index 000000000000..243a15f54002
--- /dev/null
+++ b/include/linux/tipc.h
@@ -0,0 +1,212 @@
1/*
2 * include/linux/tipc.h: Include file for TIPC socket interface
3 *
4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _LINUX_TIPC_H_
38#define _LINUX_TIPC_H_
39
40#include <linux/types.h>
41
42/*
43 * TIPC addressing primitives
44 */
45
46struct tipc_portid {
47 __u32 ref;
48 __u32 node;
49};
50
51struct tipc_name {
52 __u32 type;
53 __u32 instance;
54};
55
56struct tipc_name_seq {
57 __u32 type;
58 __u32 lower;
59 __u32 upper;
60};
61
62static inline __u32 tipc_addr(unsigned int zone,
63 unsigned int cluster,
64 unsigned int node)
65{
66 return (zone << 24) | (cluster << 12) | node;
67}
68
69static inline unsigned int tipc_zone(__u32 addr)
70{
71 return addr >> 24;
72}
73
74static inline unsigned int tipc_cluster(__u32 addr)
75{
76 return (addr >> 12) & 0xfff;
77}
78
79static inline unsigned int tipc_node(__u32 addr)
80{
81 return addr & 0xfff;
82}
83
84/*
85 * Application-accessible port name types
86 */
87
88#define TIPC_CFG_SRV 0 /* configuration service name type */
89#define TIPC_TOP_SRV 1 /* topology service name type */
90#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */
91
92/*
93 * Publication scopes when binding port names and port name sequences
94 */
95
96#define TIPC_ZONE_SCOPE 1
97#define TIPC_CLUSTER_SCOPE 2
98#define TIPC_NODE_SCOPE 3
99
100/*
101 * Limiting values for messages
102 */
103
104#define TIPC_MAX_USER_MSG_SIZE 66000
105
106/*
107 * Message importance levels
108 */
109
110#define TIPC_LOW_IMPORTANCE 0 /* default */
111#define TIPC_MEDIUM_IMPORTANCE 1
112#define TIPC_HIGH_IMPORTANCE 2
113#define TIPC_CRITICAL_IMPORTANCE 3
114
115/*
116 * Msg rejection/connection shutdown reasons
117 */
118
119#define TIPC_OK 0
120#define TIPC_ERR_NO_NAME 1
121#define TIPC_ERR_NO_PORT 2
122#define TIPC_ERR_NO_NODE 3
123#define TIPC_ERR_OVERLOAD 4
124#define TIPC_CONN_SHUTDOWN 5
125
126/*
127 * TIPC topology subscription service definitions
128 */
129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
132#if 0
133/* The following filter options are not currently implemented */
134#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
135#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */
136#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */
137#endif
138
139#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */
140
141struct tipc_subscr {
142 struct tipc_name_seq seq; /* name sequence of interest */
143 __u32 timeout; /* subscription duration (in ms) */
144 __u32 filter; /* bitmask of filter options */
145 char usr_handle[8]; /* available for subscriber use */
146};
147
148#define TIPC_PUBLISHED 1 /* publication event */
149#define TIPC_WITHDRAWN 2 /* withdraw event */
150#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */
151
152struct tipc_event {
153 __u32 event; /* event type */
154 __u32 found_lower; /* matching name seq instances */
155 __u32 found_upper; /* " " " " */
156 struct tipc_portid port; /* associated port */
157 struct tipc_subscr s; /* associated subscription */
158};
159
160/*
161 * Socket API
162 */
163
164#ifndef AF_TIPC
165#define AF_TIPC 30
166#endif
167
168#ifndef PF_TIPC
169#define PF_TIPC AF_TIPC
170#endif
171
172#ifndef SOL_TIPC
173#define SOL_TIPC 271
174#endif
175
176#define TIPC_ADDR_NAMESEQ 1
177#define TIPC_ADDR_MCAST 1
178#define TIPC_ADDR_NAME 2
179#define TIPC_ADDR_ID 3
180
181struct sockaddr_tipc {
182 unsigned short family;
183 unsigned char addrtype;
184 signed char scope;
185 union {
186 struct tipc_portid id;
187 struct tipc_name_seq nameseq;
188 struct {
189 struct tipc_name name;
190 __u32 domain; /* 0: own zone */
191 } name;
192 } addr;
193};
194
195/*
196 * Ancillary data objects supported by recvmsg()
197 */
198
199#define TIPC_ERRINFO 1 /* error info */
200#define TIPC_RETDATA 2 /* returned data */
201#define TIPC_DESTNAME 3 /* destination name */
202
203/*
204 * TIPC-specific socket option values
205 */
206
207#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */
208#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */
209#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */
210#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */
211
212#endif
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
new file mode 100644
index 000000000000..33a653913d94
--- /dev/null
+++ b/include/linux/tipc_config.h
@@ -0,0 +1,410 @@
1/*
2 * include/linux/tipc_config.h: Include file for TIPC configuration interface
3 *
4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _LINUX_TIPC_CONFIG_H_
38#define _LINUX_TIPC_CONFIG_H_
39
40#include <linux/types.h>
41#include <linux/string.h>
42#include <asm/byteorder.h>
43
44/*
45 * Configuration
46 *
47 * All configuration management messaging involves sending a request message
48 * to the TIPC configuration service on a node, which sends a reply message
49 * back. (In the future multi-message replies may be supported.)
50 *
51 * Both request and reply messages consist of a transport header and payload.
52 * The transport header contains info about the desired operation;
53 * the payload consists of zero or more type/length/value (TLV) items
54 * which specify parameters or results for the operation.
55 *
56 * For many operations, the request and reply messages have a fixed number
57 * of TLVs (usually zero or one); however, some reply messages may return
58 * a variable number of TLVs. A failed request is denoted by the presence
59 * of an "error string" TLV in the reply message instead of the TLV(s) the
60 * reply should contain if the request succeeds.
61 */
62
63/*
64 * Public commands:
65 * May be issued by any process.
66 * Accepted by own node, or by remote node only if remote management enabled.
67 */
68
69#define TIPC_CMD_NOOP 0x0000 /* tx none, rx none */
70#define TIPC_CMD_GET_NODES 0x0001 /* tx net_addr, rx node_info(s) */
71#define TIPC_CMD_GET_MEDIA_NAMES 0x0002 /* tx none, rx media_name(s) */
72#define TIPC_CMD_GET_BEARER_NAMES 0x0003 /* tx none, rx bearer_name(s) */
73#define TIPC_CMD_GET_LINKS 0x0004 /* tx net_addr, rx link_info(s) */
74#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */
75#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */
76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */
77
78#if 0
79#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */
80#define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */
81#define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */
82#define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */
83#endif
84
85/*
86 * Protected commands:
87 * May only be issued by "network administration capable" process.
88 * Accepted by own node, or by remote node only if remote management enabled
89 * and this node is zone manager.
90 */
91
92#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */
93#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
94#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */
95#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
96#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* tx none, rx unsigned */
97#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* tx none, rx unsigned */
98#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */
99#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* tx none, rx unsigned */
100#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */
101
102#define TIPC_CMD_ENABLE_BEARER 0x4101 /* tx bearer_config, rx none */
103#define TIPC_CMD_DISABLE_BEARER 0x4102 /* tx bearer_name, rx none */
104#define TIPC_CMD_SET_LINK_TOL 0x4107 /* tx link_config, rx none */
105#define TIPC_CMD_SET_LINK_PRI 0x4108 /* tx link_config, rx none */
106#define TIPC_CMD_SET_LINK_WINDOW 0x4109 /* tx link_config, rx none */
107#define TIPC_CMD_SET_LOG_SIZE 0x410A /* tx unsigned, rx none */
108#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */
109#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */
110
111#if 0
112#define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */
113#define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */
114#define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */
115#define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */
116#endif
117
118/*
119 * Private commands:
120 * May only be issued by "network administration capable" process.
121 * Accepted by own node only; cannot be used on a remote node.
122 */
123
124#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
125#if 0
126#define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */
127#endif
128#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
129#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
130#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
131#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
132#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* tx unsigned, rx none */
133#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* tx unsigned, rx none */
134#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */
135#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* tx unsigned, rx none */
136#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */
137
138/*
139 * TLV types defined for TIPC
140 */
141
142#define TIPC_TLV_NONE 0 /* no TLV present */
143#define TIPC_TLV_VOID 1 /* empty TLV (0 data bytes)*/
144#define TIPC_TLV_UNSIGNED 2 /* 32-bit integer */
145#define TIPC_TLV_STRING 3 /* char[128] (max) */
146#define TIPC_TLV_LARGE_STRING 4 /* char[2048] (max) */
147#define TIPC_TLV_ULTRA_STRING 5 /* char[32768] (max) */
148
149#define TIPC_TLV_ERROR_STRING 16 /* char[128] containing "error code" */
150#define TIPC_TLV_NET_ADDR 17 /* 32-bit integer denoting <Z.C.N> */
151#define TIPC_TLV_MEDIA_NAME 18 /* char[TIPC_MAX_MEDIA_NAME] */
152#define TIPC_TLV_BEARER_NAME 19 /* char[TIPC_MAX_BEARER_NAME] */
153#define TIPC_TLV_LINK_NAME 20 /* char[TIPC_MAX_LINK_NAME] */
154#define TIPC_TLV_NODE_INFO 21 /* struct tipc_node_info */
155#define TIPC_TLV_LINK_INFO 22 /* struct tipc_link_info */
156#define TIPC_TLV_BEARER_CONFIG 23 /* struct tipc_bearer_config */
157#define TIPC_TLV_LINK_CONFIG 24 /* struct tipc_link_config */
158#define TIPC_TLV_NAME_TBL_QUERY 25 /* struct tipc_name_table_query */
159#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */
160
161/*
162 * Maximum sizes of TIPC bearer-related names (including terminating NUL)
163 */
164
165#define TIPC_MAX_MEDIA_NAME 16 /* format = media */
166#define TIPC_MAX_IF_NAME 16 /* format = interface */
167#define TIPC_MAX_BEARER_NAME 32 /* format = media:interface */
168#define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */
169
170/*
171 * Link priority limits (min, default, max, media default)
172 */
173
174#define TIPC_MIN_LINK_PRI 0
175#define TIPC_DEF_LINK_PRI 10
176#define TIPC_MAX_LINK_PRI 31
177#define TIPC_MEDIA_LINK_PRI (TIPC_MAX_LINK_PRI + 1)
178
179/*
180 * Link tolerance limits (min, default, max), in ms
181 */
182
183#define TIPC_MIN_LINK_TOL 50
184#define TIPC_DEF_LINK_TOL 1500
185#define TIPC_MAX_LINK_TOL 30000
186
187/*
188 * Link window limits (min, default, max), in packets
189 */
190
191#define TIPC_MIN_LINK_WIN 16
192#define TIPC_DEF_LINK_WIN 50
193#define TIPC_MAX_LINK_WIN 150
194
195
196struct tipc_node_info {
197 __u32 addr; /* network address of node */
198 __u32 up; /* 0=down, 1= up */
199};
200
201struct tipc_link_info {
202 __u32 dest; /* network address of peer node */
203 __u32 up; /* 0=down, 1=up */
204 char str[TIPC_MAX_LINK_NAME]; /* link name */
205};
206
207struct tipc_bearer_config {
208 __u32 priority; /* Range [1,31]. Override per link */
209 __u32 detect_scope;
210 char name[TIPC_MAX_BEARER_NAME];
211};
212
213struct tipc_link_config {
214 __u32 value;
215 char name[TIPC_MAX_LINK_NAME];
216};
217
218#define TIPC_NTQ_ALLTYPES 0x80000000
219
220struct tipc_name_table_query {
221 __u32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */
222 __u32 type; /* {t,l,u} info ignored if high bit of "depth" is set */
223 __u32 lowbound; /* (i.e. displays all entries of name table) */
224 __u32 upbound;
225};
226
227/*
228 * The error string TLV is a null-terminated string describing the cause
229 * of the request failure. To simplify error processing (and to save space)
230 * the first character of the string can be a special error code character
231 * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason.
232 */
233
234#define TIPC_CFG_TLV_ERROR "\x80" /* request contains incorrect TLV(s) */
235#define TIPC_CFG_NOT_NET_ADMIN "\x81" /* must be network administrator */
236#define TIPC_CFG_NOT_ZONE_MSTR "\x82" /* must be zone master */
237#define TIPC_CFG_NO_REMOTE "\x83" /* remote management not enabled */
238#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */
239#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */
240
241#if 0
242/* prototypes TLV structures for proposed commands */
243struct tipc_link_create {
244 __u32 domain;
245 struct tipc_media_addr peer_addr;
246 char bearer_name[TIPC_MAX_BEARER_NAME];
247};
248
249struct tipc_route_info {
250 __u32 dest;
251 __u32 router;
252};
253#endif
254
255/*
256 * A TLV consists of a descriptor, followed by the TLV value.
257 * TLV descriptor fields are stored in network byte order;
258 * TLV values must also be stored in network byte order (where applicable).
259 * TLV descriptors must be aligned to addresses which are multiple of 4,
260 * so up to 3 bytes of padding may exist at the end of the TLV value area.
261 * There must not be any padding between the TLV descriptor and its value.
262 */
263
264struct tlv_desc {
265 __u16 tlv_len; /* TLV length (descriptor + value) */
266 __u16 tlv_type; /* TLV identifier */
267};
268
269#define TLV_ALIGNTO 4
270
271#define TLV_ALIGN(datalen) (((datalen)+(TLV_ALIGNTO-1)) & ~(TLV_ALIGNTO-1))
272#define TLV_LENGTH(datalen) (sizeof(struct tlv_desc) + (datalen))
273#define TLV_SPACE(datalen) (TLV_ALIGN(TLV_LENGTH(datalen)))
274#define TLV_DATA(tlv) ((void *)((char *)(tlv) + TLV_LENGTH(0)))
275
276static inline int TLV_OK(const void *tlv, __u16 space)
277{
278 /*
279 * Would also like to check that "tlv" is a multiple of 4,
280 * but don't know how to do this in a portable way.
281 * - Tried doing (!(tlv & (TLV_ALIGNTO-1))), but GCC compiler
282 * won't allow binary "&" with a pointer.
283 * - Tried casting "tlv" to integer type, but causes warning about size
284 * mismatch when pointer is bigger than chosen type (int, long, ...).
285 */
286
287 return (space >= TLV_SPACE(0)) &&
288 (ntohs(((struct tlv_desc *)tlv)->tlv_len) <= space);
289}
290
291static inline int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type)
292{
293 return TLV_OK(tlv, space) &&
294 (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type);
295}
296
297static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len)
298{
299 struct tlv_desc *tlv_ptr;
300 int tlv_len;
301
302 tlv_len = TLV_LENGTH(len);
303 tlv_ptr = (struct tlv_desc *)tlv;
304 tlv_ptr->tlv_type = htons(type);
305 tlv_ptr->tlv_len = htons(tlv_len);
306 if (len && data)
307 memcpy(TLV_DATA(tlv_ptr), data, tlv_len);
308 return TLV_SPACE(len);
309}
310
311/*
312 * A TLV list descriptor simplifies processing of messages
313 * containing multiple TLVs.
314 */
315
316struct tlv_list_desc {
317 struct tlv_desc *tlv_ptr; /* ptr to current TLV */
318 __u32 tlv_space; /* # bytes from curr TLV to list end */
319};
320
321static inline void TLV_LIST_INIT(struct tlv_list_desc *list,
322 void *data, __u32 space)
323{
324 list->tlv_ptr = (struct tlv_desc *)data;
325 list->tlv_space = space;
326}
327
328static inline int TLV_LIST_EMPTY(struct tlv_list_desc *list)
329{
330 return (list->tlv_space == 0);
331}
332
333static inline int TLV_LIST_CHECK(struct tlv_list_desc *list, __u16 exp_type)
334{
335 return TLV_CHECK(list->tlv_ptr, list->tlv_space, exp_type);
336}
337
338static inline void *TLV_LIST_DATA(struct tlv_list_desc *list)
339{
340 return TLV_DATA(list->tlv_ptr);
341}
342
343static inline void TLV_LIST_STEP(struct tlv_list_desc *list)
344{
345 __u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len));
346
347 list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space);
348 list->tlv_space -= tlv_space;
349}
350
351/*
352 * Configuration messages exchanged via NETLINK_GENERIC use the following
353 * family id, name, version and command.
354 */
355#define TIPC_GENL_NAME "TIPC"
356#define TIPC_GENL_VERSION 0x1
357#define TIPC_GENL_CMD 0x1
358
359/*
360 * TIPC specific header used in NETLINK_GENERIC requests.
361 */
362struct tipc_genlmsghdr {
363 __u32 dest; /* Destination address */
364 __u16 cmd; /* Command */
365 __u16 reserved; /* Unused */
366};
367
368#define TIPC_GENL_HDRLEN NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr))
369
370/*
371 * Configuration messages exchanged via TIPC sockets use the TIPC configuration
372 * message header, which is defined below. This structure is analogous
373 * to the Netlink message header, but fields are stored in network byte order
374 * and no padding is permitted between the header and the message data
375 * that follows.
376 */
377
378struct tipc_cfg_msg_hdr
379{
380 __u32 tcm_len; /* Message length (including header) */
381 __u16 tcm_type; /* Command type */
382 __u16 tcm_flags; /* Additional flags */
383 char tcm_reserved[8]; /* Unused */
384};
385
386#define TCM_F_REQUEST 0x1 /* Flag: Request message */
387#define TCM_F_MORE 0x2 /* Flag: Message to be continued */
388
389#define TCM_ALIGN(datalen) (((datalen)+3) & ~3)
390#define TCM_LENGTH(datalen) (sizeof(struct tipc_cfg_msg_hdr) + datalen)
391#define TCM_SPACE(datalen) (TCM_ALIGN(TCM_LENGTH(datalen)))
392#define TCM_DATA(tcm_hdr) ((void *)((char *)(tcm_hdr) + TCM_LENGTH(0)))
393
394static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags,
395 void *data, __u16 data_len)
396{
397 struct tipc_cfg_msg_hdr *tcm_hdr;
398 int msg_len;
399
400 msg_len = TCM_LENGTH(data_len);
401 tcm_hdr = (struct tipc_cfg_msg_hdr *)msg;
402 tcm_hdr->tcm_len = htonl(msg_len);
403 tcm_hdr->tcm_type = htons(cmd);
404 tcm_hdr->tcm_flags = htons(flags);
405 if (data_len && data)
406 memcpy(TCM_DATA(msg), data, data_len);
407 return TCM_SPACE(data_len);
408}
409
410#endif
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 3df1d474e5c5..e8eb0040ce3a 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -56,6 +56,14 @@
56#define REMOTE_DISTANCE 20 56#define REMOTE_DISTANCE 20
57#define node_distance(from,to) ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE) 57#define node_distance(from,to) ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)
58#endif 58#endif
59#ifndef RECLAIM_DISTANCE
60/*
61 * If the distance between nodes in a system is larger than RECLAIM_DISTANCE
62 * (in whatever arch specific measurement units returned by node_distance())
63 * then switch on zone reclaim on boot.
64 */
65#define RECLAIM_DISTANCE 20
66#endif
59#ifndef PENALTY_FOR_NODE_WITH_CPUS 67#ifndef PENALTY_FOR_NODE_WITH_CPUS
60#define PENALTY_FOR_NODE_WITH_CPUS (1) 68#define PENALTY_FOR_NODE_WITH_CPUS (1)
61#endif 69#endif
@@ -86,7 +94,6 @@
86 .max_interval = 2, \ 94 .max_interval = 2, \
87 .busy_factor = 8, \ 95 .busy_factor = 8, \
88 .imbalance_pct = 110, \ 96 .imbalance_pct = 110, \
89 .cache_hot_time = 0, \
90 .cache_nice_tries = 0, \ 97 .cache_nice_tries = 0, \
91 .per_cpu_gain = 25, \ 98 .per_cpu_gain = 25, \
92 .busy_idx = 0, \ 99 .busy_idx = 0, \
@@ -117,7 +124,6 @@
117 .max_interval = 4, \ 124 .max_interval = 4, \
118 .busy_factor = 64, \ 125 .busy_factor = 64, \
119 .imbalance_pct = 125, \ 126 .imbalance_pct = 125, \
120 .cache_hot_time = (5*1000000/2), \
121 .cache_nice_tries = 1, \ 127 .cache_nice_tries = 1, \
122 .per_cpu_gain = 100, \ 128 .per_cpu_gain = 100, \
123 .busy_idx = 2, \ 129 .busy_idx = 2, \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1267f88ece6e..3787102e4b12 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,6 +23,7 @@
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <linux/tty_driver.h> 24#include <linux/tty_driver.h>
25#include <linux/tty_ldisc.h> 25#include <linux/tty_ldisc.h>
26#include <linux/screen_info.h>
26 27
27#include <asm/system.h> 28#include <asm/system.h>
28 29
@@ -37,77 +38,6 @@
37#define NR_LDISCS 16 38#define NR_LDISCS 16
38 39
39/* 40/*
40 * These are set up by the setup-routine at boot-time:
41 */
42
43struct screen_info {
44 u8 orig_x; /* 0x00 */
45 u8 orig_y; /* 0x01 */
46 u16 dontuse1; /* 0x02 -- EXT_MEM_K sits here */
47 u16 orig_video_page; /* 0x04 */
48 u8 orig_video_mode; /* 0x06 */
49 u8 orig_video_cols; /* 0x07 */
50 u16 unused2; /* 0x08 */
51 u16 orig_video_ega_bx; /* 0x0a */
52 u16 unused3; /* 0x0c */
53 u8 orig_video_lines; /* 0x0e */
54 u8 orig_video_isVGA; /* 0x0f */
55 u16 orig_video_points; /* 0x10 */
56
57 /* VESA graphic mode -- linear frame buffer */
58 u16 lfb_width; /* 0x12 */
59 u16 lfb_height; /* 0x14 */
60 u16 lfb_depth; /* 0x16 */
61 u32 lfb_base; /* 0x18 */
62 u32 lfb_size; /* 0x1c */
63 u16 dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
64 u16 lfb_linelength; /* 0x24 */
65 u8 red_size; /* 0x26 */
66 u8 red_pos; /* 0x27 */
67 u8 green_size; /* 0x28 */
68 u8 green_pos; /* 0x29 */
69 u8 blue_size; /* 0x2a */
70 u8 blue_pos; /* 0x2b */
71 u8 rsvd_size; /* 0x2c */
72 u8 rsvd_pos; /* 0x2d */
73 u16 vesapm_seg; /* 0x2e */
74 u16 vesapm_off; /* 0x30 */
75 u16 pages; /* 0x32 */
76 u16 vesa_attributes; /* 0x34 */
77 u32 capabilities; /* 0x36 */
78 /* 0x3a -- 0x3f reserved for future expansion */
79};
80
81extern struct screen_info screen_info;
82
83#define ORIG_X (screen_info.orig_x)
84#define ORIG_Y (screen_info.orig_y)
85#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
86#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
87#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
88#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
89#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
90#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
91
92#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
93#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
94#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
95#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */
96#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */
97#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
98
99#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */
100#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */
101#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */
102
103#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */
104
105#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */
106#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */
107
108#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
109
110/*
111 * This character is the same as _POSIX_VDISABLE: it cannot be used as 41 * This character is the same as _POSIX_VDISABLE: it cannot be used as
112 * a c_cc[] character, but indicates that a particular special character 42 * a c_cc[] character, but indicates that a particular special character
113 * isn't in use (eg VINTR has no character etc) 43 * isn't in use (eg VINTR has no character etc)
@@ -121,16 +51,22 @@ extern struct screen_info screen_info;
121 */ 51 */
122#define TTY_FLIPBUF_SIZE 512 52#define TTY_FLIPBUF_SIZE 512
123 53
124struct tty_flip_buffer { 54struct tty_buffer {
55 struct tty_buffer *next;
56 char *char_buf_ptr;
57 unsigned char *flag_buf_ptr;
58 int used;
59 int size;
60 /* Data points here */
61 unsigned long data[0];
62};
63
64struct tty_bufhead {
125 struct work_struct work; 65 struct work_struct work;
126 struct semaphore pty_sem; 66 struct semaphore pty_sem;
127 char *char_buf_ptr; 67 struct tty_buffer *head; /* Queue head */
128 unsigned char *flag_buf_ptr; 68 struct tty_buffer *tail; /* Active buffer */
129 int count; 69 struct tty_buffer *free; /* Free queue head */
130 int buf_num;
131 unsigned char char_buf[2*TTY_FLIPBUF_SIZE];
132 char flag_buf[2*TTY_FLIPBUF_SIZE];
133 unsigned char slop[4]; /* N.B. bug overwrites buffer by 1 */
134}; 70};
135/* 71/*
136 * The pty uses char_buf and flag_buf as a contiguous buffer 72 * The pty uses char_buf and flag_buf as a contiguous buffer
@@ -256,10 +192,11 @@ struct tty_struct {
256 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 192 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
257 unsigned char low_latency:1, warned:1; 193 unsigned char low_latency:1, warned:1;
258 unsigned char ctrl_status; 194 unsigned char ctrl_status;
195 unsigned int receive_room; /* Bytes free for queue */
259 196
260 struct tty_struct *link; 197 struct tty_struct *link;
261 struct fasync_struct *fasync; 198 struct fasync_struct *fasync;
262 struct tty_flip_buffer flip; 199 struct tty_bufhead buf;
263 int max_flip_cnt; 200 int max_flip_cnt;
264 int alt_speed; /* For magic substitution of 38400 bps */ 201 int alt_speed; /* For magic substitution of 38400 bps */
265 wait_queue_head_t write_wait; 202 wait_queue_head_t write_wait;
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index abe9bfcf226c..be1400e82482 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -1,25 +1,33 @@
1#ifndef _LINUX_TTY_FLIP_H 1#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_request_room(struct tty_struct *tty, size_t size);
5extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size);
6extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size);
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
9
4#ifdef INCLUDE_INLINE_FUNCS 10#ifdef INCLUDE_INLINE_FUNCS
5#define _INLINE_ extern 11#define _INLINE_ extern
6#else 12#else
7#define _INLINE_ static __inline__ 13#define _INLINE_ static __inline__
8#endif 14#endif
9 15
10_INLINE_ void tty_insert_flip_char(struct tty_struct *tty, 16_INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
11 unsigned char ch, char flag) 17 unsigned char ch, char flag)
12{ 18{
13 if (tty->flip.count < TTY_FLIPBUF_SIZE) { 19 struct tty_buffer *tb = tty->buf.tail;
14 tty->flip.count++; 20 if (tb && tb->used < tb->size) {
15 *tty->flip.flag_buf_ptr++ = flag; 21 tb->flag_buf_ptr[tb->used] = flag;
16 *tty->flip.char_buf_ptr++ = ch; 22 tb->char_buf_ptr[tb->used++] = ch;
23 return 1;
17 } 24 }
25 return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
18} 26}
19 27
20_INLINE_ void tty_schedule_flip(struct tty_struct *tty) 28_INLINE_ void tty_schedule_flip(struct tty_struct *tty)
21{ 29{
22 schedule_delayed_work(&tty->flip.work, 1); 30 schedule_delayed_work(&tty->buf.work, 1);
23} 31}
24 32
25#undef _INLINE_ 33#undef _INLINE_
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 6066afde5ce4..83c6e6c10ebb 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -81,14 +81,6 @@
81 * pointer of flag bytes which indicate whether a character was 81 * pointer of flag bytes which indicate whether a character was
82 * received with a parity error, etc. 82 * received with a parity error, etc.
83 * 83 *
84 * int (*receive_room)(struct tty_struct *);
85 *
86 * This function is called by the low-level tty driver to
87 * determine how many characters the line discpline can accept.
88 * The low-level driver must not send more characters than was
89 * indicated by receive_room, or the line discpline may drop
90 * those characters.
91 *
92 * void (*write_wakeup)(struct tty_struct *); 84 * void (*write_wakeup)(struct tty_struct *);
93 * 85 *
94 * This function is called by the low-level tty driver to signal 86 * This function is called by the low-level tty driver to signal
@@ -136,7 +128,6 @@ struct tty_ldisc {
136 */ 128 */
137 void (*receive_buf)(struct tty_struct *, const unsigned char *cp, 129 void (*receive_buf)(struct tty_struct *, const unsigned char *cp,
138 char *fp, int count); 130 char *fp, int count);
139 int (*receive_room)(struct tty_struct *);
140 void (*write_wakeup)(struct tty_struct *); 131 void (*write_wakeup)(struct tty_struct *);
141 132
142 struct module *owner; 133 struct module *owner;
diff --git a/include/linux/video_decoder.h b/include/linux/video_decoder.h
index 0e9e48b83e3b..121e26da2c18 100644
--- a/include/linux/video_decoder.h
+++ b/include/linux/video_decoder.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_VIDEO_DECODER_H 1#ifndef _LINUX_VIDEO_DECODER_H
2#define _LINUX_VIDEO_DECODER_H 2#define _LINUX_VIDEO_DECODER_H
3 3
4#define HAVE_VIDEO_DECODER 1
5
4struct video_decoder_capability { /* this name is too long */ 6struct video_decoder_capability { /* this name is too long */
5 __u32 flags; 7 __u32 flags;
6#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */ 8#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 1cded681eb6d..ce40675324bd 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -642,6 +642,12 @@ typedef __u64 v4l2_std_id;
642#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) 642#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
643#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) 643#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
644 644
645/* some merged standards */
646#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
647#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
648#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
649#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
650
645/* some common needed stuff */ 651/* some common needed stuff */
646#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ 652#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
647 V4L2_STD_PAL_B1 |\ 653 V4L2_STD_PAL_B1 |\
@@ -662,7 +668,8 @@ typedef __u64 v4l2_std_id;
662 V4L2_STD_SECAM_G |\ 668 V4L2_STD_SECAM_G |\
663 V4L2_STD_SECAM_H |\ 669 V4L2_STD_SECAM_H |\
664 V4L2_STD_SECAM_DK |\ 670 V4L2_STD_SECAM_DK |\
665 V4L2_STD_SECAM_L) 671 V4L2_STD_SECAM_L |\
672 V4L2_STD_SECAM_LC)
666 673
667#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ 674#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
668 V4L2_STD_PAL_60 |\ 675 V4L2_STD_PAL_60 |\
@@ -888,7 +895,6 @@ struct v4l2_audio
888 895
889/* Flags for the 'mode' field */ 896/* Flags for the 'mode' field */
890#define V4L2_AUDMODE_AVL 0x00001 897#define V4L2_AUDMODE_AVL 0x00001
891#define V4L2_AUDMODE_32BITS 0x00002
892 898
893struct v4l2_audioout 899struct v4l2_audioout
894{ 900{
@@ -1110,7 +1116,6 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
1110/* names for fancy debug output */ 1116/* names for fancy debug output */
1111extern char *v4l2_field_names[]; 1117extern char *v4l2_field_names[];
1112extern char *v4l2_type_names[]; 1118extern char *v4l2_type_names[];
1113extern char *v4l2_ioctl_names[];
1114 1119
1115/* Compatibility layer interface -- v4l1-compat module */ 1120/* Compatibility layer interface -- v4l1-compat module */
1116typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, 1121typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
@@ -1118,6 +1123,11 @@ typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
1118int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, 1123int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
1119 int cmd, void *arg, v4l2_kioctl driver_ioctl); 1124 int cmd, void *arg, v4l2_kioctl driver_ioctl);
1120 1125
1126/* 32 Bits compatibility layer for 64 bits processors */
1127extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
1128 unsigned long arg);
1129
1130
1121#endif /* __KERNEL__ */ 1131#endif /* __KERNEL__ */
1122#endif /* __LINUX_VIDEODEV2_H */ 1132#endif /* __LINUX_VIDEODEV2_H */
1123 1133
diff --git a/include/linux/wavefront.h b/include/linux/wavefront.h
index 61bd0fd35240..51ab3c933acd 100644
--- a/include/linux/wavefront.h
+++ b/include/linux/wavefront.h
@@ -434,22 +434,22 @@ typedef struct wf_multisample {
434} wavefront_multisample; 434} wavefront_multisample;
435 435
436typedef struct wf_alias { 436typedef struct wf_alias {
437 INT16 OriginalSample __attribute__ ((packed)); 437 INT16 OriginalSample;
438 438
439 struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); 439 struct wf_sample_offset sampleStartOffset;
440 struct wf_sample_offset loopStartOffset __attribute__ ((packed)); 440 struct wf_sample_offset loopStartOffset;
441 struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); 441 struct wf_sample_offset sampleEndOffset;
442 struct wf_sample_offset loopEndOffset __attribute__ ((packed)); 442 struct wf_sample_offset loopEndOffset;
443 443
444 INT16 FrequencyBias __attribute__ ((packed)); 444 INT16 FrequencyBias;
445 445
446 UCHAR8 SampleResolution:2 __attribute__ ((packed)); 446 UCHAR8 SampleResolution:2;
447 UCHAR8 Unused1:1 __attribute__ ((packed)); 447 UCHAR8 Unused1:1;
448 UCHAR8 Loop:1 __attribute__ ((packed)); 448 UCHAR8 Loop:1;
449 UCHAR8 Bidirectional:1 __attribute__ ((packed)); 449 UCHAR8 Bidirectional:1;
450 UCHAR8 Unused2:1 __attribute__ ((packed)); 450 UCHAR8 Unused2:1;
451 UCHAR8 Reverse:1 __attribute__ ((packed)); 451 UCHAR8 Reverse:1;
452 UCHAR8 Unused3:1 __attribute__ ((packed)); 452 UCHAR8 Unused3:1;
453 453
454 /* This structure is meant to be padded only to 16 bits on their 454 /* This structure is meant to be padded only to 16 bits on their
455 original. Of course, whoever wrote their documentation didn't 455 original. Of course, whoever wrote their documentation didn't
@@ -460,8 +460,8 @@ typedef struct wf_alias {
460 standard 16->32 bit issues. 460 standard 16->32 bit issues.
461 */ 461 */
462 462
463 UCHAR8 sixteen_bit_padding __attribute__ ((packed)); 463 UCHAR8 sixteen_bit_padding;
464} wavefront_alias; 464} __attribute__((packed)) wavefront_alias;
465 465
466typedef struct wf_drum { 466typedef struct wf_drum {
467 UCHAR8 PatchNumber; 467 UCHAR8 PatchNumber;
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index ac39d04d027c..86b111300231 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -65,6 +65,7 @@ extern int FASTCALL(schedule_work(struct work_struct *work));
65extern int FASTCALL(schedule_delayed_work(struct work_struct *work, unsigned long delay)); 65extern int FASTCALL(schedule_delayed_work(struct work_struct *work, unsigned long delay));
66 66
67extern int schedule_delayed_work_on(int cpu, struct work_struct *work, unsigned long delay); 67extern int schedule_delayed_work_on(int cpu, struct work_struct *work, unsigned long delay);
68extern int schedule_on_each_cpu(void (*func)(void *info), void *info);
68extern void flush_scheduled_work(void); 69extern void flush_scheduled_work(void);
69extern int current_is_keventd(void); 70extern int current_is_keventd(void);
70extern int keventd_up(void); 71extern int keventd_up(void);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index b096159086e8..beaef5c7a0ea 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -103,7 +103,9 @@ void balance_dirty_pages_ratelimited(struct address_space *mapping);
103int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); 103int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
104int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 104int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
105int sync_page_range(struct inode *inode, struct address_space *mapping, 105int sync_page_range(struct inode *inode, struct address_space *mapping,
106 loff_t pos, size_t count); 106 loff_t pos, loff_t count);
107int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
108 loff_t pos, loff_t count);
107 109
108/* pdflush.c */ 110/* pdflush.c */
109extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 111extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index 23f9c61d9546..cda8a96e2fa0 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -13,7 +13,22 @@
13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ 13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ 14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
15 15
16/* Namespaces */
17#define XATTR_OS2_PREFIX "os2."
18#define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1)
19
16#define XATTR_SECURITY_PREFIX "security." 20#define XATTR_SECURITY_PREFIX "security."
21#define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1)
22
23#define XATTR_SYSTEM_PREFIX "system."
24#define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1)
25
26#define XATTR_TRUSTED_PREFIX "trusted."
27#define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1)
28
29#define XATTR_USER_PREFIX "user."
30#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
31
17 32
18struct xattr_handler { 33struct xattr_handler {
19 char *prefix; 34 char *prefix;
@@ -25,6 +40,10 @@ struct xattr_handler {
25 size_t size, int flags); 40 size_t size, int flags);
26}; 41};
27 42
43ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t);
44int vfs_setxattr(struct dentry *, char *, void *, size_t, int);
45int vfs_removexattr(struct dentry *, char *);
46
28ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); 47ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
29ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); 48ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
30int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags); 49int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 74f7b78c22d2..4fa32f0d4df8 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -442,9 +442,11 @@ extern int deflateInit2 (z_streamp strm,
442 not perform any compression: this will be done by deflate(). 442 not perform any compression: this will be done by deflate().
443*/ 443*/
444 444
445#if 0
445extern int zlib_deflateSetDictionary (z_streamp strm, 446extern int zlib_deflateSetDictionary (z_streamp strm,
446 const Byte *dictionary, 447 const Byte *dictionary,
447 uInt dictLength); 448 uInt dictLength);
449#endif
448/* 450/*
449 Initializes the compression dictionary from the given byte sequence 451 Initializes the compression dictionary from the given byte sequence
450 without producing any compressed output. This function must be called 452 without producing any compressed output. This function must be called
@@ -478,7 +480,10 @@ extern int zlib_deflateSetDictionary (z_streamp strm,
478 perform any compression: this will be done by deflate(). 480 perform any compression: this will be done by deflate().
479*/ 481*/
480 482
483#if 0
481extern int zlib_deflateCopy (z_streamp dest, z_streamp source); 484extern int zlib_deflateCopy (z_streamp dest, z_streamp source);
485#endif
486
482/* 487/*
483 Sets the destination stream as a complete copy of the source stream. 488 Sets the destination stream as a complete copy of the source stream.
484 489
@@ -511,7 +516,9 @@ static inline unsigned long deflateBound(unsigned long s)
511 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; 516 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
512} 517}
513 518
519#if 0
514extern int zlib_deflateParams (z_streamp strm, int level, int strategy); 520extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
521#endif
515/* 522/*
516 Dynamically update the compression level and compression strategy. The 523 Dynamically update the compression level and compression strategy. The
517 interpretation of level and strategy is as in deflateInit2. This can be 524 interpretation of level and strategy is as in deflateInit2. This can be
@@ -571,7 +578,9 @@ extern int zlib_inflateSetDictionary (z_streamp strm,
571 inflate(). 578 inflate().
572*/ 579*/
573 580
581#if 0
574extern int zlib_inflateSync (z_streamp strm); 582extern int zlib_inflateSync (z_streamp strm);
583#endif
575/* 584/*
576 Skips invalid compressed data until a full flush point (see above the 585 Skips invalid compressed data until a full flush point (see above the
577 description of deflate with Z_FULL_FLUSH) can be found, or until all 586 description of deflate with Z_FULL_FLUSH) can be found, or until all
@@ -636,7 +645,9 @@ extern int zlib_inflateInit2_ (z_streamp strm, int windowBits,
636#endif 645#endif
637 646
638extern const char * zlib_zError (int err); 647extern const char * zlib_zError (int err);
648#if 0
639extern int zlib_inflateSyncPoint (z_streamp z); 649extern int zlib_inflateSyncPoint (z_streamp z);
650#endif
640extern const uLong * zlib_get_crc_table (void); 651extern const uLong * zlib_get_crc_table (void);
641 652
642#endif /* _ZLIB_H */ 653#endif /* _ZLIB_H */