aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJames Bottomley <jejb@titanic.(none)>2005-11-10 09:29:07 -0500
committerJames Bottomley <jejb@titanic.(none)>2005-11-10 09:29:07 -0500
commit8a87a0b6313109d2fea87b1271d497c954ce2ca8 (patch)
tree1b7ae51ff681e27118590e9cab4bf0ce38f5d80e /include
parente6a04466ba965875a6132700fabb2f2c0249c41a (diff)
parent3b44f137b9a846c5452d9e6e1271b79b1dbcc942 (diff)
Merge by hand (whitespace conflicts in libata.h)
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/ide.h4
-rw-r--r--include/asm-arm/arch-realview/entry-macro.S11
-rw-r--r--include/asm-arm/arch-realview/irqs.h3
-rw-r--r--include/asm-arm/arch-realview/platform.h5
-rw-r--r--include/asm-arm/arch-s3c2410/uncompress.h22
-rw-r--r--include/asm-arm/assembler.h9
-rw-r--r--include/asm-arm/hardirq.h1
-rw-r--r--include/asm-arm/hardware/scoop.h10
-rw-r--r--include/asm-arm/mach/flash.h3
-rw-r--r--include/asm-arm/smp.h54
-rw-r--r--include/asm-i386/ide.h6
-rw-r--r--include/asm-powerpc/pmc.h1
-rw-r--r--include/asm-ppc/mpc83xx.h1
-rw-r--r--include/asm-s390/debug.h16
-rw-r--r--include/asm-s390/ebcdic.h2
-rw-r--r--include/asm-s390/io.h8
-rw-r--r--include/asm-s390/lowcore.h2
-rw-r--r--include/asm-s390/mmu_context.h2
-rw-r--r--include/asm-s390/pgtable.h68
-rw-r--r--include/asm-s390/sigp.h6
-rw-r--r--include/asm-s390/smp.h2
-rw-r--r--include/asm-sh/ide.h4
-rw-r--r--include/asm-sh64/ide.h4
-rw-r--r--include/linux/compat_ioctl.h15
-rw-r--r--include/linux/cpu.h5
-rw-r--r--include/linux/eeprom.h136
-rw-r--r--include/linux/fb.h23
-rw-r--r--include/linux/fs.h6
-rw-r--r--include/linux/fs_enet_pd.h1
-rw-r--r--include/linux/genetlink.h51
-rw-r--r--include/linux/i2c-id.h18
-rw-r--r--include/linux/ide.h5
-rw-r--r--include/linux/if_ppp.h7
-rw-r--r--include/linux/if_wanpipe_common.h2
-rw-r--r--include/linux/istallion.h2
-rw-r--r--include/linux/mtd/cfi.h1
-rw-r--r--include/linux/mtd/mtd.h1
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h159
-rw-r--r--include/linux/netfilter/nf_conntrack_ftp.h44
-rw-r--r--include/linux/netfilter/nf_conntrack_sctp.h27
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h56
-rw-r--r--include/linux/netfilter/nf_conntrack_tuple_common.h13
-rw-r--r--include/linux/netfilter/nfnetlink.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h152
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_ftp.h39
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_icmp.h9
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sctp.h21
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tcp.h47
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h10
-rw-r--r--include/linux/netfilter_ipv6.h1
-rw-r--r--include/linux/netlink.h24
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/phonedev.h1
-rw-r--r--include/linux/ppp-comp.h9
-rw-r--r--include/linux/proc_fs.h1
-rw-r--r--include/linux/raid/bitmap.h11
-rw-r--r--include/linux/raid/md.h5
-rw-r--r--include/linux/raid/md_k.h40
-rw-r--r--include/linux/raid/raid1.h4
-rw-r--r--include/linux/raid/raid5.h2
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/skbuff.h19
-rw-r--r--include/linux/stallion.h2
-rw-r--r--include/linux/sysctl.h40
-rw-r--r--include/linux/videodev.h82
-rw-r--r--include/linux/videodev2.h207
-rw-r--r--include/media/audiochip.h17
-rw-r--r--include/media/id.h35
-rw-r--r--include/media/ir-common.h6
-rw-r--r--include/media/ir-kbd-i2c.h22
-rw-r--r--include/media/saa7146_vv.h2
-rw-r--r--include/media/tuner.h22
-rw-r--r--include/media/video-buf.h4
-rw-r--r--include/net/bluetooth/bluetooth.h4
-rw-r--r--include/net/bluetooth/hci.h116
-rw-r--r--include/net/bluetooth/hci_core.h9
-rw-r--r--include/net/bluetooth/rfcomm.h2
-rw-r--r--include/net/genetlink.h154
-rw-r--r--include/net/ieee80211.h2
-rw-r--r--include/net/ieee80211_crypt.h1
-rw-r--r--include/net/ipv6.h67
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_icmp.h11
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_ipv4.h43
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_icmpv6.h27
-rw-r--r--include/net/netfilter/nf_conntrack.h354
-rw-r--r--include/net/netfilter/nf_conntrack_compat.h108
-rw-r--r--include/net/netfilter/nf_conntrack_core.h76
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h51
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h93
-rw-r--r--include/net/netfilter/nf_conntrack_protocol.h105
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h190
-rw-r--r--include/net/netlink.h883
-rw-r--r--include/net/sock.h20
94 files changed, 3186 insertions, 788 deletions
diff --git a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h
index 68934a25931f..6126afe27380 100644
--- a/include/asm-alpha/ide.h
+++ b/include/asm-alpha/ide.h
@@ -15,10 +15,6 @@
15 15
16#include <linux/config.h> 16#include <linux/config.h>
17 17
18#ifndef MAX_HWIFS
19#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
20#endif
21
22#define IDE_ARCH_OBSOLETE_DEFAULTS 18#define IDE_ARCH_OBSOLETE_DEFAULTS
23 19
24static inline int ide_default_irq(unsigned long base) 20static inline int ide_default_irq(unsigned long base)
diff --git a/include/asm-arm/arch-realview/entry-macro.S b/include/asm-arm/arch-realview/entry-macro.S
index 4df469bf42e2..6288fad0dc41 100644
--- a/include/asm-arm/arch-realview/entry-macro.S
+++ b/include/asm-arm/arch-realview/entry-macro.S
@@ -61,3 +61,14 @@
61 strcc \irqstat, [\base, #GIC_CPU_EOI] 61 strcc \irqstat, [\base, #GIC_CPU_EOI]
62 cmpcs \irqnr, \irqnr 62 cmpcs \irqnr, \irqnr
63 .endm 63 .endm
64
65 /* As above, this assumes that irqstat and base are preserved.. */
66
67 .macro test_for_ltirq, irqnr, irqstat, base, tmp
68 bic \irqnr, \irqstat, #0x1c00
69 mov \tmp, #0
70 cmp \irqnr, #29
71 moveq \tmp, #1
72 streq \irqstat, [\base, #GIC_CPU_EOI]
73 cmp \tmp, #0
74 .endm
diff --git a/include/asm-arm/arch-realview/irqs.h b/include/asm-arm/arch-realview/irqs.h
index ff376494e5b1..c16223c9588d 100644
--- a/include/asm-arm/arch-realview/irqs.h
+++ b/include/asm-arm/arch-realview/irqs.h
@@ -21,6 +21,9 @@
21 21
22#include <asm/arch/platform.h> 22#include <asm/arch/platform.h>
23 23
24#define IRQ_LOCALTIMER 29
25#define IRQ_LOCALWDOG 30
26
24/* 27/*
25 * IRQ interrupts definitions are the same the INT definitions 28 * IRQ interrupts definitions are the same the INT definitions
26 * held within platform.h 29 * held within platform.h
diff --git a/include/asm-arm/arch-realview/platform.h b/include/asm-arm/arch-realview/platform.h
index aef9b36b3c37..18d7c18b738c 100644
--- a/include/asm-arm/arch-realview/platform.h
+++ b/include/asm-arm/arch-realview/platform.h
@@ -209,6 +209,8 @@
209#else 209#else
210#define REALVIEW_MPCORE_SCU_BASE 0x10100000 /* SCU registers */ 210#define REALVIEW_MPCORE_SCU_BASE 0x10100000 /* SCU registers */
211#define REALVIEW_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */ 211#define REALVIEW_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */
212#define REALVIEW_TWD_BASE 0x10100700
213#define REALVIEW_TWD_SIZE 0x00000100
212#define REALVIEW_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */ 214#define REALVIEW_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */
213#endif 215#endif
214#define REALVIEW_SMC_BASE 0x10080000 /* SMC */ 216#define REALVIEW_SMC_BASE 0x10080000 /* SMC */
@@ -305,9 +307,6 @@
305#define INT_TSPENINT 30 /* Touchscreen pen */ 307#define INT_TSPENINT 30 /* Touchscreen pen */
306#define INT_TSKPADINT 31 /* Touchscreen keypad */ 308#define INT_TSKPADINT 31 /* Touchscreen keypad */
307#else 309#else
308#define INT_LOCALTIMER 29
309#define INT_LOCALWDOG 30
310
311#define INT_AACI 0 310#define INT_AACI 0
312#define INT_TIMERINT0_1 1 311#define INT_TIMERINT0_1 1
313#define INT_TIMERINT2_3 2 312#define INT_TIMERINT2_3 2
diff --git a/include/asm-arm/arch-s3c2410/uncompress.h b/include/asm-arm/arch-s3c2410/uncompress.h
index d7a4a8354fa9..ddd1578a7ee0 100644
--- a/include/asm-arm/arch-s3c2410/uncompress.h
+++ b/include/asm-arm/arch-s3c2410/uncompress.h
@@ -116,6 +116,8 @@ putstr(const char *ptr)
116 } 116 }
117} 117}
118 118
119#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0)
120
119/* CONFIG_S3C2410_BOOT_WATCHDOG 121/* CONFIG_S3C2410_BOOT_WATCHDOG
120 * 122 *
121 * Simple boot-time watchdog setup, to reboot the system if there is 123 * Simple boot-time watchdog setup, to reboot the system if there is
@@ -126,8 +128,6 @@ putstr(const char *ptr)
126 128
127#define WDOG_COUNT (0xff00) 129#define WDOG_COUNT (0xff00)
128 130
129#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0)
130
131static inline void arch_decomp_wdog(void) 131static inline void arch_decomp_wdog(void)
132{ 132{
133 __raw_writel(WDOG_COUNT, S3C2410_WTCNT); 133 __raw_writel(WDOG_COUNT, S3C2410_WTCNT);
@@ -145,6 +145,24 @@ static void arch_decomp_wdog_start(void)
145#define arch_decomp_wdog() 145#define arch_decomp_wdog()
146#endif 146#endif
147 147
148#ifdef CONFIG_S3C2410_BOOT_ERROR_RESET
149
150static void arch_decomp_error(const char *x)
151{
152 putstr("\n\n");
153 putstr(x);
154 putstr("\n\n -- System resetting\n");
155
156 __raw_writel(0x4000, S3C2410_WTDAT);
157 __raw_writel(0x4000, S3C2410_WTCNT);
158 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON);
159
160 while(1);
161}
162
163#define arch_error arch_decomp_error
164#endif
165
148static void error(char *err); 166static void error(char *err);
149 167
150static void 168static void
diff --git a/include/asm-arm/assembler.h b/include/asm-arm/assembler.h
index 69a28f96bee2..f31ac92b6c7f 100644
--- a/include/asm-arm/assembler.h
+++ b/include/asm-arm/assembler.h
@@ -83,10 +83,13 @@
83 * Save the current IRQ state and disable IRQs. Note that this macro 83 * Save the current IRQ state and disable IRQs. Note that this macro
84 * assumes FIQs are enabled, and that the processor is in SVC mode. 84 * assumes FIQs are enabled, and that the processor is in SVC mode.
85 */ 85 */
86 .macro save_and_disable_irqs, oldcpsr, temp 86 .macro save_and_disable_irqs, oldcpsr
87 mrs \oldcpsr, cpsr 87 mrs \oldcpsr, cpsr
88 mov \temp, #PSR_I_BIT | MODE_SVC 88#if __LINUX_ARM_ARCH__ >= 6
89 msr cpsr_c, \temp 89 cpsid i
90#else
91 msr cpsr_c, #PSR_I_BIT | MODE_SVC
92#endif
90 .endm 93 .endm
91 94
92/* 95/*
diff --git a/include/asm-arm/hardirq.h b/include/asm-arm/hardirq.h
index e5ccb6b8ff83..1cbb173bf5b1 100644
--- a/include/asm-arm/hardirq.h
+++ b/include/asm-arm/hardirq.h
@@ -8,6 +8,7 @@
8 8
9typedef struct { 9typedef struct {
10 unsigned int __softirq_pending; 10 unsigned int __softirq_pending;
11 unsigned int local_timer_irqs;
11} ____cacheline_aligned irq_cpustat_t; 12} ____cacheline_aligned irq_cpustat_t;
12 13
13#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ 14#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
diff --git a/include/asm-arm/hardware/scoop.h b/include/asm-arm/hardware/scoop.h
index a8f1013930e3..d37bf7443264 100644
--- a/include/asm-arm/hardware/scoop.h
+++ b/include/asm-arm/hardware/scoop.h
@@ -52,8 +52,14 @@ struct scoop_pcmcia_dev {
52 unsigned char keep_rd; 52 unsigned char keep_rd;
53}; 53};
54 54
55extern int scoop_num; 55struct scoop_pcmcia_config {
56extern struct scoop_pcmcia_dev *scoop_devs; 56 struct scoop_pcmcia_dev *devs;
57 int num_devs;
58 void (*pcmcia_init)(void);
59 void (*power_ctrl)(struct device *scoop, unsigned short cpr, int nr);
60};
61
62extern struct scoop_pcmcia_config *platform_scoop_config;
57 63
58void reset_scoop(struct device *dev); 64void reset_scoop(struct device *dev);
59unsigned short set_scoop_gpio(struct device *dev, unsigned short bit); 65unsigned short set_scoop_gpio(struct device *dev, unsigned short bit);
diff --git a/include/asm-arm/mach/flash.h b/include/asm-arm/mach/flash.h
index cd57436d9874..05b029ef6371 100644
--- a/include/asm-arm/mach/flash.h
+++ b/include/asm-arm/mach/flash.h
@@ -11,6 +11,7 @@
11#define ASMARM_MACH_FLASH_H 11#define ASMARM_MACH_FLASH_H
12 12
13struct mtd_partition; 13struct mtd_partition;
14struct mtd_info;
14 15
15/* 16/*
16 * map_name: the map probe function name 17 * map_name: the map probe function name
@@ -19,6 +20,7 @@ struct mtd_partition;
19 * init: method called at driver/device initialisation 20 * init: method called at driver/device initialisation
20 * exit: method called at driver/device removal 21 * exit: method called at driver/device removal
21 * set_vpp: method called to enable or disable VPP 22 * set_vpp: method called to enable or disable VPP
23 * mmcontrol: method called to enable or disable Sync. Burst Read in OneNAND
22 * parts: optional array of mtd_partitions for static partitioning 24 * parts: optional array of mtd_partitions for static partitioning
23 * nr_parts: number of mtd_partitions for static partitoning 25 * nr_parts: number of mtd_partitions for static partitoning
24 */ 26 */
@@ -29,6 +31,7 @@ struct flash_platform_data {
29 int (*init)(void); 31 int (*init)(void);
30 void (*exit)(void); 32 void (*exit)(void);
31 void (*set_vpp)(int on); 33 void (*set_vpp)(int on);
34 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
32 struct mtd_partition *parts; 35 struct mtd_partition *parts;
33 unsigned int nr_parts; 36 unsigned int nr_parts;
34}; 37};
diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h
index 551cd3c3093c..5a72e50ca9fc 100644
--- a/include/asm-arm/smp.h
+++ b/include/asm-arm/smp.h
@@ -37,6 +37,11 @@ struct seq_file;
37extern void show_ipi_list(struct seq_file *p); 37extern void show_ipi_list(struct seq_file *p);
38 38
39/* 39/*
40 * Called from assembly code, this handles an IPI.
41 */
42asmlinkage void do_IPI(struct pt_regs *regs);
43
44/*
40 * Move global data into per-processor storage. 45 * Move global data into per-processor storage.
41 */ 46 */
42extern void smp_store_cpu_info(unsigned int cpuid); 47extern void smp_store_cpu_info(unsigned int cpuid);
@@ -47,12 +52,23 @@ extern void smp_store_cpu_info(unsigned int cpuid);
47extern void smp_cross_call(cpumask_t callmap); 52extern void smp_cross_call(cpumask_t callmap);
48 53
49/* 54/*
55 * Broadcast a timer interrupt to the other CPUs.
56 */
57extern void smp_send_timer(void);
58
59/*
50 * Boot a secondary CPU, and assign it the specified idle task. 60 * Boot a secondary CPU, and assign it the specified idle task.
51 * This also gives us the initial stack to use for this CPU. 61 * This also gives us the initial stack to use for this CPU.
52 */ 62 */
53extern int boot_secondary(unsigned int cpu, struct task_struct *); 63extern int boot_secondary(unsigned int cpu, struct task_struct *);
54 64
55/* 65/*
66 * Called from platform specific assembly code, this is the
67 * secondary CPU entry point.
68 */
69asmlinkage void secondary_start_kernel(void);
70
71/*
56 * Perform platform specific initialisation of the specified CPU. 72 * Perform platform specific initialisation of the specified CPU.
57 */ 73 */
58extern void platform_secondary_init(unsigned int cpu); 74extern void platform_secondary_init(unsigned int cpu);
@@ -76,4 +92,42 @@ extern void platform_cpu_die(unsigned int cpu);
76extern int platform_cpu_kill(unsigned int cpu); 92extern int platform_cpu_kill(unsigned int cpu);
77extern void platform_cpu_enable(unsigned int cpu); 93extern void platform_cpu_enable(unsigned int cpu);
78 94
95#ifdef CONFIG_LOCAL_TIMERS
96/*
97 * Setup a local timer interrupt for a CPU.
98 */
99extern void local_timer_setup(unsigned int cpu);
100
101/*
102 * Stop a local timer interrupt.
103 */
104extern void local_timer_stop(unsigned int cpu);
105
106/*
107 * Platform provides this to acknowledge a local timer IRQ
108 */
109extern int local_timer_ack(void);
110
111#else
112
113static inline void local_timer_setup(unsigned int cpu)
114{
115}
116
117static inline void local_timer_stop(unsigned int cpu)
118{
119}
120
121#endif
122
123/*
124 * show local interrupt info
125 */
126extern void show_local_irqs(struct seq_file *);
127
128/*
129 * Called from assembly, this is the local timer IRQ handler
130 */
131asmlinkage void do_local_timer(struct pt_regs *);
132
79#endif /* ifndef __ASM_ARM_SMP_H */ 133#endif /* ifndef __ASM_ARM_SMP_H */
diff --git a/include/asm-i386/ide.h b/include/asm-i386/ide.h
index 79dfab87135d..454440193eac 100644
--- a/include/asm-i386/ide.h
+++ b/include/asm-i386/ide.h
@@ -41,6 +41,12 @@ static __inline__ int ide_default_irq(unsigned long base)
41 41
42static __inline__ unsigned long ide_default_io_base(int index) 42static __inline__ unsigned long ide_default_io_base(int index)
43{ 43{
44 /*
45 * If PCI is present then it is not safe to poke around
46 * the other legacy IDE ports. Only 0x1f0 and 0x170 are
47 * defined compatibility mode ports for PCI. A user can
48 * override this using ide= but we must default safe.
49 */
44 if (pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) { 50 if (pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) {
45 switch(index) { 51 switch(index) {
46 case 2: return 0x1e8; 52 case 2: return 0x1e8;
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h
index 2f3c3fc2b796..5f41f3a2b293 100644
--- a/include/asm-powerpc/pmc.h
+++ b/include/asm-powerpc/pmc.h
@@ -22,6 +22,7 @@
22#include <asm/ptrace.h> 22#include <asm/ptrace.h>
23 23
24typedef void (*perf_irq_t)(struct pt_regs *); 24typedef void (*perf_irq_t)(struct pt_regs *);
25extern perf_irq_t perf_irq;
25 26
26int reserve_pmc_hardware(perf_irq_t new_perf_irq); 27int reserve_pmc_hardware(perf_irq_t new_perf_irq);
27void release_pmc_hardware(void); 28void release_pmc_hardware(void);
diff --git a/include/asm-ppc/mpc83xx.h b/include/asm-ppc/mpc83xx.h
index bb1b0576c947..ce212201db2a 100644
--- a/include/asm-ppc/mpc83xx.h
+++ b/include/asm-ppc/mpc83xx.h
@@ -107,6 +107,7 @@ enum ppc_sys_devices {
107 MPC83xx_SEC2, 107 MPC83xx_SEC2,
108 MPC83xx_USB2_DR, 108 MPC83xx_USB2_DR,
109 MPC83xx_USB2_MPH, 109 MPC83xx_USB2_MPH,
110 MPC83xx_MDIO,
110}; 111};
111 112
112#endif /* CONFIG_83xx */ 113#endif /* CONFIG_83xx */
diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h
index 7127030ae162..23450ed4b571 100644
--- a/include/asm-s390/debug.h
+++ b/include/asm-s390/debug.h
@@ -129,7 +129,7 @@ void debug_set_level(debug_info_t* id, int new_level);
129 129
130void debug_stop_all(void); 130void debug_stop_all(void);
131 131
132extern inline debug_entry_t* 132static inline debug_entry_t*
133debug_event(debug_info_t* id, int level, void* data, int length) 133debug_event(debug_info_t* id, int level, void* data, int length)
134{ 134{
135 if ((!id) || (level > id->level) || (id->pages_per_area == 0)) 135 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
@@ -137,7 +137,7 @@ debug_event(debug_info_t* id, int level, void* data, int length)
137 return debug_event_common(id,level,data,length); 137 return debug_event_common(id,level,data,length);
138} 138}
139 139
140extern inline debug_entry_t* 140static inline debug_entry_t*
141debug_int_event(debug_info_t* id, int level, unsigned int tag) 141debug_int_event(debug_info_t* id, int level, unsigned int tag)
142{ 142{
143 unsigned int t=tag; 143 unsigned int t=tag;
@@ -146,7 +146,7 @@ debug_int_event(debug_info_t* id, int level, unsigned int tag)
146 return debug_event_common(id,level,&t,sizeof(unsigned int)); 146 return debug_event_common(id,level,&t,sizeof(unsigned int));
147} 147}
148 148
149extern inline debug_entry_t * 149static inline debug_entry_t *
150debug_long_event (debug_info_t* id, int level, unsigned long tag) 150debug_long_event (debug_info_t* id, int level, unsigned long tag)
151{ 151{
152 unsigned long t=tag; 152 unsigned long t=tag;
@@ -155,7 +155,7 @@ debug_long_event (debug_info_t* id, int level, unsigned long tag)
155 return debug_event_common(id,level,&t,sizeof(unsigned long)); 155 return debug_event_common(id,level,&t,sizeof(unsigned long));
156} 156}
157 157
158extern inline debug_entry_t* 158static inline debug_entry_t*
159debug_text_event(debug_info_t* id, int level, const char* txt) 159debug_text_event(debug_info_t* id, int level, const char* txt)
160{ 160{
161 if ((!id) || (level > id->level) || (id->pages_per_area == 0)) 161 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
@@ -168,7 +168,7 @@ debug_sprintf_event(debug_info_t* id,int level,char *string,...)
168 __attribute__ ((format(printf, 3, 4))); 168 __attribute__ ((format(printf, 3, 4)));
169 169
170 170
171extern inline debug_entry_t* 171static inline debug_entry_t*
172debug_exception(debug_info_t* id, int level, void* data, int length) 172debug_exception(debug_info_t* id, int level, void* data, int length)
173{ 173{
174 if ((!id) || (level > id->level) || (id->pages_per_area == 0)) 174 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
@@ -176,7 +176,7 @@ debug_exception(debug_info_t* id, int level, void* data, int length)
176 return debug_exception_common(id,level,data,length); 176 return debug_exception_common(id,level,data,length);
177} 177}
178 178
179extern inline debug_entry_t* 179static inline debug_entry_t*
180debug_int_exception(debug_info_t* id, int level, unsigned int tag) 180debug_int_exception(debug_info_t* id, int level, unsigned int tag)
181{ 181{
182 unsigned int t=tag; 182 unsigned int t=tag;
@@ -185,7 +185,7 @@ debug_int_exception(debug_info_t* id, int level, unsigned int tag)
185 return debug_exception_common(id,level,&t,sizeof(unsigned int)); 185 return debug_exception_common(id,level,&t,sizeof(unsigned int));
186} 186}
187 187
188extern inline debug_entry_t * 188static inline debug_entry_t *
189debug_long_exception (debug_info_t* id, int level, unsigned long tag) 189debug_long_exception (debug_info_t* id, int level, unsigned long tag)
190{ 190{
191 unsigned long t=tag; 191 unsigned long t=tag;
@@ -194,7 +194,7 @@ debug_long_exception (debug_info_t* id, int level, unsigned long tag)
194 return debug_exception_common(id,level,&t,sizeof(unsigned long)); 194 return debug_exception_common(id,level,&t,sizeof(unsigned long));
195} 195}
196 196
197extern inline debug_entry_t* 197static inline debug_entry_t*
198debug_text_exception(debug_info_t* id, int level, const char* txt) 198debug_text_exception(debug_info_t* id, int level, const char* txt)
199{ 199{
200 if ((!id) || (level > id->level) || (id->pages_per_area == 0)) 200 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
diff --git a/include/asm-s390/ebcdic.h b/include/asm-s390/ebcdic.h
index 20e81e885821..4cbc336e4d60 100644
--- a/include/asm-s390/ebcdic.h
+++ b/include/asm-s390/ebcdic.h
@@ -21,7 +21,7 @@ extern __u8 _ebcasc[]; /* EBCDIC -> ASCII conversion table */
21extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */ 21extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */
22extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */ 22extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */
23 23
24extern __inline__ void 24static inline void
25codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr) 25codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr)
26{ 26{
27 if (nr-- <= 0) 27 if (nr-- <= 0)
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h
index 8188fdc9884f..71f55eb2350a 100644
--- a/include/asm-s390/io.h
+++ b/include/asm-s390/io.h
@@ -24,7 +24,7 @@
24 * Change virtual addresses to physical addresses and vv. 24 * Change virtual addresses to physical addresses and vv.
25 * These are pretty trivial 25 * These are pretty trivial
26 */ 26 */
27extern inline unsigned long virt_to_phys(volatile void * address) 27static inline unsigned long virt_to_phys(volatile void * address)
28{ 28{
29 unsigned long real_address; 29 unsigned long real_address;
30 __asm__ ( 30 __asm__ (
@@ -42,7 +42,7 @@ extern inline unsigned long virt_to_phys(volatile void * address)
42 return real_address; 42 return real_address;
43} 43}
44 44
45extern inline void * phys_to_virt(unsigned long address) 45static inline void * phys_to_virt(unsigned long address)
46{ 46{
47 return __io_virt(address); 47 return __io_virt(address);
48} 48}
@@ -54,7 +54,7 @@ extern inline void * phys_to_virt(unsigned long address)
54 54
55extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); 55extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
56 56
57extern inline void * ioremap (unsigned long offset, unsigned long size) 57static inline void * ioremap (unsigned long offset, unsigned long size)
58{ 58{
59 return __ioremap(offset, size, 0); 59 return __ioremap(offset, size, 0);
60} 60}
@@ -64,7 +64,7 @@ extern inline void * ioremap (unsigned long offset, unsigned long size)
64 * it's useful if some control registers are in such an area and write combining 64 * it's useful if some control registers are in such an area and write combining
65 * or read caching is not desirable: 65 * or read caching is not desirable:
66 */ 66 */
67extern inline void * ioremap_nocache (unsigned long offset, unsigned long size) 67static inline void * ioremap_nocache (unsigned long offset, unsigned long size)
68{ 68{
69 return __ioremap(offset, size, 0); 69 return __ioremap(offset, size, 0);
70} 70}
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index c6f51c9ce3ff..db0606c1abd4 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -346,7 +346,7 @@ struct _lowcore
346#define S390_lowcore (*((struct _lowcore *) 0)) 346#define S390_lowcore (*((struct _lowcore *) 0))
347extern struct _lowcore *lowcore_ptr[]; 347extern struct _lowcore *lowcore_ptr[];
348 348
349extern __inline__ void set_prefix(__u32 address) 349static inline void set_prefix(__u32 address)
350{ 350{
351 __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); 351 __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" );
352} 352}
diff --git a/include/asm-s390/mmu_context.h b/include/asm-s390/mmu_context.h
index 3a3bb3f2dad5..bcf24a873874 100644
--- a/include/asm-s390/mmu_context.h
+++ b/include/asm-s390/mmu_context.h
@@ -44,7 +44,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
44 44
45#define deactivate_mm(tsk,mm) do { } while (0) 45#define deactivate_mm(tsk,mm) do { } while (0)
46 46
47extern inline void activate_mm(struct mm_struct *prev, 47static inline void activate_mm(struct mm_struct *prev,
48 struct mm_struct *next) 48 struct mm_struct *next)
49{ 49{
50 switch_mm(prev, next, current); 50 switch_mm(prev, next, current);
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 9be741bb1496..859b5e969826 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -319,7 +319,7 @@ extern char empty_zero_page[PAGE_SIZE];
319 * within a page table are directly modified. Thus, the following 319 * within a page table are directly modified. Thus, the following
320 * hook is made available. 320 * hook is made available.
321 */ 321 */
322extern inline void set_pte(pte_t *pteptr, pte_t pteval) 322static inline void set_pte(pte_t *pteptr, pte_t pteval)
323{ 323{
324 *pteptr = pteval; 324 *pteptr = pteval;
325} 325}
@@ -330,63 +330,63 @@ extern inline void set_pte(pte_t *pteptr, pte_t pteval)
330 */ 330 */
331#ifndef __s390x__ 331#ifndef __s390x__
332 332
333extern inline int pgd_present(pgd_t pgd) { return 1; } 333static inline int pgd_present(pgd_t pgd) { return 1; }
334extern inline int pgd_none(pgd_t pgd) { return 0; } 334static inline int pgd_none(pgd_t pgd) { return 0; }
335extern inline int pgd_bad(pgd_t pgd) { return 0; } 335static inline int pgd_bad(pgd_t pgd) { return 0; }
336 336
337extern inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _SEG_PRESENT; } 337static inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _SEG_PRESENT; }
338extern inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } 338static inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; }
339extern inline int pmd_bad(pmd_t pmd) 339static inline int pmd_bad(pmd_t pmd)
340{ 340{
341 return (pmd_val(pmd) & (~PAGE_MASK & ~_PAGE_TABLE_INV)) != _PAGE_TABLE; 341 return (pmd_val(pmd) & (~PAGE_MASK & ~_PAGE_TABLE_INV)) != _PAGE_TABLE;
342} 342}
343 343
344#else /* __s390x__ */ 344#else /* __s390x__ */
345 345
346extern inline int pgd_present(pgd_t pgd) 346static inline int pgd_present(pgd_t pgd)
347{ 347{
348 return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY; 348 return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY;
349} 349}
350 350
351extern inline int pgd_none(pgd_t pgd) 351static inline int pgd_none(pgd_t pgd)
352{ 352{
353 return pgd_val(pgd) & _PGD_ENTRY_INV; 353 return pgd_val(pgd) & _PGD_ENTRY_INV;
354} 354}
355 355
356extern inline int pgd_bad(pgd_t pgd) 356static inline int pgd_bad(pgd_t pgd)
357{ 357{
358 return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY; 358 return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY;
359} 359}
360 360
361extern inline int pmd_present(pmd_t pmd) 361static inline int pmd_present(pmd_t pmd)
362{ 362{
363 return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY; 363 return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY;
364} 364}
365 365
366extern inline int pmd_none(pmd_t pmd) 366static inline int pmd_none(pmd_t pmd)
367{ 367{
368 return pmd_val(pmd) & _PMD_ENTRY_INV; 368 return pmd_val(pmd) & _PMD_ENTRY_INV;
369} 369}
370 370
371extern inline int pmd_bad(pmd_t pmd) 371static inline int pmd_bad(pmd_t pmd)
372{ 372{
373 return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY; 373 return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY;
374} 374}
375 375
376#endif /* __s390x__ */ 376#endif /* __s390x__ */
377 377
378extern inline int pte_none(pte_t pte) 378static inline int pte_none(pte_t pte)
379{ 379{
380 return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; 380 return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY;
381} 381}
382 382
383extern inline int pte_present(pte_t pte) 383static inline int pte_present(pte_t pte)
384{ 384{
385 return !(pte_val(pte) & _PAGE_INVALID) || 385 return !(pte_val(pte) & _PAGE_INVALID) ||
386 (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; 386 (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE;
387} 387}
388 388
389extern inline int pte_file(pte_t pte) 389static inline int pte_file(pte_t pte)
390{ 390{
391 return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; 391 return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE;
392} 392}
@@ -397,12 +397,12 @@ extern inline int pte_file(pte_t pte)
397 * query functions pte_write/pte_dirty/pte_young only work if 397 * query functions pte_write/pte_dirty/pte_young only work if
398 * pte_present() is true. Undefined behaviour if not.. 398 * pte_present() is true. Undefined behaviour if not..
399 */ 399 */
400extern inline int pte_write(pte_t pte) 400static inline int pte_write(pte_t pte)
401{ 401{
402 return (pte_val(pte) & _PAGE_RO) == 0; 402 return (pte_val(pte) & _PAGE_RO) == 0;
403} 403}
404 404
405extern inline int pte_dirty(pte_t pte) 405static inline int pte_dirty(pte_t pte)
406{ 406{
407 /* A pte is neither clean nor dirty on s/390. The dirty bit 407 /* A pte is neither clean nor dirty on s/390. The dirty bit
408 * is in the storage key. See page_test_and_clear_dirty for 408 * is in the storage key. See page_test_and_clear_dirty for
@@ -411,7 +411,7 @@ extern inline int pte_dirty(pte_t pte)
411 return 0; 411 return 0;
412} 412}
413 413
414extern inline int pte_young(pte_t pte) 414static inline int pte_young(pte_t pte)
415{ 415{
416 /* A pte is neither young nor old on s/390. The young bit 416 /* A pte is neither young nor old on s/390. The young bit
417 * is in the storage key. See page_test_and_clear_young for 417 * is in the storage key. See page_test_and_clear_young for
@@ -420,7 +420,7 @@ extern inline int pte_young(pte_t pte)
420 return 0; 420 return 0;
421} 421}
422 422
423extern inline int pte_read(pte_t pte) 423static inline int pte_read(pte_t pte)
424{ 424{
425 /* All pages are readable since we don't use the fetch 425 /* All pages are readable since we don't use the fetch
426 * protection bit in the storage key. 426 * protection bit in the storage key.
@@ -434,9 +434,9 @@ extern inline int pte_read(pte_t pte)
434 434
435#ifndef __s390x__ 435#ifndef __s390x__
436 436
437extern inline void pgd_clear(pgd_t * pgdp) { } 437static inline void pgd_clear(pgd_t * pgdp) { }
438 438
439extern inline void pmd_clear(pmd_t * pmdp) 439static inline void pmd_clear(pmd_t * pmdp)
440{ 440{
441 pmd_val(pmdp[0]) = _PAGE_TABLE_INV; 441 pmd_val(pmdp[0]) = _PAGE_TABLE_INV;
442 pmd_val(pmdp[1]) = _PAGE_TABLE_INV; 442 pmd_val(pmdp[1]) = _PAGE_TABLE_INV;
@@ -446,12 +446,12 @@ extern inline void pmd_clear(pmd_t * pmdp)
446 446
447#else /* __s390x__ */ 447#else /* __s390x__ */
448 448
449extern inline void pgd_clear(pgd_t * pgdp) 449static inline void pgd_clear(pgd_t * pgdp)
450{ 450{
451 pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY; 451 pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY;
452} 452}
453 453
454extern inline void pmd_clear(pmd_t * pmdp) 454static inline void pmd_clear(pmd_t * pmdp)
455{ 455{
456 pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; 456 pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY;
457 pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; 457 pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY;
@@ -459,7 +459,7 @@ extern inline void pmd_clear(pmd_t * pmdp)
459 459
460#endif /* __s390x__ */ 460#endif /* __s390x__ */
461 461
462extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 462static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
463{ 463{
464 pte_val(*ptep) = _PAGE_INVALID_EMPTY; 464 pte_val(*ptep) = _PAGE_INVALID_EMPTY;
465} 465}
@@ -468,14 +468,14 @@ extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt
468 * The following pte modification functions only work if 468 * The following pte modification functions only work if
469 * pte_present() is true. Undefined behaviour if not.. 469 * pte_present() is true. Undefined behaviour if not..
470 */ 470 */
471extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 471static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
472{ 472{
473 pte_val(pte) &= PAGE_MASK; 473 pte_val(pte) &= PAGE_MASK;
474 pte_val(pte) |= pgprot_val(newprot); 474 pte_val(pte) |= pgprot_val(newprot);
475 return pte; 475 return pte;
476} 476}
477 477
478extern inline pte_t pte_wrprotect(pte_t pte) 478static inline pte_t pte_wrprotect(pte_t pte)
479{ 479{
480 /* Do not clobber _PAGE_INVALID_NONE pages! */ 480 /* Do not clobber _PAGE_INVALID_NONE pages! */
481 if (!(pte_val(pte) & _PAGE_INVALID)) 481 if (!(pte_val(pte) & _PAGE_INVALID))
@@ -483,13 +483,13 @@ extern inline pte_t pte_wrprotect(pte_t pte)
483 return pte; 483 return pte;
484} 484}
485 485
486extern inline pte_t pte_mkwrite(pte_t pte) 486static inline pte_t pte_mkwrite(pte_t pte)
487{ 487{
488 pte_val(pte) &= ~_PAGE_RO; 488 pte_val(pte) &= ~_PAGE_RO;
489 return pte; 489 return pte;
490} 490}
491 491
492extern inline pte_t pte_mkclean(pte_t pte) 492static inline pte_t pte_mkclean(pte_t pte)
493{ 493{
494 /* The only user of pte_mkclean is the fork() code. 494 /* The only user of pte_mkclean is the fork() code.
495 We must *not* clear the *physical* page dirty bit 495 We must *not* clear the *physical* page dirty bit
@@ -498,7 +498,7 @@ extern inline pte_t pte_mkclean(pte_t pte)
498 return pte; 498 return pte;
499} 499}
500 500
501extern inline pte_t pte_mkdirty(pte_t pte) 501static inline pte_t pte_mkdirty(pte_t pte)
502{ 502{
503 /* We do not explicitly set the dirty bit because the 503 /* We do not explicitly set the dirty bit because the
504 * sske instruction is slow. It is faster to let the 504 * sske instruction is slow. It is faster to let the
@@ -507,7 +507,7 @@ extern inline pte_t pte_mkdirty(pte_t pte)
507 return pte; 507 return pte;
508} 508}
509 509
510extern inline pte_t pte_mkold(pte_t pte) 510static inline pte_t pte_mkold(pte_t pte)
511{ 511{
512 /* S/390 doesn't keep its dirty/referenced bit in the pte. 512 /* S/390 doesn't keep its dirty/referenced bit in the pte.
513 * There is no point in clearing the real referenced bit. 513 * There is no point in clearing the real referenced bit.
@@ -515,7 +515,7 @@ extern inline pte_t pte_mkold(pte_t pte)
515 return pte; 515 return pte;
516} 516}
517 517
518extern inline pte_t pte_mkyoung(pte_t pte) 518static inline pte_t pte_mkyoung(pte_t pte)
519{ 519{
520 /* S/390 doesn't keep its dirty/referenced bit in the pte. 520 /* S/390 doesn't keep its dirty/referenced bit in the pte.
521 * There is no point in setting the real referenced bit. 521 * There is no point in setting the real referenced bit.
@@ -695,7 +695,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
695#ifndef __s390x__ 695#ifndef __s390x__
696 696
697/* Find an entry in the second-level page table.. */ 697/* Find an entry in the second-level page table.. */
698extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) 698static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
699{ 699{
700 return (pmd_t *) dir; 700 return (pmd_t *) dir;
701} 701}
@@ -758,7 +758,7 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
758#else 758#else
759#define __SWP_OFFSET_MASK (~0UL >> 11) 759#define __SWP_OFFSET_MASK (~0UL >> 11)
760#endif 760#endif
761extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) 761static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
762{ 762{
763 pte_t pte; 763 pte_t pte;
764 offset &= __SWP_OFFSET_MASK; 764 offset &= __SWP_OFFSET_MASK;
diff --git a/include/asm-s390/sigp.h b/include/asm-s390/sigp.h
index 3979bc3858e2..fc56458aff66 100644
--- a/include/asm-s390/sigp.h
+++ b/include/asm-s390/sigp.h
@@ -67,7 +67,7 @@ typedef enum
67/* 67/*
68 * Signal processor 68 * Signal processor
69 */ 69 */
70extern __inline__ sigp_ccode 70static inline sigp_ccode
71signal_processor(__u16 cpu_addr, sigp_order_code order_code) 71signal_processor(__u16 cpu_addr, sigp_order_code order_code)
72{ 72{
73 sigp_ccode ccode; 73 sigp_ccode ccode;
@@ -86,7 +86,7 @@ signal_processor(__u16 cpu_addr, sigp_order_code order_code)
86/* 86/*
87 * Signal processor with parameter 87 * Signal processor with parameter
88 */ 88 */
89extern __inline__ sigp_ccode 89static inline sigp_ccode
90signal_processor_p(__u32 parameter, __u16 cpu_addr, 90signal_processor_p(__u32 parameter, __u16 cpu_addr,
91 sigp_order_code order_code) 91 sigp_order_code order_code)
92{ 92{
@@ -107,7 +107,7 @@ signal_processor_p(__u32 parameter, __u16 cpu_addr,
107/* 107/*
108 * Signal processor with parameter and return status 108 * Signal processor with parameter and return status
109 */ 109 */
110extern __inline__ sigp_ccode 110static inline sigp_ccode
111signal_processor_ps(__u32 *statusptr, __u32 parameter, 111signal_processor_ps(__u32 *statusptr, __u32 parameter,
112 __u16 cpu_addr, sigp_order_code order_code) 112 __u16 cpu_addr, sigp_order_code order_code)
113{ 113{
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index dd50e57a928f..a2ae7628bbaa 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -52,7 +52,7 @@ extern int smp_call_function_on(void (*func) (void *info), void *info,
52extern int smp_get_cpu(cpumask_t cpu_map); 52extern int smp_get_cpu(cpumask_t cpu_map);
53extern void smp_put_cpu(int cpu); 53extern void smp_put_cpu(int cpu);
54 54
55extern __inline__ __u16 hard_smp_processor_id(void) 55static inline __u16 hard_smp_processor_id(void)
56{ 56{
57 __u16 cpu_address; 57 __u16 cpu_address;
58 58
diff --git a/include/asm-sh/ide.h b/include/asm-sh/ide.h
index f42cf3977a57..711dad4cb48b 100644
--- a/include/asm-sh/ide.h
+++ b/include/asm-sh/ide.h
@@ -16,10 +16,6 @@
16 16
17#include <linux/config.h> 17#include <linux/config.h>
18 18
19#ifndef MAX_HWIFS
20#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
21#endif
22
23#define ide_default_io_ctl(base) (0) 19#define ide_default_io_ctl(base) (0)
24 20
25#include <asm-generic/ide_iops.h> 21#include <asm-generic/ide_iops.h>
diff --git a/include/asm-sh64/ide.h b/include/asm-sh64/ide.h
index 6fd514daa1ba..852f50afe39c 100644
--- a/include/asm-sh64/ide.h
+++ b/include/asm-sh64/ide.h
@@ -17,10 +17,6 @@
17 17
18#include <linux/config.h> 18#include <linux/config.h>
19 19
20#ifndef MAX_HWIFS
21#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
22#endif
23
24/* Without this, the initialisation of PCI IDE cards end up calling 20/* Without this, the initialisation of PCI IDE cards end up calling
25 * ide_init_hwif_ports, which won't work. */ 21 * ide_init_hwif_ports, which won't work. */
26#ifdef CONFIG_BLK_DEV_IDEPCI 22#ifdef CONFIG_BLK_DEV_IDEPCI
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index ecb0d39c0798..2209ad3499a3 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -10,6 +10,10 @@
10#define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl) 10#define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl)
11#endif 11#endif
12 12
13
14COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */
15COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */
16
13/* Big T */ 17/* Big T */
14COMPATIBLE_IOCTL(TCGETA) 18COMPATIBLE_IOCTL(TCGETA)
15COMPATIBLE_IOCTL(TCSETA) 19COMPATIBLE_IOCTL(TCSETA)
@@ -52,13 +56,6 @@ ULONG_IOCTL(TIOCSCTTY)
52COMPATIBLE_IOCTL(TIOCGPTN) 56COMPATIBLE_IOCTL(TIOCGPTN)
53COMPATIBLE_IOCTL(TIOCSPTLCK) 57COMPATIBLE_IOCTL(TIOCSPTLCK)
54COMPATIBLE_IOCTL(TIOCSERGETLSR) 58COMPATIBLE_IOCTL(TIOCSERGETLSR)
55/* Big F */
56COMPATIBLE_IOCTL(FBIOBLANK)
57COMPATIBLE_IOCTL(FBIOGET_VSCREENINFO)
58COMPATIBLE_IOCTL(FBIOPUT_VSCREENINFO)
59COMPATIBLE_IOCTL(FBIOPAN_DISPLAY)
60COMPATIBLE_IOCTL(FBIOGET_CON2FBMAP)
61COMPATIBLE_IOCTL(FBIOPUT_CON2FBMAP)
62/* Little f */ 59/* Little f */
63COMPATIBLE_IOCTL(FIOCLEX) 60COMPATIBLE_IOCTL(FIOCLEX)
64COMPATIBLE_IOCTL(FIONCLEX) 61COMPATIBLE_IOCTL(FIONCLEX)
@@ -81,6 +78,8 @@ COMPATIBLE_IOCTL(HDIO_DRIVE_CMD)
81COMPATIBLE_IOCTL(HDIO_DRIVE_TASK) 78COMPATIBLE_IOCTL(HDIO_DRIVE_TASK)
82COMPATIBLE_IOCTL(HDIO_SET_PIO_MODE) 79COMPATIBLE_IOCTL(HDIO_SET_PIO_MODE)
83COMPATIBLE_IOCTL(HDIO_SET_NICE) 80COMPATIBLE_IOCTL(HDIO_SET_NICE)
81COMPATIBLE_IOCTL(HDIO_SET_KEEPSETTINGS)
82COMPATIBLE_IOCTL(HDIO_SCAN_HWIF)
84/* 0x02 -- Floppy ioctls */ 83/* 0x02 -- Floppy ioctls */
85COMPATIBLE_IOCTL(FDMSGON) 84COMPATIBLE_IOCTL(FDMSGON)
86COMPATIBLE_IOCTL(FDMSGOFF) 85COMPATIBLE_IOCTL(FDMSGOFF)
@@ -99,6 +98,7 @@ COMPATIBLE_IOCTL(FDTWADDLE)
99COMPATIBLE_IOCTL(FDFMTTRK) 98COMPATIBLE_IOCTL(FDFMTTRK)
100COMPATIBLE_IOCTL(FDRAWCMD) 99COMPATIBLE_IOCTL(FDRAWCMD)
101/* 0x12 */ 100/* 0x12 */
101COMPATIBLE_IOCTL(BLKRASET)
102COMPATIBLE_IOCTL(BLKROSET) 102COMPATIBLE_IOCTL(BLKROSET)
103COMPATIBLE_IOCTL(BLKROGET) 103COMPATIBLE_IOCTL(BLKROGET)
104COMPATIBLE_IOCTL(BLKRRPART) 104COMPATIBLE_IOCTL(BLKRRPART)
@@ -262,6 +262,7 @@ COMPATIBLE_IOCTL(RTC_WKALM_RD)
262/* Little m */ 262/* Little m */
263COMPATIBLE_IOCTL(MTIOCTOP) 263COMPATIBLE_IOCTL(MTIOCTOP)
264/* Socket level stuff */ 264/* Socket level stuff */
265COMPATIBLE_IOCTL(FIOQSIZE)
265COMPATIBLE_IOCTL(FIOSETOWN) 266COMPATIBLE_IOCTL(FIOSETOWN)
266COMPATIBLE_IOCTL(SIOCSPGRP) 267COMPATIBLE_IOCTL(SIOCSPGRP)
267COMPATIBLE_IOCTL(FIOGETOWN) 268COMPATIBLE_IOCTL(FIOGETOWN)
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 1f7b2c097503..43c44530ef9d 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -42,6 +42,7 @@ struct notifier_block;
42/* Need to know about CPUs going up/down? */ 42/* Need to know about CPUs going up/down? */
43extern int register_cpu_notifier(struct notifier_block *nb); 43extern int register_cpu_notifier(struct notifier_block *nb);
44extern void unregister_cpu_notifier(struct notifier_block *nb); 44extern void unregister_cpu_notifier(struct notifier_block *nb);
45extern int current_in_cpu_hotplug(void);
45 46
46int cpu_up(unsigned int cpu); 47int cpu_up(unsigned int cpu);
47 48
@@ -54,6 +55,10 @@ static inline int register_cpu_notifier(struct notifier_block *nb)
54static inline void unregister_cpu_notifier(struct notifier_block *nb) 55static inline void unregister_cpu_notifier(struct notifier_block *nb)
55{ 56{
56} 57}
58static inline int current_in_cpu_hotplug(void)
59{
60 return 0;
61}
57 62
58#endif /* CONFIG_SMP */ 63#endif /* CONFIG_SMP */
59extern struct sysdev_class cpu_sysdev_class; 64extern struct sysdev_class cpu_sysdev_class;
diff --git a/include/linux/eeprom.h b/include/linux/eeprom.h
deleted file mode 100644
index 38afd9da1dfe..000000000000
--- a/include/linux/eeprom.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/* credit winbond-840.c
2 */
3#include <asm/io.h>
4struct eeprom_ops {
5 void (*set_cs)(void *ee);
6 void (*clear_cs)(void *ee);
7};
8
9#define EEPOL_EEDI 0x01
10#define EEPOL_EEDO 0x02
11#define EEPOL_EECLK 0x04
12#define EEPOL_EESEL 0x08
13
14struct eeprom {
15 void *dev;
16 struct eeprom_ops *ops;
17
18 void __iomem * addr;
19
20 unsigned ee_addr_bits;
21
22 unsigned eesel;
23 unsigned eeclk;
24 unsigned eedo;
25 unsigned eedi;
26 unsigned polarity;
27 unsigned ee_state;
28
29 spinlock_t *lock;
30 u32 *cache;
31};
32
33
34u8 eeprom_readb(struct eeprom *ee, unsigned address);
35void eeprom_read(struct eeprom *ee, unsigned address, u8 *bytes,
36 unsigned count);
37void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data);
38void eeprom_write(struct eeprom *ee, unsigned address, u8 *bytes,
39 unsigned count);
40
41/* The EEPROM commands include the alway-set leading bit. */
42enum EEPROM_Cmds {
43 EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6),
44};
45
46void setup_ee_mem_bitbanger(struct eeprom *ee, void __iomem *memaddr, int eesel_bit, int eeclk_bit, int eedo_bit, int eedi_bit, unsigned polarity)
47{
48 ee->addr = memaddr;
49 ee->eesel = 1 << eesel_bit;
50 ee->eeclk = 1 << eeclk_bit;
51 ee->eedo = 1 << eedo_bit;
52 ee->eedi = 1 << eedi_bit;
53
54 ee->polarity = polarity;
55
56 *ee->cache = readl(ee->addr);
57}
58
59/* foo. put this in a .c file */
60static inline void eeprom_update(struct eeprom *ee, u32 mask, int pol)
61{
62 unsigned long flags;
63 u32 data;
64
65 spin_lock_irqsave(ee->lock, flags);
66 data = *ee->cache;
67
68 data &= ~mask;
69 if (pol)
70 data |= mask;
71
72 *ee->cache = data;
73//printk("update: %08x\n", data);
74 writel(data, ee->addr);
75 spin_unlock_irqrestore(ee->lock, flags);
76}
77
78void eeprom_clk_lo(struct eeprom *ee)
79{
80 int pol = !!(ee->polarity & EEPOL_EECLK);
81
82 eeprom_update(ee, ee->eeclk, pol);
83 udelay(2);
84}
85
86void eeprom_clk_hi(struct eeprom *ee)
87{
88 int pol = !!(ee->polarity & EEPOL_EECLK);
89
90 eeprom_update(ee, ee->eeclk, !pol);
91 udelay(2);
92}
93
94void eeprom_send_addr(struct eeprom *ee, unsigned address)
95{
96 int pol = !!(ee->polarity & EEPOL_EEDI);
97 unsigned i;
98 address |= 6 << 6;
99
100 /* Shift the read command bits out. */
101 for (i=0; i<11; i++) {
102 eeprom_update(ee, ee->eedi, ((address >> 10) & 1) ^ pol);
103 address <<= 1;
104 eeprom_clk_hi(ee);
105 eeprom_clk_lo(ee);
106 }
107 eeprom_update(ee, ee->eedi, pol);
108}
109
110u16 eeprom_readw(struct eeprom *ee, unsigned address)
111{
112 unsigned i;
113 u16 res = 0;
114
115 eeprom_clk_lo(ee);
116 eeprom_update(ee, ee->eesel, 1 ^ !!(ee->polarity & EEPOL_EESEL));
117 eeprom_send_addr(ee, address);
118
119 for (i=0; i<16; i++) {
120 u32 data;
121 eeprom_clk_hi(ee);
122 res <<= 1;
123 data = readl(ee->addr);
124//printk("eeprom_readw: %08x\n", data);
125 res |= !!(data & ee->eedo) ^ !!(ee->polarity & EEPOL_EEDO);
126 eeprom_clk_lo(ee);
127 }
128 eeprom_update(ee, ee->eesel, 0 ^ !!(ee->polarity & EEPOL_EESEL));
129
130 return res;
131}
132
133
134void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data)
135{
136}
diff --git a/include/linux/fb.h b/include/linux/fb.h
index e7ff98e395f6..04a58f33ec53 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -201,6 +201,14 @@ struct fb_bitfield {
201#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ 201#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
202#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ 202#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
203 203
204/*
205 * Display rotation support
206 */
207#define FB_ROTATE_UR 0
208#define FB_ROTATE_CW 1
209#define FB_ROTATE_UD 2
210#define FB_ROTATE_CCW 3
211
204#define PICOS2KHZ(a) (1000000000UL/(a)) 212#define PICOS2KHZ(a) (1000000000UL/(a))
205#define KHZ2PICOS(a) (1000000000UL/(a)) 213#define KHZ2PICOS(a) (1000000000UL/(a))
206 214
@@ -489,9 +497,9 @@ struct fb_cursor_user {
489#define FB_EVENT_MODE_DELETE 0x04 497#define FB_EVENT_MODE_DELETE 0x04
490/* A driver registered itself */ 498/* A driver registered itself */
491#define FB_EVENT_FB_REGISTERED 0x05 499#define FB_EVENT_FB_REGISTERED 0x05
492/* get console to framebuffer mapping */ 500/* CONSOLE-SPECIFIC: get console to framebuffer mapping */
493#define FB_EVENT_GET_CONSOLE_MAP 0x06 501#define FB_EVENT_GET_CONSOLE_MAP 0x06
494/* set console to framebuffer mapping */ 502/* CONSOLE-SPECIFIC: set console to framebuffer mapping */
495#define FB_EVENT_SET_CONSOLE_MAP 0x07 503#define FB_EVENT_SET_CONSOLE_MAP 0x07
496/* A display blank is requested */ 504/* A display blank is requested */
497#define FB_EVENT_BLANK 0x08 505#define FB_EVENT_BLANK 0x08
@@ -500,6 +508,12 @@ struct fb_cursor_user {
500/* The resolution of the passed in fb_info about to change and 508/* The resolution of the passed in fb_info about to change and
501 all vc's should be changed */ 509 all vc's should be changed */
502#define FB_EVENT_MODE_CHANGE_ALL 0x0A 510#define FB_EVENT_MODE_CHANGE_ALL 0x0A
511/* CONSOLE-SPECIFIC: set console rotation */
512#define FB_EVENT_SET_CON_ROTATE 0x0B
513/* CONSOLE-SPECIFIC: get console rotation */
514#define FB_EVENT_GET_CON_ROTATE 0x0C
515/* CONSOLE-SPECIFIC: rotate all consoles */
516#define FB_EVENT_SET_CON_ROTATE_ALL 0x0D
503 517
504struct fb_event { 518struct fb_event {
505 struct fb_info *info; 519 struct fb_info *info;
@@ -817,8 +831,8 @@ extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);
817/* drivers/video/fbmem.c */ 831/* drivers/video/fbmem.c */
818extern int register_framebuffer(struct fb_info *fb_info); 832extern int register_framebuffer(struct fb_info *fb_info);
819extern int unregister_framebuffer(struct fb_info *fb_info); 833extern int unregister_framebuffer(struct fb_info *fb_info);
820extern int fb_prepare_logo(struct fb_info *fb_info); 834extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
821extern int fb_show_logo(struct fb_info *fb_info); 835extern int fb_show_logo(struct fb_info *fb_info, int rotate);
822extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); 836extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
823extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, 837extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
824 u32 height, u32 shift_high, u32 shift_low, u32 mod); 838 u32 height, u32 shift_high, u32 shift_low, u32 mod);
@@ -828,6 +842,7 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var,
828 struct fb_fix_screeninfo *fix); 842 struct fb_fix_screeninfo *fix);
829extern int fb_get_options(char *name, char **option); 843extern int fb_get_options(char *name, char **option);
830extern int fb_new_modelist(struct fb_info *info); 844extern int fb_new_modelist(struct fb_info *info);
845extern int fb_con_duit(struct fb_info *info, int event, void *data);
831 846
832extern struct fb_info *registered_fb[FB_MAX]; 847extern struct fb_info *registered_fb[FB_MAX];
833extern int num_registered_fb; 848extern int num_registered_fb;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1b5f502a4b8f..cc35b6ac778d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -874,6 +874,7 @@ static inline void unlock_super(struct super_block * sb)
874/* 874/*
875 * VFS helper functions.. 875 * VFS helper functions..
876 */ 876 */
877extern int vfs_permission(struct nameidata *, int);
877extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 878extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
878extern int vfs_mkdir(struct inode *, struct dentry *, int); 879extern int vfs_mkdir(struct inode *, struct dentry *, int);
879extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 880extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
@@ -889,6 +890,11 @@ extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct de
889extern void dentry_unhash(struct dentry *dentry); 890extern void dentry_unhash(struct dentry *dentry);
890 891
891/* 892/*
893 * VFS file helper functions.
894 */
895extern int file_permission(struct file *, int);
896
897/*
892 * File types 898 * File types
893 * 899 *
894 * NOTE! These match bits 12..15 of stat.st_mode 900 * NOTE! These match bits 12..15 of stat.st_mode
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index bef23bbf8690..783c476b8674 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -16,7 +16,6 @@
16#ifndef FS_ENET_PD_H 16#ifndef FS_ENET_PD_H
17#define FS_ENET_PD_H 17#define FS_ENET_PD_H
18 18
19#include <linux/version.h>
20#include <asm/types.h> 19#include <asm/types.h>
21 20
22#define FS_ENET_NAME "fs_enet" 21#define FS_ENET_NAME "fs_enet"
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
new file mode 100644
index 000000000000..84f12a41dc01
--- /dev/null
+++ b/include/linux/genetlink.h
@@ -0,0 +1,51 @@
1#ifndef __LINUX_GENERIC_NETLINK_H
2#define __LINUX_GENERIC_NETLINK_H
3
4#include <linux/netlink.h>
5
6#define GENL_NAMSIZ 16 /* length of family name */
7
8#define GENL_MIN_ID NLMSG_MIN_TYPE
9#define GENL_MAX_ID 1023
10
11struct genlmsghdr {
12 __u8 cmd;
13 __u8 version;
14 __u16 reserved;
15};
16
17#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
18
19/*
20 * List of reserved static generic netlink identifiers:
21 */
22#define GENL_ID_GENERATE 0
23#define GENL_ID_CTRL NLMSG_MIN_TYPE
24
25/**************************************************************************
26 * Controller
27 **************************************************************************/
28
29enum {
30 CTRL_CMD_UNSPEC,
31 CTRL_CMD_NEWFAMILY,
32 CTRL_CMD_DELFAMILY,
33 CTRL_CMD_GETFAMILY,
34 CTRL_CMD_NEWOPS,
35 CTRL_CMD_DELOPS,
36 CTRL_CMD_GETOPS,
37 __CTRL_CMD_MAX,
38};
39
40#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
41
42enum {
43 CTRL_ATTR_UNSPEC,
44 CTRL_ATTR_FAMILY_ID,
45 CTRL_ATTR_FAMILY_NAME,
46 __CTRL_ATTR_MAX,
47};
48
49#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
50
51#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 1ce4b54caa21..74abaecdb572 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -27,10 +27,10 @@
27 * ---- Driver types ----------------------------------------------------- 27 * ---- Driver types -----------------------------------------------------
28 * device id name + number function description, i2c address(es) 28 * device id name + number function description, i2c address(es)
29 * 29 *
30 * Range 1000-1999 range is defined in sensors/sensors.h 30 * Range 1000-1999 range is defined in sensors/sensors.h
31 * Range 0x100 - 0x1ff is for V4L2 Common Components 31 * Range 0x100 - 0x1ff is for V4L2 Common Components
32 * Range 0xf000 - 0xffff is reserved for local experimentation, and should 32 * Range 0xf000 - 0xffff is reserved for local experimentation, and should
33 * never be used in official drivers 33 * never be used in official drivers
34 */ 34 */
35 35
36#define I2C_DRIVERID_MSP3400 1 36#define I2C_DRIVERID_MSP3400 1
@@ -99,7 +99,14 @@
99#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ 99#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */
100#define I2C_DRIVERID_SAA7114H 64 /* video decoder */ 100#define I2C_DRIVERID_SAA7114H 64 /* video decoder */
101#define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */ 101#define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */
102 102#define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */
103#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */
104#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */
105#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */
106#define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */
107#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */
108#define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */
109#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
103 110
104#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ 111#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */
105#define I2C_DRIVERID_EXP1 0xF1 112#define I2C_DRIVERID_EXP1 0xF1
@@ -111,7 +118,7 @@
111#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 118#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
112#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ 119#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */
113 120
114/* IDs -- Use DRIVERIDs 1000-1999 for sensors. 121/* IDs -- Use DRIVERIDs 1000-1999 for sensors.
115 These were originally in sensors.h in the lm_sensors package */ 122 These were originally in sensors.h in the lm_sensors package */
116#define I2C_DRIVERID_LM78 1002 123#define I2C_DRIVERID_LM78 1002
117#define I2C_DRIVERID_LM75 1003 124#define I2C_DRIVERID_LM75 1003
@@ -190,6 +197,7 @@
190#define I2C_HW_B_NVIDIA 0x01001c /* nvidia framebuffer driver */ 197#define I2C_HW_B_NVIDIA 0x01001c /* nvidia framebuffer driver */
191#define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ 198#define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */
192#define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ 199#define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */
200#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */
193 201
194/* --- PCF 8584 based algorithms */ 202/* --- PCF 8584 based algorithms */
195#define I2C_HW_P_LP 0x020000 /* Parallel port interface */ 203#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 3461abc1e854..77ae55d4c13c 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -230,6 +230,7 @@ typedef struct hw_regs_s {
230 int dma; /* our dma entry */ 230 int dma; /* our dma entry */
231 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ 231 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
232 hwif_chipset_t chipset; 232 hwif_chipset_t chipset;
233 struct device *dev;
233} hw_regs_t; 234} hw_regs_t;
234 235
235/* 236/*
@@ -266,6 +267,10 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
266 267
267#include <asm/ide.h> 268#include <asm/ide.h>
268 269
270#ifndef MAX_HWIFS
271#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
272#endif
273
269/* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */ 274/* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */
270#ifndef IDE_ARCH_OBSOLETE_DEFAULTS 275#ifndef IDE_ARCH_OBSOLETE_DEFAULTS
271# define ide_default_io_base(index) (0) 276# define ide_default_io_base(index) (0)
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h
index 572aff7daa21..768372f07caa 100644
--- a/include/linux/if_ppp.h
+++ b/include/linux/if_ppp.h
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23/* 23/*
24 * ==FILEVERSION 20000724== 24 * ==FILEVERSION 20050812==
25 * 25 *
26 * NOTE TO MAINTAINERS: 26 * NOTE TO MAINTAINERS:
27 * If you modify this file at all, please set the above date. 27 * If you modify this file at all, please set the above date.
@@ -35,6 +35,8 @@
35#ifndef _IF_PPP_H_ 35#ifndef _IF_PPP_H_
36#define _IF_PPP_H_ 36#define _IF_PPP_H_
37 37
38#include <linux/compiler.h>
39
38/* 40/*
39 * Packet sizes 41 * Packet sizes
40 */ 42 */
@@ -70,7 +72,8 @@
70#define SC_LOG_RAWIN 0x00080000 /* log all chars received */ 72#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
71#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ 73#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
72#define SC_SYNC 0x00200000 /* synchronous serial mode */ 74#define SC_SYNC 0x00200000 /* synchronous serial mode */
73#define SC_MASK 0x0f200fff /* bits that user can change */ 75#define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */
76#define SC_MASK 0x0f600fff /* bits that user can change */
74 77
75/* state bits */ 78/* state bits */
76#define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ 79#define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */
diff --git a/include/linux/if_wanpipe_common.h b/include/linux/if_wanpipe_common.h
index f25fec8ee2ca..6e5461d69fdd 100644
--- a/include/linux/if_wanpipe_common.h
+++ b/include/linux/if_wanpipe_common.h
@@ -17,8 +17,6 @@
17#ifndef _WANPIPE_SOCK_DRIVER_COMMON_H 17#ifndef _WANPIPE_SOCK_DRIVER_COMMON_H
18#define _WANPIPE_SOCK_DRIVER_COMMON_H 18#define _WANPIPE_SOCK_DRIVER_COMMON_H
19 19
20#include <linux/version.h>
21
22typedef struct { 20typedef struct {
23 struct net_device *slave; 21 struct net_device *slave;
24 atomic_t packet_sent; 22 atomic_t packet_sent;
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index 5f4ee646c119..1f996621bc9c 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -21,8 +21,6 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23 23
24#include <linux/version.h>
25
26/*****************************************************************************/ 24/*****************************************************************************/
27#ifndef _ISTALLION_H 25#ifndef _ISTALLION_H
28#define _ISTALLION_H 26#define _ISTALLION_H
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 39f1430bd6d5..3c9ea4b7adda 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -8,7 +8,6 @@
8#define __MTD_CFI_H__ 8#define __MTD_CFI_H__
9 9
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/version.h>
12#include <linux/delay.h> 11#include <linux/delay.h>
13#include <linux/types.h> 12#include <linux/types.h>
14#include <linux/interrupt.h> 13#include <linux/interrupt.h>
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index e95d0463a3e5..b6f2fdae65c6 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -14,7 +14,6 @@
14#endif 14#endif
15 15
16#include <linux/config.h> 16#include <linux/config.h>
17#include <linux/version.h>
18#include <linux/types.h> 17#include <linux/types.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/uio.h> 19#include <linux/uio.h>
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 1c975d0d9e94..455660eafba9 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -74,7 +74,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
74extern void release_open_intent(struct nameidata *); 74extern void release_open_intent(struct nameidata *);
75 75
76extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 76extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
77extern struct dentry * lookup_hash(struct qstr *, struct dentry *); 77extern struct dentry * lookup_hash(struct nameidata *);
78 78
79extern int follow_down(struct vfsmount **, struct dentry **); 79extern int follow_down(struct vfsmount **, struct dentry **);
80extern int follow_up(struct vfsmount **, struct dentry **); 80extern int follow_up(struct vfsmount **, struct dentry **);
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
new file mode 100644
index 000000000000..6d39b518486b
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -0,0 +1,159 @@
1#ifndef _NF_CONNTRACK_COMMON_H
2#define _NF_CONNTRACK_COMMON_H
3/* Connection state tracking for netfilter. This is separated from,
4 but required by, the NAT layer; it can also be used by an iptables
5 extension. */
6enum ip_conntrack_info
7{
8 /* Part of an established connection (either direction). */
9 IP_CT_ESTABLISHED,
10
11 /* Like NEW, but related to an existing connection, or ICMP error
12 (in either direction). */
13 IP_CT_RELATED,
14
15 /* Started a new connection to track (only
16 IP_CT_DIR_ORIGINAL); may be a retransmission. */
17 IP_CT_NEW,
18
19 /* >= this indicates reply direction */
20 IP_CT_IS_REPLY,
21
22 /* Number of distinct IP_CT types (no NEW in reply dirn). */
23 IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
24};
25
26/* Bitset representing status of connection. */
27enum ip_conntrack_status {
28 /* It's an expected connection: bit 0 set. This bit never changed */
29 IPS_EXPECTED_BIT = 0,
30 IPS_EXPECTED = (1 << IPS_EXPECTED_BIT),
31
32 /* We've seen packets both ways: bit 1 set. Can be set, not unset. */
33 IPS_SEEN_REPLY_BIT = 1,
34 IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT),
35
36 /* Conntrack should never be early-expired. */
37 IPS_ASSURED_BIT = 2,
38 IPS_ASSURED = (1 << IPS_ASSURED_BIT),
39
40 /* Connection is confirmed: originating packet has left box */
41 IPS_CONFIRMED_BIT = 3,
42 IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT),
43
44 /* Connection needs src nat in orig dir. This bit never changed. */
45 IPS_SRC_NAT_BIT = 4,
46 IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT),
47
48 /* Connection needs dst nat in orig dir. This bit never changed. */
49 IPS_DST_NAT_BIT = 5,
50 IPS_DST_NAT = (1 << IPS_DST_NAT_BIT),
51
52 /* Both together. */
53 IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT),
54
55 /* Connection needs TCP sequence adjusted. */
56 IPS_SEQ_ADJUST_BIT = 6,
57 IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT),
58
59 /* NAT initialization bits. */
60 IPS_SRC_NAT_DONE_BIT = 7,
61 IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT),
62
63 IPS_DST_NAT_DONE_BIT = 8,
64 IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT),
65
66 /* Both together */
67 IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE),
68
69 /* Connection is dying (removed from lists), can not be unset. */
70 IPS_DYING_BIT = 9,
71 IPS_DYING = (1 << IPS_DYING_BIT),
72};
73
74/* Connection tracking event bits */
75enum ip_conntrack_events
76{
77 /* New conntrack */
78 IPCT_NEW_BIT = 0,
79 IPCT_NEW = (1 << IPCT_NEW_BIT),
80
81 /* Expected connection */
82 IPCT_RELATED_BIT = 1,
83 IPCT_RELATED = (1 << IPCT_RELATED_BIT),
84
85 /* Destroyed conntrack */
86 IPCT_DESTROY_BIT = 2,
87 IPCT_DESTROY = (1 << IPCT_DESTROY_BIT),
88
89 /* Timer has been refreshed */
90 IPCT_REFRESH_BIT = 3,
91 IPCT_REFRESH = (1 << IPCT_REFRESH_BIT),
92
93 /* Status has changed */
94 IPCT_STATUS_BIT = 4,
95 IPCT_STATUS = (1 << IPCT_STATUS_BIT),
96
97 /* Update of protocol info */
98 IPCT_PROTOINFO_BIT = 5,
99 IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT),
100
101 /* Volatile protocol info */
102 IPCT_PROTOINFO_VOLATILE_BIT = 6,
103 IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT),
104
105 /* New helper for conntrack */
106 IPCT_HELPER_BIT = 7,
107 IPCT_HELPER = (1 << IPCT_HELPER_BIT),
108
109 /* Update of helper info */
110 IPCT_HELPINFO_BIT = 8,
111 IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT),
112
113 /* Volatile helper info */
114 IPCT_HELPINFO_VOLATILE_BIT = 9,
115 IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT),
116
117 /* NAT info */
118 IPCT_NATINFO_BIT = 10,
119 IPCT_NATINFO = (1 << IPCT_NATINFO_BIT),
120
121 /* Counter highest bit has been set */
122 IPCT_COUNTER_FILLING_BIT = 11,
123 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT),
124};
125
126enum ip_conntrack_expect_events {
127 IPEXP_NEW_BIT = 0,
128 IPEXP_NEW = (1 << IPEXP_NEW_BIT),
129};
130
131#ifdef __KERNEL__
132struct ip_conntrack_counter
133{
134 u_int32_t packets;
135 u_int32_t bytes;
136};
137
138struct ip_conntrack_stat
139{
140 unsigned int searched;
141 unsigned int found;
142 unsigned int new;
143 unsigned int invalid;
144 unsigned int ignore;
145 unsigned int delete;
146 unsigned int delete_list;
147 unsigned int insert;
148 unsigned int insert_failed;
149 unsigned int drop;
150 unsigned int early_drop;
151 unsigned int error;
152 unsigned int expect_new;
153 unsigned int expect_create;
154 unsigned int expect_delete;
155};
156
157#endif /* __KERNEL__ */
158
159#endif /* _NF_CONNTRACK_COMMON_H */
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h
new file mode 100644
index 000000000000..ad4a41c9ce93
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_ftp.h
@@ -0,0 +1,44 @@
1#ifndef _NF_CONNTRACK_FTP_H
2#define _NF_CONNTRACK_FTP_H
3/* FTP tracking. */
4
5/* This enum is exposed to userspace */
6enum ip_ct_ftp_type
7{
8 /* PORT command from client */
9 IP_CT_FTP_PORT,
10 /* PASV response from server */
11 IP_CT_FTP_PASV,
12 /* EPRT command from client */
13 IP_CT_FTP_EPRT,
14 /* EPSV response from server */
15 IP_CT_FTP_EPSV,
16};
17
18#ifdef __KERNEL__
19
20#define FTP_PORT 21
21
22#define NUM_SEQ_TO_REMEMBER 2
23/* This structure exists only once per master */
24struct ip_ct_ftp_master {
25 /* Valid seq positions for cmd matching after newline */
26 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
27 /* 0 means seq_match_aft_nl not set */
28 int seq_aft_nl_num[IP_CT_DIR_MAX];
29};
30
31struct ip_conntrack_expect;
32
33/* For NAT to hook in when we find a packet which describes what other
34 * connection we should expect. */
35extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb,
36 enum ip_conntrack_info ctinfo,
37 enum ip_ct_ftp_type type,
38 unsigned int matchoff,
39 unsigned int matchlen,
40 struct ip_conntrack_expect *exp,
41 u32 *seq);
42#endif /* __KERNEL__ */
43
44#endif /* _NF_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h
new file mode 100644
index 000000000000..b8994d9fd1a9
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_sctp.h
@@ -0,0 +1,27 @@
1#ifndef _NF_CONNTRACK_SCTP_H
2#define _NF_CONNTRACK_SCTP_H
3/* SCTP tracking. */
4
5#include <linux/netfilter/nf_conntrack_tuple_common.h>
6
7enum sctp_conntrack {
8 SCTP_CONNTRACK_NONE,
9 SCTP_CONNTRACK_CLOSED,
10 SCTP_CONNTRACK_COOKIE_WAIT,
11 SCTP_CONNTRACK_COOKIE_ECHOED,
12 SCTP_CONNTRACK_ESTABLISHED,
13 SCTP_CONNTRACK_SHUTDOWN_SENT,
14 SCTP_CONNTRACK_SHUTDOWN_RECD,
15 SCTP_CONNTRACK_SHUTDOWN_ACK_SENT,
16 SCTP_CONNTRACK_MAX
17};
18
19struct ip_ct_sctp
20{
21 enum sctp_conntrack state;
22
23 u_int32_t vtag[IP_CT_DIR_MAX];
24 u_int32_t ttag[IP_CT_DIR_MAX];
25};
26
27#endif /* _NF_CONNTRACK_SCTP_H */
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
new file mode 100644
index 000000000000..b2feeffde384
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -0,0 +1,56 @@
1#ifndef _NF_CONNTRACK_TCP_H
2#define _NF_CONNTRACK_TCP_H
3/* TCP tracking. */
4
5/* This is exposed to userspace (ctnetlink) */
6enum tcp_conntrack {
7 TCP_CONNTRACK_NONE,
8 TCP_CONNTRACK_SYN_SENT,
9 TCP_CONNTRACK_SYN_RECV,
10 TCP_CONNTRACK_ESTABLISHED,
11 TCP_CONNTRACK_FIN_WAIT,
12 TCP_CONNTRACK_CLOSE_WAIT,
13 TCP_CONNTRACK_LAST_ACK,
14 TCP_CONNTRACK_TIME_WAIT,
15 TCP_CONNTRACK_CLOSE,
16 TCP_CONNTRACK_LISTEN,
17 TCP_CONNTRACK_MAX,
18 TCP_CONNTRACK_IGNORE
19};
20
21/* Window scaling is advertised by the sender */
22#define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01
23
24/* SACK is permitted by the sender */
25#define IP_CT_TCP_FLAG_SACK_PERM 0x02
26
27/* This sender sent FIN first */
28#define IP_CT_TCP_FLAG_CLOSE_INIT 0x03
29
30#ifdef __KERNEL__
31
32struct ip_ct_tcp_state {
33 u_int32_t td_end; /* max of seq + len */
34 u_int32_t td_maxend; /* max of ack + max(win, 1) */
35 u_int32_t td_maxwin; /* max(win) */
36 u_int8_t td_scale; /* window scale factor */
37 u_int8_t loose; /* used when connection picked up from the middle */
38 u_int8_t flags; /* per direction options */
39};
40
41struct ip_ct_tcp
42{
43 struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */
44 u_int8_t state; /* state of the connection (enum tcp_conntrack) */
45 /* For detecting stale connections */
46 u_int8_t last_dir; /* Direction of the last packet (enum ip_conntrack_dir) */
47 u_int8_t retrans; /* Number of retransmitted packets */
48 u_int8_t last_index; /* Index of the last packet */
49 u_int32_t last_seq; /* Last sequence number seen in dir */
50 u_int32_t last_ack; /* Last sequence number seen in opposite dir */
51 u_int32_t last_end; /* Last seq + len */
52};
53
54#endif /* __KERNEL__ */
55
56#endif /* _NF_CONNTRACK_TCP_H */
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/linux/netfilter/nf_conntrack_tuple_common.h
new file mode 100644
index 000000000000..8e145f0d61cb
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_tuple_common.h
@@ -0,0 +1,13 @@
1#ifndef _NF_CONNTRACK_TUPLE_COMMON_H
2#define _NF_CONNTRACK_TUPLE_COMMON_H
3
4enum ip_conntrack_dir
5{
6 IP_CT_DIR_ORIGINAL,
7 IP_CT_DIR_REPLY,
8 IP_CT_DIR_MAX
9};
10
11#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
12
13#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index f08e870100f4..72975fa8795d 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -146,7 +146,7 @@ extern void nfnl_unlock(void);
146extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); 146extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
147extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); 147extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
148 148
149extern int nfattr_parse(struct nfattr *tb[], int maxattr, 149extern void nfattr_parse(struct nfattr *tb[], int maxattr,
150 struct nfattr *nfa, int len); 150 struct nfattr *nfa, int len);
151 151
152#define nfattr_parse_nested(tb, max, nfa) \ 152#define nfattr_parse_nested(tb, max, nfa) \
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index d078bb91d9e5..b3432ab59a17 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -1,132 +1,7 @@
1#ifndef _IP_CONNTRACK_H 1#ifndef _IP_CONNTRACK_H
2#define _IP_CONNTRACK_H 2#define _IP_CONNTRACK_H
3/* Connection state tracking for netfilter. This is separated from,
4 but required by, the NAT layer; it can also be used by an iptables
5 extension. */
6enum ip_conntrack_info
7{
8 /* Part of an established connection (either direction). */
9 IP_CT_ESTABLISHED,
10
11 /* Like NEW, but related to an existing connection, or ICMP error
12 (in either direction). */
13 IP_CT_RELATED,
14
15 /* Started a new connection to track (only
16 IP_CT_DIR_ORIGINAL); may be a retransmission. */
17 IP_CT_NEW,
18
19 /* >= this indicates reply direction */
20 IP_CT_IS_REPLY,
21
22 /* Number of distinct IP_CT types (no NEW in reply dirn). */
23 IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
24};
25
26/* Bitset representing status of connection. */
27enum ip_conntrack_status {
28 /* It's an expected connection: bit 0 set. This bit never changed */
29 IPS_EXPECTED_BIT = 0,
30 IPS_EXPECTED = (1 << IPS_EXPECTED_BIT),
31
32 /* We've seen packets both ways: bit 1 set. Can be set, not unset. */
33 IPS_SEEN_REPLY_BIT = 1,
34 IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT),
35
36 /* Conntrack should never be early-expired. */
37 IPS_ASSURED_BIT = 2,
38 IPS_ASSURED = (1 << IPS_ASSURED_BIT),
39
40 /* Connection is confirmed: originating packet has left box */
41 IPS_CONFIRMED_BIT = 3,
42 IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT),
43
44 /* Connection needs src nat in orig dir. This bit never changed. */
45 IPS_SRC_NAT_BIT = 4,
46 IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT),
47
48 /* Connection needs dst nat in orig dir. This bit never changed. */
49 IPS_DST_NAT_BIT = 5,
50 IPS_DST_NAT = (1 << IPS_DST_NAT_BIT),
51
52 /* Both together. */
53 IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT),
54
55 /* Connection needs TCP sequence adjusted. */
56 IPS_SEQ_ADJUST_BIT = 6,
57 IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT),
58
59 /* NAT initialization bits. */
60 IPS_SRC_NAT_DONE_BIT = 7,
61 IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT),
62
63 IPS_DST_NAT_DONE_BIT = 8,
64 IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT),
65
66 /* Both together */
67 IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE),
68
69 /* Connection is dying (removed from lists), can not be unset. */
70 IPS_DYING_BIT = 9,
71 IPS_DYING = (1 << IPS_DYING_BIT),
72};
73
74/* Connection tracking event bits */
75enum ip_conntrack_events
76{
77 /* New conntrack */
78 IPCT_NEW_BIT = 0,
79 IPCT_NEW = (1 << IPCT_NEW_BIT),
80
81 /* Expected connection */
82 IPCT_RELATED_BIT = 1,
83 IPCT_RELATED = (1 << IPCT_RELATED_BIT),
84
85 /* Destroyed conntrack */
86 IPCT_DESTROY_BIT = 2,
87 IPCT_DESTROY = (1 << IPCT_DESTROY_BIT),
88
89 /* Timer has been refreshed */
90 IPCT_REFRESH_BIT = 3,
91 IPCT_REFRESH = (1 << IPCT_REFRESH_BIT),
92
93 /* Status has changed */
94 IPCT_STATUS_BIT = 4,
95 IPCT_STATUS = (1 << IPCT_STATUS_BIT),
96
97 /* Update of protocol info */
98 IPCT_PROTOINFO_BIT = 5,
99 IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT),
100
101 /* Volatile protocol info */
102 IPCT_PROTOINFO_VOLATILE_BIT = 6,
103 IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT),
104
105 /* New helper for conntrack */
106 IPCT_HELPER_BIT = 7,
107 IPCT_HELPER = (1 << IPCT_HELPER_BIT),
108
109 /* Update of helper info */
110 IPCT_HELPINFO_BIT = 8,
111 IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT),
112
113 /* Volatile helper info */
114 IPCT_HELPINFO_VOLATILE_BIT = 9,
115 IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT),
116 3
117 /* NAT info */ 4#include <linux/netfilter/nf_conntrack_common.h>
118 IPCT_NATINFO_BIT = 10,
119 IPCT_NATINFO = (1 << IPCT_NATINFO_BIT),
120
121 /* Counter highest bit has been set */
122 IPCT_COUNTER_FILLING_BIT = 11,
123 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT),
124};
125
126enum ip_conntrack_expect_events {
127 IPEXP_NEW_BIT = 0,
128 IPEXP_NEW = (1 << IPEXP_NEW_BIT),
129};
130 5
131#ifdef __KERNEL__ 6#ifdef __KERNEL__
132#include <linux/config.h> 7#include <linux/config.h>
@@ -194,12 +69,6 @@ do { \
194#define IP_NF_ASSERT(x) 69#define IP_NF_ASSERT(x)
195#endif 70#endif
196 71
197struct ip_conntrack_counter
198{
199 u_int32_t packets;
200 u_int32_t bytes;
201};
202
203struct ip_conntrack_helper; 72struct ip_conntrack_helper;
204 73
205struct ip_conntrack 74struct ip_conntrack
@@ -426,25 +295,6 @@ static inline int is_dying(struct ip_conntrack *ct)
426 295
427extern unsigned int ip_conntrack_htable_size; 296extern unsigned int ip_conntrack_htable_size;
428 297
429struct ip_conntrack_stat
430{
431 unsigned int searched;
432 unsigned int found;
433 unsigned int new;
434 unsigned int invalid;
435 unsigned int ignore;
436 unsigned int delete;
437 unsigned int delete_list;
438 unsigned int insert;
439 unsigned int insert_failed;
440 unsigned int drop;
441 unsigned int early_drop;
442 unsigned int error;
443 unsigned int expect_new;
444 unsigned int expect_create;
445 unsigned int expect_delete;
446};
447
448#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) 298#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++)
449 299
450#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS 300#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
index 5f06429b9047..63811934de4d 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
@@ -1,43 +1,6 @@
1#ifndef _IP_CONNTRACK_FTP_H 1#ifndef _IP_CONNTRACK_FTP_H
2#define _IP_CONNTRACK_FTP_H 2#define _IP_CONNTRACK_FTP_H
3/* FTP tracking. */
4 3
5#ifdef __KERNEL__ 4#include <linux/netfilter/nf_conntrack_ftp.h>
6 5
7#define FTP_PORT 21
8
9#endif /* __KERNEL__ */
10
11enum ip_ct_ftp_type
12{
13 /* PORT command from client */
14 IP_CT_FTP_PORT,
15 /* PASV response from server */
16 IP_CT_FTP_PASV,
17 /* EPRT command from client */
18 IP_CT_FTP_EPRT,
19 /* EPSV response from server */
20 IP_CT_FTP_EPSV,
21};
22
23#define NUM_SEQ_TO_REMEMBER 2
24/* This structure exists only once per master */
25struct ip_ct_ftp_master {
26 /* Valid seq positions for cmd matching after newline */
27 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
28 /* 0 means seq_match_aft_nl not set */
29 int seq_aft_nl_num[IP_CT_DIR_MAX];
30};
31
32struct ip_conntrack_expect;
33
34/* For NAT to hook in when we find a packet which describes what other
35 * connection we should expect. */
36extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb,
37 enum ip_conntrack_info ctinfo,
38 enum ip_ct_ftp_type type,
39 unsigned int matchoff,
40 unsigned int matchlen,
41 struct ip_conntrack_expect *exp,
42 u32 *seq);
43#endif /* _IP_CONNTRACK_FTP_H */ 6#endif /* _IP_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h b/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
index f1664abbe392..eed5ee3e4744 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
@@ -1,11 +1,6 @@
1#ifndef _IP_CONNTRACK_ICMP_H 1#ifndef _IP_CONNTRACK_ICMP_H
2#define _IP_CONNTRACK_ICMP_H 2#define _IP_CONNTRACK_ICMP_H
3/* ICMP tracking. */
4#include <asm/atomic.h>
5 3
6struct ip_ct_icmp 4#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
7{ 5
8 /* Optimization: when number in == number out, forget immediately. */
9 atomic_t count;
10};
11#endif /* _IP_CONNTRACK_ICMP_H */ 6#endif /* _IP_CONNTRACK_ICMP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h b/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
index 7a8d869321f7..4099a041a32a 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
@@ -1,25 +1,6 @@
1#ifndef _IP_CONNTRACK_SCTP_H 1#ifndef _IP_CONNTRACK_SCTP_H
2#define _IP_CONNTRACK_SCTP_H 2#define _IP_CONNTRACK_SCTP_H
3/* SCTP tracking. */
4 3
5enum sctp_conntrack { 4#include <linux/netfilter/nf_conntrack_sctp.h>
6 SCTP_CONNTRACK_NONE,
7 SCTP_CONNTRACK_CLOSED,
8 SCTP_CONNTRACK_COOKIE_WAIT,
9 SCTP_CONNTRACK_COOKIE_ECHOED,
10 SCTP_CONNTRACK_ESTABLISHED,
11 SCTP_CONNTRACK_SHUTDOWN_SENT,
12 SCTP_CONNTRACK_SHUTDOWN_RECD,
13 SCTP_CONNTRACK_SHUTDOWN_ACK_SENT,
14 SCTP_CONNTRACK_MAX
15};
16
17struct ip_ct_sctp
18{
19 enum sctp_conntrack state;
20
21 u_int32_t vtag[IP_CT_DIR_MAX];
22 u_int32_t ttag[IP_CT_DIR_MAX];
23};
24 5
25#endif /* _IP_CONNTRACK_SCTP_H */ 6#endif /* _IP_CONNTRACK_SCTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h b/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
index 16da044d97a7..876b8fb17e68 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
@@ -1,51 +1,6 @@
1#ifndef _IP_CONNTRACK_TCP_H 1#ifndef _IP_CONNTRACK_TCP_H
2#define _IP_CONNTRACK_TCP_H 2#define _IP_CONNTRACK_TCP_H
3/* TCP tracking. */
4 3
5enum tcp_conntrack { 4#include <linux/netfilter/nf_conntrack_tcp.h>
6 TCP_CONNTRACK_NONE,
7 TCP_CONNTRACK_SYN_SENT,
8 TCP_CONNTRACK_SYN_RECV,
9 TCP_CONNTRACK_ESTABLISHED,
10 TCP_CONNTRACK_FIN_WAIT,
11 TCP_CONNTRACK_CLOSE_WAIT,
12 TCP_CONNTRACK_LAST_ACK,
13 TCP_CONNTRACK_TIME_WAIT,
14 TCP_CONNTRACK_CLOSE,
15 TCP_CONNTRACK_LISTEN,
16 TCP_CONNTRACK_MAX,
17 TCP_CONNTRACK_IGNORE
18};
19
20/* Window scaling is advertised by the sender */
21#define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01
22
23/* SACK is permitted by the sender */
24#define IP_CT_TCP_FLAG_SACK_PERM 0x02
25
26/* This sender sent FIN first */
27#define IP_CT_TCP_FLAG_CLOSE_INIT 0x03
28
29struct ip_ct_tcp_state {
30 u_int32_t td_end; /* max of seq + len */
31 u_int32_t td_maxend; /* max of ack + max(win, 1) */
32 u_int32_t td_maxwin; /* max(win) */
33 u_int8_t td_scale; /* window scale factor */
34 u_int8_t loose; /* used when connection picked up from the middle */
35 u_int8_t flags; /* per direction options */
36};
37
38struct ip_ct_tcp
39{
40 struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */
41 u_int8_t state; /* state of the connection (enum tcp_conntrack) */
42 /* For detecting stale connections */
43 u_int8_t last_dir; /* Direction of the last packet (enum ip_conntrack_dir) */
44 u_int8_t retrans; /* Number of retransmitted packets */
45 u_int8_t last_index; /* Index of the last packet */
46 u_int32_t last_seq; /* Last sequence number seen in dir */
47 u_int32_t last_ack; /* Last sequence number seen in opposite dir */
48 u_int32_t last_end; /* Last seq + len */
49};
50 5
51#endif /* _IP_CONNTRACK_TCP_H */ 6#endif /* _IP_CONNTRACK_TCP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
index 3232db11a4e5..2fdabdb4c0ef 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
@@ -2,6 +2,7 @@
2#define _IP_CONNTRACK_TUPLE_H 2#define _IP_CONNTRACK_TUPLE_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netfilter/nf_conntrack_tuple_common.h>
5 6
6/* A `tuple' is a structure containing the information to uniquely 7/* A `tuple' is a structure containing the information to uniquely
7 identify a connection. ie. if two packets have the same tuple, they 8 identify a connection. ie. if two packets have the same tuple, they
@@ -88,13 +89,6 @@ struct ip_conntrack_tuple
88 (tuple)->dst.u.all = 0; \ 89 (tuple)->dst.u.all = 0; \
89 } while (0) 90 } while (0)
90 91
91enum ip_conntrack_dir
92{
93 IP_CT_DIR_ORIGINAL,
94 IP_CT_DIR_REPLY,
95 IP_CT_DIR_MAX
96};
97
98#ifdef __KERNEL__ 92#ifdef __KERNEL__
99 93
100#define DUMP_TUPLE(tp) \ 94#define DUMP_TUPLE(tp) \
@@ -103,8 +97,6 @@ DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \
103 NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \ 97 NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \
104 NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all)) 98 NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all))
105 99
106#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
107
108/* If we're the first tuple, it's the original dir. */ 100/* If we're the first tuple, it's the original dir. */
109#define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir) 101#define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
110 102
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index edcc2c6eb5c7..53b2983f6278 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -59,6 +59,7 @@
59 59
60enum nf_ip6_hook_priorities { 60enum nf_ip6_hook_priorities {
61 NF_IP6_PRI_FIRST = INT_MIN, 61 NF_IP6_PRI_FIRST = INT_MIN,
62 NF_IP6_PRI_CONNTRACK_DEFRAG = -400,
62 NF_IP6_PRI_SELINUX_FIRST = -225, 63 NF_IP6_PRI_SELINUX_FIRST = -225,
63 NF_IP6_PRI_CONNTRACK = -200, 64 NF_IP6_PRI_CONNTRACK = -200,
64 NF_IP6_PRI_BRIDGE_SABOTAGE_FORWARD = -175, 65 NF_IP6_PRI_BRIDGE_SABOTAGE_FORWARD = -175,
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index ba25ca874c20..6a2ccf78a356 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -71,7 +71,8 @@ struct nlmsghdr
71 71
72#define NLMSG_ALIGNTO 4 72#define NLMSG_ALIGNTO 4
73#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) 73#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
74#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(sizeof(struct nlmsghdr))) 74#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
75#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
75#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) 76#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
76#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) 77#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
77#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ 78#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
@@ -86,6 +87,8 @@ struct nlmsghdr
86#define NLMSG_DONE 0x3 /* End of a dump */ 87#define NLMSG_DONE 0x3 /* End of a dump */
87#define NLMSG_OVERRUN 0x4 /* Data lost */ 88#define NLMSG_OVERRUN 0x4 /* Data lost */
88 89
90#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
91
89struct nlmsgerr 92struct nlmsgerr
90{ 93{
91 int error; 94 int error;
@@ -108,6 +111,25 @@ enum {
108 NETLINK_CONNECTED, 111 NETLINK_CONNECTED,
109}; 112};
110 113
114/*
115 * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
116 * +---------------------+- - -+- - - - - - - - - -+- - -+
117 * | Header | Pad | Payload | Pad |
118 * | (struct nlattr) | ing | | ing |
119 * +---------------------+- - -+- - - - - - - - - -+- - -+
120 * <-------------- nlattr->nla_len -------------->
121 */
122
123struct nlattr
124{
125 __u16 nla_len;
126 __u16 nla_type;
127};
128
129#define NLA_ALIGNTO 4
130#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
131#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
132
111#ifdef __KERNEL__ 133#ifdef __KERNEL__
112 134
113#include <linux/capability.h> 135#include <linux/capability.h>
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 914b55f4abbb..d00f8ba7f22b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -387,6 +387,7 @@
387#define PCI_DEVICE_ID_NS_SC1100_SMI 0x0511 387#define PCI_DEVICE_ID_NS_SC1100_SMI 0x0511
388#define PCI_DEVICE_ID_NS_SC1100_XBUS 0x0515 388#define PCI_DEVICE_ID_NS_SC1100_XBUS 0x0515
389#define PCI_DEVICE_ID_NS_87410 0xd001 389#define PCI_DEVICE_ID_NS_87410 0xd001
390#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
390 391
391#define PCI_VENDOR_ID_TSENG 0x100c 392#define PCI_VENDOR_ID_TSENG 0x100c
392#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 393#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202
@@ -488,6 +489,8 @@
488#define PCI_DEVICE_ID_AMD_8151_0 0x7454 489#define PCI_DEVICE_ID_AMD_8151_0 0x7454
489#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 490#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450
490 491
492#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
493
491#define PCI_VENDOR_ID_TRIDENT 0x1023 494#define PCI_VENDOR_ID_TRIDENT 0x1023
492#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 495#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
493#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 496#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001
diff --git a/include/linux/phonedev.h b/include/linux/phonedev.h
index d54049eed0c3..a0e31adf3abe 100644
--- a/include/linux/phonedev.h
+++ b/include/linux/phonedev.h
@@ -2,7 +2,6 @@
2#define __LINUX_PHONEDEV_H 2#define __LINUX_PHONEDEV_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/version.h>
6 5
7#ifdef __KERNEL__ 6#ifdef __KERNEL__
8 7
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h
index 7227e653b3be..e86a7a5cf355 100644
--- a/include/linux/ppp-comp.h
+++ b/include/linux/ppp-comp.h
@@ -111,6 +111,8 @@ struct compressor {
111 111
112 /* Used in locking compressor modules */ 112 /* Used in locking compressor modules */
113 struct module *owner; 113 struct module *owner;
114 /* Extra skb space needed by the compressor algorithm */
115 unsigned int comp_extra;
114}; 116};
115 117
116/* 118/*
@@ -191,6 +193,13 @@ struct compressor {
191#define DEFLATE_CHK_SEQUENCE 0 193#define DEFLATE_CHK_SEQUENCE 0
192 194
193/* 195/*
196 * Definitions for MPPE.
197 */
198
199#define CI_MPPE 18 /* config option for MPPE */
200#define CILEN_MPPE 6 /* length of config option */
201
202/*
194 * Definitions for other, as yet unsupported, compression methods. 203 * Definitions for other, as yet unsupported, compression methods.
195 */ 204 */
196 205
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 65ceeaa30652..74488e49166d 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -66,6 +66,7 @@ struct proc_dir_entry {
66 write_proc_t *write_proc; 66 write_proc_t *write_proc;
67 atomic_t count; /* use count */ 67 atomic_t count; /* use count */
68 int deleted; /* delete flag */ 68 int deleted; /* delete flag */
69 void *set;
69}; 70};
70 71
71struct kcore_list { 72struct kcore_list {
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 9de99198caf1..899437802aea 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -6,7 +6,13 @@
6#ifndef BITMAP_H 6#ifndef BITMAP_H
7#define BITMAP_H 1 7#define BITMAP_H 1
8 8
9#define BITMAP_MAJOR 3 9#define BITMAP_MAJOR_LO 3
10/* version 4 insists the bitmap is in little-endian order
11 * with version 3, it is host-endian which is non-portable
12 */
13#define BITMAP_MAJOR_HI 4
14#define BITMAP_MAJOR_HOSTENDIAN 3
15
10#define BITMAP_MINOR 39 16#define BITMAP_MINOR 39
11 17
12/* 18/*
@@ -133,7 +139,8 @@ typedef __u16 bitmap_counter_t;
133/* use these for bitmap->flags and bitmap->sb->state bit-fields */ 139/* use these for bitmap->flags and bitmap->sb->state bit-fields */
134enum bitmap_state { 140enum bitmap_state {
135 BITMAP_ACTIVE = 0x001, /* the bitmap is in use */ 141 BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
136 BITMAP_STALE = 0x002 /* the bitmap file is out of date or had -EIO */ 142 BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */
143 BITMAP_HOSTENDIAN = 0x8000,
137}; 144};
138 145
139/* the superblock at the front of the bitmap file -- little endian */ 146/* the superblock at the front of the bitmap file -- little endian */
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index ffa316ce4dc8..13e7c4b62367 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -66,8 +66,10 @@
66 * and major_version/minor_version accordingly 66 * and major_version/minor_version accordingly
67 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT 67 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
68 * in the super status byte 68 * in the super status byte
69 * >=3 means that bitmap superblock version 4 is supported, which uses
70 * little-ending representation rather than host-endian
69 */ 71 */
70#define MD_PATCHLEVEL_VERSION 2 72#define MD_PATCHLEVEL_VERSION 3
71 73
72extern int register_md_personality (int p_num, mdk_personality_t *p); 74extern int register_md_personality (int p_num, mdk_personality_t *p);
73extern int unregister_md_personality (int p_num); 75extern int unregister_md_personality (int p_num);
@@ -87,6 +89,7 @@ extern void md_print_devices (void);
87 89
88extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, 90extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
89 sector_t sector, int size, struct page *page); 91 sector_t sector, int size, struct page *page);
92extern void md_super_wait(mddev_t *mddev);
90extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, 93extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
91 struct page *page, int rw); 94 struct page *page, int rw);
92 95
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index ebce949b1443..46629a275ba9 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -105,6 +105,8 @@ struct mdk_rdev_s
105 int sb_size; /* bytes in the superblock */ 105 int sb_size; /* bytes in the superblock */
106 int preferred_minor; /* autorun support */ 106 int preferred_minor; /* autorun support */
107 107
108 struct kobject kobj;
109
108 /* A device can be in one of three states based on two flags: 110 /* A device can be in one of three states based on two flags:
109 * Not working: faulty==1 in_sync==0 111 * Not working: faulty==1 in_sync==0
110 * Fully working: faulty==0 in_sync==1 112 * Fully working: faulty==0 in_sync==1
@@ -115,11 +117,12 @@ struct mdk_rdev_s
115 * It can never have faulty==1, in_sync==1 117 * It can never have faulty==1, in_sync==1
116 * This reduces the burden of testing multiple flags in many cases 118 * This reduces the burden of testing multiple flags in many cases
117 */ 119 */
118 int faulty; /* if faulty do not issue IO requests */
119 int in_sync; /* device is a full member of the array */
120 120
121 unsigned long flags; /* Should include faulty and in_sync here. */ 121 unsigned long flags;
122#define Faulty 1 /* device is known to have a fault */
123#define In_sync 2 /* device is in_sync with rest of array */
122#define WriteMostly 4 /* Avoid reading if at all possible */ 124#define WriteMostly 4 /* Avoid reading if at all possible */
125#define BarriersNotsupp 5 /* BIO_RW_BARRIER is not supported */
123 126
124 int desc_nr; /* descriptor index in the superblock */ 127 int desc_nr; /* descriptor index in the superblock */
125 int raid_disk; /* role of device in array */ 128 int raid_disk; /* role of device in array */
@@ -132,6 +135,9 @@ struct mdk_rdev_s
132 * only maintained for arrays that 135 * only maintained for arrays that
133 * support hot removal 136 * support hot removal
134 */ 137 */
138 atomic_t read_errors; /* number of consecutive read errors that
139 * we have tried to ignore.
140 */
135}; 141};
136 142
137typedef struct mdk_personality_s mdk_personality_t; 143typedef struct mdk_personality_s mdk_personality_t;
@@ -148,6 +154,8 @@ struct mddev_s
148 154
149 struct gendisk *gendisk; 155 struct gendisk *gendisk;
150 156
157 struct kobject kobj;
158
151 /* Superblock information */ 159 /* Superblock information */
152 int major_version, 160 int major_version,
153 minor_version, 161 minor_version,
@@ -171,6 +179,10 @@ struct mddev_s
171 sector_t resync_mark_cnt;/* blocks written at resync_mark */ 179 sector_t resync_mark_cnt;/* blocks written at resync_mark */
172 180
173 sector_t resync_max_sectors; /* may be set by personality */ 181 sector_t resync_max_sectors; /* may be set by personality */
182
183 sector_t resync_mismatches; /* count of sectors where
184 * parity/replica mismatch found
185 */
174 /* recovery/resync flags 186 /* recovery/resync flags
175 * NEEDED: we might need to start a resync/recover 187 * NEEDED: we might need to start a resync/recover
176 * RUNNING: a thread is running, or about to be started 188 * RUNNING: a thread is running, or about to be started
@@ -178,6 +190,8 @@ struct mddev_s
178 * ERR: and IO error was detected - abort the resync/recovery 190 * ERR: and IO error was detected - abort the resync/recovery
179 * INTR: someone requested a (clean) early abort. 191 * INTR: someone requested a (clean) early abort.
180 * DONE: thread is done and is waiting to be reaped 192 * DONE: thread is done and is waiting to be reaped
193 * REQUEST: user-space has requested a sync (used with SYNC)
194 * CHECK: user-space request for for check-only, no repair
181 */ 195 */
182#define MD_RECOVERY_RUNNING 0 196#define MD_RECOVERY_RUNNING 0
183#define MD_RECOVERY_SYNC 1 197#define MD_RECOVERY_SYNC 1
@@ -185,6 +199,8 @@ struct mddev_s
185#define MD_RECOVERY_INTR 3 199#define MD_RECOVERY_INTR 3
186#define MD_RECOVERY_DONE 4 200#define MD_RECOVERY_DONE 4
187#define MD_RECOVERY_NEEDED 5 201#define MD_RECOVERY_NEEDED 5
202#define MD_RECOVERY_REQUESTED 6
203#define MD_RECOVERY_CHECK 7
188 unsigned long recovery; 204 unsigned long recovery;
189 205
190 int in_sync; /* know to not need resync */ 206 int in_sync; /* know to not need resync */
@@ -195,6 +211,13 @@ struct mddev_s
195 int degraded; /* whether md should consider 211 int degraded; /* whether md should consider
196 * adding a spare 212 * adding a spare
197 */ 213 */
214 int barriers_work; /* initialised to true, cleared as soon
215 * as a barrier request to slave
216 * fails. Only supported
217 */
218 struct bio *biolist; /* bios that need to be retried
219 * because BIO_RW_BARRIER is not supported
220 */
198 221
199 atomic_t recovery_active; /* blocks scheduled, but not written */ 222 atomic_t recovery_active; /* blocks scheduled, but not written */
200 wait_queue_head_t recovery_wait; 223 wait_queue_head_t recovery_wait;
@@ -232,7 +255,7 @@ struct mddev_s
232 255
233static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev) 256static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev)
234{ 257{
235 int faulty = rdev->faulty; 258 int faulty = test_bit(Faulty, &rdev->flags);
236 if (atomic_dec_and_test(&rdev->nr_pending) && faulty) 259 if (atomic_dec_and_test(&rdev->nr_pending) && faulty)
237 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 260 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
238} 261}
@@ -270,6 +293,13 @@ struct mdk_personality_s
270}; 293};
271 294
272 295
296struct md_sysfs_entry {
297 struct attribute attr;
298 ssize_t (*show)(mddev_t *, char *);
299 ssize_t (*store)(mddev_t *, const char *, size_t);
300};
301
302
273static inline char * mdname (mddev_t * mddev) 303static inline char * mdname (mddev_t * mddev)
274{ 304{
275 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; 305 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
@@ -304,10 +334,8 @@ typedef struct mdk_thread_s {
304 mddev_t *mddev; 334 mddev_t *mddev;
305 wait_queue_head_t wqueue; 335 wait_queue_head_t wqueue;
306 unsigned long flags; 336 unsigned long flags;
307 struct completion *event;
308 struct task_struct *tsk; 337 struct task_struct *tsk;
309 unsigned long timeout; 338 unsigned long timeout;
310 const char *name;
311} mdk_thread_t; 339} mdk_thread_t;
312 340
313#define THREAD_WAKEUP 0 341#define THREAD_WAKEUP 0
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 60e19b667548..292b98f2b408 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -110,7 +110,9 @@ struct r1bio_s {
110#define R1BIO_Uptodate 0 110#define R1BIO_Uptodate 0
111#define R1BIO_IsSync 1 111#define R1BIO_IsSync 1
112#define R1BIO_Degraded 2 112#define R1BIO_Degraded 2
113#define R1BIO_BehindIO 3 113#define R1BIO_BehindIO 3
114#define R1BIO_Barrier 4
115#define R1BIO_BarrierRetry 5
114/* For write-behind requests, we call bi_end_io when 116/* For write-behind requests, we call bi_end_io when
115 * the last non-write-behind device completes, providing 117 * the last non-write-behind device completes, providing
116 * any write was successful. Otherwise we call when 118 * any write was successful. Otherwise we call when
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 176fc653c284..f025ba6fb14c 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -154,6 +154,8 @@ struct stripe_head {
154#define R5_Wantwrite 5 154#define R5_Wantwrite 5
155#define R5_Syncio 6 /* this io need to be accounted as resync io */ 155#define R5_Syncio 6 /* this io need to be accounted as resync io */
156#define R5_Overlap 7 /* There is a pending overlapping request on this block */ 156#define R5_Overlap 7 /* There is a pending overlapping request on this block */
157#define R5_ReadError 8 /* seen a read error here recently */
158#define R5_ReWrite 9 /* have tried to over-write the readerror */
157 159
158/* 160/*
159 * Write method 161 * Write method
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 03b68a7b4b82..2bbf968b23d9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -909,6 +909,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
909#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ 909#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */
910#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ 910#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */
911#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 911#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */
912#define PF_HOTPLUG_CPU 0x01000000 /* Currently performing CPU hotplug */
912 913
913/* 914/*
914 * Only the _current_ task can read/write to tsk->flags, but other 915 * Only the _current_ task can read/write to tsk->flags, but other
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fdfb8fe8c38c..83010231db99 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -274,6 +274,9 @@ struct sk_buff {
274#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) 274#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
275 __u8 ipvs_property:1; 275 __u8 ipvs_property:1;
276#endif 276#endif
277#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
278 struct sk_buff *nfct_reasm;
279#endif
277#ifdef CONFIG_BRIDGE_NETFILTER 280#ifdef CONFIG_BRIDGE_NETFILTER
278 struct nf_bridge_info *nf_bridge; 281 struct nf_bridge_info *nf_bridge;
279#endif 282#endif
@@ -1313,10 +1316,26 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
1313 if (nfct) 1316 if (nfct)
1314 atomic_inc(&nfct->use); 1317 atomic_inc(&nfct->use);
1315} 1318}
1319#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1320static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
1321{
1322 if (skb)
1323 atomic_inc(&skb->users);
1324}
1325static inline void nf_conntrack_put_reasm(struct sk_buff *skb)
1326{
1327 if (skb)
1328 kfree_skb(skb);
1329}
1330#endif
1316static inline void nf_reset(struct sk_buff *skb) 1331static inline void nf_reset(struct sk_buff *skb)
1317{ 1332{
1318 nf_conntrack_put(skb->nfct); 1333 nf_conntrack_put(skb->nfct);
1319 skb->nfct = NULL; 1334 skb->nfct = NULL;
1335#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1336 nf_conntrack_put_reasm(skb->nfct_reasm);
1337 skb->nfct_reasm = NULL;
1338#endif
1320} 1339}
1321 1340
1322#ifdef CONFIG_BRIDGE_NETFILTER 1341#ifdef CONFIG_BRIDGE_NETFILTER
diff --git a/include/linux/stallion.h b/include/linux/stallion.h
index e89b77b6505a..13a37f137ea2 100644
--- a/include/linux/stallion.h
+++ b/include/linux/stallion.h
@@ -21,8 +21,6 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23 23
24#include <linux/version.h>
25
26/*****************************************************************************/ 24/*****************************************************************************/
27#ifndef _STALLION_H 25#ifndef _STALLION_H
28#define _STALLION_H 26#define _STALLION_H
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index fc8e367f671e..22cf5e1ac987 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -24,6 +24,7 @@
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25 25
26struct file; 26struct file;
27struct completion;
27 28
28#define CTL_MAXNAME 10 /* how many path components do we allow in a 29#define CTL_MAXNAME 10 /* how many path components do we allow in a
29 call to sysctl? In other words, what is 30 call to sysctl? In other words, what is
@@ -204,6 +205,7 @@ enum
204 NET_ECONET=16, 205 NET_ECONET=16,
205 NET_SCTP=17, 206 NET_SCTP=17,
206 NET_LLC=18, 207 NET_LLC=18,
208 NET_NETFILTER=19,
207}; 209};
208 210
209/* /proc/sys/kernel/random */ 211/* /proc/sys/kernel/random */
@@ -269,6 +271,42 @@ enum
269 NET_UNIX_MAX_DGRAM_QLEN=3, 271 NET_UNIX_MAX_DGRAM_QLEN=3,
270}; 272};
271 273
274/* /proc/sys/net/netfilter */
275enum
276{
277 NET_NF_CONNTRACK_MAX=1,
278 NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2,
279 NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3,
280 NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4,
281 NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5,
282 NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6,
283 NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7,
284 NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8,
285 NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9,
286 NET_NF_CONNTRACK_UDP_TIMEOUT=10,
287 NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11,
288 NET_NF_CONNTRACK_ICMP_TIMEOUT=12,
289 NET_NF_CONNTRACK_GENERIC_TIMEOUT=13,
290 NET_NF_CONNTRACK_BUCKETS=14,
291 NET_NF_CONNTRACK_LOG_INVALID=15,
292 NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16,
293 NET_NF_CONNTRACK_TCP_LOOSE=17,
294 NET_NF_CONNTRACK_TCP_BE_LIBERAL=18,
295 NET_NF_CONNTRACK_TCP_MAX_RETRANS=19,
296 NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20,
297 NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21,
298 NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22,
299 NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23,
300 NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
301 NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
302 NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
303 NET_NF_CONNTRACK_COUNT=27,
304 NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28,
305 NET_NF_CONNTRACK_FRAG6_TIMEOUT=29,
306 NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30,
307 NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31,
308};
309
272/* /proc/sys/net/ipv4 */ 310/* /proc/sys/net/ipv4 */
273enum 311enum
274{ 312{
@@ -925,6 +963,8 @@ struct ctl_table_header
925{ 963{
926 ctl_table *ctl_table; 964 ctl_table *ctl_table;
927 struct list_head ctl_entry; 965 struct list_head ctl_entry;
966 int used;
967 struct completion *unregistering;
928}; 968};
929 969
930struct ctl_table_header * register_sysctl_table(ctl_table * table, 970struct ctl_table_header * register_sysctl_table(ctl_table * table,
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 1cc8c31b7988..91140091ced2 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -1,57 +1,16 @@
1#ifndef __LINUX_VIDEODEV_H 1#ifndef __LINUX_VIDEODEV_H
2#define __LINUX_VIDEODEV_H 2#define __LINUX_VIDEODEV_H
3 3
4#include <linux/compiler.h>
5#include <linux/types.h> 4#include <linux/types.h>
6 5
7#define HAVE_V4L2 1 6#define HAVE_V4L1 1
7
8#include <linux/videodev2.h> 8#include <linux/videodev2.h>
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12#include <linux/poll.h>
13#include <linux/mm.h> 12#include <linux/mm.h>
14#include <linux/device.h>
15
16struct video_device
17{
18 /* device info */
19 struct device *dev;
20 char name[32];
21 int type; /* v4l1 */
22 int type2; /* v4l2 */
23 int hardware;
24 int minor;
25
26 /* device ops + callbacks */
27 struct file_operations *fops;
28 void (*release)(struct video_device *vfd);
29
30
31 /* obsolete -- fops->owner is used instead */
32 struct module *owner;
33 /* dev->driver_data will be used instead some day.
34 * Use the video_{get|set}_drvdata() helper functions,
35 * so the switch over will be transparent for you.
36 * Or use {pci|usb}_{get|set}_drvdata() directly. */
37 void *priv;
38
39 /* for videodev.c intenal usage -- please don't touch */
40 int users; /* video_exclusive_{open|close} ... */
41 struct semaphore lock; /* ... helper function uses these */
42 char devfs_name[64]; /* devfs */
43 struct class_device class_dev; /* sysfs */
44};
45
46#define VIDEO_MAJOR 81
47
48#define VFL_TYPE_GRABBER 0
49#define VFL_TYPE_VBI 1
50#define VFL_TYPE_RADIO 2
51#define VFL_TYPE_VTX 3
52 13
53extern int video_register_device(struct video_device *, int type, int nr);
54extern void video_unregister_device(struct video_device *);
55extern struct video_device* video_devdata(struct file*); 14extern struct video_device* video_devdata(struct file*);
56 15
57#define to_video_device(cd) container_of(cd, struct video_device, class_dev) 16#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
@@ -68,11 +27,7 @@ video_device_remove_file(struct video_device *vfd,
68 class_device_remove_file(&vfd->class_dev, attr); 27 class_device_remove_file(&vfd->class_dev, attr);
69} 28}
70 29
71/* helper functions to alloc / release struct video_device, the 30#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
72 later can be used for video_device->release() */
73struct video_device *video_device_alloc(void);
74void video_device_release(struct video_device *vfd);
75
76/* helper functions to access driver private data. */ 31/* helper functions to access driver private data. */
77static inline void *video_get_drvdata(struct video_device *dev) 32static inline void *video_get_drvdata(struct video_device *dev)
78{ 33{
@@ -83,30 +38,12 @@ static inline void video_set_drvdata(struct video_device *dev, void *data)
83{ 38{
84 dev->priv = data; 39 dev->priv = data;
85} 40}
41#endif
86 42
87extern int video_exclusive_open(struct inode *inode, struct file *file); 43extern int video_exclusive_open(struct inode *inode, struct file *file);
88extern int video_exclusive_release(struct inode *inode, struct file *file); 44extern int video_exclusive_release(struct inode *inode, struct file *file);
89extern int video_usercopy(struct inode *inode, struct file *file,
90 unsigned int cmd, unsigned long arg,
91 int (*func)(struct inode *inode, struct file *file,
92 unsigned int cmd, void *arg));
93#endif /* __KERNEL__ */ 45#endif /* __KERNEL__ */
94 46
95#define VID_TYPE_CAPTURE 1 /* Can capture */
96#define VID_TYPE_TUNER 2 /* Can tune */
97#define VID_TYPE_TELETEXT 4 /* Does teletext */
98#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
99#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
100#define VID_TYPE_CLIPPING 32 /* Can clip */
101#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
102#define VID_TYPE_SCALES 128 /* Scalable */
103#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
104#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
105#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
106#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
107#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
108#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
109
110struct video_capability 47struct video_capability
111{ 48{
112 char name[32]; 49 char name[32];
@@ -202,9 +139,9 @@ struct video_audio
202#define VIDEO_SOUND_STEREO 2 139#define VIDEO_SOUND_STEREO 2
203#define VIDEO_SOUND_LANG1 4 140#define VIDEO_SOUND_LANG1 4
204#define VIDEO_SOUND_LANG2 8 141#define VIDEO_SOUND_LANG2 8
205 __u16 mode; 142 __u16 mode;
206 __u16 balance; /* Stereo balance */ 143 __u16 balance; /* Stereo balance */
207 __u16 step; /* Step actual volume uses */ 144 __u16 step; /* Step actual volume uses */
208}; 145};
209 146
210struct video_clip 147struct video_clip
@@ -260,9 +197,6 @@ struct video_key
260 __u32 flags; 197 __u32 flags;
261}; 198};
262 199
263
264#define VIDEO_MAX_FRAME 32
265
266struct video_mbuf 200struct video_mbuf
267{ 201{
268 int size; /* Total memory to map */ 202 int size; /* Total memory to map */
@@ -270,10 +204,8 @@ struct video_mbuf
270 int offsets[VIDEO_MAX_FRAME]; 204 int offsets[VIDEO_MAX_FRAME];
271}; 205};
272 206
273
274#define VIDEO_NO_UNIT (-1) 207#define VIDEO_NO_UNIT (-1)
275 208
276
277struct video_unit 209struct video_unit
278{ 210{
279 int video; /* Video minor */ 211 int video; /* Video minor */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 89a055761bed..a114fff6568b 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -15,16 +15,99 @@
15 */ 15 */
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17#include <linux/time.h> /* need struct timeval */ 17#include <linux/time.h> /* need struct timeval */
18#include <linux/poll.h>
19#include <linux/device.h>
18#endif 20#endif
19#include <linux/compiler.h> /* need __user */ 21#include <linux/compiler.h> /* need __user */
20 22
23
24#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.15 */
25#define HAVE_V4L2 1
26
27/*
28 * Common stuff for both V4L1 and V4L2
29 * Moved from videodev.h
30 */
31
32#define VIDEO_MAX_FRAME 32
33
34#define VID_TYPE_CAPTURE 1 /* Can capture */
35#define VID_TYPE_TUNER 2 /* Can tune */
36#define VID_TYPE_TELETEXT 4 /* Does teletext */
37#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
38#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
39#define VID_TYPE_CLIPPING 32 /* Can clip */
40#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
41#define VID_TYPE_SCALES 128 /* Scalable */
42#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
43#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
44#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
45#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
46#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
47#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
48
49#ifdef __KERNEL__
50
51#define VFL_TYPE_GRABBER 0
52#define VFL_TYPE_VBI 1
53#define VFL_TYPE_RADIO 2
54#define VFL_TYPE_VTX 3
55
56struct video_device
57{
58 /* device info */
59 struct device *dev;
60 char name[32];
61 int type; /* v4l1 */
62 int type2; /* v4l2 */
63 int hardware;
64 int minor;
65
66 /* device ops + callbacks */
67 struct file_operations *fops;
68 void (*release)(struct video_device *vfd);
69
70
71#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
72 /* obsolete -- fops->owner is used instead */
73 struct module *owner;
74 /* dev->driver_data will be used instead some day.
75 * Use the video_{get|set}_drvdata() helper functions,
76 * so the switch over will be transparent for you.
77 * Or use {pci|usb}_{get|set}_drvdata() directly. */
78 void *priv;
79#endif
80
81 /* for videodev.c intenal usage -- please don't touch */
82 int users; /* video_exclusive_{open|close} ... */
83 struct semaphore lock; /* ... helper function uses these */
84 char devfs_name[64]; /* devfs */
85 struct class_device class_dev; /* sysfs */
86};
87
88#define VIDEO_MAJOR 81
89
90extern int video_register_device(struct video_device *, int type, int nr);
91extern void video_unregister_device(struct video_device *);
92extern int video_usercopy(struct inode *inode, struct file *file,
93 unsigned int cmd, unsigned long arg,
94 int (*func)(struct inode *inode, struct file *file,
95 unsigned int cmd, void *arg));
96
97/* helper functions to alloc / release struct video_device, the
98 later can be used for video_device->release() */
99struct video_device *video_device_alloc(void);
100void video_device_release(struct video_device *vfd);
101
102#endif
103
21/* 104/*
22 * M I S C E L L A N E O U S 105 * M I S C E L L A N E O U S
23 */ 106 */
24 107
25/* Four-character-code (FOURCC) */ 108/* Four-character-code (FOURCC) */
26#define v4l2_fourcc(a,b,c,d)\ 109#define v4l2_fourcc(a,b,c,d)\
27 (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) 110 (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
28 111
29/* 112/*
30 * E N U M S 113 * E N U M S
@@ -154,20 +237,20 @@ struct v4l2_capability
154}; 237};
155 238
156/* Values for 'capabilities' field */ 239/* Values for 'capabilities' field */
157#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ 240#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */
158#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ 241#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */
159#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ 242#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */
160#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ 243#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */
161#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ 244#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */
162#if 1 245#if 1
163#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ 246#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */
164#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ 247#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
165#endif 248#endif
166#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ 249#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
167 250
168#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 251#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
169#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 252#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
170#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ 253#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
171 254
172#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ 255#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
173#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ 256#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
@@ -179,13 +262,13 @@ struct v4l2_capability
179 262
180struct v4l2_pix_format 263struct v4l2_pix_format
181{ 264{
182 __u32 width; 265 __u32 width;
183 __u32 height; 266 __u32 height;
184 __u32 pixelformat; 267 __u32 pixelformat;
185 enum v4l2_field field; 268 enum v4l2_field field;
186 __u32 bytesperline; /* for padding, zero if unused */ 269 __u32 bytesperline; /* for padding, zero if unused */
187 __u32 sizeimage; 270 __u32 sizeimage;
188 enum v4l2_colorspace colorspace; 271 enum v4l2_colorspace colorspace;
189 __u32 priv; /* private data, depends on pixelformat */ 272 __u32 priv; /* private data, depends on pixelformat */
190}; 273};
191 274
@@ -238,12 +321,12 @@ struct v4l2_pix_format
238 */ 321 */
239struct v4l2_fmtdesc 322struct v4l2_fmtdesc
240{ 323{
241 __u32 index; /* Format number */ 324 __u32 index; /* Format number */
242 enum v4l2_buf_type type; /* buffer type */ 325 enum v4l2_buf_type type; /* buffer type */
243 __u32 flags; 326 __u32 flags;
244 __u8 description[32]; /* Description string */ 327 __u8 description[32]; /* Description string */
245 __u32 pixelformat; /* Format fourcc */ 328 __u32 pixelformat; /* Format fourcc */
246 __u32 reserved[4]; 329 __u32 reserved[4];
247}; 330};
248 331
249#define V4L2_FMT_FLAG_COMPRESSED 0x0001 332#define V4L2_FMT_FLAG_COMPRESSED 0x0001
@@ -393,7 +476,7 @@ struct v4l2_jpegcompression
393#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ 476#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
394#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ 477#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
395#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will 478#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
396 * allways use APP0 */ 479 * allways use APP0 */
397}; 480};
398 481
399 482
@@ -402,10 +485,10 @@ struct v4l2_jpegcompression
402 */ 485 */
403struct v4l2_requestbuffers 486struct v4l2_requestbuffers
404{ 487{
405 __u32 count; 488 __u32 count;
406 enum v4l2_buf_type type; 489 enum v4l2_buf_type type;
407 enum v4l2_memory memory; 490 enum v4l2_memory memory;
408 __u32 reserved[2]; 491 __u32 reserved[2];
409}; 492};
410 493
411struct v4l2_buffer 494struct v4l2_buffer
@@ -511,9 +594,9 @@ struct v4l2_outputparm
511 594
512struct v4l2_cropcap { 595struct v4l2_cropcap {
513 enum v4l2_buf_type type; 596 enum v4l2_buf_type type;
514 struct v4l2_rect bounds; 597 struct v4l2_rect bounds;
515 struct v4l2_rect defrect; 598 struct v4l2_rect defrect;
516 struct v4l2_fract pixelaspect; 599 struct v4l2_fract pixelaspect;
517}; 600};
518 601
519struct v4l2_crop { 602struct v4l2_crop {
@@ -544,6 +627,7 @@ typedef __u64 v4l2_std_id;
544 627
545#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) 628#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000)
546#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) 629#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000)
630#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
547 631
548#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) 632#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
549#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) 633#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
@@ -581,13 +665,14 @@ typedef __u64 v4l2_std_id;
581 665
582#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ 666#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
583 V4L2_STD_PAL_60 |\ 667 V4L2_STD_PAL_60 |\
584 V4L2_STD_NTSC) 668 V4L2_STD_NTSC |\
669 V4L2_STD_NTSC_443)
585#define V4L2_STD_625_50 (V4L2_STD_PAL |\ 670#define V4L2_STD_625_50 (V4L2_STD_PAL |\
586 V4L2_STD_PAL_N |\ 671 V4L2_STD_PAL_N |\
587 V4L2_STD_PAL_Nc |\ 672 V4L2_STD_PAL_Nc |\
588 V4L2_STD_SECAM) 673 V4L2_STD_SECAM)
589#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ 674#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
590 V4L2_STD_ATSC_16_VSB) 675 V4L2_STD_ATSC_16_VSB)
591 676
592#define V4L2_STD_UNKNOWN 0 677#define V4L2_STD_UNKNOWN 0
593#define V4L2_STD_ALL (V4L2_STD_525_60 |\ 678#define V4L2_STD_ALL (V4L2_STD_525_60 |\
@@ -595,7 +680,7 @@ typedef __u64 v4l2_std_id;
595 680
596struct v4l2_standard 681struct v4l2_standard
597{ 682{
598 __u32 index; 683 __u32 index;
599 v4l2_std_id id; 684 v4l2_std_id id;
600 __u8 name[24]; 685 __u8 name[24];
601 struct v4l2_fract frameperiod; /* Frames, not fields */ 686 struct v4l2_fract frameperiod; /* Frames, not fields */
@@ -610,9 +695,9 @@ struct v4l2_standard
610struct v4l2_input 695struct v4l2_input
611{ 696{
612 __u32 index; /* Which input */ 697 __u32 index; /* Which input */
613 __u8 name[32]; /* Label */ 698 __u8 name[32]; /* Label */
614 __u32 type; /* Type of input */ 699 __u32 type; /* Type of input */
615 __u32 audioset; /* Associated audios (bitfield) */ 700 __u32 audioset; /* Associated audios (bitfield) */
616 __u32 tuner; /* Associated tuner */ 701 __u32 tuner; /* Associated tuner */
617 v4l2_std_id std; 702 v4l2_std_id std;
618 __u32 status; 703 __u32 status;
@@ -647,9 +732,9 @@ struct v4l2_input
647struct v4l2_output 732struct v4l2_output
648{ 733{
649 __u32 index; /* Which output */ 734 __u32 index; /* Which output */
650 __u8 name[32]; /* Label */ 735 __u8 name[32]; /* Label */
651 __u32 type; /* Type of output */ 736 __u32 type; /* Type of output */
652 __u32 audioset; /* Associated audios (bitfield) */ 737 __u32 audioset; /* Associated audios (bitfield) */
653 __u32 modulator; /* Associated modulator */ 738 __u32 modulator; /* Associated modulator */
654 v4l2_std_id std; 739 v4l2_std_id std;
655 __u32 reserved[4]; 740 __u32 reserved[4];
@@ -671,12 +756,12 @@ struct v4l2_control
671/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 756/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
672struct v4l2_queryctrl 757struct v4l2_queryctrl
673{ 758{
674 __u32 id; 759 __u32 id;
675 enum v4l2_ctrl_type type; 760 enum v4l2_ctrl_type type;
676 __u8 name[32]; /* Whatever */ 761 __u8 name[32]; /* Whatever */
677 __s32 minimum; /* Note signedness */ 762 __s32 minimum; /* Note signedness */
678 __s32 maximum; 763 __s32 maximum;
679 __s32 step; 764 __s32 step;
680 __s32 default_value; 765 __s32 default_value;
681 __u32 flags; 766 __u32 flags;
682 __u32 reserved[2]; 767 __u32 reserved[2];
@@ -779,10 +864,10 @@ struct v4l2_modulator
779 864
780struct v4l2_frequency 865struct v4l2_frequency
781{ 866{
782 __u32 tuner; 867 __u32 tuner;
783 enum v4l2_tuner_type type; 868 enum v4l2_tuner_type type;
784 __u32 frequency; 869 __u32 frequency;
785 __u32 reserved[8]; 870 __u32 reserved[8];
786}; 871};
787 872
788/* 873/*
@@ -802,6 +887,7 @@ struct v4l2_audio
802 887
803/* Flags for the 'mode' field */ 888/* Flags for the 'mode' field */
804#define V4L2_AUDMODE_AVL 0x00001 889#define V4L2_AUDMODE_AVL 0x00001
890#define V4L2_AUDMODE_32BITS 0x00002
805 891
806struct v4l2_audioout 892struct v4l2_audioout
807{ 893{
@@ -846,14 +932,14 @@ struct v4l2_vbi_format
846 932
847struct v4l2_sliced_vbi_format 933struct v4l2_sliced_vbi_format
848{ 934{
849 __u16 service_set; 935 __u16 service_set;
850 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 936 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
851 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 937 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
852 (equals frame lines 313-336 for 625 line video 938 (equals frame lines 313-336 for 625 line video
853 standards, 263-286 for 525 line standards) */ 939 standards, 263-286 for 525 line standards) */
854 __u16 service_lines[2][24]; 940 __u16 service_lines[2][24];
855 __u32 io_size; 941 __u32 io_size;
856 __u32 reserved[2]; /* must be zero */ 942 __u32 reserved[2]; /* must be zero */
857}; 943};
858 944
859#define V4L2_SLICED_TELETEXT_B (0x0001) 945#define V4L2_SLICED_TELETEXT_B (0x0001)
@@ -866,22 +952,22 @@ struct v4l2_sliced_vbi_format
866 952
867struct v4l2_sliced_vbi_cap 953struct v4l2_sliced_vbi_cap
868{ 954{
869 __u16 service_set; 955 __u16 service_set;
870 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 956 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
871 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 957 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
872 (equals frame lines 313-336 for 625 line video 958 (equals frame lines 313-336 for 625 line video
873 standards, 263-286 for 525 line standards) */ 959 standards, 263-286 for 525 line standards) */
874 __u16 service_lines[2][24]; 960 __u16 service_lines[2][24];
875 __u32 reserved[4]; /* must be 0 */ 961 __u32 reserved[4]; /* must be 0 */
876}; 962};
877 963
878struct v4l2_sliced_vbi_data 964struct v4l2_sliced_vbi_data
879{ 965{
880 __u32 id; 966 __u32 id;
881 __u32 field; /* 0: first field, 1: second field */ 967 __u32 field; /* 0: first field, 1: second field */
882 __u32 line; /* 1-23 */ 968 __u32 line; /* 1-23 */
883 __u32 reserved; /* must be 0 */ 969 __u32 reserved; /* must be 0 */
884 __u8 data[48]; 970 __u8 data[48];
885}; 971};
886#endif 972#endif
887 973
@@ -896,9 +982,9 @@ struct v4l2_format
896 enum v4l2_buf_type type; 982 enum v4l2_buf_type type;
897 union 983 union
898 { 984 {
899 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE 985 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE
900 struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY 986 struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY
901 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE 987 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE
902#if 1 988#if 1
903 struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 989 struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
904#endif 990#endif
@@ -981,6 +1067,7 @@ struct v4l2_streamparm
981#if 1 1067#if 1
982#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) 1068#define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap)
983#endif 1069#endif
1070#define VIDIOC_LOG_STATUS _IO ('V', 70)
984 1071
985/* for compatibility, will go away some day */ 1072/* for compatibility, will go away some day */
986#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1073#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int)
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index a7ceee9fc5e9..b7d4b0930408 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -4,6 +4,23 @@
4#ifndef AUDIOCHIP_H 4#ifndef AUDIOCHIP_H
5#define AUDIOCHIP_H 5#define AUDIOCHIP_H
6 6
7enum audiochip {
8 AUDIO_CHIP_NONE,
9 AUDIO_CHIP_UNKNOWN,
10 /* Provided by video chip */
11 AUDIO_CHIP_INTERNAL,
12 /* Provided by tvaudio.c */
13 AUDIO_CHIP_TDA8425,
14 AUDIO_CHIP_TEA6300,
15 AUDIO_CHIP_TEA6420,
16 AUDIO_CHIP_TDA9840,
17 AUDIO_CHIP_TDA985X,
18 AUDIO_CHIP_TDA9874,
19 AUDIO_CHIP_PIC16C54,
20 /* Provided by msp3400.c */
21 AUDIO_CHIP_MSP34XX
22};
23
7/* ---------------------------------------------------------------------- */ 24/* ---------------------------------------------------------------------- */
8 25
9/* v4l device was opened in Radio mode */ 26/* v4l device was opened in Radio mode */
diff --git a/include/media/id.h b/include/media/id.h
deleted file mode 100644
index 6d02c94cdc0d..000000000000
--- a/include/media/id.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 */
3
4/* FIXME: this temporarely, until these are included in linux/i2c-id.h */
5
6/* drivers */
7#ifndef I2C_DRIVERID_TVMIXER
8# define I2C_DRIVERID_TVMIXER I2C_DRIVERID_EXP0
9#endif
10#ifndef I2C_DRIVERID_TVAUDIO
11# define I2C_DRIVERID_TVAUDIO I2C_DRIVERID_EXP1
12#endif
13
14/* chips */
15#ifndef I2C_DRIVERID_DPL3518
16# define I2C_DRIVERID_DPL3518 I2C_DRIVERID_EXP2
17#endif
18#ifndef I2C_DRIVERID_TDA9873
19# define I2C_DRIVERID_TDA9873 I2C_DRIVERID_EXP3
20#endif
21#ifndef I2C_DRIVERID_TDA9875
22# define I2C_DRIVERID_TDA9875 I2C_DRIVERID_EXP0+4
23#endif
24#ifndef I2C_DRIVERID_PIC16C54_PV951
25# define I2C_DRIVERID_PIC16C54_PV951 I2C_DRIVERID_EXP0+5
26#endif
27#ifndef I2C_DRIVERID_TDA7432
28# define I2C_DRIVERID_TDA7432 I2C_DRIVERID_EXP0+6
29#endif
30#ifndef I2C_DRIVERID_TDA9874
31# define I2C_DRIVERID_TDA9874 I2C_DRIVERID_EXP0+7
32#endif
33#ifndef I2C_DRIVERID_SAA6752HS
34# define I2C_DRIVERID_SAA6752HS I2C_DRIVERID_EXP0+8
35#endif
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 01b56822df4d..0f1ba95ec8d6 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -20,8 +20,10 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include <linux/input.h> 23#ifndef _IR_COMMON
24#define _IR_COMMON
24 25
26#include <linux/input.h>
25 27
26#define IR_TYPE_RC5 1 28#define IR_TYPE_RC5 1
27#define IR_TYPE_PD 2 /* Pulse distance encoded IR */ 29#define IR_TYPE_PD 2 /* Pulse distance encoded IR */
@@ -61,6 +63,8 @@ int ir_dump_samples(u32 *samples, int count);
61int ir_decode_biphase(u32 *samples, int count, int low, int high); 63int ir_decode_biphase(u32 *samples, int count, int low, int high);
62int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); 64int ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
63 65
66#endif
67
64/* 68/*
65 * Local variables: 69 * Local variables:
66 * c-basic-offset: 8 70 * c-basic-offset: 8
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
new file mode 100644
index 000000000000..00fa57eb9fde
--- /dev/null
+++ b/include/media/ir-kbd-i2c.h
@@ -0,0 +1,22 @@
1#ifndef _IR_I2C
2#define _IR_I2C
3
4#include <media/ir-common.h>
5
6struct IR_i2c;
7
8struct IR_i2c {
9 IR_KEYTAB_TYPE *ir_codes;
10 struct i2c_client c;
11 struct input_dev *input;
12 struct ir_input_state ir;
13
14 /* Used to avoid fast repeating */
15 unsigned char old;
16
17 struct work_struct work;
18 struct timer_list timer;
19 char phys[32];
20 int (*get_key)(struct IR_i2c*, u32*, u32*);
21};
22#endif
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index f3aa24f8131c..64691753721e 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -1,7 +1,7 @@
1#ifndef __SAA7146_VV__ 1#ifndef __SAA7146_VV__
2#define __SAA7146_VV__ 2#define __SAA7146_VV__
3 3
4#include <linux/videodev2.h> 4#include <linux/videodev.h>
5 5
6#include <media/saa7146.h> 6#include <media/saa7146.h>
7#include <media/video-buf.h> 7#include <media/video-buf.h>
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 4ad08e24a1aa..9184e534b7ef 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -95,7 +95,7 @@
95#define TUNER_THOMSON_DTT7610 52 95#define TUNER_THOMSON_DTT7610 52
96#define TUNER_PHILIPS_FQ1286 53 96#define TUNER_PHILIPS_FQ1286 53
97#define TUNER_PHILIPS_TDA8290 54 97#define TUNER_PHILIPS_TDA8290 54
98#define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ 98#define TUNER_TCL_2002MB 55 /* Hauppauge PVR-150 PAL */
99 99
100#define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ 100#define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */
101#define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ 101#define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */
@@ -110,6 +110,9 @@
110#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ 110#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */
111#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ 111#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */
112#define TUNER_LG_NTSC_TALN_MINI 66 112#define TUNER_LG_NTSC_TALN_MINI 66
113#define TUNER_PHILIPS_TD1316 67
114
115#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */
113 116
114#define NOTUNER 0 117#define NOTUNER 0
115#define PAL 1 /* PAL_BG */ 118#define PAL 1 /* PAL_BG */
@@ -145,6 +148,7 @@
145# define TDA9887_INTERCARRIER (1<<4) 148# define TDA9887_INTERCARRIER (1<<4)
146# define TDA9887_PORT1_ACTIVE (1<<5) 149# define TDA9887_PORT1_ACTIVE (1<<5)
147# define TDA9887_PORT2_ACTIVE (1<<6) 150# define TDA9887_PORT2_ACTIVE (1<<6)
151# define TDA9887_INTERCARRIER_NTSC (1<<7)
148/* config options */ 152/* config options */
149# define TDA9887_DEEMPHASIS_MASK (3<<16) 153# define TDA9887_DEEMPHASIS_MASK (3<<16)
150# define TDA9887_DEEMPHASIS_NONE (1<<16) 154# define TDA9887_DEEMPHASIS_NONE (1<<16)
@@ -188,8 +192,11 @@ struct tuner {
188 unsigned int radio_if2; 192 unsigned int radio_if2;
189 193
190 /* used by tda8290 */ 194 /* used by tda8290 */
191 unsigned char i2c_easy_mode[2]; 195 unsigned char tda8290_easy_mode;
192 unsigned char i2c_set_freq[8]; 196 unsigned char tda827x_lpsel;
197 unsigned char tda827x_addr;
198 unsigned char tda827x_ver;
199 unsigned int sgIF;
193 200
194 /* function ptrs */ 201 /* function ptrs */
195 void (*tv_freq)(struct i2c_client *c, unsigned int freq); 202 void (*tv_freq)(struct i2c_client *c, unsigned int freq);
@@ -204,20 +211,21 @@ extern unsigned const int tuner_count;
204 211
205extern int microtune_init(struct i2c_client *c); 212extern int microtune_init(struct i2c_client *c);
206extern int tda8290_init(struct i2c_client *c); 213extern int tda8290_init(struct i2c_client *c);
214extern int tda8290_probe(struct i2c_client *c);
207extern int tea5767_tuner_init(struct i2c_client *c); 215extern int tea5767_tuner_init(struct i2c_client *c);
208extern int default_tuner_init(struct i2c_client *c); 216extern int default_tuner_init(struct i2c_client *c);
209extern int tea5767_autodetection(struct i2c_client *c); 217extern int tea5767_autodetection(struct i2c_client *c);
210 218
211#define tuner_warn(fmt, arg...) do {\ 219#define tuner_warn(fmt, arg...) do {\
212 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ 220 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \
213 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 221 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
214#define tuner_info(fmt, arg...) do {\ 222#define tuner_info(fmt, arg...) do {\
215 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ 223 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \
216 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 224 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
217#define tuner_dbg(fmt, arg...) do {\ 225#define tuner_dbg(fmt, arg...) do {\
218 if (tuner_debug) \ 226 if (tuner_debug) \
219 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ 227 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \
220 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 228 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
221 229
222#endif /* __KERNEL__ */ 230#endif /* __KERNEL__ */
223 231
diff --git a/include/media/video-buf.h b/include/media/video-buf.h
index ae8d7a000440..8ecfd78e0027 100644
--- a/include/media/video-buf.h
+++ b/include/media/video-buf.h
@@ -17,7 +17,7 @@
17 * (at your option) any later version. 17 * (at your option) any later version.
18 */ 18 */
19 19
20#include <linux/videodev.h> 20#include <linux/videodev2.h>
21 21
22#define UNSET (-1U) 22#define UNSET (-1U)
23 23
@@ -177,7 +177,7 @@ struct videobuf_queue_ops {
177}; 177};
178 178
179struct videobuf_queue { 179struct videobuf_queue {
180 struct semaphore lock; 180 struct semaphore lock;
181 spinlock_t *irqlock; 181 spinlock_t *irqlock;
182 struct pci_dev *pci; 182 struct pci_dev *pci;
183 183
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index e42d728b1620..911ceb5cd263 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -57,8 +57,6 @@
57#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg) 57#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg)
58#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg) 58#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg)
59 59
60extern struct proc_dir_entry *proc_bt;
61
62/* Connection and socket states */ 60/* Connection and socket states */
63enum { 61enum {
64 BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ 62 BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
@@ -177,4 +175,6 @@ extern int hci_sock_cleanup(void);
177extern int bt_sysfs_init(void); 175extern int bt_sysfs_init(void);
178extern void bt_sysfs_cleanup(void); 176extern void bt_sysfs_cleanup(void);
179 177
178extern struct class bt_class;
179
180#endif /* __BLUETOOTH_H */ 180#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index fa2d12b0579b..b06a2d2f63d2 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -184,10 +184,10 @@ enum {
184struct hci_rp_read_loc_version { 184struct hci_rp_read_loc_version {
185 __u8 status; 185 __u8 status;
186 __u8 hci_ver; 186 __u8 hci_ver;
187 __u16 hci_rev; 187 __le16 hci_rev;
188 __u8 lmp_ver; 188 __u8 lmp_ver;
189 __u16 manufacturer; 189 __le16 manufacturer;
190 __u16 lmp_subver; 190 __le16 lmp_subver;
191} __attribute__ ((packed)); 191} __attribute__ ((packed));
192 192
193#define OCF_READ_LOCAL_FEATURES 0x0003 193#define OCF_READ_LOCAL_FEATURES 0x0003
@@ -199,10 +199,10 @@ struct hci_rp_read_loc_features {
199#define OCF_READ_BUFFER_SIZE 0x0005 199#define OCF_READ_BUFFER_SIZE 0x0005
200struct hci_rp_read_buffer_size { 200struct hci_rp_read_buffer_size {
201 __u8 status; 201 __u8 status;
202 __u16 acl_mtu; 202 __le16 acl_mtu;
203 __u8 sco_mtu; 203 __u8 sco_mtu;
204 __u16 acl_max_pkt; 204 __le16 acl_max_pkt;
205 __u16 sco_max_pkt; 205 __le16 sco_max_pkt;
206} __attribute__ ((packed)); 206} __attribute__ ((packed));
207 207
208#define OCF_READ_BD_ADDR 0x0009 208#define OCF_READ_BD_ADDR 0x0009
@@ -267,21 +267,21 @@ struct hci_cp_write_dev_class {
267 267
268#define OCF_READ_VOICE_SETTING 0x0025 268#define OCF_READ_VOICE_SETTING 0x0025
269struct hci_rp_read_voice_setting { 269struct hci_rp_read_voice_setting {
270 __u8 status; 270 __u8 status;
271 __u16 voice_setting; 271 __le16 voice_setting;
272} __attribute__ ((packed)); 272} __attribute__ ((packed));
273 273
274#define OCF_WRITE_VOICE_SETTING 0x0026 274#define OCF_WRITE_VOICE_SETTING 0x0026
275struct hci_cp_write_voice_setting { 275struct hci_cp_write_voice_setting {
276 __u16 voice_setting; 276 __le16 voice_setting;
277} __attribute__ ((packed)); 277} __attribute__ ((packed));
278 278
279#define OCF_HOST_BUFFER_SIZE 0x0033 279#define OCF_HOST_BUFFER_SIZE 0x0033
280struct hci_cp_host_buffer_size { 280struct hci_cp_host_buffer_size {
281 __u16 acl_mtu; 281 __le16 acl_mtu;
282 __u8 sco_mtu; 282 __u8 sco_mtu;
283 __u16 acl_max_pkt; 283 __le16 acl_max_pkt;
284 __u16 sco_max_pkt; 284 __le16 sco_max_pkt;
285} __attribute__ ((packed)); 285} __attribute__ ((packed));
286 286
287/* Link Control */ 287/* Link Control */
@@ -289,10 +289,10 @@ struct hci_cp_host_buffer_size {
289#define OCF_CREATE_CONN 0x0005 289#define OCF_CREATE_CONN 0x0005
290struct hci_cp_create_conn { 290struct hci_cp_create_conn {
291 bdaddr_t bdaddr; 291 bdaddr_t bdaddr;
292 __u16 pkt_type; 292 __le16 pkt_type;
293 __u8 pscan_rep_mode; 293 __u8 pscan_rep_mode;
294 __u8 pscan_mode; 294 __u8 pscan_mode;
295 __u16 clock_offset; 295 __le16 clock_offset;
296 __u8 role_switch; 296 __u8 role_switch;
297} __attribute__ ((packed)); 297} __attribute__ ((packed));
298 298
@@ -310,14 +310,14 @@ struct hci_cp_reject_conn_req {
310 310
311#define OCF_DISCONNECT 0x0006 311#define OCF_DISCONNECT 0x0006
312struct hci_cp_disconnect { 312struct hci_cp_disconnect {
313 __u16 handle; 313 __le16 handle;
314 __u8 reason; 314 __u8 reason;
315} __attribute__ ((packed)); 315} __attribute__ ((packed));
316 316
317#define OCF_ADD_SCO 0x0007 317#define OCF_ADD_SCO 0x0007
318struct hci_cp_add_sco { 318struct hci_cp_add_sco {
319 __u16 handle; 319 __le16 handle;
320 __u16 pkt_type; 320 __le16 pkt_type;
321} __attribute__ ((packed)); 321} __attribute__ ((packed));
322 322
323#define OCF_INQUIRY 0x0001 323#define OCF_INQUIRY 0x0001
@@ -354,56 +354,56 @@ struct hci_cp_pin_code_neg_reply {
354 354
355#define OCF_CHANGE_CONN_PTYPE 0x000F 355#define OCF_CHANGE_CONN_PTYPE 0x000F
356struct hci_cp_change_conn_ptype { 356struct hci_cp_change_conn_ptype {
357 __u16 handle; 357 __le16 handle;
358 __u16 pkt_type; 358 __le16 pkt_type;
359} __attribute__ ((packed)); 359} __attribute__ ((packed));
360 360
361#define OCF_AUTH_REQUESTED 0x0011 361#define OCF_AUTH_REQUESTED 0x0011
362struct hci_cp_auth_requested { 362struct hci_cp_auth_requested {
363 __u16 handle; 363 __le16 handle;
364} __attribute__ ((packed)); 364} __attribute__ ((packed));
365 365
366#define OCF_SET_CONN_ENCRYPT 0x0013 366#define OCF_SET_CONN_ENCRYPT 0x0013
367struct hci_cp_set_conn_encrypt { 367struct hci_cp_set_conn_encrypt {
368 __u16 handle; 368 __le16 handle;
369 __u8 encrypt; 369 __u8 encrypt;
370} __attribute__ ((packed)); 370} __attribute__ ((packed));
371 371
372#define OCF_CHANGE_CONN_LINK_KEY 0x0015 372#define OCF_CHANGE_CONN_LINK_KEY 0x0015
373struct hci_cp_change_conn_link_key { 373struct hci_cp_change_conn_link_key {
374 __u16 handle; 374 __le16 handle;
375} __attribute__ ((packed)); 375} __attribute__ ((packed));
376 376
377#define OCF_READ_REMOTE_FEATURES 0x001B 377#define OCF_READ_REMOTE_FEATURES 0x001B
378struct hci_cp_read_rmt_features { 378struct hci_cp_read_rmt_features {
379 __u16 handle; 379 __le16 handle;
380} __attribute__ ((packed)); 380} __attribute__ ((packed));
381 381
382#define OCF_READ_REMOTE_VERSION 0x001D 382#define OCF_READ_REMOTE_VERSION 0x001D
383struct hci_cp_read_rmt_version { 383struct hci_cp_read_rmt_version {
384 __u16 handle; 384 __le16 handle;
385} __attribute__ ((packed)); 385} __attribute__ ((packed));
386 386
387/* Link Policy */ 387/* Link Policy */
388#define OGF_LINK_POLICY 0x02 388#define OGF_LINK_POLICY 0x02
389#define OCF_ROLE_DISCOVERY 0x0009 389#define OCF_ROLE_DISCOVERY 0x0009
390struct hci_cp_role_discovery { 390struct hci_cp_role_discovery {
391 __u16 handle; 391 __le16 handle;
392} __attribute__ ((packed)); 392} __attribute__ ((packed));
393struct hci_rp_role_discovery { 393struct hci_rp_role_discovery {
394 __u8 status; 394 __u8 status;
395 __u16 handle; 395 __le16 handle;
396 __u8 role; 396 __u8 role;
397} __attribute__ ((packed)); 397} __attribute__ ((packed));
398 398
399#define OCF_READ_LINK_POLICY 0x000C 399#define OCF_READ_LINK_POLICY 0x000C
400struct hci_cp_read_link_policy { 400struct hci_cp_read_link_policy {
401 __u16 handle; 401 __le16 handle;
402} __attribute__ ((packed)); 402} __attribute__ ((packed));
403struct hci_rp_read_link_policy { 403struct hci_rp_read_link_policy {
404 __u8 status; 404 __u8 status;
405 __u16 handle; 405 __le16 handle;
406 __u16 policy; 406 __le16 policy;
407} __attribute__ ((packed)); 407} __attribute__ ((packed));
408 408
409#define OCF_SWITCH_ROLE 0x000B 409#define OCF_SWITCH_ROLE 0x000B
@@ -414,12 +414,12 @@ struct hci_cp_switch_role {
414 414
415#define OCF_WRITE_LINK_POLICY 0x000D 415#define OCF_WRITE_LINK_POLICY 0x000D
416struct hci_cp_write_link_policy { 416struct hci_cp_write_link_policy {
417 __u16 handle; 417 __le16 handle;
418 __u16 policy; 418 __le16 policy;
419} __attribute__ ((packed)); 419} __attribute__ ((packed));
420struct hci_rp_write_link_policy { 420struct hci_rp_write_link_policy {
421 __u8 status; 421 __u8 status;
422 __u16 handle; 422 __le16 handle;
423} __attribute__ ((packed)); 423} __attribute__ ((packed));
424 424
425/* Status params */ 425/* Status params */
@@ -441,7 +441,7 @@ struct inquiry_info {
441 __u8 pscan_period_mode; 441 __u8 pscan_period_mode;
442 __u8 pscan_mode; 442 __u8 pscan_mode;
443 __u8 dev_class[3]; 443 __u8 dev_class[3];
444 __u16 clock_offset; 444 __le16 clock_offset;
445} __attribute__ ((packed)); 445} __attribute__ ((packed));
446 446
447#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 447#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
@@ -450,7 +450,7 @@ struct inquiry_info_with_rssi {
450 __u8 pscan_rep_mode; 450 __u8 pscan_rep_mode;
451 __u8 pscan_period_mode; 451 __u8 pscan_period_mode;
452 __u8 dev_class[3]; 452 __u8 dev_class[3];
453 __u16 clock_offset; 453 __le16 clock_offset;
454 __s8 rssi; 454 __s8 rssi;
455} __attribute__ ((packed)); 455} __attribute__ ((packed));
456struct inquiry_info_with_rssi_and_pscan_mode { 456struct inquiry_info_with_rssi_and_pscan_mode {
@@ -459,7 +459,7 @@ struct inquiry_info_with_rssi_and_pscan_mode {
459 __u8 pscan_period_mode; 459 __u8 pscan_period_mode;
460 __u8 pscan_mode; 460 __u8 pscan_mode;
461 __u8 dev_class[3]; 461 __u8 dev_class[3];
462 __u16 clock_offset; 462 __le16 clock_offset;
463 __s8 rssi; 463 __s8 rssi;
464} __attribute__ ((packed)); 464} __attribute__ ((packed));
465 465
@@ -469,7 +469,7 @@ struct extended_inquiry_info {
469 __u8 pscan_rep_mode; 469 __u8 pscan_rep_mode;
470 __u8 pscan_period_mode; 470 __u8 pscan_period_mode;
471 __u8 dev_class[3]; 471 __u8 dev_class[3];
472 __u16 clock_offset; 472 __le16 clock_offset;
473 __s8 rssi; 473 __s8 rssi;
474 __u8 data[240]; 474 __u8 data[240];
475} __attribute__ ((packed)); 475} __attribute__ ((packed));
@@ -477,7 +477,7 @@ struct extended_inquiry_info {
477#define HCI_EV_CONN_COMPLETE 0x03 477#define HCI_EV_CONN_COMPLETE 0x03
478struct hci_ev_conn_complete { 478struct hci_ev_conn_complete {
479 __u8 status; 479 __u8 status;
480 __u16 handle; 480 __le16 handle;
481 bdaddr_t bdaddr; 481 bdaddr_t bdaddr;
482 __u8 link_type; 482 __u8 link_type;
483 __u8 encr_mode; 483 __u8 encr_mode;
@@ -493,27 +493,27 @@ struct hci_ev_conn_request {
493#define HCI_EV_DISCONN_COMPLETE 0x05 493#define HCI_EV_DISCONN_COMPLETE 0x05
494struct hci_ev_disconn_complete { 494struct hci_ev_disconn_complete {
495 __u8 status; 495 __u8 status;
496 __u16 handle; 496 __le16 handle;
497 __u8 reason; 497 __u8 reason;
498} __attribute__ ((packed)); 498} __attribute__ ((packed));
499 499
500#define HCI_EV_AUTH_COMPLETE 0x06 500#define HCI_EV_AUTH_COMPLETE 0x06
501struct hci_ev_auth_complete { 501struct hci_ev_auth_complete {
502 __u8 status; 502 __u8 status;
503 __u16 handle; 503 __le16 handle;
504} __attribute__ ((packed)); 504} __attribute__ ((packed));
505 505
506#define HCI_EV_ENCRYPT_CHANGE 0x08 506#define HCI_EV_ENCRYPT_CHANGE 0x08
507struct hci_ev_encrypt_change { 507struct hci_ev_encrypt_change {
508 __u8 status; 508 __u8 status;
509 __u16 handle; 509 __le16 handle;
510 __u8 encrypt; 510 __u8 encrypt;
511} __attribute__ ((packed)); 511} __attribute__ ((packed));
512 512
513#define HCI_EV_CHANGE_CONN_LINK_KEY_COMPLETE 0x09 513#define HCI_EV_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
514struct hci_ev_change_conn_link_key_complete { 514struct hci_ev_change_conn_link_key_complete {
515 __u8 status; 515 __u8 status;
516 __u16 handle; 516 __le16 handle;
517} __attribute__ ((packed)); 517} __attribute__ ((packed));
518 518
519#define HCI_EV_QOS_SETUP_COMPLETE 0x0D 519#define HCI_EV_QOS_SETUP_COMPLETE 0x0D
@@ -526,21 +526,21 @@ struct hci_qos {
526} __attribute__ ((packed)); 526} __attribute__ ((packed));
527struct hci_ev_qos_setup_complete { 527struct hci_ev_qos_setup_complete {
528 __u8 status; 528 __u8 status;
529 __u16 handle; 529 __le16 handle;
530 struct hci_qos qos; 530 struct hci_qos qos;
531} __attribute__ ((packed)); 531} __attribute__ ((packed));
532 532
533#define HCI_EV_CMD_COMPLETE 0x0E 533#define HCI_EV_CMD_COMPLETE 0x0E
534struct hci_ev_cmd_complete { 534struct hci_ev_cmd_complete {
535 __u8 ncmd; 535 __u8 ncmd;
536 __u16 opcode; 536 __le16 opcode;
537} __attribute__ ((packed)); 537} __attribute__ ((packed));
538 538
539#define HCI_EV_CMD_STATUS 0x0F 539#define HCI_EV_CMD_STATUS 0x0F
540struct hci_ev_cmd_status { 540struct hci_ev_cmd_status {
541 __u8 status; 541 __u8 status;
542 __u8 ncmd; 542 __u8 ncmd;
543 __u16 opcode; 543 __le16 opcode;
544} __attribute__ ((packed)); 544} __attribute__ ((packed));
545 545
546#define HCI_EV_NUM_COMP_PKTS 0x13 546#define HCI_EV_NUM_COMP_PKTS 0x13
@@ -559,9 +559,9 @@ struct hci_ev_role_change {
559#define HCI_EV_MODE_CHANGE 0x14 559#define HCI_EV_MODE_CHANGE 0x14
560struct hci_ev_mode_change { 560struct hci_ev_mode_change {
561 __u8 status; 561 __u8 status;
562 __u16 handle; 562 __le16 handle;
563 __u8 mode; 563 __u8 mode;
564 __u16 interval; 564 __le16 interval;
565} __attribute__ ((packed)); 565} __attribute__ ((packed));
566 566
567#define HCI_EV_PIN_CODE_REQ 0x16 567#define HCI_EV_PIN_CODE_REQ 0x16
@@ -584,24 +584,24 @@ struct hci_ev_link_key_notify {
584#define HCI_EV_RMT_FEATURES 0x0B 584#define HCI_EV_RMT_FEATURES 0x0B
585struct hci_ev_rmt_features { 585struct hci_ev_rmt_features {
586 __u8 status; 586 __u8 status;
587 __u16 handle; 587 __le16 handle;
588 __u8 features[8]; 588 __u8 features[8];
589} __attribute__ ((packed)); 589} __attribute__ ((packed));
590 590
591#define HCI_EV_RMT_VERSION 0x0C 591#define HCI_EV_RMT_VERSION 0x0C
592struct hci_ev_rmt_version { 592struct hci_ev_rmt_version {
593 __u8 status; 593 __u8 status;
594 __u16 handle; 594 __le16 handle;
595 __u8 lmp_ver; 595 __u8 lmp_ver;
596 __u16 manufacturer; 596 __le16 manufacturer;
597 __u16 lmp_subver; 597 __le16 lmp_subver;
598} __attribute__ ((packed)); 598} __attribute__ ((packed));
599 599
600#define HCI_EV_CLOCK_OFFSET 0x01C 600#define HCI_EV_CLOCK_OFFSET 0x01C
601struct hci_ev_clock_offset { 601struct hci_ev_clock_offset {
602 __u8 status; 602 __u8 status;
603 __u16 handle; 603 __le16 handle;
604 __u16 clock_offset; 604 __le16 clock_offset;
605} __attribute__ ((packed)); 605} __attribute__ ((packed));
606 606
607#define HCI_EV_PSCAN_REP_MODE 0x20 607#define HCI_EV_PSCAN_REP_MODE 0x20
@@ -638,7 +638,7 @@ struct hci_ev_si_security {
638#define HCI_SCO_HDR_SIZE 3 638#define HCI_SCO_HDR_SIZE 3
639 639
640struct hci_command_hdr { 640struct hci_command_hdr {
641 __u16 opcode; /* OCF & OGF */ 641 __le16 opcode; /* OCF & OGF */
642 __u8 plen; 642 __u8 plen;
643} __attribute__ ((packed)); 643} __attribute__ ((packed));
644 644
@@ -648,22 +648,22 @@ struct hci_event_hdr {
648} __attribute__ ((packed)); 648} __attribute__ ((packed));
649 649
650struct hci_acl_hdr { 650struct hci_acl_hdr {
651 __u16 handle; /* Handle & Flags(PB, BC) */ 651 __le16 handle; /* Handle & Flags(PB, BC) */
652 __u16 dlen; 652 __le16 dlen;
653} __attribute__ ((packed)); 653} __attribute__ ((packed));
654 654
655struct hci_sco_hdr { 655struct hci_sco_hdr {
656 __u16 handle; 656 __le16 handle;
657 __u8 dlen; 657 __u8 dlen;
658} __attribute__ ((packed)); 658} __attribute__ ((packed));
659 659
660/* Command opcode pack/unpack */ 660/* Command opcode pack/unpack */
661#define hci_opcode_pack(ogf, ocf) (__u16)((ocf & 0x03ff)|(ogf << 10)) 661#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
662#define hci_opcode_ogf(op) (op >> 10) 662#define hci_opcode_ogf(op) (op >> 10)
663#define hci_opcode_ocf(op) (op & 0x03ff) 663#define hci_opcode_ocf(op) (op & 0x03ff)
664 664
665/* ACL handle and flags pack/unpack */ 665/* ACL handle and flags pack/unpack */
666#define hci_handle_pack(h, f) (__u16)((h & 0x0fff)|(f << 12)) 666#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))
667#define hci_handle(h) (h & 0x0fff) 667#define hci_handle(h) (h & 0x0fff)
668#define hci_flags(h) (h >> 12) 668#define hci_flags(h) (h >> 12)
669 669
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7f933f302078..bb9f81dc8723 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -25,7 +25,6 @@
25#ifndef __HCI_CORE_H 25#ifndef __HCI_CORE_H
26#define __HCI_CORE_H 26#define __HCI_CORE_H
27 27
28#include <linux/proc_fs.h>
29#include <net/bluetooth/hci.h> 28#include <net/bluetooth/hci.h>
30 29
31/* HCI upper protocols */ 30/* HCI upper protocols */
@@ -34,8 +33,6 @@
34 33
35#define HCI_INIT_TIMEOUT (HZ * 10) 34#define HCI_INIT_TIMEOUT (HZ * 10)
36 35
37extern struct proc_dir_entry *proc_bt_hci;
38
39/* HCI Core structures */ 36/* HCI Core structures */
40 37
41struct inquiry_data { 38struct inquiry_data {
@@ -44,7 +41,7 @@ struct inquiry_data {
44 __u8 pscan_period_mode; 41 __u8 pscan_period_mode;
45 __u8 pscan_mode; 42 __u8 pscan_mode;
46 __u8 dev_class[3]; 43 __u8 dev_class[3];
47 __u16 clock_offset; 44 __le16 clock_offset;
48 __s8 rssi; 45 __s8 rssi;
49}; 46};
50 47
@@ -126,10 +123,6 @@ struct hci_dev {
126 123
127 atomic_t promisc; 124 atomic_t promisc;
128 125
129#ifdef CONFIG_PROC_FS
130 struct proc_dir_entry *proc;
131#endif
132
133 struct class_device class_dev; 126 struct class_device class_dev;
134 127
135 struct module *owner; 128 struct module *owner;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index e656be7c001a..bbfac86734ec 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -351,6 +351,4 @@ int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
351int rfcomm_init_ttys(void); 351int rfcomm_init_ttys(void);
352void rfcomm_cleanup_ttys(void); 352void rfcomm_cleanup_ttys(void);
353 353
354extern struct proc_dir_entry *proc_bt_rfcomm;
355
356#endif /* __RFCOMM_H */ 354#endif /* __RFCOMM_H */
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
new file mode 100644
index 000000000000..52d8b1a73d52
--- /dev/null
+++ b/include/net/genetlink.h
@@ -0,0 +1,154 @@
1#ifndef __NET_GENERIC_NETLINK_H
2#define __NET_GENERIC_NETLINK_H
3
4#include <linux/genetlink.h>
5#include <net/netlink.h>
6
7/**
8 * struct genl_family - generic netlink family
9 * @id: protocol family idenfitier
10 * @hdrsize: length of user specific header in bytes
11 * @name: name of family
12 * @version: protocol version
13 * @maxattr: maximum number of attributes supported
14 * @attrbuf: buffer to store parsed attributes
15 * @ops_list: list of all assigned operations
16 * @family_list: family list
17 */
18struct genl_family
19{
20 unsigned int id;
21 unsigned int hdrsize;
22 char name[GENL_NAMSIZ];
23 unsigned int version;
24 unsigned int maxattr;
25 struct module * owner;
26 struct nlattr ** attrbuf; /* private */
27 struct list_head ops_list; /* private */
28 struct list_head family_list; /* private */
29};
30
31#define GENL_ADMIN_PERM 0x01
32
33/**
34 * struct genl_info - receiving information
35 * @snd_seq: sending sequence number
36 * @snd_pid: netlink pid of sender
37 * @nlhdr: netlink message header
38 * @genlhdr: generic netlink message header
39 * @userhdr: user specific header
40 * @attrs: netlink attributes
41 */
42struct genl_info
43{
44 u32 snd_seq;
45 u32 snd_pid;
46 struct nlmsghdr * nlhdr;
47 struct genlmsghdr * genlhdr;
48 void * userhdr;
49 struct nlattr ** attrs;
50};
51
52/**
53 * struct genl_ops - generic netlink operations
54 * @cmd: command identifier
55 * @flags: flags
56 * @policy: attribute validation policy
57 * @doit: standard command callback
58 * @dumpit: callback for dumpers
59 * @ops_list: operations list
60 */
61struct genl_ops
62{
63 unsigned int cmd;
64 unsigned int flags;
65 struct nla_policy *policy;
66 int (*doit)(struct sk_buff *skb,
67 struct genl_info *info);
68 int (*dumpit)(struct sk_buff *skb,
69 struct netlink_callback *cb);
70 struct list_head ops_list;
71};
72
73extern int genl_register_family(struct genl_family *family);
74extern int genl_unregister_family(struct genl_family *family);
75extern int genl_register_ops(struct genl_family *, struct genl_ops *ops);
76extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
77
78extern struct sock *genl_sock;
79
80/**
81 * genlmsg_put - Add generic netlink header to netlink message
82 * @skb: socket buffer holding the message
83 * @pid: netlink pid the message is addressed to
84 * @seq: sequence number (usually the one of the sender)
85 * @type: netlink message type
86 * @hdrlen: length of the user specific header
87 * @flags netlink message flags
88 * @cmd: generic netlink command
89 * @version: version
90 *
91 * Returns pointer to user specific header
92 */
93static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
94 int type, int hdrlen, int flags,
95 u8 cmd, u8 version)
96{
97 struct nlmsghdr *nlh;
98 struct genlmsghdr *hdr;
99
100 nlh = nlmsg_put(skb, pid, seq, type, GENL_HDRLEN + hdrlen, flags);
101 if (nlh == NULL)
102 return NULL;
103
104 hdr = nlmsg_data(nlh);
105 hdr->cmd = cmd;
106 hdr->version = version;
107 hdr->reserved = 0;
108
109 return (char *) hdr + GENL_HDRLEN;
110}
111
112/**
113 * genlmsg_end - Finalize a generic netlink message
114 * @skb: socket buffer the message is stored in
115 * @hdr: user specific header
116 */
117static inline int genlmsg_end(struct sk_buff *skb, void *hdr)
118{
119 return nlmsg_end(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
120}
121
122/**
123 * genlmsg_cancel - Cancel construction of a generic netlink message
124 * @skb: socket buffer the message is stored in
125 * @hdr: generic netlink message header
126 */
127static inline int genlmsg_cancel(struct sk_buff *skb, void *hdr)
128{
129 return nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
130}
131
132/**
133 * genlmsg_multicast - multicast a netlink message
134 * @skb: netlink message as socket buffer
135 * @pid: own netlink pid to avoid sending to yourself
136 * @group: multicast group id
137 */
138static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid,
139 unsigned int group)
140{
141 return nlmsg_multicast(genl_sock, skb, pid, group);
142}
143
144/**
145 * genlmsg_unicast - unicast a netlink message
146 * @skb: netlink message as socket buffer
147 * @pid: netlink pid of the destination socket
148 */
149static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid)
150{
151 return nlmsg_unicast(genl_sock, skb, pid);
152}
153
154#endif /* __NET_GENERIC_NETLINK_H */
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 5e38dca1d082..b93fd8c1d884 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -29,7 +29,7 @@
29#include <linux/kernel.h> /* ARRAY_SIZE */ 29#include <linux/kernel.h> /* ARRAY_SIZE */
30#include <linux/wireless.h> 30#include <linux/wireless.h>
31 31
32#define IEEE80211_VERSION "git-1.1.6" 32#define IEEE80211_VERSION "git-1.1.7"
33 33
34#define IEEE80211_DATA_LEN 2304 34#define IEEE80211_DATA_LEN 2304
35/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 35/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index 0a1c2d82ca4b..225fc751d464 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -31,6 +31,7 @@ enum {
31 31
32struct ieee80211_crypto_ops { 32struct ieee80211_crypto_ops {
33 const char *name; 33 const char *name;
34 struct list_head list;
34 35
35 /* init new crypto context (e.g., allocate private data space, 36 /* init new crypto context (e.g., allocate private data space,
36 * select IV, etc.); returns NULL on failure or pointer to allocated 37 * select IV, etc.); returns NULL on failure or pointer to allocated
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 65ec86678a08..6addb4d464d6 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -252,12 +252,25 @@ typedef int (*inet_getfrag_t) (const void *data,
252 char *, 252 char *,
253 unsigned int, unsigned int); 253 unsigned int, unsigned int);
254 254
255 255extern int __ipv6_addr_type(const struct in6_addr *addr);
256extern int ipv6_addr_type(const struct in6_addr *addr); 256static inline int ipv6_addr_type(const struct in6_addr *addr)
257{
258 return __ipv6_addr_type(addr) & 0xffff;
259}
257 260
258static inline int ipv6_addr_scope(const struct in6_addr *addr) 261static inline int ipv6_addr_scope(const struct in6_addr *addr)
259{ 262{
260 return ipv6_addr_type(addr) & IPV6_ADDR_SCOPE_MASK; 263 return __ipv6_addr_type(addr) & IPV6_ADDR_SCOPE_MASK;
264}
265
266static inline int __ipv6_addr_src_scope(int type)
267{
268 return (type == IPV6_ADDR_ANY ? __IPV6_ADDR_SCOPE_INVALID : (type >> 16));
269}
270
271static inline int ipv6_addr_src_scope(const struct in6_addr *addr)
272{
273 return __ipv6_addr_src_scope(__ipv6_addr_type(addr));
261} 274}
262 275
263static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) 276static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2)
@@ -341,6 +354,54 @@ static inline int ipv6_addr_any(const struct in6_addr *a)
341} 354}
342 355
343/* 356/*
357 * find the first different bit between two addresses
358 * length of address must be a multiple of 32bits
359 */
360static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen)
361{
362 const __u32 *a1 = token1, *a2 = token2;
363 int i;
364
365 addrlen >>= 2;
366
367 for (i = 0; i < addrlen; i++) {
368 __u32 xb = a1[i] ^ a2[i];
369 if (xb) {
370 int j = 31;
371
372 xb = ntohl(xb);
373 while ((xb & (1 << j)) == 0)
374 j--;
375
376 return (i * 32 + 31 - j);
377 }
378 }
379
380 /*
381 * we should *never* get to this point since that
382 * would mean the addrs are equal
383 *
384 * However, we do get to it 8) And exacly, when
385 * addresses are equal 8)
386 *
387 * ip route add 1111::/128 via ...
388 * ip route add 1111::/64 via ...
389 * and we are here.
390 *
391 * Ideally, this function should stop comparison
392 * at prefix length. It does not, but it is still OK,
393 * if returned value is greater than prefix length.
394 * --ANK (980803)
395 */
396 return (addrlen << 5);
397}
398
399static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_addr *a2)
400{
401 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
402}
403
404/*
344 * Prototypes exported by ipv6 405 * Prototypes exported by ipv6
345 */ 406 */
346 407
diff --git a/include/net/netfilter/ipv4/nf_conntrack_icmp.h b/include/net/netfilter/ipv4/nf_conntrack_icmp.h
new file mode 100644
index 000000000000..3dd22cff23ec
--- /dev/null
+++ b/include/net/netfilter/ipv4/nf_conntrack_icmp.h
@@ -0,0 +1,11 @@
1#ifndef _NF_CONNTRACK_ICMP_H
2#define _NF_CONNTRACK_ICMP_H
3/* ICMP tracking. */
4#include <asm/atomic.h>
5
6struct ip_ct_icmp
7{
8 /* Optimization: when number in == number out, forget immediately. */
9 atomic_t count;
10};
11#endif /* _NF_CONNTRACK_ICMP_H */
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
new file mode 100644
index 000000000000..25b081a730e6
--- /dev/null
+++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
@@ -0,0 +1,43 @@
1/*
2 * IPv4 support for nf_conntrack.
3 *
4 * 23 Mar 2004: Yasuyuki Kozakai @ USAGI <yasuyuki.kozakai@toshiba.co.jp>
5 * - move L3 protocol dependent part from include/linux/netfilter_ipv4/
6 * ip_conntarck.h
7 */
8
9#ifndef _NF_CONNTRACK_IPV4_H
10#define _NF_CONNTRACK_IPV4_H
11
12#ifdef CONFIG_IP_NF_NAT_NEEDED
13#include <linux/netfilter_ipv4/ip_nat.h>
14
15/* per conntrack: nat application helper private data */
16union ip_conntrack_nat_help {
17 /* insert nat helper private data here */
18};
19
20struct nf_conntrack_ipv4_nat {
21 struct ip_nat_info info;
22 union ip_conntrack_nat_help help;
23#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
24 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
25 int masq_index;
26#endif
27};
28#endif /* CONFIG_IP_NF_NAT_NEEDED */
29
30struct nf_conntrack_ipv4 {
31#ifdef CONFIG_IP_NF_NAT_NEEDED
32 struct nf_conntrack_ipv4_nat *nat;
33#endif
34};
35
36/* Returns new sk_buff, or NULL */
37struct sk_buff *
38nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb);
39
40/* call to create an explicit dependency on nf_conntrack_l3proto_ipv4. */
41extern void need_ip_conntrack(void);
42
43#endif /*_NF_CONNTRACK_IPV4_H*/
diff --git a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h
new file mode 100644
index 000000000000..86591afda29c
--- /dev/null
+++ b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h
@@ -0,0 +1,27 @@
1/*
2 * ICMPv6 tracking.
3 *
4 * 21 Apl 2004: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
5 * - separated from nf_conntrack_icmp.h
6 *
7 * Derived from include/linux/netfiter_ipv4/ip_conntrack_icmp.h
8 */
9
10#ifndef _NF_CONNTRACK_ICMPV6_H
11#define _NF_CONNTRACK_ICMPV6_H
12#include <asm/atomic.h>
13
14#ifndef ICMPV6_NI_QUERY
15#define ICMPV6_NI_QUERY 139
16#endif
17#ifndef ICMPV6_NI_REPLY
18#define ICMPV6_NI_REPLY 140
19#endif
20
21struct nf_ct_icmpv6
22{
23 /* Optimization: when number in == number out, forget immediately. */
24 atomic_t count;
25};
26
27#endif /* _NF_CONNTRACK_ICMPV6_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
new file mode 100644
index 000000000000..cc4825610795
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack.h
@@ -0,0 +1,354 @@
1/*
2 * Connection state tracking for netfilter. This is separated from,
3 * but required by, the (future) NAT layer; it can also be used by an iptables
4 * extension.
5 *
6 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
7 * - generalize L3 protocol dependent part.
8 *
9 * Derived from include/linux/netfiter_ipv4/ip_conntrack.h
10 */
11
12#ifndef _NF_CONNTRACK_H
13#define _NF_CONNTRACK_H
14
15#include <linux/netfilter/nf_conntrack_common.h>
16
17#ifdef __KERNEL__
18#include <linux/config.h>
19#include <linux/bitops.h>
20#include <linux/compiler.h>
21#include <asm/atomic.h>
22
23#include <linux/netfilter/nf_conntrack_tcp.h>
24#include <linux/netfilter/nf_conntrack_sctp.h>
25#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
26#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h>
27
28#include <net/netfilter/nf_conntrack_tuple.h>
29
30/* per conntrack: protocol private data */
31union nf_conntrack_proto {
32 /* insert conntrack proto private data here */
33 struct ip_ct_sctp sctp;
34 struct ip_ct_tcp tcp;
35 struct ip_ct_icmp icmp;
36 struct nf_ct_icmpv6 icmpv6;
37};
38
39union nf_conntrack_expect_proto {
40 /* insert expect proto private data here */
41};
42
43/* Add protocol helper include file here */
44#include <linux/netfilter/nf_conntrack_ftp.h>
45
46/* per conntrack: application helper private data */
47union nf_conntrack_help {
48 /* insert conntrack helper private data (master) here */
49 struct ip_ct_ftp_master ct_ftp_info;
50};
51
52#include <linux/types.h>
53#include <linux/skbuff.h>
54
55#ifdef CONFIG_NETFILTER_DEBUG
56#define NF_CT_ASSERT(x) \
57do { \
58 if (!(x)) \
59 /* Wooah! I'm tripping my conntrack in a frenzy of \
60 netplay... */ \
61 printk("NF_CT_ASSERT: %s:%i(%s)\n", \
62 __FILE__, __LINE__, __FUNCTION__); \
63} while(0)
64#else
65#define NF_CT_ASSERT(x)
66#endif
67
68struct nf_conntrack_helper;
69
70#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
71struct nf_conn
72{
73 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
74 plus 1 for any connection(s) we are `master' for */
75 struct nf_conntrack ct_general;
76
77 /* XXX should I move this to the tail ? - Y.K */
78 /* These are my tuples; original and reply */
79 struct nf_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
80
81 /* Have we seen traffic both ways yet? (bitset) */
82 unsigned long status;
83
84 /* Timer function; drops refcnt when it goes off. */
85 struct timer_list timeout;
86
87#ifdef CONFIG_NF_CT_ACCT
88 /* Accounting Information (same cache line as other written members) */
89 struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
90#endif
91 /* If we were expected by an expectation, this will be it */
92 struct nf_conn *master;
93
94 /* Current number of expected connections */
95 unsigned int expecting;
96
97 /* Helper. if any */
98 struct nf_conntrack_helper *helper;
99
100 /* features - nat, helper, ... used by allocating system */
101 u_int32_t features;
102
103 /* Storage reserved for other modules: */
104
105 union nf_conntrack_proto proto;
106
107#if defined(CONFIG_NF_CONNTRACK_MARK)
108 u_int32_t mark;
109#endif
110
111 /* These members are dynamically allocated. */
112
113 union nf_conntrack_help *help;
114
115 /* Layer 3 dependent members. (ex: NAT) */
116 union {
117 struct nf_conntrack_ipv4 *ipv4;
118 } l3proto;
119 void *data[0];
120};
121
122struct nf_conntrack_expect
123{
124 /* Internal linked list (global expectation list) */
125 struct list_head list;
126
127 /* We expect this tuple, with the following mask */
128 struct nf_conntrack_tuple tuple, mask;
129
130 /* Function to call after setup and insertion */
131 void (*expectfn)(struct nf_conn *new,
132 struct nf_conntrack_expect *this);
133
134 /* The conntrack of the master connection */
135 struct nf_conn *master;
136
137 /* Timer function; deletes the expectation. */
138 struct timer_list timeout;
139
140 /* Usage count. */
141 atomic_t use;
142
143 /* Flags */
144 unsigned int flags;
145
146#ifdef CONFIG_NF_NAT_NEEDED
147 /* This is the original per-proto part, used to map the
148 * expected connection the way the recipient expects. */
149 union nf_conntrack_manip_proto saved_proto;
150 /* Direction relative to the master connection. */
151 enum ip_conntrack_dir dir;
152#endif
153};
154
155#define NF_CT_EXPECT_PERMANENT 0x1
156
157static inline struct nf_conn *
158nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash)
159{
160 return container_of(hash, struct nf_conn,
161 tuplehash[hash->tuple.dst.dir]);
162}
163
164/* get master conntrack via master expectation */
165#define master_ct(conntr) (conntr->master)
166
167/* Alter reply tuple (maybe alter helper). */
168extern void
169nf_conntrack_alter_reply(struct nf_conn *conntrack,
170 const struct nf_conntrack_tuple *newreply);
171
172/* Is this tuple taken? (ignoring any belonging to the given
173 conntrack). */
174extern int
175nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
176 const struct nf_conn *ignored_conntrack);
177
178/* Return conntrack_info and tuple hash for given skb. */
179static inline struct nf_conn *
180nf_ct_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo)
181{
182 *ctinfo = skb->nfctinfo;
183 return (struct nf_conn *)skb->nfct;
184}
185
186/* decrement reference count on a conntrack */
187static inline void nf_ct_put(struct nf_conn *ct)
188{
189 NF_CT_ASSERT(ct);
190 nf_conntrack_put(&ct->ct_general);
191}
192
193/* call to create an explicit dependency on nf_conntrack. */
194extern void need_nf_conntrack(void);
195
196extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
197 const struct nf_conntrack_tuple *orig);
198
199extern void __nf_ct_refresh_acct(struct nf_conn *ct,
200 enum ip_conntrack_info ctinfo,
201 const struct sk_buff *skb,
202 unsigned long extra_jiffies,
203 int do_acct);
204
205/* Refresh conntrack for this many jiffies and do accounting */
206static inline void nf_ct_refresh_acct(struct nf_conn *ct,
207 enum ip_conntrack_info ctinfo,
208 const struct sk_buff *skb,
209 unsigned long extra_jiffies)
210{
211 __nf_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1);
212}
213
214/* Refresh conntrack for this many jiffies */
215static inline void nf_ct_refresh(struct nf_conn *ct,
216 const struct sk_buff *skb,
217 unsigned long extra_jiffies)
218{
219 __nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
220}
221
222/* These are for NAT. Icky. */
223/* Update TCP window tracking data when NAT mangles the packet */
224extern void nf_conntrack_tcp_update(struct sk_buff *skb,
225 unsigned int dataoff,
226 struct nf_conn *conntrack,
227 int dir);
228
229/* Call me when a conntrack is destroyed. */
230extern void (*nf_conntrack_destroyed)(struct nf_conn *conntrack);
231
232/* Fake conntrack entry for untracked connections */
233extern struct nf_conn nf_conntrack_untracked;
234
235extern int nf_ct_no_defrag;
236
237/* Iterate over all conntracks: if iter returns true, it's deleted. */
238extern void
239nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), void *data);
240extern void nf_conntrack_free(struct nf_conn *ct);
241extern struct nf_conn *
242nf_conntrack_alloc(const struct nf_conntrack_tuple *orig,
243 const struct nf_conntrack_tuple *repl);
244
245/* It's confirmed if it is, or has been in the hash table. */
246static inline int nf_ct_is_confirmed(struct nf_conn *ct)
247{
248 return test_bit(IPS_CONFIRMED_BIT, &ct->status);
249}
250
251static inline int nf_ct_is_dying(struct nf_conn *ct)
252{
253 return test_bit(IPS_DYING_BIT, &ct->status);
254}
255
256extern unsigned int nf_conntrack_htable_size;
257
258#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++)
259
260#ifdef CONFIG_NF_CONNTRACK_EVENTS
261#include <linux/notifier.h>
262#include <linux/interrupt.h>
263
264struct nf_conntrack_ecache {
265 struct nf_conn *ct;
266 unsigned int events;
267};
268DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
269
270#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
271
272extern struct notifier_block *nf_conntrack_chain;
273extern struct notifier_block *nf_conntrack_expect_chain;
274
275static inline int nf_conntrack_register_notifier(struct notifier_block *nb)
276{
277 return notifier_chain_register(&nf_conntrack_chain, nb);
278}
279
280static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb)
281{
282 return notifier_chain_unregister(&nf_conntrack_chain, nb);
283}
284
285static inline int
286nf_conntrack_expect_register_notifier(struct notifier_block *nb)
287{
288 return notifier_chain_register(&nf_conntrack_expect_chain, nb);
289}
290
291static inline int
292nf_conntrack_expect_unregister_notifier(struct notifier_block *nb)
293{
294 return notifier_chain_unregister(&nf_conntrack_expect_chain, nb);
295}
296
297extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
298extern void __nf_ct_event_cache_init(struct nf_conn *ct);
299
300static inline void
301nf_conntrack_event_cache(enum ip_conntrack_events event,
302 const struct sk_buff *skb)
303{
304 struct nf_conn *ct = (struct nf_conn *)skb->nfct;
305 struct nf_conntrack_ecache *ecache;
306
307 local_bh_disable();
308 ecache = &__get_cpu_var(nf_conntrack_ecache);
309 if (ct != ecache->ct)
310 __nf_ct_event_cache_init(ct);
311 ecache->events |= event;
312 local_bh_enable();
313}
314
315static inline void nf_conntrack_event(enum ip_conntrack_events event,
316 struct nf_conn *ct)
317{
318 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
319 notifier_call_chain(&nf_conntrack_chain, event, ct);
320}
321
322static inline void
323nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
324 struct nf_conntrack_expect *exp)
325{
326 notifier_call_chain(&nf_conntrack_expect_chain, event, exp);
327}
328#else /* CONFIG_NF_CONNTRACK_EVENTS */
329static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
330 const struct sk_buff *skb) {}
331static inline void nf_conntrack_event(enum ip_conntrack_events event,
332 struct nf_conn *ct) {}
333static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
334static inline void
335nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
336 struct nf_conntrack_expect *exp) {}
337#endif /* CONFIG_NF_CONNTRACK_EVENTS */
338
339/* no helper, no nat */
340#define NF_CT_F_BASIC 0
341/* for helper */
342#define NF_CT_F_HELP 1
343/* for nat. */
344#define NF_CT_F_NAT 2
345#define NF_CT_F_NUM 4
346
347extern int
348nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size,
349 int (*init_conntrack)(struct nf_conn *, u_int32_t));
350extern void
351nf_conntrack_unregister_cache(u_int32_t features);
352
353#endif /* __KERNEL__ */
354#endif /* _NF_CONNTRACK_H */
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h
new file mode 100644
index 000000000000..3cac19fb3648
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_compat.h
@@ -0,0 +1,108 @@
1#ifndef _NF_CONNTRACK_COMPAT_H
2#define _NF_CONNTRACK_COMPAT_H
3
4#ifdef __KERNEL__
5
6#if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE)
7
8#include <linux/netfilter_ipv4/ip_conntrack.h>
9
10#ifdef CONFIG_IP_NF_CONNTRACK_MARK
11static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
12 u_int32_t *ctinfo)
13{
14 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
15
16 if (ct)
17 return &ct->mark;
18 else
19 return NULL;
20}
21#endif /* CONFIG_IP_NF_CONNTRACK_MARK */
22
23#ifdef CONFIG_IP_NF_CT_ACCT
24static inline struct ip_conntrack_counter *
25nf_ct_get_counters(const struct sk_buff *skb)
26{
27 enum ip_conntrack_info ctinfo;
28 struct ip_conntrack *ct = ip_conntrack_get(skb, &ctinfo);
29
30 if (ct)
31 return ct->counters;
32 else
33 return NULL;
34}
35#endif /* CONFIG_IP_NF_CT_ACCT */
36
37static inline int nf_ct_is_untracked(const struct sk_buff *skb)
38{
39 return (skb->nfct == &ip_conntrack_untracked.ct_general);
40}
41
42static inline void nf_ct_untrack(struct sk_buff *skb)
43{
44 skb->nfct = &ip_conntrack_untracked.ct_general;
45}
46
47static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
48 enum ip_conntrack_info *ctinfo)
49{
50 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
51 return (ct != NULL);
52}
53
54#else /* CONFIG_IP_NF_CONNTRACK */
55
56#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
57#include <net/netfilter/nf_conntrack.h>
58
59#ifdef CONFIG_NF_CONNTRACK_MARK
60
61static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
62 u_int32_t *ctinfo)
63{
64 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
65
66 if (ct)
67 return &ct->mark;
68 else
69 return NULL;
70}
71#endif /* CONFIG_NF_CONNTRACK_MARK */
72
73#ifdef CONFIG_NF_CT_ACCT
74static inline struct ip_conntrack_counter *
75nf_ct_get_counters(const struct sk_buff *skb)
76{
77 enum ip_conntrack_info ctinfo;
78 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
79
80 if (ct)
81 return ct->counters;
82 else
83 return NULL;
84}
85#endif /* CONFIG_NF_CT_ACCT */
86
87static inline int nf_ct_is_untracked(const struct sk_buff *skb)
88{
89 return (skb->nfct == &nf_conntrack_untracked.ct_general);
90}
91
92static inline void nf_ct_untrack(struct sk_buff *skb)
93{
94 skb->nfct = &nf_conntrack_untracked.ct_general;
95}
96
97static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
98 enum ip_conntrack_info *ctinfo)
99{
100 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
101 return (ct != NULL);
102}
103
104#endif /* CONFIG_IP_NF_CONNTRACK */
105
106#endif /* __KERNEL__ */
107
108#endif /* _NF_CONNTRACK_COMPAT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
new file mode 100644
index 000000000000..da254525a4ce
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -0,0 +1,76 @@
1/*
2 * This header is used to share core functionality between the
3 * standalone connection tracking module, and the compatibility layer's use
4 * of connection tracking.
5 *
6 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
7 * - generalize L3 protocol dependent part.
8 *
9 * Derived from include/linux/netfiter_ipv4/ip_conntrack_core.h
10 */
11
12#ifndef _NF_CONNTRACK_CORE_H
13#define _NF_CONNTRACK_CORE_H
14
15#include <linux/netfilter.h>
16
17/* This header is used to share core functionality between the
18 standalone connection tracking module, and the compatibility layer's use
19 of connection tracking. */
20extern unsigned int nf_conntrack_in(int pf,
21 unsigned int hooknum,
22 struct sk_buff **pskb);
23
24extern int nf_conntrack_init(void);
25extern void nf_conntrack_cleanup(void);
26
27struct nf_conntrack_l3proto;
28extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
29/* Like above, but you already have conntrack read lock. */
30extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto);
31
32struct nf_conntrack_protocol;
33
34extern int
35nf_ct_get_tuple(const struct sk_buff *skb,
36 unsigned int nhoff,
37 unsigned int dataoff,
38 u_int16_t l3num,
39 u_int8_t protonum,
40 struct nf_conntrack_tuple *tuple,
41 const struct nf_conntrack_l3proto *l3proto,
42 const struct nf_conntrack_protocol *protocol);
43
44extern int
45nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
46 const struct nf_conntrack_tuple *orig,
47 const struct nf_conntrack_l3proto *l3proto,
48 const struct nf_conntrack_protocol *protocol);
49
50/* Find a connection corresponding to a tuple. */
51extern struct nf_conntrack_tuple_hash *
52nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple,
53 const struct nf_conn *ignored_conntrack);
54
55extern int __nf_conntrack_confirm(struct sk_buff **pskb);
56
57/* Confirm a connection: returns NF_DROP if packet must be dropped. */
58static inline int nf_conntrack_confirm(struct sk_buff **pskb)
59{
60 struct nf_conn *ct = (struct nf_conn *)(*pskb)->nfct;
61 int ret = NF_ACCEPT;
62
63 if (ct) {
64 if (!nf_ct_is_confirmed(ct))
65 ret = __nf_conntrack_confirm(pskb);
66 nf_ct_deliver_cached_events(ct);
67 }
68 return ret;
69}
70
71extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb);
72
73extern struct list_head *nf_conntrack_hash;
74extern struct list_head nf_conntrack_expect_list;
75extern rwlock_t nf_conntrack_lock ;
76#endif /* _NF_CONNTRACK_CORE_H */
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
new file mode 100644
index 000000000000..5a66b2a3a623
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -0,0 +1,51 @@
1/*
2 * connection tracking helpers.
3 *
4 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
5 * - generalize L3 protocol dependent part.
6 *
7 * Derived from include/linux/netfiter_ipv4/ip_conntrack_helper.h
8 */
9
10#ifndef _NF_CONNTRACK_HELPER_H
11#define _NF_CONNTRACK_HELPER_H
12#include <net/netfilter/nf_conntrack.h>
13
14struct module;
15
16struct nf_conntrack_helper
17{
18 struct list_head list; /* Internal use. */
19
20 const char *name; /* name of the module */
21 struct module *me; /* pointer to self */
22 unsigned int max_expected; /* Maximum number of concurrent
23 * expected connections */
24 unsigned int timeout; /* timeout for expecteds */
25
26 /* Mask of things we will help (compared against server response) */
27 struct nf_conntrack_tuple tuple;
28 struct nf_conntrack_tuple mask;
29
30 /* Function to call when data passes; return verdict, or -1 to
31 invalidate. */
32 int (*help)(struct sk_buff **pskb,
33 unsigned int protoff,
34 struct nf_conn *ct,
35 enum ip_conntrack_info conntrackinfo);
36};
37
38extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
39extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
40
41/* Allocate space for an expectation: this is mandatory before calling
42 nf_conntrack_expect_related. You will have to call put afterwards. */
43extern struct nf_conntrack_expect *
44nf_conntrack_expect_alloc(struct nf_conn *master);
45extern void nf_conntrack_expect_put(struct nf_conntrack_expect *exp);
46
47/* Add an expected connection: can have more than one per connection */
48extern int nf_conntrack_expect_related(struct nf_conntrack_expect *exp);
49extern void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp);
50
51#endif /*_NF_CONNTRACK_HELPER_H*/
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
new file mode 100644
index 000000000000..01663e5b33df
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -0,0 +1,93 @@
1/*
2 * Copyright (C)2003,2004 USAGI/WIDE Project
3 *
4 * Header for use in defining a given L3 protocol for connection tracking.
5 *
6 * Author:
7 * Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
8 *
9 * Derived from include/netfilter_ipv4/ip_conntrack_protocol.h
10 */
11
12#ifndef _NF_CONNTRACK_L3PROTO_H
13#define _NF_CONNTRACK_L3PROTO_H
14#include <linux/seq_file.h>
15#include <net/netfilter/nf_conntrack.h>
16
17struct nf_conntrack_l3proto
18{
19 /* Next pointer. */
20 struct list_head list;
21
22 /* L3 Protocol Family number. ex) PF_INET */
23 u_int16_t l3proto;
24
25 /* Protocol name */
26 const char *name;
27
28 /*
29 * Try to fill in the third arg: nhoff is offset of l3 proto
30 * hdr. Return true if possible.
31 */
32 int (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff,
33 struct nf_conntrack_tuple *tuple);
34
35 /*
36 * Invert the per-proto part of the tuple: ie. turn xmit into reply.
37 * Some packets can't be inverted: return 0 in that case.
38 */
39 int (*invert_tuple)(struct nf_conntrack_tuple *inverse,
40 const struct nf_conntrack_tuple *orig);
41
42 /* Print out the per-protocol part of the tuple. */
43 int (*print_tuple)(struct seq_file *s,
44 const struct nf_conntrack_tuple *);
45
46 /* Print out the private part of the conntrack. */
47 int (*print_conntrack)(struct seq_file *s, const struct nf_conn *);
48
49 /* Returns verdict for packet, or -1 for invalid. */
50 int (*packet)(struct nf_conn *conntrack,
51 const struct sk_buff *skb,
52 enum ip_conntrack_info ctinfo);
53
54 /*
55 * Called when a new connection for this protocol found;
56 * returns TRUE if it's OK. If so, packet() called next.
57 */
58 int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb);
59
60 /* Called when a conntrack entry is destroyed */
61 void (*destroy)(struct nf_conn *conntrack);
62
63 /*
64 * Called before tracking.
65 * *dataoff: offset of protocol header (TCP, UDP,...) in *pskb
66 * *protonum: protocol number
67 */
68 int (*prepare)(struct sk_buff **pskb, unsigned int hooknum,
69 unsigned int *dataoff, u_int8_t *protonum);
70
71 u_int32_t (*get_features)(const struct nf_conntrack_tuple *tuple);
72
73 /* Module (if any) which this is connected to. */
74 struct module *me;
75};
76
77extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX];
78
79/* Protocol registration. */
80extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
81extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
82
83static inline struct nf_conntrack_l3proto *
84nf_ct_find_l3proto(u_int16_t l3proto)
85{
86 return nf_ct_l3protos[l3proto];
87}
88
89/* Existing built-in protocols */
90extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4;
91extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
92extern struct nf_conntrack_l3proto nf_conntrack_generic_l3proto;
93#endif /*_NF_CONNTRACK_L3PROTO_H*/
diff --git a/include/net/netfilter/nf_conntrack_protocol.h b/include/net/netfilter/nf_conntrack_protocol.h
new file mode 100644
index 000000000000..b3afda35397a
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_protocol.h
@@ -0,0 +1,105 @@
1/*
2 * Header for use in defining a given protocol for connection tracking.
3 *
4 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
5 * - generalized L3 protocol dependent part.
6 *
7 * Derived from include/linux/netfiter_ipv4/ip_conntrack_protcol.h
8 */
9
10#ifndef _NF_CONNTRACK_PROTOCOL_H
11#define _NF_CONNTRACK_PROTOCOL_H
12#include <net/netfilter/nf_conntrack.h>
13
14struct seq_file;
15
16struct nf_conntrack_protocol
17{
18 /* Next pointer. */
19 struct list_head list;
20
21 /* L3 Protocol number. */
22 u_int16_t l3proto;
23
24 /* Protocol number. */
25 u_int8_t proto;
26
27 /* Protocol name */
28 const char *name;
29
30 /* Try to fill in the third arg: dataoff is offset past network protocol
31 hdr. Return true if possible. */
32 int (*pkt_to_tuple)(const struct sk_buff *skb,
33 unsigned int dataoff,
34 struct nf_conntrack_tuple *tuple);
35
36 /* Invert the per-proto part of the tuple: ie. turn xmit into reply.
37 * Some packets can't be inverted: return 0 in that case.
38 */
39 int (*invert_tuple)(struct nf_conntrack_tuple *inverse,
40 const struct nf_conntrack_tuple *orig);
41
42 /* Print out the per-protocol part of the tuple. Return like seq_* */
43 int (*print_tuple)(struct seq_file *s,
44 const struct nf_conntrack_tuple *);
45
46 /* Print out the private part of the conntrack. */
47 int (*print_conntrack)(struct seq_file *s, const struct nf_conn *);
48
49 /* Returns verdict for packet, or -1 for invalid. */
50 int (*packet)(struct nf_conn *conntrack,
51 const struct sk_buff *skb,
52 unsigned int dataoff,
53 enum ip_conntrack_info ctinfo,
54 int pf,
55 unsigned int hooknum);
56
57 /* Called when a new connection for this protocol found;
58 * returns TRUE if it's OK. If so, packet() called next. */
59 int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb,
60 unsigned int dataoff);
61
62 /* Called when a conntrack entry is destroyed */
63 void (*destroy)(struct nf_conn *conntrack);
64
65 int (*error)(struct sk_buff *skb, unsigned int dataoff,
66 enum ip_conntrack_info *ctinfo,
67 int pf, unsigned int hooknum);
68
69 /* Module (if any) which this is connected to. */
70 struct module *me;
71};
72
73/* Existing built-in protocols */
74extern struct nf_conntrack_protocol nf_conntrack_protocol_tcp6;
75extern struct nf_conntrack_protocol nf_conntrack_protocol_udp4;
76extern struct nf_conntrack_protocol nf_conntrack_protocol_udp6;
77extern struct nf_conntrack_protocol nf_conntrack_generic_protocol;
78
79#define MAX_NF_CT_PROTO 256
80extern struct nf_conntrack_protocol **nf_ct_protos[PF_MAX];
81
82extern struct nf_conntrack_protocol *
83nf_ct_find_proto(u_int16_t l3proto, u_int8_t protocol);
84
85/* Protocol registration. */
86extern int nf_conntrack_protocol_register(struct nf_conntrack_protocol *proto);
87extern void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto);
88
89/* Log invalid packets */
90extern unsigned int nf_ct_log_invalid;
91
92#ifdef CONFIG_SYSCTL
93#ifdef DEBUG_INVALID_PACKETS
94#define LOG_INVALID(proto) \
95 (nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW)
96#else
97#define LOG_INVALID(proto) \
98 ((nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) \
99 && net_ratelimit())
100#endif
101#else
102#define LOG_INVALID(proto) 0
103#endif /* CONFIG_SYSCTL */
104
105#endif /*_NF_CONNTRACK_PROTOCOL_H*/
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
new file mode 100644
index 000000000000..14ce790e5c65
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -0,0 +1,190 @@
1/*
2 * Definitions and Declarations for tuple.
3 *
4 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
5 * - generalize L3 protocol dependent part.
6 *
7 * Derived from include/linux/netfiter_ipv4/ip_conntrack_tuple.h
8 */
9
10#ifndef _NF_CONNTRACK_TUPLE_H
11#define _NF_CONNTRACK_TUPLE_H
12
13#include <linux/netfilter/nf_conntrack_tuple_common.h>
14
15/* A `tuple' is a structure containing the information to uniquely
16 identify a connection. ie. if two packets have the same tuple, they
17 are in the same connection; if not, they are not.
18
19 We divide the structure along "manipulatable" and
20 "non-manipulatable" lines, for the benefit of the NAT code.
21*/
22
23#define NF_CT_TUPLE_L3SIZE 4
24
25/* The l3 protocol-specific manipulable parts of the tuple: always in
26 network order! */
27union nf_conntrack_man_l3proto {
28 u_int32_t all[NF_CT_TUPLE_L3SIZE];
29 u_int32_t ip;
30 u_int32_t ip6[4];
31};
32
33/* The protocol-specific manipulable parts of the tuple: always in
34 network order! */
35union nf_conntrack_man_proto
36{
37 /* Add other protocols here. */
38 u_int16_t all;
39
40 struct {
41 u_int16_t port;
42 } tcp;
43 struct {
44 u_int16_t port;
45 } udp;
46 struct {
47 u_int16_t id;
48 } icmp;
49 struct {
50 u_int16_t port;
51 } sctp;
52};
53
54/* The manipulable part of the tuple. */
55struct nf_conntrack_man
56{
57 union nf_conntrack_man_l3proto u3;
58 union nf_conntrack_man_proto u;
59 /* Layer 3 protocol */
60 u_int16_t l3num;
61};
62
63/* This contains the information to distinguish a connection. */
64struct nf_conntrack_tuple
65{
66 struct nf_conntrack_man src;
67
68 /* These are the parts of the tuple which are fixed. */
69 struct {
70 union {
71 u_int32_t all[NF_CT_TUPLE_L3SIZE];
72 u_int32_t ip;
73 u_int32_t ip6[4];
74 } u3;
75 union {
76 /* Add other protocols here. */
77 u_int16_t all;
78
79 struct {
80 u_int16_t port;
81 } tcp;
82 struct {
83 u_int16_t port;
84 } udp;
85 struct {
86 u_int8_t type, code;
87 } icmp;
88 struct {
89 u_int16_t port;
90 } sctp;
91 } u;
92
93 /* The protocol. */
94 u_int8_t protonum;
95
96 /* The direction (for tuplehash) */
97 u_int8_t dir;
98 } dst;
99};
100
101/* This is optimized opposed to a memset of the whole structure. Everything we
102 * really care about is the source/destination unions */
103#define NF_CT_TUPLE_U_BLANK(tuple) \
104 do { \
105 (tuple)->src.u.all = 0; \
106 (tuple)->dst.u.all = 0; \
107 memset(&(tuple)->src.u3, 0, sizeof((tuple)->src.u3)); \
108 memset(&(tuple)->dst.u3, 0, sizeof((tuple)->dst.u3)); \
109 } while (0)
110
111#ifdef __KERNEL__
112
113#define NF_CT_DUMP_TUPLE(tp) \
114DEBUGP("tuple %p: %u %u %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x %hu -> %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x %hu\n", \
115 (tp), (tp)->src.l3num, (tp)->dst.protonum, \
116 NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \
117 NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all))
118
119/* If we're the first tuple, it's the original dir. */
120#define NF_CT_DIRECTION(h) \
121 ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
122
123/* Connections have two entries in the hash table: one for each way */
124struct nf_conntrack_tuple_hash
125{
126 struct list_head list;
127
128 struct nf_conntrack_tuple tuple;
129};
130
131#endif /* __KERNEL__ */
132
133static inline int nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1,
134 const struct nf_conntrack_tuple *t2)
135{
136 return (t1->src.u3.all[0] == t2->src.u3.all[0] &&
137 t1->src.u3.all[1] == t2->src.u3.all[1] &&
138 t1->src.u3.all[2] == t2->src.u3.all[2] &&
139 t1->src.u3.all[3] == t2->src.u3.all[3] &&
140 t1->src.u.all == t2->src.u.all &&
141 t1->src.l3num == t2->src.l3num &&
142 t1->dst.protonum == t2->dst.protonum);
143}
144
145static inline int nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1,
146 const struct nf_conntrack_tuple *t2)
147{
148 return (t1->dst.u3.all[0] == t2->dst.u3.all[0] &&
149 t1->dst.u3.all[1] == t2->dst.u3.all[1] &&
150 t1->dst.u3.all[2] == t2->dst.u3.all[2] &&
151 t1->dst.u3.all[3] == t2->dst.u3.all[3] &&
152 t1->dst.u.all == t2->dst.u.all &&
153 t1->src.l3num == t2->src.l3num &&
154 t1->dst.protonum == t2->dst.protonum);
155}
156
157static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1,
158 const struct nf_conntrack_tuple *t2)
159{
160 return nf_ct_tuple_src_equal(t1, t2) && nf_ct_tuple_dst_equal(t1, t2);
161}
162
163static inline int nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t,
164 const struct nf_conntrack_tuple *tuple,
165 const struct nf_conntrack_tuple *mask)
166{
167 int count = 0;
168
169 for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++){
170 if ((t->src.u3.all[count] ^ tuple->src.u3.all[count]) &
171 mask->src.u3.all[count])
172 return 0;
173 }
174
175 for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++){
176 if ((t->dst.u3.all[count] ^ tuple->dst.u3.all[count]) &
177 mask->dst.u3.all[count])
178 return 0;
179 }
180
181 if ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all ||
182 (t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all ||
183 (t->src.l3num ^ tuple->src.l3num) & mask->src.l3num ||
184 (t->dst.protonum ^ tuple->dst.protonum) & mask->dst.protonum)
185 return 0;
186
187 return 1;
188}
189
190#endif /* _NF_CONNTRACK_TUPLE_H */
diff --git a/include/net/netlink.h b/include/net/netlink.h
new file mode 100644
index 000000000000..640c26a90cf1
--- /dev/null
+++ b/include/net/netlink.h
@@ -0,0 +1,883 @@
1#ifndef __NET_NETLINK_H
2#define __NET_NETLINK_H
3
4#include <linux/types.h>
5#include <linux/netlink.h>
6
7/* ========================================================================
8 * Netlink Messages and Attributes Interface (As Seen On TV)
9 * ------------------------------------------------------------------------
10 * Messages Interface
11 * ------------------------------------------------------------------------
12 *
13 * Message Format:
14 * <--- nlmsg_total_size(payload) --->
15 * <-- nlmsg_msg_size(payload) ->
16 * +----------+- - -+-------------+- - -+-------- - -
17 * | nlmsghdr | Pad | Payload | Pad | nlmsghdr
18 * +----------+- - -+-------------+- - -+-------- - -
19 * nlmsg_data(nlh)---^ ^
20 * nlmsg_next(nlh)-----------------------+
21 *
22 * Payload Format:
23 * <---------------------- nlmsg_len(nlh) --------------------->
24 * <------ hdrlen ------> <- nlmsg_attrlen(nlh, hdrlen) ->
25 * +----------------------+- - -+--------------------------------+
26 * | Family Header | Pad | Attributes |
27 * +----------------------+- - -+--------------------------------+
28 * nlmsg_attrdata(nlh, hdrlen)---^
29 *
30 * Data Structures:
31 * struct nlmsghdr netlink message header
32 *
33 * Message Construction:
34 * nlmsg_new() create a new netlink message
35 * nlmsg_put() add a netlink message to an skb
36 * nlmsg_put_answer() callback based nlmsg_put()
37 * nlmsg_end() finanlize netlink message
38 * nlmsg_cancel() cancel message construction
39 * nlmsg_free() free a netlink message
40 *
41 * Message Sending:
42 * nlmsg_multicast() multicast message to several groups
43 * nlmsg_unicast() unicast a message to a single socket
44 *
45 * Message Length Calculations:
46 * nlmsg_msg_size(payload) length of message w/o padding
47 * nlmsg_total_size(payload) length of message w/ padding
48 * nlmsg_padlen(payload) length of padding at tail
49 *
50 * Message Payload Access:
51 * nlmsg_data(nlh) head of message payload
52 * nlmsg_len(nlh) length of message payload
53 * nlmsg_attrdata(nlh, hdrlen) head of attributes data
54 * nlmsg_attrlen(nlh, hdrlen) length of attributes data
55 *
56 * Message Parsing:
57 * nlmsg_ok(nlh, remaining) does nlh fit into remaining bytes?
58 * nlmsg_next(nlh, remaining) get next netlink message
59 * nlmsg_parse() parse attributes of a message
60 * nlmsg_find_attr() find an attribute in a message
61 * nlmsg_for_each_msg() loop over all messages
62 * nlmsg_validate() validate netlink message incl. attrs
63 * nlmsg_for_each_attr() loop over all attributes
64 *
65 * ------------------------------------------------------------------------
66 * Attributes Interface
67 * ------------------------------------------------------------------------
68 *
69 * Attribute Format:
70 * <------- nla_total_size(payload) ------->
71 * <---- nla_attr_size(payload) ----->
72 * +----------+- - -+- - - - - - - - - +- - -+-------- - -
73 * | Header | Pad | Payload | Pad | Header
74 * +----------+- - -+- - - - - - - - - +- - -+-------- - -
75 * <- nla_len(nla) -> ^
76 * nla_data(nla)----^ |
77 * nla_next(nla)-----------------------------'
78 *
79 * Data Structures:
80 * struct nlattr netlink attribtue header
81 *
82 * Attribute Construction:
83 * nla_reserve(skb, type, len) reserve skb tailroom for an attribute
84 * nla_put(skb, type, len, data) add attribute to skb
85 *
86 * Attribute Construction for Basic Types:
87 * nla_put_u8(skb, type, value) add u8 attribute to skb
88 * nla_put_u16(skb, type, value) add u16 attribute to skb
89 * nla_put_u32(skb, type, value) add u32 attribute to skb
90 * nla_put_u64(skb, type, value) add u64 attribute to skb
91 * nla_put_string(skb, type, str) add string attribute to skb
92 * nla_put_flag(skb, type) add flag attribute to skb
93 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb
94 *
95 * Exceptions Based Attribute Construction:
96 * NLA_PUT(skb, type, len, data) add attribute to skb
97 * NLA_PUT_U8(skb, type, value) add u8 attribute to skb
98 * NLA_PUT_U16(skb, type, value) add u16 attribute to skb
99 * NLA_PUT_U32(skb, type, value) add u32 attribute to skb
100 * NLA_PUT_U64(skb, type, value) add u64 attribute to skb
101 * NLA_PUT_STRING(skb, type, str) add string attribute to skb
102 * NLA_PUT_FLAG(skb, type) add flag attribute to skb
103 * NLA_PUT_MSECS(skb, type, jiffies) add msecs attribute to skb
104 *
105 * The meaning of these functions is equal to their lower case
106 * variants but they jump to the label nla_put_failure in case
107 * of a failure.
108 *
109 * Nested Attributes Construction:
110 * nla_nest_start(skb, type) start a nested attribute
111 * nla_nest_end(skb, nla) finalize a nested attribute
112 * nla_nest_cancel(skb, nla) cancel nested attribute construction
113 *
114 * Attribute Length Calculations:
115 * nla_attr_size(payload) length of attribute w/o padding
116 * nla_total_size(payload) length of attribute w/ padding
117 * nla_padlen(payload) length of padding
118 *
119 * Attribute Payload Access:
120 * nla_data(nla) head of attribute payload
121 * nla_len(nla) length of attribute payload
122 *
123 * Attribute Payload Access for Basic Types:
124 * nla_get_u8(nla) get payload for a u8 attribute
125 * nla_get_u16(nla) get payload for a u16 attribute
126 * nla_get_u32(nla) get payload for a u32 attribute
127 * nla_get_u64(nla) get payload for a u64 attribute
128 * nla_get_flag(nla) return 1 if flag is true
129 * nla_get_msecs(nla) get payload for a msecs attribute
130 *
131 * Attribute Misc:
132 * nla_memcpy(dest, nla, count) copy attribute into memory
133 * nla_memcmp(nla, data, size) compare attribute with memory area
134 * nla_strlcpy(dst, nla, size) copy attribute to a sized string
135 * nla_strcmp(nla, str) compare attribute with string
136 *
137 * Attribute Parsing:
138 * nla_ok(nla, remaining) does nla fit into remaining bytes?
139 * nla_next(nla, remaining) get next netlink attribute
140 * nla_validate() validate a stream of attributes
141 * nla_find() find attribute in stream of attributes
142 * nla_parse() parse and validate stream of attrs
143 * nla_parse_nested() parse nested attribuets
144 * nla_for_each_attr() loop over all attributes
145 *=========================================================================
146 */
147
148 /**
149 * Standard attribute types to specify validation policy
150 */
151enum {
152 NLA_UNSPEC,
153 NLA_U8,
154 NLA_U16,
155 NLA_U32,
156 NLA_U64,
157 NLA_STRING,
158 NLA_FLAG,
159 NLA_MSECS,
160 NLA_NESTED,
161 __NLA_TYPE_MAX,
162};
163
164#define NLA_TYPE_MAX (__NLA_TYPE_MAX - 1)
165
166/**
167 * struct nla_policy - attribute validation policy
168 * @type: Type of attribute or NLA_UNSPEC
169 * @minlen: Minimal length of payload required to be available
170 *
171 * Policies are defined as arrays of this struct, the array must be
172 * accessible by attribute type up to the highest identifier to be expected.
173 *
174 * Example:
175 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = {
176 * [ATTR_FOO] = { .type = NLA_U16 },
177 * [ATTR_BAR] = { .type = NLA_STRING },
178 * [ATTR_BAZ] = { .minlen = sizeof(struct mystruct) },
179 * };
180 */
181struct nla_policy {
182 u16 type;
183 u16 minlen;
184};
185
186extern void netlink_run_queue(struct sock *sk, unsigned int *qlen,
187 int (*cb)(struct sk_buff *,
188 struct nlmsghdr *, int *));
189extern void netlink_queue_skip(struct nlmsghdr *nlh,
190 struct sk_buff *skb);
191
192extern int nla_validate(struct nlattr *head, int len, int maxtype,
193 struct nla_policy *policy);
194extern int nla_parse(struct nlattr *tb[], int maxtype,
195 struct nlattr *head, int len,
196 struct nla_policy *policy);
197extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
198extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
199 size_t dstsize);
200extern int nla_memcpy(void *dest, struct nlattr *src, int count);
201extern int nla_memcmp(const struct nlattr *nla, const void *data,
202 size_t size);
203extern int nla_strcmp(const struct nlattr *nla, const char *str);
204extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype,
205 int attrlen);
206extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype,
207 int attrlen);
208extern void __nla_put(struct sk_buff *skb, int attrtype,
209 int attrlen, const void *data);
210extern int nla_put(struct sk_buff *skb, int attrtype,
211 int attrlen, const void *data);
212
213/**************************************************************************
214 * Netlink Messages
215 **************************************************************************/
216
217/**
218 * nlmsg_msg_size - length of netlink message not including padding
219 * @payload: length of message payload
220 */
221static inline int nlmsg_msg_size(int payload)
222{
223 return NLMSG_HDRLEN + payload;
224}
225
226/**
227 * nlmsg_total_size - length of netlink message including padding
228 * @payload: length of message payload
229 */
230static inline int nlmsg_total_size(int payload)
231{
232 return NLMSG_ALIGN(nlmsg_msg_size(payload));
233}
234
235/**
236 * nlmsg_padlen - length of padding at the message's tail
237 * @payload: length of message payload
238 */
239static inline int nlmsg_padlen(int payload)
240{
241 return nlmsg_total_size(payload) - nlmsg_msg_size(payload);
242}
243
244/**
245 * nlmsg_data - head of message payload
246 * @nlh: netlink messsage header
247 */
248static inline void *nlmsg_data(const struct nlmsghdr *nlh)
249{
250 return (unsigned char *) nlh + NLMSG_HDRLEN;
251}
252
253/**
254 * nlmsg_len - length of message payload
255 * @nlh: netlink message header
256 */
257static inline int nlmsg_len(const struct nlmsghdr *nlh)
258{
259 return nlh->nlmsg_len - NLMSG_HDRLEN;
260}
261
262/**
263 * nlmsg_attrdata - head of attributes data
264 * @nlh: netlink message header
265 * @hdrlen: length of family specific header
266 */
267static inline struct nlattr *nlmsg_attrdata(const struct nlmsghdr *nlh,
268 int hdrlen)
269{
270 unsigned char *data = nlmsg_data(nlh);
271 return (struct nlattr *) (data + NLMSG_ALIGN(hdrlen));
272}
273
274/**
275 * nlmsg_attrlen - length of attributes data
276 * @nlh: netlink message header
277 * @hdrlen: length of family specific header
278 */
279static inline int nlmsg_attrlen(const struct nlmsghdr *nlh, int hdrlen)
280{
281 return nlmsg_len(nlh) - NLMSG_ALIGN(hdrlen);
282}
283
284/**
285 * nlmsg_ok - check if the netlink message fits into the remaining bytes
286 * @nlh: netlink message header
287 * @remaining: number of bytes remaining in message stream
288 */
289static inline int nlmsg_ok(const struct nlmsghdr *nlh, int remaining)
290{
291 return (remaining >= sizeof(struct nlmsghdr) &&
292 nlh->nlmsg_len >= sizeof(struct nlmsghdr) &&
293 nlh->nlmsg_len <= remaining);
294}
295
296/**
297 * nlmsg_next - next netlink message in message stream
298 * @nlh: netlink message header
299 * @remaining: number of bytes remaining in message stream
300 *
301 * Returns the next netlink message in the message stream and
302 * decrements remaining by the size of the current message.
303 */
304static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining)
305{
306 int totlen = NLMSG_ALIGN(nlh->nlmsg_len);
307
308 *remaining -= totlen;
309
310 return (struct nlmsghdr *) ((unsigned char *) nlh + totlen);
311}
312
313/**
314 * nlmsg_parse - parse attributes of a netlink message
315 * @nlh: netlink message header
316 * @hdrlen: length of family specific header
317 * @tb: destination array with maxtype+1 elements
318 * @maxtype: maximum attribute type to be expected
319 * @policy: validation policy
320 *
321 * See nla_parse()
322 */
323static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen,
324 struct nlattr *tb[], int maxtype,
325 struct nla_policy *policy)
326{
327 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
328 return -EINVAL;
329
330 return nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen),
331 nlmsg_attrlen(nlh, hdrlen), policy);
332}
333
334/**
335 * nlmsg_find_attr - find a specific attribute in a netlink message
336 * @nlh: netlink message header
337 * @hdrlen: length of familiy specific header
338 * @attrtype: type of attribute to look for
339 *
340 * Returns the first attribute which matches the specified type.
341 */
342static inline struct nlattr *nlmsg_find_attr(struct nlmsghdr *nlh,
343 int hdrlen, int attrtype)
344{
345 return nla_find(nlmsg_attrdata(nlh, hdrlen),
346 nlmsg_attrlen(nlh, hdrlen), attrtype);
347}
348
349/**
350 * nlmsg_validate - validate a netlink message including attributes
351 * @nlh: netlinket message header
352 * @hdrlen: length of familiy specific header
353 * @maxtype: maximum attribute type to be expected
354 * @policy: validation policy
355 */
356static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
357 struct nla_policy *policy)
358{
359 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
360 return -EINVAL;
361
362 return nla_validate(nlmsg_attrdata(nlh, hdrlen),
363 nlmsg_attrlen(nlh, hdrlen), maxtype, policy);
364}
365
366/**
367 * nlmsg_for_each_attr - iterate over a stream of attributes
368 * @pos: loop counter, set to current attribute
369 * @nlh: netlink message header
370 * @hdrlen: length of familiy specific header
371 * @rem: initialized to len, holds bytes currently remaining in stream
372 */
373#define nlmsg_for_each_attr(pos, nlh, hdrlen, rem) \
374 nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \
375 nlmsg_attrlen(nlh, hdrlen), rem)
376
377#if 0
378/* FIXME: Enable once all users have been converted */
379
380/**
381 * __nlmsg_put - Add a new netlink message to an skb
382 * @skb: socket buffer to store message in
383 * @pid: netlink process id
384 * @seq: sequence number of message
385 * @type: message type
386 * @payload: length of message payload
387 * @flags: message flags
388 *
389 * The caller is responsible to ensure that the skb provides enough
390 * tailroom for both the netlink header and payload.
391 */
392static inline struct nlmsghdr *__nlmsg_put(struct sk_buff *skb, u32 pid,
393 u32 seq, int type, int payload,
394 int flags)
395{
396 struct nlmsghdr *nlh;
397
398 nlh = (struct nlmsghdr *) skb_put(skb, nlmsg_total_size(payload));
399 nlh->nlmsg_type = type;
400 nlh->nlmsg_len = nlmsg_msg_size(payload);
401 nlh->nlmsg_flags = flags;
402 nlh->nlmsg_pid = pid;
403 nlh->nlmsg_seq = seq;
404
405 memset((unsigned char *) nlmsg_data(nlh) + payload, 0,
406 nlmsg_padlen(payload));
407
408 return nlh;
409}
410#endif
411
412/**
413 * nlmsg_put - Add a new netlink message to an skb
414 * @skb: socket buffer to store message in
415 * @pid: netlink process id
416 * @seq: sequence number of message
417 * @type: message type
418 * @payload: length of message payload
419 * @flags: message flags
420 *
421 * Returns NULL if the tailroom of the skb is insufficient to store
422 * the message header and payload.
423 */
424static inline struct nlmsghdr *nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
425 int type, int payload, int flags)
426{
427 if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload)))
428 return NULL;
429
430 return __nlmsg_put(skb, pid, seq, type, payload, flags);
431}
432
433/**
434 * nlmsg_put_answer - Add a new callback based netlink message to an skb
435 * @skb: socket buffer to store message in
436 * @cb: netlink callback
437 * @type: message type
438 * @payload: length of message payload
439 * @flags: message flags
440 *
441 * Returns NULL if the tailroom of the skb is insufficient to store
442 * the message header and payload.
443 */
444static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb,
445 struct netlink_callback *cb,
446 int type, int payload,
447 int flags)
448{
449 return nlmsg_put(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
450 type, payload, flags);
451}
452
453/**
454 * nlmsg_new - Allocate a new netlink message
455 * @size: maximum size of message
456 *
457 * Use NLMSG_GOODSIZE if size isn't know and you need a good default size.
458 */
459static inline struct sk_buff *nlmsg_new(int size)
460{
461 return alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
462}
463
464/**
465 * nlmsg_end - Finalize a netlink message
466 * @skb: socket buffer the message is stored in
467 * @nlh: netlink message header
468 *
469 * Corrects the netlink message header to include the appeneded
470 * attributes. Only necessary if attributes have been added to
471 * the message.
472 *
473 * Returns the total data length of the skb.
474 */
475static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
476{
477 nlh->nlmsg_len = skb->tail - (unsigned char *) nlh;
478
479 return skb->len;
480}
481
482/**
483 * nlmsg_cancel - Cancel construction of a netlink message
484 * @skb: socket buffer the message is stored in
485 * @nlh: netlink message header
486 *
487 * Removes the complete netlink message including all
488 * attributes from the socket buffer again. Returns -1.
489 */
490static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh)
491{
492 skb_trim(skb, (unsigned char *) nlh - skb->data);
493
494 return -1;
495}
496
497/**
498 * nlmsg_free - free a netlink message
499 * @skb: socket buffer of netlink message
500 */
501static inline void nlmsg_free(struct sk_buff *skb)
502{
503 kfree_skb(skb);
504}
505
506/**
507 * nlmsg_multicast - multicast a netlink message
508 * @sk: netlink socket to spread messages to
509 * @skb: netlink message as socket buffer
510 * @pid: own netlink pid to avoid sending to yourself
511 * @group: multicast group id
512 */
513static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
514 u32 pid, unsigned int group)
515{
516 int err;
517
518 NETLINK_CB(skb).dst_group = group;
519
520 err = netlink_broadcast(sk, skb, pid, group, GFP_KERNEL);
521 if (err > 0)
522 err = 0;
523
524 return err;
525}
526
527/**
528 * nlmsg_unicast - unicast a netlink message
529 * @sk: netlink socket to spread message to
530 * @skb: netlink message as socket buffer
531 * @pid: netlink pid of the destination socket
532 */
533static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 pid)
534{
535 int err;
536
537 err = netlink_unicast(sk, skb, pid, MSG_DONTWAIT);
538 if (err > 0)
539 err = 0;
540
541 return err;
542}
543
544/**
545 * nlmsg_for_each_msg - iterate over a stream of messages
546 * @pos: loop counter, set to current message
547 * @head: head of message stream
548 * @len: length of message stream
549 * @rem: initialized to len, holds bytes currently remaining in stream
550 */
551#define nlmsg_for_each_msg(pos, head, len, rem) \
552 for (pos = head, rem = len; \
553 nlmsg_ok(pos, rem); \
554 pos = nlmsg_next(pos, &(rem)))
555
556/**************************************************************************
557 * Netlink Attributes
558 **************************************************************************/
559
560/**
561 * nla_attr_size - length of attribute not including padding
562 * @payload: length of payload
563 */
564static inline int nla_attr_size(int payload)
565{
566 return NLA_HDRLEN + payload;
567}
568
569/**
570 * nla_total_size - total length of attribute including padding
571 * @payload: length of payload
572 */
573static inline int nla_total_size(int payload)
574{
575 return NLA_ALIGN(nla_attr_size(payload));
576}
577
578/**
579 * nla_padlen - length of padding at the tail of attribute
580 * @payload: length of payload
581 */
582static inline int nla_padlen(int payload)
583{
584 return nla_total_size(payload) - nla_attr_size(payload);
585}
586
587/**
588 * nla_data - head of payload
589 * @nla: netlink attribute
590 */
591static inline void *nla_data(const struct nlattr *nla)
592{
593 return (char *) nla + NLA_HDRLEN;
594}
595
596/**
597 * nla_len - length of payload
598 * @nla: netlink attribute
599 */
600static inline int nla_len(const struct nlattr *nla)
601{
602 return nla->nla_len - NLA_HDRLEN;
603}
604
605/**
606 * nla_ok - check if the netlink attribute fits into the remaining bytes
607 * @nla: netlink attribute
608 * @remaining: number of bytes remaining in attribute stream
609 */
610static inline int nla_ok(const struct nlattr *nla, int remaining)
611{
612 return remaining >= sizeof(*nla) &&
613 nla->nla_len >= sizeof(*nla) &&
614 nla->nla_len <= remaining;
615}
616
617/**
618 * nla_next - next netlink attribte in attribute stream
619 * @nla: netlink attribute
620 * @remaining: number of bytes remaining in attribute stream
621 *
622 * Returns the next netlink attribute in the attribute stream and
623 * decrements remaining by the size of the current attribute.
624 */
625static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining)
626{
627 int totlen = NLA_ALIGN(nla->nla_len);
628
629 *remaining -= totlen;
630 return (struct nlattr *) ((char *) nla + totlen);
631}
632
633/**
634 * nla_parse_nested - parse nested attributes
635 * @tb: destination array with maxtype+1 elements
636 * @maxtype: maximum attribute type to be expected
637 * @nla: attribute containing the nested attributes
638 * @policy: validation policy
639 *
640 * See nla_parse()
641 */
642static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
643 struct nlattr *nla,
644 struct nla_policy *policy)
645{
646 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
647}
648/**
649 * nla_put_u8 - Add a u16 netlink attribute to a socket buffer
650 * @skb: socket buffer to add attribute to
651 * @attrtype: attribute type
652 * @value: numeric value
653 */
654static inline int nla_put_u8(struct sk_buff *skb, int attrtype, u8 value)
655{
656 return nla_put(skb, attrtype, sizeof(u8), &value);
657}
658
659/**
660 * nla_put_u16 - Add a u16 netlink attribute to a socket buffer
661 * @skb: socket buffer to add attribute to
662 * @attrtype: attribute type
663 * @value: numeric value
664 */
665static inline int nla_put_u16(struct sk_buff *skb, int attrtype, u16 value)
666{
667 return nla_put(skb, attrtype, sizeof(u16), &value);
668}
669
670/**
671 * nla_put_u32 - Add a u32 netlink attribute to a socket buffer
672 * @skb: socket buffer to add attribute to
673 * @attrtype: attribute type
674 * @value: numeric value
675 */
676static inline int nla_put_u32(struct sk_buff *skb, int attrtype, u32 value)
677{
678 return nla_put(skb, attrtype, sizeof(u32), &value);
679}
680
681/**
682 * nla_put_64 - Add a u64 netlink attribute to a socket buffer
683 * @skb: socket buffer to add attribute to
684 * @attrtype: attribute type
685 * @value: numeric value
686 */
687static inline int nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
688{
689 return nla_put(skb, attrtype, sizeof(u64), &value);
690}
691
692/**
693 * nla_put_string - Add a string netlink attribute to a socket buffer
694 * @skb: socket buffer to add attribute to
695 * @attrtype: attribute type
696 * @str: NUL terminated string
697 */
698static inline int nla_put_string(struct sk_buff *skb, int attrtype,
699 const char *str)
700{
701 return nla_put(skb, attrtype, strlen(str) + 1, str);
702}
703
704/**
705 * nla_put_flag - Add a flag netlink attribute to a socket buffer
706 * @skb: socket buffer to add attribute to
707 * @attrtype: attribute type
708 */
709static inline int nla_put_flag(struct sk_buff *skb, int attrtype)
710{
711 return nla_put(skb, attrtype, 0, NULL);
712}
713
714/**
715 * nla_put_msecs - Add a msecs netlink attribute to a socket buffer
716 * @skb: socket buffer to add attribute to
717 * @attrtype: attribute type
718 * @jiffies: number of msecs in jiffies
719 */
720static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
721 unsigned long jiffies)
722{
723 u64 tmp = jiffies_to_msecs(jiffies);
724 return nla_put(skb, attrtype, sizeof(u64), &tmp);
725}
726
727#define NLA_PUT(skb, attrtype, attrlen, data) \
728 do { \
729 if (nla_put(skb, attrtype, attrlen, data) < 0) \
730 goto nla_put_failure; \
731 } while(0)
732
733#define NLA_PUT_TYPE(skb, type, attrtype, value) \
734 do { \
735 type __tmp = value; \
736 NLA_PUT(skb, attrtype, sizeof(type), &__tmp); \
737 } while(0)
738
739#define NLA_PUT_U8(skb, attrtype, value) \
740 NLA_PUT_TYPE(skb, u8, attrtype, value)
741
742#define NLA_PUT_U16(skb, attrtype, value) \
743 NLA_PUT_TYPE(skb, u16, attrtype, value)
744
745#define NLA_PUT_U32(skb, attrtype, value) \
746 NLA_PUT_TYPE(skb, u32, attrtype, value)
747
748#define NLA_PUT_U64(skb, attrtype, value) \
749 NLA_PUT_TYPE(skb, u64, attrtype, value)
750
751#define NLA_PUT_STRING(skb, attrtype, value) \
752 NLA_PUT(skb, attrtype, strlen(value) + 1, value)
753
754#define NLA_PUT_FLAG(skb, attrtype, value) \
755 NLA_PUT(skb, attrtype, 0, NULL)
756
757#define NLA_PUT_MSECS(skb, attrtype, jiffies) \
758 NLA_PUT_U64(skb, attrtype, jiffies_to_msecs(jiffies))
759
760/**
761 * nla_get_u32 - return payload of u32 attribute
762 * @nla: u32 netlink attribute
763 */
764static inline u32 nla_get_u32(struct nlattr *nla)
765{
766 return *(u32 *) nla_data(nla);
767}
768
769/**
770 * nla_get_u16 - return payload of u16 attribute
771 * @nla: u16 netlink attribute
772 */
773static inline u16 nla_get_u16(struct nlattr *nla)
774{
775 return *(u16 *) nla_data(nla);
776}
777
778/**
779 * nla_get_u8 - return payload of u8 attribute
780 * @nla: u8 netlink attribute
781 */
782static inline u8 nla_get_u8(struct nlattr *nla)
783{
784 return *(u8 *) nla_data(nla);
785}
786
787/**
788 * nla_get_u64 - return payload of u64 attribute
789 * @nla: u64 netlink attribute
790 */
791static inline u64 nla_get_u64(struct nlattr *nla)
792{
793 u64 tmp;
794
795 nla_memcpy(&tmp, nla, sizeof(tmp));
796
797 return tmp;
798}
799
800/**
801 * nla_get_flag - return payload of flag attribute
802 * @nla: flag netlink attribute
803 */
804static inline int nla_get_flag(struct nlattr *nla)
805{
806 return !!nla;
807}
808
809/**
810 * nla_get_msecs - return payload of msecs attribute
811 * @nla: msecs netlink attribute
812 *
813 * Returns the number of milliseconds in jiffies.
814 */
815static inline unsigned long nla_get_msecs(struct nlattr *nla)
816{
817 u64 msecs = nla_get_u64(nla);
818
819 return msecs_to_jiffies((unsigned long) msecs);
820}
821
822/**
823 * nla_nest_start - Start a new level of nested attributes
824 * @skb: socket buffer to add attributes to
825 * @attrtype: attribute type of container
826 *
827 * Returns the container attribute
828 */
829static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
830{
831 struct nlattr *start = (struct nlattr *) skb->tail;
832
833 if (nla_put(skb, attrtype, 0, NULL) < 0)
834 return NULL;
835
836 return start;
837}
838
839/**
840 * nla_nest_end - Finalize nesting of attributes
841 * @skb: socket buffer the attribtues are stored in
842 * @start: container attribute
843 *
844 * Corrects the container attribute header to include the all
845 * appeneded attributes.
846 *
847 * Returns the total data length of the skb.
848 */
849static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start)
850{
851 start->nla_len = skb->tail - (unsigned char *) start;
852 return skb->len;
853}
854
855/**
856 * nla_nest_cancel - Cancel nesting of attributes
857 * @skb: socket buffer the message is stored in
858 * @start: container attribute
859 *
860 * Removes the container attribute and including all nested
861 * attributes. Returns -1.
862 */
863static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start)
864{
865 if (start)
866 skb_trim(skb, (unsigned char *) start - skb->data);
867
868 return -1;
869}
870
871/**
872 * nla_for_each_attr - iterate over a stream of attributes
873 * @pos: loop counter, set to current attribute
874 * @head: head of attribute stream
875 * @len: length of attribute stream
876 * @rem: initialized to len, holds bytes currently remaining in stream
877 */
878#define nla_for_each_attr(pos, head, len, rem) \
879 for (pos = head, rem = len; \
880 nla_ok(pos, rem); \
881 pos = nla_next(pos, &(rem)))
882
883#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index e0498bd36004..ff13c4cc287a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -461,16 +461,16 @@ static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb)
461} 461}
462 462
463/* The per-socket spinlock must be held here. */ 463/* The per-socket spinlock must be held here. */
464#define sk_add_backlog(__sk, __skb) \ 464static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb)
465do { if (!(__sk)->sk_backlog.tail) { \ 465{
466 (__sk)->sk_backlog.head = \ 466 if (!sk->sk_backlog.tail) {
467 (__sk)->sk_backlog.tail = (__skb); \ 467 sk->sk_backlog.head = sk->sk_backlog.tail = skb;
468 } else { \ 468 } else {
469 ((__sk)->sk_backlog.tail)->next = (__skb); \ 469 sk->sk_backlog.tail->next = skb;
470 (__sk)->sk_backlog.tail = (__skb); \ 470 sk->sk_backlog.tail = skb;
471 } \ 471 }
472 (__skb)->next = NULL; \ 472 skb->next = NULL;
473} while(0) 473}
474 474
475#define sk_wait_event(__sk, __timeo, __condition) \ 475#define sk_wait_event(__sk, __timeo, __condition) \
476({ int rc; \ 476({ int rc; \