9018c808c446b3d3c707c9f6ef13444c23d147f0
[linux-2.6.git] / linux-2.6-720-click.patch
1 diff -Nurb linux-2.6.27-720/drivers/input/serio/i8042-ppcio.h linux-2.6.27-710/drivers/input/serio/i8042-ppcio.h
2 --- linux-2.6.27-720/drivers/input/serio/i8042-ppcio.h  2009-05-04 12:18:33.000000000 -0400
3 +++ linux-2.6.27-710/drivers/input/serio/i8042-ppcio.h  2008-10-09 18:13:53.000000000 -0400
4 @@ -77,7 +77,7 @@
5         asm volatile("lis     7,0xff88        \n\
6                       lswi    6,7,0x8         \n\
7                       mr      %0,6"
8 -                     : "=r" (kbd_data) : : "6", "7");
9 +                     : "=r" (kbd_data) :: "6", "7");
10  
11         __raw_writel(0x00000000, 0xff50000c);
12         eieio();
13 @@ -99,7 +99,7 @@
14                       ori     7,7,0x8         \n\
15                       lswi    6,7,0x8         \n\
16                       mr      %0,6"
17 -                     : "=r" (kbd_status) : : "6", "7");
18 +                     : "=r" (kbd_status) :: "6", "7");
19  
20         __raw_writel(0x00000000, 0xff50000c);
21         eieio();
22 diff -Nurb linux-2.6.27-720/drivers/net/wireless/rayctl.h linux-2.6.27-710/drivers/net/wireless/rayctl.h
23 --- linux-2.6.27-720/drivers/net/wireless/rayctl.h      2009-05-04 12:18:33.000000000 -0400
24 +++ linux-2.6.27-710/drivers/net/wireless/rayctl.h      2008-10-09 18:13:53.000000000 -0400
25 @@ -418,7 +418,9 @@
26  };
27  
28  /****** Host-to-ECF Data Area at Shared RAM offset 0x200 *********************/
29 -EMPTY_STRUCT_DECL(host_to_ecf_area);
30 +struct host_to_ecf_area {
31 +    
32 +};
33  
34  /****** ECF-to-Host Data Area at Shared RAM offset 0x0300 ********************/
35  struct startup_res_518 {
36 diff -Nurb linux-2.6.27-720/drivers/video/i810/i810_main.h linux-2.6.27-710/drivers/video/i810/i810_main.h
37 --- linux-2.6.27-720/drivers/video/i810/i810_main.h     2009-05-04 12:18:33.000000000 -0400
38 +++ linux-2.6.27-710/drivers/video/i810/i810_main.h     2008-10-09 18:13:53.000000000 -0400
39 @@ -54,7 +54,7 @@
40  #ifdef CONFIG_X86
41  static inline void flush_cache(void)
42  {
43 -       asm volatile ("wbinvd": : :"memory");
44 +       asm volatile ("wbinvd":::"memory");
45  }
46  #else
47  #define flush_cache() do { } while(0)
48 diff -Nurb linux-2.6.27-720/fs/file_table.c linux-2.6.27-710/fs/file_table.c
49 --- linux-2.6.27-720/fs/file_table.c    2009-05-04 12:18:33.000000000 -0400
50 +++ linux-2.6.27-710/fs/file_table.c    2009-05-04 12:15:11.000000000 -0400
51 @@ -34,8 +34,6 @@
52  /* public. Not pretty! */
53  __cacheline_aligned_in_smp DEFINE_SPINLOCK(files_lock);
54  
55 -EXPORT_SYMBOL(files_lock);
56 -
57  static struct percpu_counter nr_files __cacheline_aligned_in_smp;
58  
59  static inline void file_free_rcu(struct rcu_head *head)
60 diff -Nurb linux-2.6.27-720/fs/super.c linux-2.6.27-710/fs/super.c
61 --- linux-2.6.27-720/fs/super.c 2009-05-04 12:18:33.000000000 -0400
62 +++ linux-2.6.27-710/fs/super.c 2009-05-04 12:15:12.000000000 -0400
63 @@ -48,8 +48,6 @@
64  LIST_HEAD(super_blocks);
65  DEFINE_SPINLOCK(sb_lock);
66  
67 -EXPORT_SYMBOL(sb_lock);
68 -
69  /**
70   *     alloc_super     -       create new superblock
71   *     @type:  filesystem type superblock should belong to
72 diff -Nurb linux-2.6.27-720/include/asm-cris/arch-v10/io.h linux-2.6.27-710/include/asm-cris/arch-v10/io.h
73 --- linux-2.6.27-720/include/asm-cris/arch-v10/io.h     2009-05-04 12:18:33.000000000 -0400
74 +++ linux-2.6.27-710/include/asm-cris/arch-v10/io.h     2008-10-09 18:13:53.000000000 -0400
75 @@ -190,8 +190,8 @@
76   ({ int _Foofoo; __asm__ volatile ("bmod [%0],%0" : "=r" (_Foofoo) : "0" \
77                                (255)); _Foofoo; })
78  
79 -#define TRACE_OFF() do { __asm__ volatile ("bmod [%0],%0" : : "r" (254)); } while (0)
80 -#define SIM_END() do { __asm__ volatile ("bmod [%0],%0" : : "r" (28)); } while (0)
81 +#define TRACE_OFF() do { __asm__ volatile ("bmod [%0],%0" :: "r" (254)); } while (0)
82 +#define SIM_END() do { __asm__ volatile ("bmod [%0],%0" :: "r" (28)); } while (0)
83  #define CRIS_CYCLES() __extension__ \
84   ({ unsigned long c; asm ("bmod [%1],%0" : "=r" (c) : "r" (27)); c;})
85  #endif /* ! defined CONFIG_SVINTO_SIM */
86 diff -Nurb linux-2.6.27-720/include/asm-cris/module.h linux-2.6.27-710/include/asm-cris/module.h
87 --- linux-2.6.27-720/include/asm-cris/module.h  2009-05-04 12:18:33.000000000 -0400
88 +++ linux-2.6.27-710/include/asm-cris/module.h  2008-10-09 18:13:53.000000000 -0400
89 @@ -1,7 +1,7 @@
90  #ifndef _ASM_CRIS_MODULE_H
91  #define _ASM_CRIS_MODULE_H
92  /* cris is simple */
93 -EMPTY_STRUCT_DECL(mod_arch_specific);
94 +struct mod_arch_specific { };
95  
96  #define Elf_Shdr Elf32_Shdr
97  #define Elf_Sym Elf32_Sym
98 diff -Nurb linux-2.6.27-720/include/asm-frv/bug.h linux-2.6.27-710/include/asm-frv/bug.h
99 --- linux-2.6.27-720/include/asm-frv/bug.h      2009-05-04 12:18:33.000000000 -0400
100 +++ linux-2.6.27-710/include/asm-frv/bug.h      2008-10-09 18:13:53.000000000 -0400
101 @@ -17,7 +17,7 @@
102  /*
103   * Tell the user there is some problem.
104   */
105 -asmlinkage void __debug_bug_trap(int signr);
106 +extern asmlinkage void __debug_bug_trap(int signr);
107  
108  #ifdef CONFIG_NO_KERNEL_MSG
109  #define        _debug_bug_printk()
110 diff -Nurb linux-2.6.27-720/include/asm-frv/fpu.h linux-2.6.27-710/include/asm-frv/fpu.h
111 --- linux-2.6.27-720/include/asm-frv/fpu.h      2009-05-04 12:18:33.000000000 -0400
112 +++ linux-2.6.27-710/include/asm-frv/fpu.h      2008-10-09 18:13:53.000000000 -0400
113 @@ -6,6 +6,6 @@
114   * MAX floating point unit state size (FSAVE/FRESTORE)
115   */
116  
117 -#define kernel_fpu_end() do { asm volatile("bar": : :"memory"); preempt_enable(); } while(0)
118 +#define kernel_fpu_end() do { asm volatile("bar":::"memory"); preempt_enable(); } while(0)
119  
120  #endif /* __ASM_FPU_H */
121 diff -Nurb linux-2.6.27-720/include/asm-frv/gdb-stub.h linux-2.6.27-710/include/asm-frv/gdb-stub.h
122 --- linux-2.6.27-720/include/asm-frv/gdb-stub.h 2009-05-04 12:18:33.000000000 -0400
123 +++ linux-2.6.27-710/include/asm-frv/gdb-stub.h 2008-10-09 18:13:53.000000000 -0400
124 @@ -87,14 +87,14 @@
125  extern void gdbstub_tx_flush(void);
126  extern void gdbstub_do_rx(void);
127  
128 -asmlinkage void __debug_stub_init_break(void);
129 -asmlinkage void __break_hijack_kernel_event(void);
130 -asmlinkage void __break_hijack_kernel_event_breaks_here(void);
131 -asmlinkage void start_kernel(void);
132 -
133 -asmlinkage void gdbstub_rx_handler(void);
134 -asmlinkage void gdbstub_rx_irq(void);
135 -asmlinkage void gdbstub_intercept(void);
136 +extern asmlinkage void __debug_stub_init_break(void);
137 +extern asmlinkage void __break_hijack_kernel_event(void);
138 +extern asmlinkage void __break_hijack_kernel_event_breaks_here(void);
139 +extern asmlinkage void start_kernel(void);
140 +
141 +extern asmlinkage void gdbstub_rx_handler(void);
142 +extern asmlinkage void gdbstub_rx_irq(void);
143 +extern asmlinkage void gdbstub_intercept(void);
144  
145  extern uint32_t __entry_usertrap_table[];
146  extern uint32_t __entry_kerneltrap_table[];
147 diff -Nurb linux-2.6.27-720/include/asm-frv/highmem.h linux-2.6.27-710/include/asm-frv/highmem.h
148 --- linux-2.6.27-720/include/asm-frv/highmem.h  2009-05-04 12:18:33.000000000 -0400
149 +++ linux-2.6.27-710/include/asm-frv/highmem.h  2008-10-09 18:13:53.000000000 -0400
150 @@ -82,11 +82,11 @@
151         dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V;             \
152                                                                                                 \
153         if (type != __KM_CACHE)                                                                 \
154 -               asm volatile("movgs %0,dampr"#ampr : : "r"(dampr) : "memory");                  \
155 +               asm volatile("movgs %0,dampr"#ampr :: "r"(dampr) : "memory");                   \
156         else                                                                                    \
157                 asm volatile("movgs %0,iampr"#ampr"\n"                                          \
158                              "movgs %0,dampr"#ampr"\n"                                          \
159 -                            : : "r"(dampr) : "memory"                                          \
160 +                            :: "r"(dampr) : "memory"                                           \
161                              );                                                                 \
162                                                                                                 \
163         asm("movsg damlr"#ampr",%0" : "=r"(damlr));                                             \
164 @@ -140,9 +140,9 @@
165  
166  #define __kunmap_atomic_primary(type, ampr)                            \
167  do {                                                                   \
168 -       asm volatile("movgs gr0,dampr"#ampr"\n" : : : "memory");        \
169 +       asm volatile("movgs gr0,dampr"#ampr"\n" ::: "memory");          \
170         if (type == __KM_CACHE)                                         \
171 -               asm volatile("movgs gr0,iampr"#ampr"\n" : : : "memory");\
172 +               asm volatile("movgs gr0,iampr"#ampr"\n" ::: "memory");  \
173  } while(0)
174  
175  #define __kunmap_atomic_secondary(slot, vaddr)                         \
176 diff -Nurb linux-2.6.27-720/include/asm-frv/module.h linux-2.6.27-710/include/asm-frv/module.h
177 --- linux-2.6.27-720/include/asm-frv/module.h   2009-05-04 12:18:33.000000000 -0400
178 +++ linux-2.6.27-710/include/asm-frv/module.h   2008-10-09 18:13:53.000000000 -0400
179 @@ -11,7 +11,9 @@
180  #ifndef _ASM_MODULE_H
181  #define _ASM_MODULE_H
182  
183 -EMPTY_STRUCT_DECL(mod_arch_specific);
184 +struct mod_arch_specific
185 +{
186 +};
187  
188  #define Elf_Shdr       Elf32_Shdr
189  #define Elf_Sym                Elf32_Sym
190 diff -Nurb linux-2.6.27-720/include/asm-frv/pgtable.h linux-2.6.27-710/include/asm-frv/pgtable.h
191 --- linux-2.6.27-720/include/asm-frv/pgtable.h  2009-05-04 12:18:33.000000000 -0400
192 +++ linux-2.6.27-710/include/asm-frv/pgtable.h  2008-10-09 18:13:53.000000000 -0400
193 @@ -176,7 +176,7 @@
194  #define set_pte(pteptr, pteval)                                \
195  do {                                                   \
196         *(pteptr) = (pteval);                           \
197 -       asm volatile("dcf %M0" : : "U"(*pteptr));       \
198 +       asm volatile("dcf %M0" :: "U"(*pteptr));        \
199  } while(0)
200  #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
201  
202 @@ -210,7 +210,7 @@
203  #define set_pgd(pgdptr, pgdval)                                \
204  do {                                                   \
205         memcpy((pgdptr), &(pgdval), sizeof(pgd_t));     \
206 -       asm volatile("dcf %M0" : : "U"(*(pgdptr)));     \
207 +       asm volatile("dcf %M0" :: "U"(*(pgdptr)));      \
208  } while(0)
209  
210  static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
211 diff -Nurb linux-2.6.27-720/include/asm-frv/processor.h linux-2.6.27-710/include/asm-frv/processor.h
212 --- linux-2.6.27-720/include/asm-frv/processor.h        2009-05-04 12:18:33.000000000 -0400
213 +++ linux-2.6.27-710/include/asm-frv/processor.h        2008-10-09 18:13:53.000000000 -0400
214 @@ -111,9 +111,9 @@
215  {
216  }
217  
218 -asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
219 -asmlinkage void save_user_regs(struct user_context *target);
220 -asmlinkage void *restore_user_regs(const struct user_context *target, ...);
221 +extern asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
222 +extern asmlinkage void save_user_regs(struct user_context *target);
223 +extern asmlinkage void *restore_user_regs(const struct user_context *target, ...);
224  
225  #define copy_segments(tsk, mm)         do { } while (0)
226  #define release_segments(mm)           do { } while (0)
227 diff -Nurb linux-2.6.27-720/include/asm-frv/spr-regs.h linux-2.6.27-710/include/asm-frv/spr-regs.h
228 --- linux-2.6.27-720/include/asm-frv/spr-regs.h 2009-05-04 12:18:33.000000000 -0400
229 +++ linux-2.6.27-710/include/asm-frv/spr-regs.h 2008-10-09 18:13:53.000000000 -0400
230 @@ -343,7 +343,7 @@
231  
232  #define restore_dampr(R, _dampr)                       \
233  do {                                                   \
234 -       asm volatile("movgs %0,dampr"R : : "r"(_dampr));        \
235 +       asm volatile("movgs %0,dampr"R :: "r"(_dampr)); \
236  } while(0)
237  
238  /*
239 diff -Nurb linux-2.6.27-720/include/asm-frv/system.h linux-2.6.27-710/include/asm-frv/system.h
240 --- linux-2.6.27-720/include/asm-frv/system.h   2009-05-04 12:18:33.000000000 -0400
241 +++ linux-2.6.27-710/include/asm-frv/system.h   2008-10-09 18:13:53.000000000 -0400
242 @@ -23,7 +23,7 @@
243   * `prev' will never be the same as `next'.
244   * The `mb' is to tell GCC not to cache `current' across this call.
245   */
246 -asmlinkage
247 +extern asmlinkage
248  struct task_struct *__switch_to(struct thread_struct *prev_thread,
249                                 struct thread_struct *next_thread,
250                                 struct task_struct *prev);
251 @@ -175,7 +175,7 @@
252  /*
253   * Force strict CPU ordering.
254   */
255 -#define nop()                  asm volatile ("nop": :)
256 +#define nop()                  asm volatile ("nop"::)
257  #define mb()                   asm volatile ("membar" : : :"memory")
258  #define rmb()                  asm volatile ("membar" : : :"memory")
259  #define wmb()                  asm volatile ("membar" : : :"memory")
260 diff -Nurb linux-2.6.27-720/include/asm-m32r/module.h linux-2.6.27-710/include/asm-m32r/module.h
261 --- linux-2.6.27-720/include/asm-m32r/module.h  2009-05-04 12:18:33.000000000 -0400
262 +++ linux-2.6.27-710/include/asm-m32r/module.h  2008-10-09 18:13:53.000000000 -0400
263 @@ -1,7 +1,7 @@
264  #ifndef _ASM_M32R_MODULE_H
265  #define _ASM_M32R_MODULE_H
266  
267 -EMPTY_STRUCT_DECL(mod_arch_specific);
268 +struct mod_arch_specific { };
269  
270  #define Elf_Shdr       Elf32_Shdr
271  #define Elf_Sym                Elf32_Sym
272 diff -Nurb linux-2.6.27-720/include/asm-m68k/system.h linux-2.6.27-710/include/asm-m68k/system.h
273 --- linux-2.6.27-720/include/asm-m68k/system.h  2009-05-04 12:18:33.000000000 -0400
274 +++ linux-2.6.27-710/include/asm-m68k/system.h  2008-10-09 18:13:53.000000000 -0400
275 @@ -167,23 +167,23 @@
276  #define __HAVE_ARCH_CMPXCHG    1
277  
278  static inline unsigned long __cmpxchg(volatile void *p, unsigned long old,
279 -                                     unsigned long n, int size)
280 +                                     unsigned long new, int size)
281  {
282         switch (size) {
283         case 1:
284                 __asm__ __volatile__ ("casb %0,%2,%1"
285                                       : "=d" (old), "=m" (*(char *)p)
286 -                                     : "d" (n), "0" (old), "m" (*(char *)p));
287 +                                     : "d" (new), "0" (old), "m" (*(char *)p));
288                 break;
289         case 2:
290                 __asm__ __volatile__ ("casw %0,%2,%1"
291                                       : "=d" (old), "=m" (*(short *)p)
292 -                                     : "d" (n), "0" (old), "m" (*(short *)p));
293 +                                     : "d" (new), "0" (old), "m" (*(short *)p));
294                 break;
295         case 4:
296                 __asm__ __volatile__ ("casl %0,%2,%1"
297                                       : "=d" (old), "=m" (*(int *)p)
298 -                                     : "d" (n), "0" (old), "m" (*(int *)p));
299 +                                     : "d" (new), "0" (old), "m" (*(int *)p));
300                 break;
301         }
302         return old;
303 diff -Nurb linux-2.6.27-720/include/asm-mips/fpu.h linux-2.6.27-710/include/asm-mips/fpu.h
304 --- linux-2.6.27-720/include/asm-mips/fpu.h     2009-05-04 12:18:33.000000000 -0400
305 +++ linux-2.6.27-710/include/asm-mips/fpu.h     2008-10-09 18:13:53.000000000 -0400
306 @@ -28,11 +28,11 @@
307  struct sigcontext;
308  struct sigcontext32;
309  
310 -asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
311 -asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
312 +extern asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
313 +extern asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
314  
315 -asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
316 -asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
317 +extern asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
318 +extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
319  
320  extern void fpu_emulator_init_fpu(void);
321  extern int fpu_emulator_save_context(struct sigcontext __user *sc);
322 diff -Nurb linux-2.6.27-720/include/asm-mips/io.h linux-2.6.27-710/include/asm-mips/io.h
323 --- linux-2.6.27-720/include/asm-mips/io.h      2009-05-04 12:18:33.000000000 -0400
324 +++ linux-2.6.27-710/include/asm-mips/io.h      2008-10-09 18:13:53.000000000 -0400
325 @@ -303,7 +303,7 @@
326         volatile type *__mem;                                           \
327         type __val;                                                     \
328                                                                         \
329 -       __mem = (type *)__swizzle_addr_##bwlq((unsigned long)(mem));    \
330 +       __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem));    \
331                                                                         \
332         __val = pfx##ioswab##bwlq(__mem, val);                          \
333                                                                         \
334 @@ -336,7 +336,7 @@
335         volatile type *__mem;                                           \
336         type __val;                                                     \
337                                                                         \
338 -       __mem = (type *)__swizzle_addr_##bwlq((unsigned long)(mem));    \
339 +       __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem));    \
340                                                                         \
341         if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
342                 __val = *__mem;                                         \
343 @@ -370,7 +370,7 @@
344         volatile type *__addr;                                          \
345         type __val;                                                     \
346                                                                         \
347 -       __addr = (type *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
348 +       __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
349                                                                         \
350         __val = pfx##ioswab##bwlq(__addr, val);                         \
351                                                                         \
352 @@ -386,7 +386,7 @@
353         volatile type *__addr;                                          \
354         type __val;                                                     \
355                                                                         \
356 -       __addr = (type *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
357 +       __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
358                                                                         \
359         BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long));             \
360                                                                         \
361 @@ -448,7 +448,7 @@
362  static inline void writes##bwlq(volatile void __iomem *mem,            \
363                                 const void *addr, unsigned int count)   \
364  {                                                                      \
365 -       const volatile type *__addr = (const type *) addr;              \
366 +       const volatile type *__addr = addr;                             \
367                                                                         \
368         while (count--) {                                               \
369                 __mem_write##bwlq(*__addr, mem);                        \
370 @@ -459,7 +459,7 @@
371  static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
372                                unsigned int count)                      \
373  {                                                                      \
374 -       volatile type *__addr = (type *) addr;                          \
375 +       volatile type *__addr = addr;                                   \
376                                                                         \
377         while (count--) {                                               \
378                 *__addr = __mem_read##bwlq(mem);                        \
379 @@ -472,7 +472,7 @@
380  static inline void outs##bwlq(unsigned long port, const void *addr,    \
381                               unsigned int count)                       \
382  {                                                                      \
383 -       const volatile type *__addr = (const type *) addr;              \
384 +       const volatile type *__addr = addr;                             \
385                                                                         \
386         while (count--) {                                               \
387                 __mem_out##bwlq(*__addr, port);                         \
388 @@ -483,7 +483,7 @@
389  static inline void ins##bwlq(unsigned long port, void *addr,           \
390                              unsigned int count)                        \
391  {                                                                      \
392 -       volatile type *__addr = (type *) addr;                          \
393 +       volatile type *__addr = addr;                                   \
394                                                                         \
395         while (count--) {                                               \
396                 *__addr = __mem_in##bwlq(port);                         \
397 @@ -505,7 +505,7 @@
398  
399  
400  /* Depends on MIPS II instruction set */
401 -#define mmiowb() asm volatile ("sync" : : : "memory")
402 +#define mmiowb() asm volatile ("sync" ::: "memory")
403  
404  static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
405  {
406 diff -Nurb linux-2.6.27-720/include/asm-mips/ip32/mace.h linux-2.6.27-710/include/asm-mips/ip32/mace.h
407 --- linux-2.6.27-720/include/asm-mips/ip32/mace.h       2009-05-04 12:18:33.000000000 -0400
408 +++ linux-2.6.27-710/include/asm-mips/ip32/mace.h       2008-10-09 18:13:53.000000000 -0400
409 @@ -308,9 +308,11 @@
410   */
411  
412  /* Parallel port */
413 -EMPTY_STRUCT_DECL(mace_parallel);
414 +struct mace_parallel {
415 +};
416  
417 -EMPTY_STRUCT_DECL(mace_ecp1284);       /* later... */
418 +struct mace_ecp1284 {  /* later... */
419 +};
420  
421  /* Serial port */
422  struct mace_serial {
423 diff -Nurb linux-2.6.27-720/include/asm-mips/mips-boards/sim.h linux-2.6.27-710/include/asm-mips/mips-boards/sim.h
424 --- linux-2.6.27-720/include/asm-mips/mips-boards/sim.h 2009-05-04 12:18:33.000000000 -0400
425 +++ linux-2.6.27-710/include/asm-mips/mips-boards/sim.h 2008-10-09 18:13:53.000000000 -0400
426 @@ -31,7 +31,7 @@
427  ({                                        \
428         __asm__  __volatile__( \
429          "sltiu $0,$0, %0" \
430 -               : :"i"(code)                                    \
431 +               ::"i"(code)                                     \
432                 ); \
433  })
434  
435 diff -Nurb linux-2.6.27-720/include/asm-mips/mipsregs.h linux-2.6.27-710/include/asm-mips/mipsregs.h
436 --- linux-2.6.27-720/include/asm-mips/mipsregs.h        2009-05-04 12:18:33.000000000 -0400
437 +++ linux-2.6.27-710/include/asm-mips/mipsregs.h        2008-10-09 18:13:53.000000000 -0400
438 @@ -1052,15 +1052,15 @@
439  #define mfhi2() ({ long mfhi2; __asm__("mfhi %0, $ac2" : "=r" (mfhi2)); mfhi2;})
440  #define mfhi3() ({ long mfhi3; __asm__("mfhi %0, $ac3" : "=r" (mfhi3)); mfhi3;})
441  
442 -#define mtlo0(x) __asm__("mtlo %0, $ac0" : :"r" (x))
443 -#define mtlo1(x) __asm__("mtlo %0, $ac1" : :"r" (x))
444 -#define mtlo2(x) __asm__("mtlo %0, $ac2" : :"r" (x))
445 -#define mtlo3(x) __asm__("mtlo %0, $ac3" : :"r" (x))
446 -
447 -#define mthi0(x) __asm__("mthi %0, $ac0" : :"r" (x))
448 -#define mthi1(x) __asm__("mthi %0, $ac1" : :"r" (x))
449 -#define mthi2(x) __asm__("mthi %0, $ac2" : :"r" (x))
450 -#define mthi3(x) __asm__("mthi %0, $ac3" : :"r" (x))
451 +#define mtlo0(x) __asm__("mtlo %0, $ac0" ::"r" (x))
452 +#define mtlo1(x) __asm__("mtlo %0, $ac1" ::"r" (x))
453 +#define mtlo2(x) __asm__("mtlo %0, $ac2" ::"r" (x))
454 +#define mtlo3(x) __asm__("mtlo %0, $ac3" ::"r" (x))
455 +
456 +#define mthi0(x) __asm__("mthi %0, $ac0" ::"r" (x))
457 +#define mthi1(x) __asm__("mthi %0, $ac1" ::"r" (x))
458 +#define mthi2(x) __asm__("mthi %0, $ac2" ::"r" (x))
459 +#define mthi3(x) __asm__("mthi %0, $ac3" ::"r" (x))
460  
461  #else
462  
463 @@ -1390,13 +1390,13 @@
464  }                                                              \
465                                                                 \
466  static inline unsigned int                                     \
467 -change_c0_##name(unsigned int change, unsigned int newval)     \
468 +change_c0_##name(unsigned int change, unsigned int new)                \
469  {                                                              \
470         unsigned int res;                                       \
471                                                                 \
472         res = read_c0_##name();                                 \
473         res &= ~change;                                         \
474 -       res |= (newval & change);                               \
475 +       res |= (new & change);                                  \
476         write_c0_##name(res);                                   \
477                                                                 \
478         return res;                                             \
479 diff -Nurb linux-2.6.27-720/include/asm-mips/paccess.h linux-2.6.27-710/include/asm-mips/paccess.h
480 --- linux-2.6.27-720/include/asm-mips/paccess.h 2009-05-04 12:18:33.000000000 -0400
481 +++ linux-2.6.27-710/include/asm-mips/paccess.h 2008-10-09 18:13:53.000000000 -0400
482 @@ -22,8 +22,8 @@
483  #define __PA_ADDR      ".dword"
484  #endif
485  
486 -asmlinkage void handle_ibe(void);
487 -asmlinkage void handle_dbe(void);
488 +extern asmlinkage void handle_ibe(void);
489 +extern asmlinkage void handle_dbe(void);
490  
491  #define put_dbe(x, ptr) __put_dbe((x), (ptr), sizeof(*(ptr)))
492  #define get_dbe(x, ptr) __get_dbe((x), (ptr), sizeof(*(ptr)))
493 diff -Nurb linux-2.6.27-720/include/asm-mips/processor.h linux-2.6.27-710/include/asm-mips/processor.h
494 --- linux-2.6.27-720/include/asm-mips/processor.h       2009-05-04 12:18:33.000000000 -0400
495 +++ linux-2.6.27-710/include/asm-mips/processor.h       2008-10-09 18:13:53.000000000 -0400
496 @@ -242,7 +242,7 @@
497   * overhead of a function call by forcing the compiler to save the return
498   * address register on the stack.
499   */
500 -#define return_address() ({__asm__ __volatile__("": : :"$31");__builtin_return_address(0);})
501 +#define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
502  
503  #ifdef CONFIG_CPU_HAS_PREFETCH
504  
505 diff -Nurb linux-2.6.27-720/include/asm-mips/ptrace.h linux-2.6.27-710/include/asm-mips/ptrace.h
506 --- linux-2.6.27-720/include/asm-mips/ptrace.h  2009-05-04 12:18:33.000000000 -0400
507 +++ linux-2.6.27-710/include/asm-mips/ptrace.h  2008-10-09 18:13:53.000000000 -0400
508 @@ -84,7 +84,7 @@
509  #define instruction_pointer(regs) ((regs)->cp0_epc)
510  #define profile_pc(regs) instruction_pointer(regs)
511  
512 -asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
513 +extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
514  
515  extern NORET_TYPE void die(const char *, const struct pt_regs *) ATTRIB_NORET;
516  
517 diff -Nurb linux-2.6.27-720/include/asm-mips/smp.h linux-2.6.27-710/include/asm-mips/smp.h
518 --- linux-2.6.27-720/include/asm-mips/smp.h     2009-05-04 12:18:33.000000000 -0400
519 +++ linux-2.6.27-710/include/asm-mips/smp.h     2008-10-09 18:13:53.000000000 -0400
520 @@ -55,7 +55,7 @@
521         mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
522  }
523  
524 -asmlinkage void smp_call_function_interrupt(void);
525 +extern asmlinkage void smp_call_function_interrupt(void);
526  
527  extern void arch_send_call_function_single_ipi(int cpu);
528  extern void arch_send_call_function_ipi(cpumask_t mask);
529 diff -Nurb linux-2.6.27-720/include/asm-mips/system.h linux-2.6.27-710/include/asm-mips/system.h
530 --- linux-2.6.27-720/include/asm-mips/system.h  2009-05-04 12:18:33.000000000 -0400
531 +++ linux-2.6.27-710/include/asm-mips/system.h  2008-10-09 18:13:53.000000000 -0400
532 @@ -27,7 +27,7 @@
533   * switch_to(n) should switch tasks to task nr n, first
534   * checking that n isn't the current task, in which case it does nothing.
535   */
536 -asmlinkage void *resume(void *last, void *next, void *next_ti);
537 +extern asmlinkage void *resume(void *last, void *next, void *next_ti);
538  
539  struct task_struct;
540  
541 @@ -189,9 +189,9 @@
542  {
543         switch (size) {
544         case 4:
545 -               return __xchg_u32((volatile int *) ptr, x);
546 +               return __xchg_u32(ptr, x);
547         case 8:
548 -               return __xchg_u64((volatile __u64 *) ptr, x);
549 +               return __xchg_u64(ptr, x);
550         }
551         __xchg_called_with_bad_pointer();
552         return x;
553 diff -Nurb linux-2.6.27-720/include/asm-parisc/system.h linux-2.6.27-710/include/asm-parisc/system.h
554 --- linux-2.6.27-720/include/asm-parisc/system.h        2009-05-04 12:18:33.000000000 -0400
555 +++ linux-2.6.27-710/include/asm-parisc/system.h        2008-10-09 18:13:53.000000000 -0400
556 @@ -122,7 +122,7 @@
557  ** The __asm__ op below simple prevents gcc/ld from reordering
558  ** instructions across the mb() "call".
559  */
560 -#define mb()           __asm__ __volatile__("": : :"memory")   /* barrier() */
561 +#define mb()           __asm__ __volatile__("":::"memory")     /* barrier() */
562  #define rmb()          mb()
563  #define wmb()          mb()
564  #define smp_mb()       mb()
565 diff -Nurb linux-2.6.27-720/include/asm-um/module-i386.h linux-2.6.27-710/include/asm-um/module-i386.h
566 --- linux-2.6.27-720/include/asm-um/module-i386.h       2009-05-04 12:18:33.000000000 -0400
567 +++ linux-2.6.27-710/include/asm-um/module-i386.h       2008-10-09 18:13:53.000000000 -0400
568 @@ -2,7 +2,9 @@
569  #define __UM_MODULE_I386_H
570  
571  /* UML is simple */
572 -EMPTY_STRUCT_DECL(mod_arch_specific);
573 +struct mod_arch_specific
574 +{
575 +};
576  
577  #define Elf_Shdr Elf32_Shdr
578  #define Elf_Sym Elf32_Sym
579 diff -Nurb linux-2.6.27-720/include/asm-um/module-x86_64.h linux-2.6.27-710/include/asm-um/module-x86_64.h
580 --- linux-2.6.27-720/include/asm-um/module-x86_64.h     2009-05-04 12:18:33.000000000 -0400
581 +++ linux-2.6.27-710/include/asm-um/module-x86_64.h     2008-10-09 18:13:53.000000000 -0400
582 @@ -8,7 +8,9 @@
583  #define __UM_MODULE_X86_64_H
584  
585  /* UML is simple */
586 -EMPTY_STRUCT_DECL(mod_arch_specific);
587 +struct mod_arch_specific
588 +{
589 +};
590  
591  #define Elf_Shdr Elf64_Shdr
592  #define Elf_Sym Elf64_Sym
593 diff -Nurb linux-2.6.27-720/include/asm-x86/bitops.h linux-2.6.27-710/include/asm-x86/bitops.h
594 --- linux-2.6.27-720/include/asm-x86/bitops.h   2009-05-04 12:18:33.000000000 -0400
595 +++ linux-2.6.27-710/include/asm-x86/bitops.h   2008-10-09 18:13:53.000000000 -0400
596 @@ -35,7 +35,7 @@
597   * a mask operation on a byte.
598   */
599  #define IS_IMMEDIATE(nr)               (__builtin_constant_p(nr))
600 -#define CONST_MASK_ADDR(nr, addr)      BITOP_ADDR((char *)(addr) + ((nr)>>3))
601 +#define CONST_MASK_ADDR(nr, addr)      BITOP_ADDR((void *)(addr) + ((nr)>>3))
602  #define CONST_MASK(nr)                 (1 << ((nr) & 7))
603  
604  /**
605 diff -Nurb linux-2.6.27-720/include/asm-x86/desc.h linux-2.6.27-710/include/asm-x86/desc.h
606 --- linux-2.6.27-720/include/asm-x86/desc.h     2009-05-04 12:18:33.000000000 -0400
607 +++ linux-2.6.27-710/include/asm-x86/desc.h     2008-10-09 18:13:53.000000000 -0400
608 @@ -70,7 +70,7 @@
609  
610  static inline int desc_empty(const void *ptr)
611  {
612 -       const u32 *desc = (const u32 *) ptr;
613 +       const u32 *desc = ptr;
614         return !(desc[0] | desc[1]);
615  }
616  
617 diff -Nurb linux-2.6.27-720/include/asm-x86/hw_irq.h linux-2.6.27-710/include/asm-x86/hw_irq.h
618 --- linux-2.6.27-720/include/asm-x86/hw_irq.h   2009-05-04 12:18:33.000000000 -0400
619 +++ linux-2.6.27-710/include/asm-x86/hw_irq.h   2008-10-09 18:13:53.000000000 -0400
620 @@ -84,16 +84,6 @@
621  extern void eisa_set_level_irq(unsigned int irq);
622  
623  /* Voyager functions */
624 -#ifdef __cplusplus
625 -asmlinkage void vic_cpi_interrupt(void);
626 -asmlinkage void vic_sys_interrupt(void);
627 -asmlinkage void vic_cmn_interrupt(void);
628 -asmlinkage void qic_timer_interrupt(void);
629 -asmlinkage void qic_invalidate_interrupt(void);
630 -asmlinkage void qic_reschedule_interrupt(void);
631 -asmlinkage void qic_enable_irq_interrupt(void);
632 -asmlinkage void qic_call_function_interrupt(void);
633 -#else
634  extern asmlinkage void vic_cpi_interrupt(void);
635  extern asmlinkage void vic_sys_interrupt(void);
636  extern asmlinkage void vic_cmn_interrupt(void);
637 @@ -103,8 +93,6 @@
638  extern asmlinkage void qic_enable_irq_interrupt(void);
639  extern asmlinkage void qic_call_function_interrupt(void);
640  
641 -#endif
642 -
643  #ifdef CONFIG_X86_32
644  extern void (*const interrupt[NR_IRQS])(void);
645  #else
646 diff -Nurb linux-2.6.27-720/include/asm-x86/page.h linux-2.6.27-710/include/asm-x86/page.h
647 --- linux-2.6.27-720/include/asm-x86/page.h     2009-05-04 12:18:33.000000000 -0400
648 +++ linux-2.6.27-710/include/asm-x86/page.h     2008-10-09 18:13:53.000000000 -0400
649 @@ -138,7 +138,7 @@
650  
651  static inline pte_t native_make_pte(pteval_t val)
652  {
653 -       return (pte_t) ({pte_t duh; duh.pte = val;duh;});
654 +       return (pte_t) { .pte = val };
655  }
656  
657  static inline pteval_t native_pte_val(pte_t pte)
658 diff -Nurb linux-2.6.27-720/include/asm-x86/paravirt.h linux-2.6.27-710/include/asm-x86/paravirt.h
659 --- linux-2.6.27-720/include/asm-x86/paravirt.h 2009-05-04 12:18:33.000000000 -0400
660 +++ linux-2.6.27-710/include/asm-x86/paravirt.h 2008-10-09 18:13:53.000000000 -0400
661 @@ -1060,7 +1060,7 @@
662                                  pv_mmu_ops.make_pte,
663                                  val);
664  
665 -       return (pte_t) ({pte_t duh; duh.pte = ret;duh;});
666 +       return (pte_t) { .pte = ret };
667  }
668  
669  static inline pteval_t pte_val(pte_t pte)
670 @@ -1131,7 +1131,7 @@
671         ret = PVOP_CALL3(pteval_t, pv_mmu_ops.ptep_modify_prot_start,
672                          mm, addr, ptep);
673  
674 -       return (pte_t) ({pte_t duh; duh.pte = ret;duh;});
675 +       return (pte_t) { .pte = ret };
676  }
677  
678  static inline void ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
679 @@ -1314,12 +1314,10 @@
680         set_pte_at(mm, addr, ptep, __pte(0));
681  }
682  
683 -/*
684  static inline void pmd_clear(pmd_t *pmdp)
685  {
686         set_pmd(pmdp, __pmd(0));
687  }
688 -*/
689  #endif /* CONFIG_X86_PAE */
690  
691  /* Lazy mode for batching updates / context switch */
692 diff -Nurb linux-2.6.27-720/include/asm-x86/pgtable-2level.h linux-2.6.27-710/include/asm-x86/pgtable-2level.h
693 --- linux-2.6.27-720/include/asm-x86/pgtable-2level.h   2009-05-04 12:18:33.000000000 -0400
694 +++ linux-2.6.27-710/include/asm-x86/pgtable-2level.h   2008-10-09 18:13:53.000000000 -0400
695 @@ -33,12 +33,10 @@
696         native_set_pte(ptep, pte);
697  }
698  
699 -/*
700  static inline void native_pmd_clear(pmd_t *pmdp)
701  {
702         native_set_pmd(pmdp, __pmd(0));
703  }
704 -*/
705  
706  static inline void native_pte_clear(struct mm_struct *mm,
707                                     unsigned long addr, pte_t *xp)
708 diff -Nurb linux-2.6.27-720/include/asm-x86/pgtable.h linux-2.6.27-710/include/asm-x86/pgtable.h
709 --- linux-2.6.27-720/include/asm-x86/pgtable.h  2009-05-04 12:18:33.000000000 -0400
710 +++ linux-2.6.27-710/include/asm-x86/pgtable.h  2008-10-09 18:13:53.000000000 -0400
711 @@ -260,13 +260,11 @@
712                       pgprot_val(pgprot)) & __supported_pte_mask);
713  }
714  
715 -/*
716  static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
717  {
718         return __pmd((((phys_addr_t)page_nr << PAGE_SHIFT) |
719                       pgprot_val(pgprot)) & __supported_pte_mask);
720  }
721 -*/
722  
723  static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
724  {
725 diff -Nurb linux-2.6.27-720/include/asm-x86/spinlock_types.h linux-2.6.27-710/include/asm-x86/spinlock_types.h
726 --- linux-2.6.27-720/include/asm-x86/spinlock_types.h   2009-05-04 12:18:33.000000000 -0400
727 +++ linux-2.6.27-710/include/asm-x86/spinlock_types.h   2008-10-09 18:13:53.000000000 -0400
728 @@ -9,19 +9,12 @@
729         unsigned int slock;
730  } raw_spinlock_t;
731  
732 -#ifndef __cplusplus
733  #define __RAW_SPIN_LOCK_UNLOCKED       { 0 }
734 -#else
735 -#define __RAW_SPIN_LOCK_UNLOCKED       ({raw_spinlock_t duh; duh.slock=0;duh;})
736 -#endif
737  
738  typedef struct {
739         unsigned int lock;
740  } raw_rwlock_t;
741  
742 -#ifndef __cplusplus
743  #define __RAW_RW_LOCK_UNLOCKED         { RW_LOCK_BIAS }
744 -#else
745 -#define __RAW_RW_LOCK_UNLOCKED         ({raw_rwlock_t duh;duh.lock=RW_LOCK_BIAS;duh;})
746 -#endif
747 +
748  #endif
749 diff -Nurb linux-2.6.27-720/include/asm-x86/vdso.h linux-2.6.27-710/include/asm-x86/vdso.h
750 --- linux-2.6.27-720/include/asm-x86/vdso.h     2009-05-04 12:18:33.000000000 -0400
751 +++ linux-2.6.27-710/include/asm-x86/vdso.h     2008-10-09 18:13:53.000000000 -0400
752 @@ -33,8 +33,8 @@
753   * These symbols are defined with the addresses in the vsyscall page.
754   * See vsyscall-sigreturn.S.
755   */
756 -extern void* __user __kernel_sigreturn;
757 -extern void* __user __kernel_rt_sigreturn;
758 +extern void __user __kernel_sigreturn;
759 +extern void __user __kernel_rt_sigreturn;
760  
761  /*
762   * These symbols are defined by vdso32.S to mark the bounds
763 diff -Nurb linux-2.6.27-720/include/asm-xtensa/module.h linux-2.6.27-710/include/asm-xtensa/module.h
764 --- linux-2.6.27-720/include/asm-xtensa/module.h        2009-05-04 12:18:33.000000000 -0400
765 +++ linux-2.6.27-710/include/asm-xtensa/module.h        2008-10-09 18:13:53.000000000 -0400
766 @@ -13,7 +13,10 @@
767  #ifndef _XTENSA_MODULE_H
768  #define _XTENSA_MODULE_H
769  
770 -EMPTY_STRUCT_DECL(mod_arch_specific);
771 +struct mod_arch_specific
772 +{
773 +       /* No special elements, yet. */
774 +};
775  
776  #define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " "
777  
778 diff -Nurb linux-2.6.27-720/include/asm-xtensa/processor.h linux-2.6.27-710/include/asm-xtensa/processor.h
779 --- linux-2.6.27-720/include/asm-xtensa/processor.h     2009-05-04 12:18:33.000000000 -0400
780 +++ linux-2.6.27-710/include/asm-xtensa/processor.h     2008-10-09 18:13:53.000000000 -0400
781 @@ -183,7 +183,7 @@
782  
783  /* Special register access. */
784  
785 -#define WSR(v,sr) __asm__ __volatile__ ("wsr %0,"__stringify(sr) : : "a"(v));
786 +#define WSR(v,sr) __asm__ __volatile__ ("wsr %0,"__stringify(sr) :: "a"(v));
787  #define RSR(v,sr) __asm__ __volatile__ ("rsr %0,"__stringify(sr) : "=a"(v));
788  
789  #define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);})
790 diff -Nurb linux-2.6.27-720/include/asm-xtensa/system.h linux-2.6.27-710/include/asm-xtensa/system.h
791 --- linux-2.6.27-720/include/asm-xtensa/system.h        2009-05-04 12:18:33.000000000 -0400
792 +++ linux-2.6.27-710/include/asm-xtensa/system.h        2008-10-09 18:13:53.000000000 -0400
793 @@ -21,21 +21,21 @@
794         __asm__ __volatile__ ("rsr %0,"__stringify(PS) : "=a" (x));
795  #define local_irq_restore(x)   do {                                    \
796         __asm__ __volatile__ ("wsr %0, "__stringify(PS)" ; rsync"       \
797 -                             : : "a" (x) : "memory"); } while(0);
798 +                             :: "a" (x) : "memory"); } while(0);
799  #define local_irq_save(x)      do {                                    \
800         __asm__ __volatile__ ("rsil %0, "__stringify(LOCKLEVEL)         \
801 -                             : "=a" (x) : : "memory");} while(0);
802 +                             : "=a" (x) :: "memory");} while(0);
803  
804  static inline void local_irq_disable(void)
805  {
806         unsigned long flags;
807         __asm__ __volatile__ ("rsil %0, "__stringify(LOCKLEVEL)
808 -                             : "=a" (flags) : : "memory");
809 +                             : "=a" (flags) :: "memory");
810  }
811  static inline void local_irq_enable(void)
812  {
813         unsigned long flags;
814 -       __asm__ __volatile__ ("rsil %0, 0" : "=a" (flags) : : "memory");
815 +       __asm__ __volatile__ ("rsil %0, 0" : "=a" (flags) :: "memory");
816  
817  }
818  
819 diff -Nurb linux-2.6.27-720/include/linux/backing-dev.h linux-2.6.27-710/include/linux/backing-dev.h
820 --- linux-2.6.27-720/include/linux/backing-dev.h        2009-05-04 12:18:33.000000000 -0400
821 +++ linux-2.6.27-710/include/linux/backing-dev.h        2008-10-09 18:13:53.000000000 -0400
822 @@ -29,7 +29,7 @@
823         BDI_unused,             /* Available bits start here */
824  };
825  
826 -typedef int (congested_fn_t)(void *, int);
827 +typedef int (congested_fn)(void *, int);
828  
829  enum bdi_stat_item {
830         BDI_RECLAIMABLE,
831 @@ -43,7 +43,7 @@
832         unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
833         unsigned long state;    /* Always use atomic bitops on this */
834         unsigned int capabilities; /* Device capabilities */
835 -       congested_fn_t *congested_fn; /* Function pointer if device is md/dm */
836 +       congested_fn *congested_fn; /* Function pointer if device is md/dm */
837         void *congested_data;   /* Pointer to aux data for congested func */
838         void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
839         void *unplug_io_data;
840 diff -Nurb linux-2.6.27-720/include/linux/compat.h linux-2.6.27-710/include/linux/compat.h
841 --- linux-2.6.27-720/include/linux/compat.h     2009-05-04 12:18:34.000000000 -0400
842 +++ linux-2.6.27-710/include/linux/compat.h     2009-05-04 12:15:01.000000000 -0400
843 @@ -115,7 +115,7 @@
844  
845  struct compat_siginfo;
846  
847 -asmlinkage long compat_sys_waitid(int, compat_pid_t,
848 +extern asmlinkage long compat_sys_waitid(int, compat_pid_t,
849                 struct compat_siginfo __user *, int,
850                 struct compat_rusage __user *);
851  
852 diff -Nurb linux-2.6.27-720/include/linux/dmaengine.h linux-2.6.27-710/include/linux/dmaengine.h
853 --- linux-2.6.27-720/include/linux/dmaengine.h  2009-05-04 12:18:34.000000000 -0400
854 +++ linux-2.6.27-710/include/linux/dmaengine.h  2008-10-09 18:13:53.000000000 -0400
855 @@ -377,7 +377,7 @@
856  
857  static inline void async_tx_ack(struct dma_async_tx_descriptor *tx)
858  {
859 -       tx->flags = (enum dma_ctrl_flags) (tx->flags | DMA_CTRL_ACK);
860 +       tx->flags |= DMA_CTRL_ACK;
861  }
862  
863  static inline bool async_tx_test_ack(struct dma_async_tx_descriptor *tx)
864 diff -Nurb linux-2.6.27-720/include/linux/dqblk_v1.h linux-2.6.27-710/include/linux/dqblk_v1.h
865 --- linux-2.6.27-720/include/linux/dqblk_v1.h   2009-05-04 12:18:34.000000000 -0400
866 +++ linux-2.6.27-710/include/linux/dqblk_v1.h   2008-10-09 18:13:53.000000000 -0400
867 @@ -18,6 +18,7 @@
868  #define V1_DEL_REWRITE 2
869  
870  /* Special information about quotafile */
871 -EMPTY_STRUCT_DECL(v1_mem_dqinfo);
872 +struct v1_mem_dqinfo {
873 +};
874  
875  #endif /* _LINUX_DQBLK_V1_H */
876 diff -Nurb linux-2.6.27-720/include/linux/fs.h linux-2.6.27-710/include/linux/fs.h
877 --- linux-2.6.27-720/include/linux/fs.h 2009-05-04 12:18:34.000000000 -0400
878 +++ linux-2.6.27-710/include/linux/fs.h 2009-05-04 12:16:10.000000000 -0400
879 @@ -2111,7 +2111,7 @@
880  
881  static inline void simple_transaction_set(struct file *file, size_t n)
882  {
883 -       struct simple_transaction_argresp *ar = (struct simple_transaction_argresp *) file->private_data;
884 +       struct simple_transaction_argresp *ar = file->private_data;
885  
886         BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
887  
888 diff -Nurb linux-2.6.27-720/include/linux/fs.h.orig linux-2.6.27-710/include/linux/fs.h.orig
889 --- linux-2.6.27-720/include/linux/fs.h.orig    2009-05-04 12:16:10.000000000 -0400
890 +++ linux-2.6.27-710/include/linux/fs.h.orig    1969-12-31 19:00:00.000000000 -0500
891 @@ -1,2199 +0,0 @@
892 -#ifndef _LINUX_FS_H
893 -#define _LINUX_FS_H
894 -
895 -/*
896 - * This file has definitions for some important file table
897 - * structures etc.
898 - */
899 -
900 -#include <linux/limits.h>
901 -#include <linux/ioctl.h>
902 -
903 -/*
904 - * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
905 - * the file limit at runtime and only root can increase the per-process
906 - * nr_file rlimit, so it's safe to set up a ridiculously high absolute
907 - * upper limit on files-per-process.
908 - *
909 - * Some programs (notably those using select()) may have to be 
910 - * recompiled to take full advantage of the new limits..  
911 - */
912 -
913 -/* Fixed constants first: */
914 -#undef NR_OPEN
915 -extern int sysctl_nr_open;
916 -#define INR_OPEN 4096          /* Initial setting for nfile rlimits */
917 -
918 -#define BLOCK_SIZE_BITS 10
919 -#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
920 -
921 -#define SEEK_SET       0       /* seek relative to beginning of file */
922 -#define SEEK_CUR       1       /* seek relative to current file position */
923 -#define SEEK_END       2       /* seek relative to end of file */
924 -#define SEEK_MAX       SEEK_END
925 -
926 -/* And dynamically-tunable limits and defaults: */
927 -struct files_stat_struct {
928 -       int nr_files;           /* read only */
929 -       int nr_free_files;      /* read only */
930 -       int max_files;          /* tunable */
931 -};
932 -extern struct files_stat_struct files_stat;
933 -extern int get_max_files(void);
934 -
935 -struct inodes_stat_t {
936 -       int nr_inodes;
937 -       int nr_unused;
938 -       int dummy[5];           /* padding for sysctl ABI compatibility */
939 -};
940 -extern struct inodes_stat_t inodes_stat;
941 -
942 -extern int leases_enable, lease_break_time;
943 -
944 -#ifdef CONFIG_DNOTIFY
945 -extern int dir_notify_enable;
946 -#endif
947 -
948 -#define NR_FILE  8192  /* this can well be larger on a larger system */
949 -
950 -#define MAY_EXEC 1
951 -#define MAY_WRITE 2
952 -#define MAY_READ 4
953 -#define MAY_APPEND 8
954 -#define MAY_ACCESS 16
955 -#define MAY_OPEN 32
956 -
957 -#define FMODE_READ 1
958 -#define FMODE_WRITE 2
959 -
960 -/* Internal kernel extensions */
961 -#define FMODE_LSEEK    4
962 -#define FMODE_PREAD    8
963 -#define FMODE_PWRITE   FMODE_PREAD     /* These go hand in hand */
964 -
965 -/* File is being opened for execution. Primary users of this flag are
966 -   distributed filesystems that can use it to achieve correct ETXTBUSY
967 -   behavior for cross-node execution/opening_for_writing of files */
968 -#define FMODE_EXEC     16
969 -
970 -#define RW_MASK                1
971 -#define RWA_MASK       2
972 -#define READ 0
973 -#define WRITE 1
974 -#define READA 2                /* read-ahead  - don't block if no resources */
975 -#define SWRITE 3       /* for ll_rw_block() - wait for buffer lock */
976 -#define READ_SYNC      (READ | (1 << BIO_RW_SYNC))
977 -#define READ_META      (READ | (1 << BIO_RW_META))
978 -#define WRITE_SYNC     (WRITE | (1 << BIO_RW_SYNC))
979 -#define SWRITE_SYNC    (SWRITE | (1 << BIO_RW_SYNC))
980 -#define WRITE_BARRIER  ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
981 -
982 -#define SEL_IN         1
983 -#define SEL_OUT                2
984 -#define SEL_EX         4
985 -
986 -/* public flags for file_system_type */
987 -#define FS_REQUIRES_DEV 1 
988 -#define FS_BINARY_MOUNTDATA 2
989 -#define FS_HAS_SUBTYPE 4
990 -#define FS_REVAL_DOT   16384   /* Check the paths ".", ".." for staleness */
991 -#define FS_RENAME_DOES_D_MOVE  32768   /* FS will handle d_move()
992 -                                        * during rename() internally.
993 -                                        */
994 -
995 -/*
996 - * These are the fs-independent mount-flags: up to 32 flags are supported
997 - */
998 -#define MS_RDONLY       1      /* Mount read-only */
999 -#define MS_NOSUID       2      /* Ignore suid and sgid bits */
1000 -#define MS_NODEV        4      /* Disallow access to device special files */
1001 -#define MS_NOEXEC       8      /* Disallow program execution */
1002 -#define MS_SYNCHRONOUS 16      /* Writes are synced at once */
1003 -#define MS_REMOUNT     32      /* Alter flags of a mounted FS */
1004 -#define MS_MANDLOCK    64      /* Allow mandatory locks on an FS */
1005 -#define MS_DIRSYNC     128     /* Directory modifications are synchronous */
1006 -#define MS_NOATIME     1024    /* Do not update access times. */
1007 -#define MS_NODIRATIME  2048    /* Do not update directory access times */
1008 -#define MS_BIND                4096
1009 -#define MS_MOVE                8192
1010 -#define MS_REC         16384
1011 -#define MS_VERBOSE     32768   /* War is peace. Verbosity is silence.
1012 -                                  MS_VERBOSE is deprecated. */
1013 -#define MS_SILENT      32768
1014 -#define MS_POSIXACL    (1<<16) /* VFS does not apply the umask */
1015 -#define MS_UNBINDABLE  (1<<17) /* change to unbindable */
1016 -#define MS_PRIVATE     (1<<18) /* change to private */
1017 -#define MS_SLAVE       (1<<19) /* change to slave */
1018 -#define MS_SHARED      (1<<20) /* change to shared */
1019 -#define MS_RELATIME    (1<<21) /* Update atime relative to mtime/ctime. */
1020 -#define MS_KERNMOUNT   (1<<22) /* this is a kern_mount call */
1021 -#define MS_I_VERSION   (1<<23) /* Update inode I_version field */
1022 -#define MS_TAGGED      (1<<24) /* use generic inode tagging */
1023 -#define MS_TAGID       (1<<25) /* use specific tag for this mount */
1024 -#define MS_NOTAGCHECK  (1<<26) /* don't check tags */
1025 -#define MS_ACTIVE      (1<<30)
1026 -#define MS_NOUSER      (1<<31)
1027 -
1028 -/*
1029 - * Superblock flags that can be altered by MS_REMOUNT
1030 - */
1031 -#define MS_RMT_MASK    (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)
1032 -
1033 -/*
1034 - * Old magic mount flag and mask
1035 - */
1036 -#define MS_MGC_VAL 0xC0ED0000
1037 -#define MS_MGC_MSK 0xffff0000
1038 -
1039 -/* Inode flags - they have nothing to superblock flags now */
1040 -
1041 -#define S_SYNC         1       /* Writes are synced at once */
1042 -#define S_NOATIME      2       /* Do not update access times */
1043 -#define S_APPEND       4       /* Append-only file */
1044 -#define S_IMMUTABLE    8       /* Immutable file */
1045 -#define S_DEAD         16      /* removed, but still open directory */
1046 -#define S_NOQUOTA      32      /* Inode is not counted to quota */
1047 -#define S_DIRSYNC      64      /* Directory modifications are synchronous */
1048 -#define S_NOCMTIME     128     /* Do not update file c/mtime */
1049 -#define S_SWAPFILE     256     /* Do not truncate: swapon got its bmaps */
1050 -#define S_PRIVATE      512     /* Inode is fs-internal */
1051 -#define S_IXUNLINK     1024    /* Immutable Invert on unlink */
1052 -
1053 -/* Linux-VServer related Inode flags */
1054 -
1055 -#define V_VALID                1
1056 -#define V_XATTR                2
1057 -#define V_BARRIER      4       /* Barrier for chroot() */
1058 -#define V_COW          8       /* Copy on Write */
1059 -
1060 -/*
1061 - * Note that nosuid etc flags are inode-specific: setting some file-system
1062 - * flags just means all the inodes inherit those flags by default. It might be
1063 - * possible to override it selectively if you really wanted to with some
1064 - * ioctl() that is not currently implemented.
1065 - *
1066 - * Exception: MS_RDONLY is always applied to the entire file system.
1067 - *
1068 - * Unfortunately, it is possible to change a filesystems flags with it mounted
1069 - * with files in use.  This means that all of the inodes will not have their
1070 - * i_flags updated.  Hence, i_flags no longer inherit the superblock mount
1071 - * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
1072 - */
1073 -#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
1074 -
1075 -#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
1076 -#define IS_SYNC(inode)         (__IS_FLG(inode, MS_SYNCHRONOUS) || \
1077 -                                       ((inode)->i_flags & S_SYNC))
1078 -#define IS_DIRSYNC(inode)      (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
1079 -                                       ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
1080 -#define IS_MANDLOCK(inode)     __IS_FLG(inode, MS_MANDLOCK)
1081 -#define IS_NOATIME(inode)      __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
1082 -#define IS_I_VERSION(inode)    __IS_FLG(inode, MS_I_VERSION)
1083 -#define IS_TAGGED(inode)       __IS_FLG(inode, MS_TAGGED)
1084 -
1085 -#define IS_NOQUOTA(inode)      ((inode)->i_flags & S_NOQUOTA)
1086 -#define IS_APPEND(inode)       ((inode)->i_flags & S_APPEND)
1087 -#define IS_IMMUTABLE(inode)    ((inode)->i_flags & S_IMMUTABLE)
1088 -#define IS_IXUNLINK(inode)     ((inode)->i_flags & S_IXUNLINK)
1089 -#define IS_IXORUNLINK(inode)   ((IS_IXUNLINK(inode) ? S_IMMUTABLE : 0) ^ IS_IMMUTABLE(inode))
1090 -#define IS_POSIXACL(inode)     __IS_FLG(inode, MS_POSIXACL)
1091 -
1092 -#define IS_DEADDIR(inode)      ((inode)->i_flags & S_DEAD)
1093 -#define IS_NOCMTIME(inode)     ((inode)->i_flags & S_NOCMTIME)
1094 -#define IS_SWAPFILE(inode)     ((inode)->i_flags & S_SWAPFILE)
1095 -#define IS_PRIVATE(inode)      ((inode)->i_flags & S_PRIVATE)
1096 -
1097 -#define IS_BARRIER(inode)      (S_ISDIR((inode)->i_mode) && ((inode)->i_vflags & V_BARRIER))
1098 -
1099 -#ifdef CONFIG_VSERVER_COWBL
1100 -#  define IS_COW(inode)                (IS_IXUNLINK(inode) && IS_IMMUTABLE(inode))
1101 -#  define IS_COW_LINK(inode)   (S_ISREG((inode)->i_mode) && ((inode)->i_nlink > 1))
1102 -#else
1103 -#  define IS_COW(inode)                (0)
1104 -#  define IS_COW_LINK(inode)   (0)
1105 -#endif
1106 -
1107 -/* the read-only stuff doesn't really belong here, but any other place is
1108 -   probably as bad and I don't want to create yet another include file. */
1109 -
1110 -#define BLKROSET   _IO(0x12,93)        /* set device read-only (0 = read-write) */
1111 -#define BLKROGET   _IO(0x12,94)        /* get read-only status (0 = read_write) */
1112 -#define BLKRRPART  _IO(0x12,95)        /* re-read partition table */
1113 -#define BLKGETSIZE _IO(0x12,96)        /* return device size /512 (long *arg) */
1114 -#define BLKFLSBUF  _IO(0x12,97)        /* flush buffer cache */
1115 -#define BLKRASET   _IO(0x12,98)        /* set read ahead for block device */
1116 -#define BLKRAGET   _IO(0x12,99)        /* get current read ahead setting */
1117 -#define BLKFRASET  _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
1118 -#define BLKFRAGET  _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
1119 -#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
1120 -#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
1121 -#define BLKSSZGET  _IO(0x12,104)/* get block device sector size */
1122 -#if 0
1123 -#define BLKPG      _IO(0x12,105)/* See blkpg.h */
1124 -
1125 -/* Some people are morons.  Do not use sizeof! */
1126 -
1127 -#define BLKELVGET  _IOR(0x12,106,size_t)/* elevator get */
1128 -#define BLKELVSET  _IOW(0x12,107,size_t)/* elevator set */
1129 -/* This was here just to show that the number is taken -
1130 -   probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */
1131 -#endif
1132 -/* A jump here: 108-111 have been used for various private purposes. */
1133 -#define BLKBSZGET  _IOR(0x12,112,size_t)
1134 -#define BLKBSZSET  _IOW(0x12,113,size_t)
1135 -#define BLKGETSIZE64 _IOR(0x12,114,size_t)     /* return device size in bytes (u64 *arg) */
1136 -#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
1137 -#define BLKTRACESTART _IO(0x12,116)
1138 -#define BLKTRACESTOP _IO(0x12,117)
1139 -#define BLKTRACETEARDOWN _IO(0x12,118)
1140 -
1141 -#define BMAP_IOCTL 1           /* obsolete - kept for compatibility */
1142 -#define FIBMAP    _IO(0x00,1)  /* bmap access */
1143 -#define FIGETBSZ   _IO(0x00,2) /* get the block size used for bmap */
1144 -
1145 -#define        FS_IOC_GETFLAGS                 _IOR('f', 1, long)
1146 -#define        FS_IOC_SETFLAGS                 _IOW('f', 2, long)
1147 -#define        FS_IOC_GETVERSION               _IOR('v', 1, long)
1148 -#define        FS_IOC_SETVERSION               _IOW('v', 2, long)
1149 -#define FS_IOC32_GETFLAGS              _IOR('f', 1, int)
1150 -#define FS_IOC32_SETFLAGS              _IOW('f', 2, int)
1151 -#define FS_IOC32_GETVERSION            _IOR('v', 1, int)
1152 -#define FS_IOC32_SETVERSION            _IOW('v', 2, int)
1153 -
1154 -/*
1155 - * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
1156 - */
1157 -#define        FS_SECRM_FL                     0x00000001 /* Secure deletion */
1158 -#define        FS_UNRM_FL                      0x00000002 /* Undelete */
1159 -#define        FS_COMPR_FL                     0x00000004 /* Compress file */
1160 -#define FS_SYNC_FL                     0x00000008 /* Synchronous updates */
1161 -#define FS_IMMUTABLE_FL                        0x00000010 /* Immutable file */
1162 -#define FS_APPEND_FL                   0x00000020 /* writes to file may only append */
1163 -#define FS_NODUMP_FL                   0x00000040 /* do not dump file */
1164 -#define FS_NOATIME_FL                  0x00000080 /* do not update atime */
1165 -/* Reserved for compression usage... */
1166 -#define FS_DIRTY_FL                    0x00000100
1167 -#define FS_COMPRBLK_FL                 0x00000200 /* One or more compressed clusters */
1168 -#define FS_NOCOMP_FL                   0x00000400 /* Don't compress */
1169 -#define FS_ECOMPR_FL                   0x00000800 /* Compression error */
1170 -/* End compression flags --- maybe not all used */
1171 -#define FS_BTREE_FL                    0x00001000 /* btree format dir */
1172 -#define FS_INDEX_FL                    0x00001000 /* hash-indexed directory */
1173 -#define FS_IMAGIC_FL                   0x00002000 /* AFS directory */
1174 -#define FS_JOURNAL_DATA_FL             0x00004000 /* Reserved for ext3 */
1175 -#define FS_NOTAIL_FL                   0x00008000 /* file tail should not be merged */
1176 -#define FS_DIRSYNC_FL                  0x00010000 /* dirsync behaviour (directories only) */
1177 -#define FS_TOPDIR_FL                   0x00020000 /* Top of directory hierarchies*/
1178 -#define FS_EXTENT_FL                   0x00080000 /* Extents */
1179 -#define FS_DIRECTIO_FL                 0x00100000 /* Use direct i/o */
1180 -#define FS_IXUNLINK_FL                 0x08000000 /* Immutable invert on unlink */
1181 -#define FS_RESERVED_FL                 0x80000000 /* reserved for ext2 lib */
1182 -
1183 -#define FS_BARRIER_FL                  0x04000000 /* Barrier for chroot() */
1184 -#define FS_COW_FL                      0x20000000 /* Copy on Write marker */
1185 -
1186 -#define FS_FL_USER_VISIBLE             0x0103DFFF /* User visible flags */
1187 -#define FS_FL_USER_MODIFIABLE          0x010380FF /* User modifiable flags */
1188 -
1189 -#define SYNC_FILE_RANGE_WAIT_BEFORE    1
1190 -#define SYNC_FILE_RANGE_WRITE          2
1191 -#define SYNC_FILE_RANGE_WAIT_AFTER     4
1192 -
1193 -#ifdef __KERNEL__
1194 -
1195 -#include <linux/linkage.h>
1196 -#include <linux/wait.h>
1197 -#include <linux/types.h>
1198 -#include <linux/kdev_t.h>
1199 -#include <linux/dcache.h>
1200 -#include <linux/path.h>
1201 -#include <linux/stat.h>
1202 -#include <linux/cache.h>
1203 -#include <linux/kobject.h>
1204 -#include <linux/list.h>
1205 -#include <linux/radix-tree.h>
1206 -#include <linux/prio_tree.h>
1207 -#include <linux/init.h>
1208 -#include <linux/pid.h>
1209 -#include <linux/mutex.h>
1210 -#include <linux/capability.h>
1211 -#include <linux/semaphore.h>
1212 -
1213 -#include <asm/atomic.h>
1214 -#include <asm/byteorder.h>
1215 -
1216 -struct export_operations;
1217 -struct hd_geometry;
1218 -struct iovec;
1219 -struct nameidata;
1220 -struct kiocb;
1221 -struct pipe_inode_info;
1222 -struct poll_table_struct;
1223 -struct kstatfs;
1224 -struct vm_area_struct;
1225 -struct vfsmount;
1226 -
1227 -extern void __init inode_init(void);
1228 -extern void __init inode_init_early(void);
1229 -extern void __init files_init(unsigned long);
1230 -
1231 -struct buffer_head;
1232 -typedef int (get_block_t)(struct inode *inode, sector_t iblock,
1233 -                       struct buffer_head *bh_result, int create);
1234 -typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
1235 -                       ssize_t bytes, void *private);
1236 -
1237 -/*
1238 - * Attribute flags.  These should be or-ed together to figure out what
1239 - * has been changed!
1240 - */
1241 -#define ATTR_MODE      (1 << 0)
1242 -#define ATTR_UID       (1 << 1)
1243 -#define ATTR_GID       (1 << 2)
1244 -#define ATTR_SIZE      (1 << 3)
1245 -#define ATTR_ATIME     (1 << 4)
1246 -#define ATTR_MTIME     (1 << 5)
1247 -#define ATTR_CTIME     (1 << 6)
1248 -#define ATTR_ATIME_SET (1 << 7)
1249 -#define ATTR_MTIME_SET (1 << 8)
1250 -#define ATTR_FORCE     (1 << 9) /* Not a change, but a change it */
1251 -#define ATTR_ATTR_FLAG (1 << 10)
1252 -#define ATTR_KILL_SUID (1 << 11)
1253 -#define ATTR_KILL_SGID (1 << 12)
1254 -#define ATTR_FILE      (1 << 13)
1255 -#define ATTR_KILL_PRIV (1 << 14)
1256 -#define ATTR_OPEN      (1 << 15) /* Truncating from open(O_TRUNC) */
1257 -#define ATTR_TIMES_SET (1 << 16)
1258 -#define ATTR_TAG       (1 << 17)
1259 -
1260 -/*
1261 - * This is the Inode Attributes structure, used for notify_change().  It
1262 - * uses the above definitions as flags, to know which values have changed.
1263 - * Also, in this manner, a Filesystem can look at only the values it cares
1264 - * about.  Basically, these are the attributes that the VFS layer can
1265 - * request to change from the FS layer.
1266 - *
1267 - * Derek Atkins <warlord@MIT.EDU> 94-10-20
1268 - */
1269 -struct iattr {
1270 -       unsigned int    ia_valid;
1271 -       umode_t         ia_mode;
1272 -       uid_t           ia_uid;
1273 -       gid_t           ia_gid;
1274 -       tag_t           ia_tag;
1275 -       loff_t          ia_size;
1276 -       struct timespec ia_atime;
1277 -       struct timespec ia_mtime;
1278 -       struct timespec ia_ctime;
1279 -
1280 -       /*
1281 -        * Not an attribute, but an auxilary info for filesystems wanting to
1282 -        * implement an ftruncate() like method.  NOTE: filesystem should
1283 -        * check for (ia_valid & ATTR_FILE), and not for (ia_file != NULL).
1284 -        */
1285 -       struct file     *ia_file;
1286 -};
1287 -
1288 -#define ATTR_FLAG_BARRIER      512     /* Barrier for chroot() */
1289 -#define ATTR_FLAG_IXUNLINK     1024    /* Immutable invert on unlink */
1290 -
1291 -/*
1292 - * Includes for diskquotas.
1293 - */
1294 -#include <linux/quota.h>
1295 -
1296 -/** 
1297 - * enum positive_aop_returns - aop return codes with specific semantics
1298 - *
1299 - * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has
1300 - *                         completed, that the page is still locked, and
1301 - *                         should be considered active.  The VM uses this hint
1302 - *                         to return the page to the active list -- it won't
1303 - *                         be a candidate for writeback again in the near
1304 - *                         future.  Other callers must be careful to unlock
1305 - *                         the page if they get this return.  Returned by
1306 - *                         writepage(); 
1307 - *
1308 - * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has
1309 - *                     unlocked it and the page might have been truncated.
1310 - *                     The caller should back up to acquiring a new page and
1311 - *                     trying again.  The aop will be taking reasonable
1312 - *                     precautions not to livelock.  If the caller held a page
1313 - *                     reference, it should drop it before retrying.  Returned
1314 - *                     by readpage().
1315 - *
1316 - * address_space_operation functions return these large constants to indicate
1317 - * special semantics to the caller.  These are much larger than the bytes in a
1318 - * page to allow for functions that return the number of bytes operated on in a
1319 - * given page.
1320 - */
1321 -
1322 -enum positive_aop_returns {
1323 -       AOP_WRITEPAGE_ACTIVATE  = 0x80000,
1324 -       AOP_TRUNCATED_PAGE      = 0x80001,
1325 -};
1326 -
1327 -#define AOP_FLAG_UNINTERRUPTIBLE       0x0001 /* will not do a short write */
1328 -#define AOP_FLAG_CONT_EXPAND           0x0002 /* called from cont_expand */
1329 -#define AOP_FLAG_NOFS                  0x0004 /* used by filesystem to direct
1330 -                                               * helper code (eg buffer layer)
1331 -                                               * to clear GFP_FS from alloc */
1332 -
1333 -/*
1334 - * oh the beauties of C type declarations.
1335 - */
1336 -struct page;
1337 -struct address_space;
1338 -struct writeback_control;
1339 -
1340 -struct iov_iter {
1341 -       const struct iovec *iov;
1342 -       unsigned long nr_segs;
1343 -       size_t iov_offset;
1344 -       size_t count;
1345 -};
1346 -
1347 -size_t iov_iter_copy_from_user_atomic(struct page *page,
1348 -               struct iov_iter *i, unsigned long offset, size_t bytes);
1349 -size_t iov_iter_copy_from_user(struct page *page,
1350 -               struct iov_iter *i, unsigned long offset, size_t bytes);
1351 -void iov_iter_advance(struct iov_iter *i, size_t bytes);
1352 -int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
1353 -size_t iov_iter_single_seg_count(struct iov_iter *i);
1354 -
1355 -static inline void iov_iter_init(struct iov_iter *i,
1356 -                       const struct iovec *iov, unsigned long nr_segs,
1357 -                       size_t count, size_t written)
1358 -{
1359 -       i->iov = iov;
1360 -       i->nr_segs = nr_segs;
1361 -       i->iov_offset = 0;
1362 -       i->count = count + written;
1363 -
1364 -       iov_iter_advance(i, written);
1365 -}
1366 -
1367 -static inline size_t iov_iter_count(struct iov_iter *i)
1368 -{
1369 -       return i->count;
1370 -}
1371 -
1372 -/*
1373 - * "descriptor" for what we're up to with a read.
1374 - * This allows us to use the same read code yet
1375 - * have multiple different users of the data that
1376 - * we read from a file.
1377 - *
1378 - * The simplest case just copies the data to user
1379 - * mode.
1380 - */
1381 -typedef struct {
1382 -       size_t written;
1383 -       size_t count;
1384 -       union {
1385 -               char __user *buf;
1386 -               void *data;
1387 -       } arg;
1388 -       int error;
1389 -} read_descriptor_t;
1390 -
1391 -typedef int (*read_actor_t)(read_descriptor_t *, struct page *,
1392 -               unsigned long, unsigned long);
1393 -
1394 -struct address_space_operations {
1395 -       int (*writepage)(struct page *page, struct writeback_control *wbc);
1396 -       int (*readpage)(struct file *, struct page *);
1397 -       void (*sync_page)(struct page *);
1398 -
1399 -       /* Write back some dirty pages from this mapping. */
1400 -       int (*writepages)(struct address_space *, struct writeback_control *);
1401 -
1402 -       /* Set a page dirty.  Return true if this dirtied it */
1403 -       int (*set_page_dirty)(struct page *page);
1404 -
1405 -       int (*readpages)(struct file *filp, struct address_space *mapping,
1406 -                       struct list_head *pages, unsigned nr_pages);
1407 -
1408 -       /*
1409 -        * ext3 requires that a successful prepare_write() call be followed
1410 -        * by a commit_write() call - they must be balanced
1411 -        */
1412 -       int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
1413 -       int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
1414 -
1415 -       int (*write_begin)(struct file *, struct address_space *mapping,
1416 -                               loff_t pos, unsigned len, unsigned flags,
1417 -                               struct page **pagep, void **fsdata);
1418 -       int (*write_end)(struct file *, struct address_space *mapping,
1419 -                               loff_t pos, unsigned len, unsigned copied,
1420 -                               struct page *page, void *fsdata);
1421 -
1422 -       /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
1423 -       sector_t (*bmap)(struct address_space *, sector_t);
1424 -       void (*invalidatepage) (struct page *, unsigned long);
1425 -       int (*releasepage) (struct page *, gfp_t);
1426 -       ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
1427 -                       loff_t offset, unsigned long nr_segs);
1428 -       int (*get_xip_mem)(struct address_space *, pgoff_t, int,
1429 -                                               void **, unsigned long *);
1430 -       /* migrate the contents of a page to the specified target */
1431 -       int (*migratepage) (struct address_space *,
1432 -                       struct page *, struct page *);
1433 -       int (*launder_page) (struct page *);
1434 -       int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
1435 -                                       unsigned long);
1436 -};
1437 -
1438 -/*
1439 - * pagecache_write_begin/pagecache_write_end must be used by general code
1440 - * to write into the pagecache.
1441 - */
1442 -int pagecache_write_begin(struct file *, struct address_space *mapping,
1443 -                               loff_t pos, unsigned len, unsigned flags,
1444 -                               struct page **pagep, void **fsdata);
1445 -
1446 -int pagecache_write_end(struct file *, struct address_space *mapping,
1447 -                               loff_t pos, unsigned len, unsigned copied,
1448 -                               struct page *page, void *fsdata);
1449 -
1450 -struct backing_dev_info;
1451 -struct address_space {
1452 -       struct inode            *host;          /* owner: inode, block_device */
1453 -       struct radix_tree_root  page_tree;      /* radix tree of all pages */
1454 -       spinlock_t              tree_lock;      /* and lock protecting it */
1455 -       unsigned int            i_mmap_writable;/* count VM_SHARED mappings */
1456 -       struct prio_tree_root   i_mmap;         /* tree of private and shared mappings */
1457 -       struct list_head        i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
1458 -       spinlock_t              i_mmap_lock;    /* protect tree, count, list */
1459 -       unsigned int            truncate_count; /* Cover race condition with truncate */
1460 -       unsigned long           nrpages;        /* number of total pages */
1461 -       pgoff_t                 writeback_index;/* writeback starts here */
1462 -       const struct address_space_operations *a_ops;   /* methods */
1463 -       unsigned long           flags;          /* error bits/gfp mask */
1464 -       struct backing_dev_info *backing_dev_info; /* device readahead, etc */
1465 -       spinlock_t              private_lock;   /* for use by the address_space */
1466 -       struct list_head        private_list;   /* ditto */
1467 -       struct address_space    *assoc_mapping; /* ditto */
1468 -} __attribute__((aligned(sizeof(long))));
1469 -       /*
1470 -        * On most architectures that alignment is already the case; but
1471 -        * must be enforced here for CRIS, to let the least signficant bit
1472 -        * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON.
1473 -        */
1474 -
1475 -struct block_device {
1476 -       dev_t                   bd_dev;  /* not a kdev_t - it's a search key */
1477 -       struct inode *          bd_inode;       /* will die */
1478 -       int                     bd_openers;
1479 -       struct mutex            bd_mutex;       /* open/close mutex */
1480 -       struct semaphore        bd_mount_sem;
1481 -       struct list_head        bd_inodes;
1482 -       void *                  bd_holder;
1483 -       int                     bd_holders;
1484 -#ifdef CONFIG_SYSFS
1485 -       struct list_head        bd_holder_list;
1486 -#endif
1487 -       struct block_device *   bd_contains;
1488 -       unsigned                bd_block_size;
1489 -       struct hd_struct *      bd_part;
1490 -       /* number of times partitions within this device have been opened. */
1491 -       unsigned                bd_part_count;
1492 -       int                     bd_invalidated;
1493 -       struct gendisk *        bd_disk;
1494 -       struct list_head        bd_list;
1495 -       struct backing_dev_info *bd_inode_backing_dev_info;
1496 -       /*
1497 -        * Private data.  You must have bd_claim'ed the block_device
1498 -        * to use this.  NOTE:  bd_claim allows an owner to claim
1499 -        * the same device multiple times, the owner must take special
1500 -        * care to not mess up bd_private for that case.
1501 -        */
1502 -       unsigned long           bd_private;
1503 -};
1504 -
1505 -/*
1506 - * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
1507 - * radix trees
1508 - */
1509 -#define PAGECACHE_TAG_DIRTY    0
1510 -#define PAGECACHE_TAG_WRITEBACK        1
1511 -
1512 -int mapping_tagged(struct address_space *mapping, int tag);
1513 -
1514 -/*
1515 - * Might pages of this file be mapped into userspace?
1516 - */
1517 -static inline int mapping_mapped(struct address_space *mapping)
1518 -{
1519 -       return  !prio_tree_empty(&mapping->i_mmap) ||
1520 -               !list_empty(&mapping->i_mmap_nonlinear);
1521 -}
1522 -
1523 -/*
1524 - * Might pages of this file have been modified in userspace?
1525 - * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff
1526 - * marks vma as VM_SHARED if it is shared, and the file was opened for
1527 - * writing i.e. vma may be mprotected writable even if now readonly.
1528 - */
1529 -static inline int mapping_writably_mapped(struct address_space *mapping)
1530 -{
1531 -       return mapping->i_mmap_writable != 0;
1532 -}
1533 -
1534 -/*
1535 - * Use sequence counter to get consistent i_size on 32-bit processors.
1536 - */
1537 -#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
1538 -#include <linux/seqlock.h>
1539 -#define __NEED_I_SIZE_ORDERED
1540 -#define i_size_ordered_init(inode) seqcount_init(&inode->i_size_seqcount)
1541 -#else
1542 -#define i_size_ordered_init(inode) do { } while (0)
1543 -#endif
1544 -
1545 -struct inode {
1546 -       struct hlist_node       i_hash;
1547 -       struct list_head        i_list;
1548 -       struct list_head        i_sb_list;
1549 -       struct list_head        i_dentry;
1550 -       unsigned long           i_ino;
1551 -       atomic_t                i_count;
1552 -       unsigned int            i_nlink;
1553 -       uid_t                   i_uid;
1554 -       gid_t                   i_gid;
1555 -       tag_t                   i_tag;
1556 -       dev_t                   i_rdev;
1557 -       dev_t                   i_mdev;
1558 -       u64                     i_version;
1559 -       loff_t                  i_size;
1560 -#ifdef __NEED_I_SIZE_ORDERED
1561 -       seqcount_t              i_size_seqcount;
1562 -#endif
1563 -       struct timespec         i_atime;
1564 -       struct timespec         i_mtime;
1565 -       struct timespec         i_ctime;
1566 -       unsigned int            i_blkbits;
1567 -       blkcnt_t                i_blocks;
1568 -       unsigned short          i_bytes;
1569 -       umode_t                 i_mode;
1570 -       spinlock_t              i_lock; /* i_blocks, i_bytes, maybe i_size */
1571 -       struct mutex            i_mutex;
1572 -       struct rw_semaphore     i_alloc_sem;
1573 -       const struct inode_operations   *i_op;
1574 -       const struct file_operations    *i_fop; /* former ->i_op->default_file_ops */
1575 -       struct super_block      *i_sb;
1576 -       struct file_lock        *i_flock;
1577 -       struct address_space    *i_mapping;
1578 -       struct address_space    i_data;
1579 -#ifdef CONFIG_QUOTA
1580 -       struct dquot            *i_dquot[MAXQUOTAS];
1581 -#endif
1582 -       struct list_head        i_devices;
1583 -       union {
1584 -               struct pipe_inode_info  *i_pipe;
1585 -               struct block_device     *i_bdev;
1586 -               struct cdev             *i_cdev;
1587 -       };
1588 -       int                     i_cindex;
1589 -
1590 -       __u32                   i_generation;
1591 -
1592 -#ifdef CONFIG_DNOTIFY
1593 -       unsigned long           i_dnotify_mask; /* Directory notify events */
1594 -       struct dnotify_struct   *i_dnotify; /* for directory notifications */
1595 -#endif
1596 -
1597 -#ifdef CONFIG_INOTIFY
1598 -       struct list_head        inotify_watches; /* watches on this inode */
1599 -       struct mutex            inotify_mutex;  /* protects the watches list */
1600 -#endif
1601 -
1602 -       unsigned long           i_state;
1603 -       unsigned long           dirtied_when;   /* jiffies of first dirtying */
1604 -
1605 -       unsigned short          i_flags;
1606 -       unsigned short          i_vflags;
1607 -
1608 -       atomic_t                i_writecount;
1609 -#ifdef CONFIG_SECURITY
1610 -       void                    *i_security;
1611 -#endif
1612 -       void                    *i_private; /* fs or device private pointer */
1613 -};
1614 -
1615 -/*
1616 - * inode->i_mutex nesting subclasses for the lock validator:
1617 - *
1618 - * 0: the object of the current VFS operation
1619 - * 1: parent
1620 - * 2: child/target
1621 - * 3: quota file
1622 - *
1623 - * The locking order between these classes is
1624 - * parent -> child -> normal -> xattr -> quota
1625 - */
1626 -enum inode_i_mutex_lock_class
1627 -{
1628 -       I_MUTEX_NORMAL,
1629 -       I_MUTEX_PARENT,
1630 -       I_MUTEX_CHILD,
1631 -       I_MUTEX_XATTR,
1632 -       I_MUTEX_QUOTA
1633 -};
1634 -
1635 -extern void inode_double_lock(struct inode *inode1, struct inode *inode2);
1636 -extern void inode_double_unlock(struct inode *inode1, struct inode *inode2);
1637 -
1638 -/*
1639 - * NOTE: in a 32bit arch with a preemptable kernel and
1640 - * an UP compile the i_size_read/write must be atomic
1641 - * with respect to the local cpu (unlike with preempt disabled),
1642 - * but they don't need to be atomic with respect to other cpus like in
1643 - * true SMP (so they need either to either locally disable irq around
1644 - * the read or for example on x86 they can be still implemented as a
1645 - * cmpxchg8b without the need of the lock prefix). For SMP compiles
1646 - * and 64bit archs it makes no difference if preempt is enabled or not.
1647 - */
1648 -static inline loff_t i_size_read(const struct inode *inode)
1649 -{
1650 -#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
1651 -       loff_t i_size;
1652 -       unsigned int seq;
1653 -
1654 -       do {
1655 -               seq = read_seqcount_begin(&inode->i_size_seqcount);
1656 -               i_size = inode->i_size;
1657 -       } while (read_seqcount_retry(&inode->i_size_seqcount, seq));
1658 -       return i_size;
1659 -#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
1660 -       loff_t i_size;
1661 -
1662 -       preempt_disable();
1663 -       i_size = inode->i_size;
1664 -       preempt_enable();
1665 -       return i_size;
1666 -#else
1667 -       return inode->i_size;
1668 -#endif
1669 -}
1670 -
1671 -/*
1672 - * NOTE: unlike i_size_read(), i_size_write() does need locking around it
1673 - * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount
1674 - * can be lost, resulting in subsequent i_size_read() calls spinning forever.
1675 - */
1676 -static inline void i_size_write(struct inode *inode, loff_t i_size)
1677 -{
1678 -#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
1679 -       write_seqcount_begin(&inode->i_size_seqcount);
1680 -       inode->i_size = i_size;
1681 -       write_seqcount_end(&inode->i_size_seqcount);
1682 -#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
1683 -       preempt_disable();
1684 -       inode->i_size = i_size;
1685 -       preempt_enable();
1686 -#else
1687 -       inode->i_size = i_size;
1688 -#endif
1689 -}
1690 -
1691 -static inline unsigned iminor(const struct inode *inode)
1692 -{
1693 -       return MINOR(inode->i_mdev);
1694 -}
1695 -
1696 -static inline unsigned imajor(const struct inode *inode)
1697 -{
1698 -       return MAJOR(inode->i_mdev);
1699 -}
1700 -
1701 -extern struct block_device *I_BDEV(struct inode *inode);
1702 -
1703 -struct fown_struct {
1704 -       rwlock_t lock;          /* protects pid, uid, euid fields */
1705 -       struct pid *pid;        /* pid or -pgrp where SIGIO should be sent */
1706 -       enum pid_type pid_type; /* Kind of process group SIGIO should be sent to */
1707 -       uid_t uid, euid;        /* uid/euid of process setting the owner */
1708 -       int signum;             /* posix.1b rt signal to be delivered on IO */
1709 -};
1710 -
1711 -/*
1712 - * Track a single file's readahead state
1713 - */
1714 -struct file_ra_state {
1715 -       pgoff_t start;                  /* where readahead started */
1716 -       unsigned int size;              /* # of readahead pages */
1717 -       unsigned int async_size;        /* do asynchronous readahead when
1718 -                                          there are only # of pages ahead */
1719 -
1720 -       unsigned int ra_pages;          /* Maximum readahead window */
1721 -       int mmap_miss;                  /* Cache miss stat for mmap accesses */
1722 -       loff_t prev_pos;                /* Cache last read() position */
1723 -};
1724 -
1725 -/*
1726 - * Check if @index falls in the readahead windows.
1727 - */
1728 -static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
1729 -{
1730 -       return (index >= ra->start &&
1731 -               index <  ra->start + ra->size);
1732 -}
1733 -
1734 -#define FILE_MNT_WRITE_TAKEN   1
1735 -#define FILE_MNT_WRITE_RELEASED        2
1736 -
1737 -struct file {
1738 -       /*
1739 -        * fu_list becomes invalid after file_free is called and queued via
1740 -        * fu_rcuhead for RCU freeing
1741 -        */
1742 -       union {
1743 -               struct list_head        fu_list;
1744 -               struct rcu_head         fu_rcuhead;
1745 -       } f_u;
1746 -       struct path             f_path;
1747 -#define f_dentry       f_path.dentry
1748 -#define f_vfsmnt       f_path.mnt
1749 -       const struct file_operations    *f_op;
1750 -       atomic_long_t           f_count;
1751 -       unsigned int            f_flags;
1752 -       mode_t                  f_mode;
1753 -       loff_t                  f_pos;
1754 -       struct fown_struct      f_owner;
1755 -       unsigned int            f_uid, f_gid;
1756 -       xid_t                   f_xid;
1757 -       struct file_ra_state    f_ra;
1758 -
1759 -       u64                     f_version;
1760 -#ifdef CONFIG_SECURITY
1761 -       void                    *f_security;
1762 -#endif
1763 -       /* needed for tty driver, and maybe others */
1764 -       void                    *private_data;
1765 -
1766 -#ifdef CONFIG_EPOLL
1767 -       /* Used by fs/eventpoll.c to link all the hooks to this file */
1768 -       struct list_head        f_ep_links;
1769 -       spinlock_t              f_ep_lock;
1770 -#endif /* #ifdef CONFIG_EPOLL */
1771 -       struct address_space    *f_mapping;
1772 -#ifdef CONFIG_DEBUG_WRITECOUNT
1773 -       unsigned long f_mnt_write_state;
1774 -#endif
1775 -};
1776 -extern spinlock_t files_lock;
1777 -#define file_list_lock() spin_lock(&files_lock);
1778 -#define file_list_unlock() spin_unlock(&files_lock);
1779 -
1780 -#define get_file(x)    atomic_long_inc(&(x)->f_count)
1781 -#define file_count(x)  atomic_long_read(&(x)->f_count)
1782 -
1783 -#ifdef CONFIG_DEBUG_WRITECOUNT
1784 -static inline void file_take_write(struct file *f)
1785 -{
1786 -       WARN_ON(f->f_mnt_write_state != 0);
1787 -       f->f_mnt_write_state = FILE_MNT_WRITE_TAKEN;
1788 -}
1789 -static inline void file_release_write(struct file *f)
1790 -{
1791 -       f->f_mnt_write_state |= FILE_MNT_WRITE_RELEASED;
1792 -}
1793 -static inline void file_reset_write(struct file *f)
1794 -{
1795 -       f->f_mnt_write_state = 0;
1796 -}
1797 -static inline void file_check_state(struct file *f)
1798 -{
1799 -       /*
1800 -        * At this point, either both or neither of these bits
1801 -        * should be set.
1802 -        */
1803 -       WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN);
1804 -       WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_RELEASED);
1805 -}
1806 -static inline int file_check_writeable(struct file *f)
1807 -{
1808 -       if (f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN)
1809 -               return 0;
1810 -       printk(KERN_WARNING "writeable file with no "
1811 -                           "mnt_want_write()\n");
1812 -       WARN_ON(1);
1813 -       return -EINVAL;
1814 -}
1815 -#else /* !CONFIG_DEBUG_WRITECOUNT */
1816 -static inline void file_take_write(struct file *filp) {}
1817 -static inline void file_release_write(struct file *filp) {}
1818 -static inline void file_reset_write(struct file *filp) {}
1819 -static inline void file_check_state(struct file *filp) {}
1820 -static inline int file_check_writeable(struct file *filp)
1821 -{
1822 -       return 0;
1823 -}
1824 -#endif /* CONFIG_DEBUG_WRITECOUNT */
1825 -
1826 -#define        MAX_NON_LFS     ((1UL<<31) - 1)
1827 -
1828 -/* Page cache limit. The filesystems should put that into their s_maxbytes 
1829 -   limits, otherwise bad things can happen in VM. */ 
1830 -#if BITS_PER_LONG==32
1831 -#define MAX_LFS_FILESIZE       (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 
1832 -#elif BITS_PER_LONG==64
1833 -#define MAX_LFS_FILESIZE       0x7fffffffffffffffUL
1834 -#endif
1835 -
1836 -#define FL_POSIX       1
1837 -#define FL_FLOCK       2
1838 -#define FL_ACCESS      8       /* not trying to lock, just looking */
1839 -#define FL_EXISTS      16      /* when unlocking, test for existence */
1840 -#define FL_LEASE       32      /* lease held on this file */
1841 -#define FL_CLOSE       64      /* unlock on close */
1842 -#define FL_SLEEP       128     /* A blocking lock */
1843 -
1844 -/*
1845 - * Special return value from posix_lock_file() and vfs_lock_file() for
1846 - * asynchronous locking.
1847 - */
1848 -#define FILE_LOCK_DEFERRED 1
1849 -
1850 -/*
1851 - * The POSIX file lock owner is determined by
1852 - * the "struct files_struct" in the thread group
1853 - * (or NULL for no owner - BSD locks).
1854 - *
1855 - * Lockd stuffs a "host" pointer into this.
1856 - */
1857 -typedef struct files_struct *fl_owner_t;
1858 -
1859 -struct file_lock_operations {
1860 -       void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
1861 -       void (*fl_release_private)(struct file_lock *);
1862 -};
1863 -
1864 -struct lock_manager_operations {
1865 -       int (*fl_compare_owner)(struct file_lock *, struct file_lock *);
1866 -       void (*fl_notify)(struct file_lock *);  /* unblock callback */
1867 -       int (*fl_grant)(struct file_lock *, struct file_lock *, int);
1868 -       void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
1869 -       void (*fl_release_private)(struct file_lock *);
1870 -       void (*fl_break)(struct file_lock *);
1871 -       int (*fl_mylease)(struct file_lock *, struct file_lock *);
1872 -       int (*fl_change)(struct file_lock **, int);
1873 -};
1874 -
1875 -/* that will die - we need it for nfs_lock_info */
1876 -#include <linux/nfs_fs_i.h>
1877 -
1878 -struct file_lock {
1879 -       struct file_lock *fl_next;      /* singly linked list for this inode  */
1880 -       struct list_head fl_link;       /* doubly linked list of all locks */
1881 -       struct list_head fl_block;      /* circular list of blocked processes */
1882 -       fl_owner_t fl_owner;
1883 -       unsigned char fl_flags;
1884 -       unsigned char fl_type;
1885 -       unsigned int fl_pid;
1886 -       struct pid *fl_nspid;
1887 -       wait_queue_head_t fl_wait;
1888 -       struct file *fl_file;
1889 -       loff_t fl_start;
1890 -       loff_t fl_end;
1891 -       xid_t fl_xid;
1892 -
1893 -       struct fasync_struct *  fl_fasync; /* for lease break notifications */
1894 -       unsigned long fl_break_time;    /* for nonblocking lease breaks */
1895 -
1896 -       struct file_lock_operations *fl_ops;    /* Callbacks for filesystems */
1897 -       struct lock_manager_operations *fl_lmops;       /* Callbacks for lockmanagers */
1898 -       union {
1899 -               struct nfs_lock_info    nfs_fl;
1900 -               struct nfs4_lock_info   nfs4_fl;
1901 -               struct {
1902 -                       struct list_head link;  /* link in AFS vnode's pending_locks list */
1903 -                       int state;              /* state of grant or error if -ve */
1904 -               } afs;
1905 -       } fl_u;
1906 -};
1907 -
1908 -/* The following constant reflects the upper bound of the file/locking space */
1909 -#ifndef OFFSET_MAX
1910 -#define INT_LIMIT(x)   (~((x)1 << (sizeof(x)*8 - 1)))
1911 -#define OFFSET_MAX     INT_LIMIT(loff_t)
1912 -#define OFFT_OFFSET_MAX        INT_LIMIT(off_t)
1913 -#endif
1914 -
1915 -#include <linux/fcntl.h>
1916 -
1917 -extern int fcntl_getlk(struct file *, struct flock __user *);
1918 -extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
1919 -                       struct flock __user *);
1920 -
1921 -#if BITS_PER_LONG == 32
1922 -extern int fcntl_getlk64(struct file *, struct flock64 __user *);
1923 -extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
1924 -                       struct flock64 __user *);
1925 -#endif
1926 -
1927 -extern void send_sigio(struct fown_struct *fown, int fd, int band);
1928 -extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
1929 -extern int fcntl_getlease(struct file *filp);
1930 -
1931 -/* fs/sync.c */
1932 -extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1933 -                       loff_t endbyte, unsigned int flags);
1934 -
1935 -/* fs/locks.c */
1936 -extern void locks_init_lock(struct file_lock *);
1937 -extern void locks_copy_lock(struct file_lock *, struct file_lock *);
1938 -extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
1939 -extern void locks_remove_posix(struct file *, fl_owner_t);
1940 -extern void locks_remove_flock(struct file *);
1941 -extern void posix_test_lock(struct file *, struct file_lock *);
1942 -extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
1943 -extern int posix_lock_file_wait(struct file *, struct file_lock *);
1944 -extern int posix_unblock_lock(struct file *, struct file_lock *);
1945 -extern int vfs_test_lock(struct file *, struct file_lock *);
1946 -extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
1947 -extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
1948 -extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
1949 -extern int __break_lease(struct inode *inode, unsigned int flags);
1950 -extern void lease_get_mtime(struct inode *, struct timespec *time);
1951 -extern int generic_setlease(struct file *, long, struct file_lock **);
1952 -extern int vfs_setlease(struct file *, long, struct file_lock **);
1953 -extern int lease_modify(struct file_lock **, int);
1954 -extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1955 -extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1956 -extern struct seq_operations locks_seq_operations;
1957 -
1958 -struct fasync_struct {
1959 -       int     magic;
1960 -       int     fa_fd;
1961 -       struct  fasync_struct   *fa_next; /* singly linked list */
1962 -       struct  file            *fa_file;
1963 -};
1964 -
1965 -#define FASYNC_MAGIC 0x4601
1966 -
1967 -/* SMP safe fasync helpers: */
1968 -extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
1969 -/* can be called from interrupts */
1970 -extern void kill_fasync(struct fasync_struct **, int, int);
1971 -/* only for net: no internal synchronization */
1972 -extern void __kill_fasync(struct fasync_struct *, int, int);
1973 -
1974 -extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
1975 -extern int f_setown(struct file *filp, unsigned long arg, int force);
1976 -extern void f_delown(struct file *filp);
1977 -extern pid_t f_getown(struct file *filp);
1978 -extern int send_sigurg(struct fown_struct *fown);
1979 -
1980 -/*
1981 - *     Umount options
1982 - */
1983 -
1984 -#define MNT_FORCE      0x00000001      /* Attempt to forcibily umount */
1985 -#define MNT_DETACH     0x00000002      /* Just detach from the tree */
1986 -#define MNT_EXPIRE     0x00000004      /* Mark for expiry */
1987 -
1988 -extern struct list_head super_blocks;
1989 -extern spinlock_t sb_lock;
1990 -
1991 -#define sb_entry(list)  list_entry((list), struct super_block, s_list)
1992 -#define S_BIAS (1<<30)
1993 -struct super_block {
1994 -       struct list_head        s_list;         /* Keep this first */
1995 -       dev_t                   s_dev;          /* search index; _not_ kdev_t */
1996 -       unsigned long           s_blocksize;
1997 -       unsigned char           s_blocksize_bits;
1998 -       unsigned char           s_dirt;
1999 -       unsigned long long      s_maxbytes;     /* Max file size */
2000 -       struct file_system_type *s_type;
2001 -       const struct super_operations   *s_op;
2002 -       struct dquot_operations *dq_op;
2003 -       struct quotactl_ops     *s_qcop;
2004 -       const struct export_operations *s_export_op;
2005 -       unsigned long           s_flags;
2006 -       unsigned long           s_magic;
2007 -       struct dentry           *s_root;
2008 -       struct rw_semaphore     s_umount;
2009 -       struct mutex            s_lock;
2010 -       int                     s_count;
2011 -       int                     s_need_sync_fs;
2012 -       atomic_t                s_active;
2013 -#ifdef CONFIG_SECURITY
2014 -       void                    *s_security;
2015 -#endif
2016 -       struct xattr_handler    **s_xattr;
2017 -
2018 -       struct list_head        s_inodes;       /* all inodes */
2019 -       struct list_head        s_dirty;        /* dirty inodes */
2020 -       struct list_head        s_io;           /* parked for writeback */
2021 -       struct list_head        s_more_io;      /* parked for more writeback */
2022 -       struct hlist_head       s_anon;         /* anonymous dentries for (nfs) exporting */
2023 -       struct list_head        s_files;
2024 -       /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
2025 -       struct list_head        s_dentry_lru;   /* unused dentry lru */
2026 -       int                     s_nr_dentry_unused;     /* # of dentry on lru */
2027 -
2028 -       struct block_device     *s_bdev;
2029 -       struct mtd_info         *s_mtd;
2030 -       struct list_head        s_instances;
2031 -       struct quota_info       s_dquot;        /* Diskquota specific options */
2032 -
2033 -       int                     s_frozen;
2034 -       wait_queue_head_t       s_wait_unfrozen;
2035 -
2036 -       char s_id[32];                          /* Informational name */
2037 -
2038 -       void                    *s_fs_info;     /* Filesystem private info */
2039 -
2040 -       /*
2041 -        * The next field is for VFS *only*. No filesystems have any business
2042 -        * even looking at it. You had been warned.
2043 -        */
2044 -       struct mutex s_vfs_rename_mutex;        /* Kludge */
2045 -
2046 -       /* Granularity of c/m/atime in ns.
2047 -          Cannot be worse than a second */
2048 -       u32                s_time_gran;
2049 -
2050 -       /*
2051 -        * Filesystem subtype.  If non-empty the filesystem type field
2052 -        * in /proc/mounts will be "type.subtype"
2053 -        */
2054 -       char *s_subtype;
2055 -
2056 -       /*
2057 -        * Saved mount options for lazy filesystems using
2058 -        * generic_show_options()
2059 -        */
2060 -       char *s_options;
2061 -};
2062 -
2063 -extern struct timespec current_fs_time(struct super_block *sb);
2064 -
2065 -/*
2066 - * Snapshotting support.
2067 - */
2068 -enum {
2069 -       SB_UNFROZEN = 0,
2070 -       SB_FREEZE_WRITE = 1,
2071 -       SB_FREEZE_TRANS = 2,
2072 -};
2073 -
2074 -#define vfs_check_frozen(sb, level) \
2075 -       wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
2076 -
2077 -#define get_fs_excl() atomic_inc(&current->fs_excl)
2078 -#define put_fs_excl() atomic_dec(&current->fs_excl)
2079 -#define has_fs_excl() atomic_read(&current->fs_excl)
2080 -
2081 -#define is_owner_or_cap(inode) \
2082 -       ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER))
2083 -
2084 -/* not quite ready to be deprecated, but... */
2085 -extern void lock_super(struct super_block *);
2086 -extern void unlock_super(struct super_block *);
2087 -
2088 -/*
2089 - * VFS helper functions..
2090 - */
2091 -extern int vfs_permission(struct nameidata *, int);
2092 -extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
2093 -extern int vfs_mkdir(struct inode *, struct dentry *, int);
2094 -extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
2095 -extern int vfs_symlink(struct inode *, struct dentry *, const char *);
2096 -extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
2097 -extern int vfs_rmdir(struct inode *, struct dentry *);
2098 -extern int vfs_unlink(struct inode *, struct dentry *);
2099 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2100 -
2101 -/*
2102 - * VFS dentry helper functions.
2103 - */
2104 -extern void dentry_unhash(struct dentry *dentry);
2105 -
2106 -/*
2107 - * VFS file helper functions.
2108 - */
2109 -extern int file_permission(struct file *, int);
2110 -
2111 -/*
2112 - * File types
2113 - *
2114 - * NOTE! These match bits 12..15 of stat.st_mode
2115 - * (ie "(i_mode >> 12) & 15").
2116 - */
2117 -#define DT_UNKNOWN     0
2118 -#define DT_FIFO                1
2119 -#define DT_CHR         2
2120 -#define DT_DIR         4
2121 -#define DT_BLK         6
2122 -#define DT_REG         8
2123 -#define DT_LNK         10
2124 -#define DT_SOCK                12
2125 -#define DT_WHT         14
2126 -
2127 -#define OSYNC_METADATA (1<<0)
2128 -#define OSYNC_DATA     (1<<1)
2129 -#define OSYNC_INODE    (1<<2)
2130 -int generic_osync_inode(struct inode *, struct address_space *, int);
2131 -
2132 -/*
2133 - * This is the "filldir" function type, used by readdir() to let
2134 - * the kernel specify what kind of dirent layout it wants to have.
2135 - * This allows the kernel to read directories into kernel space or
2136 - * to have different dirent layouts depending on the binary type.
2137 - */
2138 -typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
2139 -
2140 -struct block_device_operations {
2141 -       int (*open) (struct inode *, struct file *);
2142 -       int (*release) (struct inode *, struct file *);
2143 -       int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
2144 -       long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
2145 -       long (*compat_ioctl) (struct file *, unsigned, unsigned long);
2146 -       int (*direct_access) (struct block_device *, sector_t,
2147 -                                               void **, unsigned long *);
2148 -       int (*media_changed) (struct gendisk *);
2149 -       int (*revalidate_disk) (struct gendisk *);
2150 -       int (*getgeo)(struct block_device *, struct hd_geometry *);
2151 -       struct module *owner;
2152 -};
2153 -
2154 -/* These macros are for out of kernel modules to test that
2155 - * the kernel supports the unlocked_ioctl and compat_ioctl
2156 - * fields in struct file_operations. */
2157 -#define HAVE_COMPAT_IOCTL 1
2158 -#define HAVE_UNLOCKED_IOCTL 1
2159 -
2160 -/*
2161 - * NOTE:
2162 - * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl
2163 - * can be called without the big kernel lock held in all filesystems.
2164 - */
2165 -struct file_operations {
2166 -       struct module *owner;
2167 -       loff_t (*llseek) (struct file *, loff_t, int);
2168 -       ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
2169 -       ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
2170 -       ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
2171 -       ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
2172 -       int (*readdir) (struct file *, void *, filldir_t);
2173 -       unsigned int (*poll) (struct file *, struct poll_table_struct *);
2174 -       int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
2175 -       long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
2176 -       long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
2177 -       int (*mmap) (struct file *, struct vm_area_struct *);
2178 -       int (*open) (struct inode *, struct file *);
2179 -       int (*flush) (struct file *, fl_owner_t id);
2180 -       int (*release) (struct inode *, struct file *);
2181 -       int (*fsync) (struct file *, struct dentry *, int datasync);
2182 -       int (*aio_fsync) (struct kiocb *, int datasync);
2183 -       int (*fasync) (int, struct file *, int);
2184 -       int (*lock) (struct file *, int, struct file_lock *);
2185 -       ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
2186 -       unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
2187 -       int (*check_flags)(int);
2188 -       int (*dir_notify)(struct file *filp, unsigned long arg);
2189 -       int (*flock) (struct file *, int, struct file_lock *);
2190 -       ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
2191 -       ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
2192 -       int (*setlease)(struct file *, long, struct file_lock **);
2193 -};
2194 -
2195 -struct inode_operations {
2196 -       int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
2197 -       struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
2198 -       int (*link) (struct dentry *,struct inode *,struct dentry *);
2199 -       int (*unlink) (struct inode *,struct dentry *);
2200 -       int (*symlink) (struct inode *,struct dentry *,const char *);
2201 -       int (*mkdir) (struct inode *,struct dentry *,int);
2202 -       int (*rmdir) (struct inode *,struct dentry *);
2203 -       int (*mknod) (struct inode *,struct dentry *,int,dev_t);
2204 -       int (*rename) (struct inode *, struct dentry *,
2205 -                       struct inode *, struct dentry *);
2206 -       int (*readlink) (struct dentry *, char __user *,int);
2207 -       void * (*follow_link) (struct dentry *, struct nameidata *);
2208 -       void (*put_link) (struct dentry *, struct nameidata *, void *);
2209 -       void (*truncate) (struct inode *);
2210 -       int (*permission) (struct inode *, int);
2211 -       int (*setattr) (struct dentry *, struct iattr *);
2212 -       int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
2213 -       int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
2214 -       ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
2215 -       ssize_t (*listxattr) (struct dentry *, char *, size_t);
2216 -       int (*removexattr) (struct dentry *, const char *);
2217 -       void (*truncate_range)(struct inode *, loff_t, loff_t);
2218 -       long (*fallocate)(struct inode *inode, int mode, loff_t offset,
2219 -                         loff_t len);
2220 -       int (*sync_flags) (struct inode *);
2221 -};
2222 -
2223 -struct seq_file;
2224 -
2225 -ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
2226 -                               unsigned long nr_segs, unsigned long fast_segs,
2227 -                               struct iovec *fast_pointer,
2228 -                               struct iovec **ret_pointer);
2229 -
2230 -extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
2231 -extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
2232 -extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
2233 -               unsigned long, loff_t *);
2234 -extern ssize_t vfs_writev(struct file *, const struct iovec __user *,
2235 -               unsigned long, loff_t *);
2236 -ssize_t vfs_sendfile(struct file *, struct file *, loff_t *, size_t, loff_t);
2237 -
2238 -struct super_operations {
2239 -       struct inode *(*alloc_inode)(struct super_block *sb);
2240 -       void (*destroy_inode)(struct inode *);
2241 -
2242 -       void (*dirty_inode) (struct inode *);
2243 -       int (*write_inode) (struct inode *, int);
2244 -       void (*drop_inode) (struct inode *);
2245 -       void (*delete_inode) (struct inode *);
2246 -       void (*put_super) (struct super_block *);
2247 -       void (*write_super) (struct super_block *);
2248 -       int (*sync_fs)(struct super_block *sb, int wait);
2249 -       void (*write_super_lockfs) (struct super_block *);
2250 -       void (*unlockfs) (struct super_block *);
2251 -       int (*statfs) (struct dentry *, struct kstatfs *);
2252 -       int (*remount_fs) (struct super_block *, int *, char *);
2253 -       void (*clear_inode) (struct inode *);
2254 -       void (*umount_begin) (struct super_block *);
2255 -
2256 -       int (*show_options)(struct seq_file *, struct vfsmount *);
2257 -       int (*show_stats)(struct seq_file *, struct vfsmount *);
2258 -#ifdef CONFIG_QUOTA
2259 -       ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
2260 -       ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
2261 -#endif
2262 -};
2263 -
2264 -/*
2265 - * Inode state bits.  Protected by inode_lock.
2266 - *
2267 - * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
2268 - * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
2269 - *
2270 - * Four bits define the lifetime of an inode.  Initially, inodes are I_NEW,
2271 - * until that flag is cleared.  I_WILL_FREE, I_FREEING and I_CLEAR are set at
2272 - * various stages of removing an inode.
2273 - *
2274 - * Two bits are used for locking and completion notification, I_LOCK and I_SYNC.
2275 - *
2276 - * I_DIRTY_SYNC                Inode is dirty, but doesn't have to be written on
2277 - *                     fdatasync().  i_atime is the usual cause.
2278 - * I_DIRTY_DATASYNC    Data-related inode changes pending. We keep track of
2279 - *                     these changes separately from I_DIRTY_SYNC so that we
2280 - *                     don't have to write inode on fdatasync() when only
2281 - *                     mtime has changed in it.
2282 - * I_DIRTY_PAGES       Inode has dirty pages.  Inode itself may be clean.
2283 - * I_NEW               get_new_inode() sets i_state to I_LOCK|I_NEW.  Both
2284 - *                     are cleared by unlock_new_inode(), called from iget().
2285 - * I_WILL_FREE         Must be set when calling write_inode_now() if i_count
2286 - *                     is zero.  I_FREEING must be set when I_WILL_FREE is
2287 - *                     cleared.
2288 - * I_FREEING           Set when inode is about to be freed but still has dirty
2289 - *                     pages or buffers attached or the inode itself is still
2290 - *                     dirty.
2291 - * I_CLEAR             Set by clear_inode().  In this state the inode is clean
2292 - *                     and can be destroyed.
2293 - *
2294 - *                     Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
2295 - *                     prohibited for many purposes.  iget() must wait for
2296 - *                     the inode to be completely released, then create it
2297 - *                     anew.  Other functions will just ignore such inodes,
2298 - *                     if appropriate.  I_LOCK is used for waiting.
2299 - *
2300 - * I_LOCK              Serves as both a mutex and completion notification.
2301 - *                     New inodes set I_LOCK.  If two processes both create
2302 - *                     the same inode, one of them will release its inode and
2303 - *                     wait for I_LOCK to be released before returning.
2304 - *                     Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can
2305 - *                     also cause waiting on I_LOCK, without I_LOCK actually
2306 - *                     being set.  find_inode() uses this to prevent returning
2307 - *                     nearly-dead inodes.
2308 - * I_SYNC              Similar to I_LOCK, but limited in scope to writeback
2309 - *                     of inode dirty data.  Having a separate lock for this
2310 - *                     purpose reduces latency and prevents some filesystem-
2311 - *                     specific deadlocks.
2312 - *
2313 - * Q: What is the difference between I_WILL_FREE and I_FREEING?
2314 - * Q: igrab() only checks on (I_FREEING|I_WILL_FREE).  Should it also check on
2315 - *    I_CLEAR?  If not, why?
2316 - */
2317 -#define I_DIRTY_SYNC           1
2318 -#define I_DIRTY_DATASYNC       2
2319 -#define I_DIRTY_PAGES          4
2320 -#define I_NEW                  8
2321 -#define I_WILL_FREE            16
2322 -#define I_FREEING              32
2323 -#define I_CLEAR                        64
2324 -#define __I_LOCK               7
2325 -#define I_LOCK                 (1 << __I_LOCK)
2326 -#define __I_SYNC               8
2327 -#define I_SYNC                 (1 << __I_SYNC)
2328 -
2329 -#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
2330 -
2331 -extern void __mark_inode_dirty(struct inode *, int);
2332 -static inline void mark_inode_dirty(struct inode *inode)
2333 -{
2334 -       __mark_inode_dirty(inode, I_DIRTY);
2335 -}
2336 -
2337 -static inline void mark_inode_dirty_sync(struct inode *inode)
2338 -{
2339 -       __mark_inode_dirty(inode, I_DIRTY_SYNC);
2340 -}
2341 -
2342 -/**
2343 - * inc_nlink - directly increment an inode's link count
2344 - * @inode: inode
2345 - *
2346 - * This is a low-level filesystem helper to replace any
2347 - * direct filesystem manipulation of i_nlink.  Currently,
2348 - * it is only here for parity with dec_nlink().
2349 - */
2350 -static inline void inc_nlink(struct inode *inode)
2351 -{
2352 -       inode->i_nlink++;
2353 -}
2354 -
2355 -static inline void inode_inc_link_count(struct inode *inode)
2356 -{
2357 -       inc_nlink(inode);
2358 -       mark_inode_dirty(inode);
2359 -}
2360 -
2361 -/**
2362 - * drop_nlink - directly drop an inode's link count
2363 - * @inode: inode
2364 - *
2365 - * This is a low-level filesystem helper to replace any
2366 - * direct filesystem manipulation of i_nlink.  In cases
2367 - * where we are attempting to track writes to the
2368 - * filesystem, a decrement to zero means an imminent
2369 - * write when the file is truncated and actually unlinked
2370 - * on the filesystem.
2371 - */
2372 -static inline void drop_nlink(struct inode *inode)
2373 -{
2374 -       inode->i_nlink--;
2375 -}
2376 -
2377 -/**
2378 - * clear_nlink - directly zero an inode's link count
2379 - * @inode: inode
2380 - *
2381 - * This is a low-level filesystem helper to replace any
2382 - * direct filesystem manipulation of i_nlink.  See
2383 - * drop_nlink() for why we care about i_nlink hitting zero.
2384 - */
2385 -static inline void clear_nlink(struct inode *inode)
2386 -{
2387 -       inode->i_nlink = 0;
2388 -}
2389 -
2390 -static inline void inode_dec_link_count(struct inode *inode)
2391 -{
2392 -       drop_nlink(inode);
2393 -       mark_inode_dirty(inode);
2394 -}
2395 -
2396 -/**
2397 - * inode_inc_iversion - increments i_version
2398 - * @inode: inode that need to be updated
2399 - *
2400 - * Every time the inode is modified, the i_version field will be incremented.
2401 - * The filesystem has to be mounted with i_version flag
2402 - */
2403 -
2404 -static inline void inode_inc_iversion(struct inode *inode)
2405 -{
2406 -       spin_lock(&inode->i_lock);
2407 -       inode->i_version++;
2408 -       spin_unlock(&inode->i_lock);
2409 -}
2410 -
2411 -extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
2412 -static inline void file_accessed(struct file *file)
2413 -{
2414 -       if (!(file->f_flags & O_NOATIME))
2415 -               touch_atime(file->f_path.mnt, file->f_path.dentry);
2416 -}
2417 -
2418 -int sync_inode(struct inode *inode, struct writeback_control *wbc);
2419 -
2420 -struct file_system_type {
2421 -       const char *name;
2422 -       int fs_flags;
2423 -       int (*get_sb) (struct file_system_type *, int,
2424 -                      const char *, void *, struct vfsmount *);
2425 -       void (*kill_sb) (struct super_block *);
2426 -       struct module *owner;
2427 -       struct file_system_type * next;
2428 -       struct list_head fs_supers;
2429 -
2430 -       struct lock_class_key s_lock_key;
2431 -       struct lock_class_key s_umount_key;
2432 -
2433 -       struct lock_class_key i_lock_key;
2434 -       struct lock_class_key i_mutex_key;
2435 -       struct lock_class_key i_mutex_dir_key;
2436 -       struct lock_class_key i_alloc_sem_key;
2437 -};
2438 -
2439 -extern int get_sb_bdev(struct file_system_type *fs_type,
2440 -       int flags, const char *dev_name, void *data,
2441 -       int (*fill_super)(struct super_block *, void *, int),
2442 -       struct vfsmount *mnt);
2443 -extern int get_sb_single(struct file_system_type *fs_type,
2444 -       int flags, void *data,
2445 -       int (*fill_super)(struct super_block *, void *, int),
2446 -       struct vfsmount *mnt);
2447 -extern int get_sb_nodev(struct file_system_type *fs_type,
2448 -       int flags, void *data,
2449 -       int (*fill_super)(struct super_block *, void *, int),
2450 -       struct vfsmount *mnt);
2451 -void generic_shutdown_super(struct super_block *sb);
2452 -void kill_block_super(struct super_block *sb);
2453 -void kill_anon_super(struct super_block *sb);
2454 -void kill_litter_super(struct super_block *sb);
2455 -void deactivate_super(struct super_block *sb);
2456 -int set_anon_super(struct super_block *s, void *data);
2457 -struct super_block *sget(struct file_system_type *type,
2458 -                       int (*test)(struct super_block *,void *),
2459 -                       int (*set)(struct super_block *,void *),
2460 -                       void *data);
2461 -extern int get_sb_pseudo(struct file_system_type *, char *,
2462 -       const struct super_operations *ops, unsigned long,
2463 -       struct vfsmount *mnt);
2464 -extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
2465 -int __put_super_and_need_restart(struct super_block *sb);
2466 -void unnamed_dev_init(void);
2467 -
2468 -/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
2469 -#define fops_get(fops) \
2470 -       (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
2471 -#define fops_put(fops) \
2472 -       do { if (fops) module_put((fops)->owner); } while(0)
2473 -
2474 -extern int register_filesystem(struct file_system_type *);
2475 -extern int unregister_filesystem(struct file_system_type *);
2476 -extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
2477 -#define kern_mount(type) kern_mount_data(type, NULL)
2478 -extern int may_umount_tree(struct vfsmount *);
2479 -extern int may_umount(struct vfsmount *);
2480 -extern long do_mount(char *, char *, char *, unsigned long, void *);
2481 -extern struct vfsmount *collect_mounts(struct vfsmount *, struct dentry *);
2482 -extern void drop_collected_mounts(struct vfsmount *);
2483 -
2484 -extern int vfs_statfs(struct dentry *, struct kstatfs *);
2485 -
2486 -/* /sys/fs */
2487 -extern struct kobject *fs_kobj;
2488 -
2489 -#define FLOCK_VERIFY_READ  1
2490 -#define FLOCK_VERIFY_WRITE 2
2491 -
2492 -extern int locks_mandatory_locked(struct inode *);
2493 -extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
2494 -
2495 -/*
2496 - * Candidates for mandatory locking have the setgid bit set
2497 - * but no group execute bit -  an otherwise meaningless combination.
2498 - */
2499 -
2500 -static inline int __mandatory_lock(struct inode *ino)
2501 -{
2502 -       return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
2503 -}
2504 -
2505 -/*
2506 - * ... and these candidates should be on MS_MANDLOCK mounted fs,
2507 - * otherwise these will be advisory locks
2508 - */
2509 -
2510 -static inline int mandatory_lock(struct inode *ino)
2511 -{
2512 -       return IS_MANDLOCK(ino) && __mandatory_lock(ino);
2513 -}
2514 -
2515 -static inline int locks_verify_locked(struct inode *inode)
2516 -{
2517 -       if (mandatory_lock(inode))
2518 -               return locks_mandatory_locked(inode);
2519 -       return 0;
2520 -}
2521 -
2522 -extern int rw_verify_area(int, struct file *, loff_t *, size_t);
2523 -
2524 -static inline int locks_verify_truncate(struct inode *inode,
2525 -                                   struct file *filp,
2526 -                                   loff_t size)
2527 -{
2528 -       if (inode->i_flock && mandatory_lock(inode))
2529 -               return locks_mandatory_area(
2530 -                       FLOCK_VERIFY_WRITE, inode, filp,
2531 -                       size < inode->i_size ? size : inode->i_size,
2532 -                       (size < inode->i_size ? inode->i_size - size
2533 -                        : size - inode->i_size)
2534 -               );
2535 -       return 0;
2536 -}
2537 -
2538 -static inline int break_lease(struct inode *inode, unsigned int mode)
2539 -{
2540 -       if (inode->i_flock)
2541 -               return __break_lease(inode, mode);
2542 -       return 0;
2543 -}
2544 -
2545 -/* fs/open.c */
2546 -
2547 -extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
2548 -                      struct file *filp);
2549 -extern long do_sys_open(int dfd, const char __user *filename, int flags,
2550 -                       int mode);
2551 -extern struct file *filp_open(const char *, int, int);
2552 -extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
2553 -extern int filp_close(struct file *, fl_owner_t id);
2554 -extern char * getname(const char __user *);
2555 -
2556 -/* fs/dcache.c */
2557 -extern void __init vfs_caches_init_early(void);
2558 -extern void __init vfs_caches_init(unsigned long);
2559 -
2560 -extern struct kmem_cache *names_cachep;
2561 -
2562 -#define __getname()    kmem_cache_alloc(names_cachep, GFP_KERNEL)
2563 -#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
2564 -#ifndef CONFIG_AUDITSYSCALL
2565 -#define putname(name)   __putname(name)
2566 -#else
2567 -extern void putname(const char *name);
2568 -#endif
2569 -
2570 -#ifdef CONFIG_BLOCK
2571 -extern int register_blkdev(unsigned int, const char *);
2572 -extern void unregister_blkdev(unsigned int, const char *);
2573 -extern struct block_device *bdget(dev_t);
2574 -extern void bd_set_size(struct block_device *, loff_t size);
2575 -extern void bd_forget(struct inode *inode);
2576 -extern void bdput(struct block_device *);
2577 -extern struct block_device *open_by_devnum(dev_t, unsigned);
2578 -#else
2579 -static inline void bd_forget(struct inode *inode) {}
2580 -#endif
2581 -extern const struct file_operations def_blk_fops;
2582 -extern const struct file_operations def_chr_fops;
2583 -extern const struct file_operations bad_sock_fops;
2584 -extern const struct file_operations def_fifo_fops;
2585 -#ifdef CONFIG_BLOCK
2586 -extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
2587 -extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
2588 -extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
2589 -                              struct gendisk *disk, unsigned cmd,
2590 -                              unsigned long arg);
2591 -extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
2592 -extern int blkdev_get(struct block_device *, mode_t, unsigned);
2593 -extern int blkdev_put(struct block_device *);
2594 -extern int bd_claim(struct block_device *, void *);
2595 -extern void bd_release(struct block_device *);
2596 -#ifdef CONFIG_SYSFS
2597 -extern int bd_claim_by_disk(struct block_device *, void *, struct gendisk *);
2598 -extern void bd_release_from_disk(struct block_device *, struct gendisk *);
2599 -#else
2600 -#define bd_claim_by_disk(bdev, holder, disk)   bd_claim(bdev, holder)
2601 -#define bd_release_from_disk(bdev, disk)       bd_release(bdev)
2602 -#endif
2603 -#endif
2604 -
2605 -/* fs/char_dev.c */
2606 -#define CHRDEV_MAJOR_HASH_SIZE 255
2607 -extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
2608 -extern int register_chrdev_region(dev_t, unsigned, const char *);
2609 -extern int register_chrdev(unsigned int, const char *,
2610 -                          const struct file_operations *);
2611 -extern void unregister_chrdev(unsigned int, const char *);
2612 -extern void unregister_chrdev_region(dev_t, unsigned);
2613 -extern void chrdev_show(struct seq_file *,off_t);
2614 -
2615 -/* fs/block_dev.c */
2616 -#define BDEVNAME_SIZE  32      /* Largest string for a blockdev identifier */
2617 -
2618 -#ifdef CONFIG_BLOCK
2619 -#define BLKDEV_MAJOR_HASH_SIZE 255
2620 -extern const char *__bdevname(dev_t, char *buffer);
2621 -extern const char *bdevname(struct block_device *bdev, char *buffer);
2622 -extern struct block_device *lookup_bdev(const char *);
2623 -extern struct block_device *open_bdev_excl(const char *, int, void *);
2624 -extern void close_bdev_excl(struct block_device *);
2625 -extern void blkdev_show(struct seq_file *,off_t);
2626 -#else
2627 -#define BLKDEV_MAJOR_HASH_SIZE 0
2628 -#endif
2629 -
2630 -extern void init_special_inode(struct inode *, umode_t, dev_t);
2631 -
2632 -/* Invalid inode operations -- fs/bad_inode.c */
2633 -extern void make_bad_inode(struct inode *);
2634 -extern int is_bad_inode(struct inode *);
2635 -
2636 -extern const struct file_operations read_pipefifo_fops;
2637 -extern const struct file_operations write_pipefifo_fops;
2638 -extern const struct file_operations rdwr_pipefifo_fops;
2639 -
2640 -extern int fs_may_remount_ro(struct super_block *);
2641 -
2642 -#ifdef CONFIG_BLOCK
2643 -/*
2644 - * return READ, READA, or WRITE
2645 - */
2646 -#define bio_rw(bio)            ((bio)->bi_rw & (RW_MASK | RWA_MASK))
2647 -
2648 -/*
2649 - * return data direction, READ or WRITE
2650 - */
2651 -#define bio_data_dir(bio)      ((bio)->bi_rw & 1)
2652 -
2653 -extern int check_disk_change(struct block_device *);
2654 -extern int __invalidate_device(struct block_device *);
2655 -extern int invalidate_partition(struct gendisk *, int);
2656 -#endif
2657 -extern int invalidate_inodes(struct super_block *);
2658 -unsigned long __invalidate_mapping_pages(struct address_space *mapping,
2659 -                                       pgoff_t start, pgoff_t end,
2660 -                                       bool be_atomic);
2661 -unsigned long invalidate_mapping_pages(struct address_space *mapping,
2662 -                                       pgoff_t start, pgoff_t end);
2663 -
2664 -static inline unsigned long __deprecated
2665 -invalidate_inode_pages(struct address_space *mapping)
2666 -{
2667 -       return invalidate_mapping_pages(mapping, 0, ~0UL);
2668 -}
2669 -
2670 -static inline void invalidate_remote_inode(struct inode *inode)
2671 -{
2672 -       if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
2673 -           S_ISLNK(inode->i_mode))
2674 -               invalidate_mapping_pages(inode->i_mapping, 0, -1);
2675 -}
2676 -extern int invalidate_inode_pages2(struct address_space *mapping);
2677 -extern int invalidate_inode_pages2_range(struct address_space *mapping,
2678 -                                        pgoff_t start, pgoff_t end);
2679 -extern void generic_sync_sb_inodes(struct super_block *sb,
2680 -                               struct writeback_control *wbc);
2681 -extern int write_inode_now(struct inode *, int);
2682 -extern int filemap_fdatawrite(struct address_space *);
2683 -extern int filemap_flush(struct address_space *);
2684 -extern int filemap_fdatawait(struct address_space *);
2685 -extern int filemap_write_and_wait(struct address_space *mapping);
2686 -extern int filemap_write_and_wait_range(struct address_space *mapping,
2687 -                                       loff_t lstart, loff_t lend);
2688 -extern int wait_on_page_writeback_range(struct address_space *mapping,
2689 -                               pgoff_t start, pgoff_t end);
2690 -extern int __filemap_fdatawrite_range(struct address_space *mapping,
2691 -                               loff_t start, loff_t end, int sync_mode);
2692 -extern int filemap_fdatawrite_range(struct address_space *mapping,
2693 -                               loff_t start, loff_t end);
2694 -
2695 -extern long do_fsync(struct file *file, int datasync);
2696 -extern void sync_supers(void);
2697 -extern void sync_filesystems(int wait);
2698 -extern void __fsync_super(struct super_block *sb);
2699 -extern void emergency_sync(void);
2700 -extern void emergency_remount(void);
2701 -extern int do_remount_sb(struct super_block *sb, int flags,
2702 -                        void *data, int force);
2703 -#ifdef CONFIG_BLOCK
2704 -extern sector_t bmap(struct inode *, sector_t);
2705 -#endif
2706 -extern int notify_change(struct dentry *, struct iattr *);
2707 -extern int inode_permission(struct inode *, int);
2708 -extern int generic_permission(struct inode *, int,
2709 -               int (*check_acl)(struct inode *, int));
2710 -
2711 -extern int get_write_access(struct inode *);
2712 -extern int deny_write_access(struct file *);
2713 -static inline void put_write_access(struct inode * inode)
2714 -{
2715 -       atomic_dec(&inode->i_writecount);
2716 -}
2717 -static inline void allow_write_access(struct file *file)
2718 -{
2719 -       if (file)
2720 -               atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
2721 -}
2722 -extern int do_pipe(int *);
2723 -extern int do_pipe_flags(int *, int);
2724 -extern struct file *create_read_pipe(struct file *f, int flags);
2725 -extern struct file *create_write_pipe(int flags);
2726 -extern void free_write_pipe(struct file *);
2727 -
2728 -extern struct file *do_filp_open(int dfd, const char *pathname,
2729 -               int open_flag, int mode);
2730 -extern int may_open(struct nameidata *, int, int);
2731 -
2732 -extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
2733 -extern struct file * open_exec(const char *);
2734
2735 -/* fs/dcache.c -- generic fs support functions */
2736 -extern int is_subdir(struct dentry *, struct dentry *);
2737 -extern ino_t find_inode_number(struct dentry *, struct qstr *);
2738 -
2739 -#include <linux/err.h>
2740 -
2741 -/* needed for stackable file system support */
2742 -extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
2743 -
2744 -extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
2745 -
2746 -extern void inode_init_once(struct inode *);
2747 -extern void iput(struct inode *);
2748 -extern struct inode * igrab(struct inode *);
2749 -extern ino_t iunique(struct super_block *, ino_t);
2750 -extern int inode_needs_sync(struct inode *inode);
2751 -extern void generic_delete_inode(struct inode *inode);
2752 -extern void generic_drop_inode(struct inode *inode);
2753 -
2754 -extern struct inode *ilookup5_nowait(struct super_block *sb,
2755 -               unsigned long hashval, int (*test)(struct inode *, void *),
2756 -               void *data);
2757 -extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval,
2758 -               int (*test)(struct inode *, void *), void *data);
2759 -extern struct inode *ilookup(struct super_block *sb, unsigned long ino);
2760 -
2761 -extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *);
2762 -extern struct inode * iget_locked(struct super_block *, unsigned long);
2763 -extern void unlock_new_inode(struct inode *);
2764 -
2765 -extern void __iget(struct inode * inode);
2766 -extern void iget_failed(struct inode *);
2767 -extern void clear_inode(struct inode *);
2768 -extern void destroy_inode(struct inode *);
2769 -extern struct inode *new_inode(struct super_block *);
2770 -extern int should_remove_suid(struct dentry *);
2771 -extern int file_remove_suid(struct file *);
2772 -
2773 -extern void __insert_inode_hash(struct inode *, unsigned long hashval);
2774 -extern void remove_inode_hash(struct inode *);
2775 -static inline void insert_inode_hash(struct inode *inode) {
2776 -       __insert_inode_hash(inode, inode->i_ino);
2777 -}
2778 -
2779 -extern struct file * get_empty_filp(void);
2780 -extern void file_move(struct file *f, struct list_head *list);
2781 -extern void file_kill(struct file *f);
2782 -#ifdef CONFIG_BLOCK
2783 -struct bio;
2784 -extern void submit_bio(int, struct bio *);
2785 -extern int bdev_read_only(struct block_device *);
2786 -#endif
2787 -extern int set_blocksize(struct block_device *, int);
2788 -extern int sb_set_blocksize(struct super_block *, int);
2789 -extern int sb_min_blocksize(struct super_block *, int);
2790 -extern int sb_has_dirty_inodes(struct super_block *);
2791 -
2792 -extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2793 -extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2794 -extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
2795 -int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
2796 -extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2797 -extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2798 -extern ssize_t generic_file_aio_write_nolock(struct kiocb *, const struct iovec *,
2799 -               unsigned long, loff_t);
2800 -extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *,
2801 -               unsigned long *, loff_t, loff_t *, size_t, size_t);
2802 -extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *,
2803 -               unsigned long, loff_t, loff_t *, size_t, ssize_t);
2804 -extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2805 -extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2806 -extern int generic_segment_checks(const struct iovec *iov,
2807 -               unsigned long *nr_segs, size_t *count, int access_flags);
2808 -
2809 -/* fs/splice.c */
2810 -extern ssize_t generic_file_splice_read(struct file *, loff_t *,
2811 -               struct pipe_inode_info *, size_t, unsigned int);
2812 -extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
2813 -               struct file *, loff_t *, size_t, unsigned int);
2814 -extern ssize_t generic_file_splice_write_nolock(struct pipe_inode_info *,
2815 -               struct file *, loff_t *, size_t, unsigned int);
2816 -extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2817 -               struct file *out, loff_t *, size_t len, unsigned int flags);
2818 -extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2819 -               size_t len, unsigned int flags);
2820 -
2821 -extern void
2822 -file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2823 -extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
2824 -extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
2825 -extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset,
2826 -                       int origin);
2827 -extern int generic_file_open(struct inode * inode, struct file * filp);
2828 -extern int nonseekable_open(struct inode * inode, struct file * filp);
2829 -
2830 -#ifdef CONFIG_FS_XIP
2831 -extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len,
2832 -                            loff_t *ppos);
2833 -extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma);
2834 -extern ssize_t xip_file_write(struct file *filp, const char __user *buf,
2835 -                             size_t len, loff_t *ppos);
2836 -extern int xip_truncate_page(struct address_space *mapping, loff_t from);
2837 -#else
2838 -static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2839 -{
2840 -       return 0;
2841 -}
2842 -#endif
2843 -
2844 -#ifdef CONFIG_BLOCK
2845 -ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2846 -       struct block_device *bdev, const struct iovec *iov, loff_t offset,
2847 -       unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2848 -       int lock_type);
2849 -
2850 -enum {
2851 -       DIO_LOCKING = 1, /* need locking between buffered and direct access */
2852 -       DIO_NO_LOCKING,  /* bdev; no locking at all between buffered/direct */
2853 -       DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */
2854 -};
2855 -
2856 -static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2857 -       struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2858 -       loff_t offset, unsigned long nr_segs, get_block_t get_block,
2859 -       dio_iodone_t end_io)
2860 -{
2861 -       return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2862 -                               nr_segs, get_block, end_io, DIO_LOCKING);
2863 -}
2864 -
2865 -static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2866 -       struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2867 -       loff_t offset, unsigned long nr_segs, get_block_t get_block,
2868 -       dio_iodone_t end_io)
2869 -{
2870 -       return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2871 -                               nr_segs, get_block, end_io, DIO_NO_LOCKING);
2872 -}
2873 -
2874 -static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
2875 -       struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2876 -       loff_t offset, unsigned long nr_segs, get_block_t get_block,
2877 -       dio_iodone_t end_io)
2878 -{
2879 -       return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2880 -                               nr_segs, get_block, end_io, DIO_OWN_LOCKING);
2881 -}
2882 -#endif
2883 -
2884 -extern const struct file_operations generic_ro_fops;
2885 -
2886 -#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
2887 -
2888 -extern int vfs_readlink(struct dentry *, char __user *, int, const char *);
2889 -extern int vfs_follow_link(struct nameidata *, const char *);
2890 -extern int page_readlink(struct dentry *, char __user *, int);
2891 -extern void *page_follow_link_light(struct dentry *, struct nameidata *);
2892 -extern void page_put_link(struct dentry *, struct nameidata *, void *);
2893 -extern int __page_symlink(struct inode *inode, const char *symname, int len,
2894 -               int nofs);
2895 -extern int page_symlink(struct inode *inode, const char *symname, int len);
2896 -extern const struct inode_operations page_symlink_inode_operations;
2897 -extern int generic_readlink(struct dentry *, char __user *, int);
2898 -extern void generic_fillattr(struct inode *, struct kstat *);
2899 -extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2900 -void inode_add_bytes(struct inode *inode, loff_t bytes);
2901 -void inode_sub_bytes(struct inode *inode, loff_t bytes);
2902 -loff_t inode_get_bytes(struct inode *inode);
2903 -void inode_set_bytes(struct inode *inode, loff_t bytes);
2904 -
2905 -extern int vfs_readdir(struct file *, filldir_t, void *);
2906 -
2907 -extern int vfs_stat(char __user *, struct kstat *);
2908 -extern int vfs_lstat(char __user *, struct kstat *);
2909 -extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
2910 -extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *);
2911 -extern int vfs_fstat(unsigned int, struct kstat *);
2912 -
2913 -extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2914 -                   unsigned long arg);
2915 -
2916 -extern void get_filesystem(struct file_system_type *fs);
2917 -extern void put_filesystem(struct file_system_type *fs);
2918 -extern struct file_system_type *get_fs_type(const char *name);
2919 -extern struct super_block *get_super(struct block_device *);
2920 -extern struct super_block *user_get_super(dev_t);
2921 -extern void drop_super(struct super_block *sb);
2922 -
2923 -extern int dcache_dir_open(struct inode *, struct file *);
2924 -extern int dcache_dir_close(struct inode *, struct file *);
2925 -extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2926 -extern int dcache_readdir(struct file *, void *, filldir_t);
2927 -extern int dcache_readdir_filter(struct file *, void *, filldir_t, int (*)(struct dentry *));
2928 -extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2929 -extern int simple_statfs(struct dentry *, struct kstatfs *);
2930 -extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2931 -extern int simple_unlink(struct inode *, struct dentry *);
2932 -extern int simple_rmdir(struct inode *, struct dentry *);
2933 -extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2934 -extern int simple_sync_file(struct file *, struct dentry *, int);
2935 -extern int simple_empty(struct dentry *);
2936 -extern int simple_readpage(struct file *file, struct page *page);
2937 -extern int simple_prepare_write(struct file *file, struct page *page,
2938 -                       unsigned offset, unsigned to);
2939 -extern int simple_write_begin(struct file *file, struct address_space *mapping,
2940 -                       loff_t pos, unsigned len, unsigned flags,
2941 -                       struct page **pagep, void **fsdata);
2942 -extern int simple_write_end(struct file *file, struct address_space *mapping,
2943 -                       loff_t pos, unsigned len, unsigned copied,
2944 -                       struct page *page, void *fsdata);
2945 -
2946 -extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *);
2947 -extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
2948 -extern const struct file_operations simple_dir_operations;
2949 -extern const struct inode_operations simple_dir_inode_operations;
2950 -struct tree_descr { char *name; const struct file_operations *ops; int mode; };
2951 -struct dentry *d_alloc_name(struct dentry *, const char *);
2952 -extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
2953 -extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
2954 -extern void simple_release_fs(struct vfsmount **mount, int *count);
2955 -
2956 -extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2957 -                       loff_t *ppos, const void *from, size_t available);
2958 -
2959 -#ifdef CONFIG_MIGRATION
2960 -extern int buffer_migrate_page(struct address_space *,
2961 -                               struct page *, struct page *);
2962 -#else
2963 -#define buffer_migrate_page NULL
2964 -#endif
2965 -
2966 -extern int inode_change_ok(struct inode *, struct iattr *);
2967 -extern int __must_check inode_setattr(struct inode *, struct iattr *);
2968 -
2969 -extern void file_update_time(struct file *file);
2970 -
2971 -extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt);
2972 -extern void save_mount_options(struct super_block *sb, char *options);
2973 -
2974 -static inline ino_t parent_ino(struct dentry *dentry)
2975 -{
2976 -       ino_t res;
2977 -
2978 -       spin_lock(&dentry->d_lock);
2979 -       res = dentry->d_parent->d_inode->i_ino;
2980 -       spin_unlock(&dentry->d_lock);
2981 -       return res;
2982 -}
2983 -
2984 -/* Transaction based IO helpers */
2985 -
2986 -/*
2987 - * An argresp is stored in an allocated page and holds the
2988 - * size of the argument or response, along with its content
2989 - */
2990 -struct simple_transaction_argresp {
2991 -       ssize_t size;
2992 -       char data[0];
2993 -};
2994 -
2995 -#define SIMPLE_TRANSACTION_LIMIT (PAGE_SIZE - sizeof(struct simple_transaction_argresp))
2996 -
2997 -char *simple_transaction_get(struct file *file, const char __user *buf,
2998 -                               size_t size);
2999 -ssize_t simple_transaction_read(struct file *file, char __user *buf,
3000 -                               size_t size, loff_t *pos);
3001 -int simple_transaction_release(struct inode *inode, struct file *file);
3002 -
3003 -static inline void simple_transaction_set(struct file *file, size_t n)
3004 -{
3005 -       struct simple_transaction_argresp *ar = file->private_data;
3006 -
3007 -       BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
3008 -
3009 -       /*
3010 -        * The barrier ensures that ar->size will really remain zero until
3011 -        * ar->data is ready for reading.
3012 -        */
3013 -       smp_mb();
3014 -       ar->size = n;
3015 -}
3016 -
3017 -/*
3018 - * simple attribute files
3019 - *
3020 - * These attributes behave similar to those in sysfs:
3021 - *
3022 - * Writing to an attribute immediately sets a value, an open file can be
3023 - * written to multiple times.
3024 - *
3025 - * Reading from an attribute creates a buffer from the value that might get
3026 - * read with multiple read calls. When the attribute has been read
3027 - * completely, no further read calls are possible until the file is opened
3028 - * again.
3029 - *
3030 - * All attributes contain a text representation of a numeric value
3031 - * that are accessed with the get() and set() functions.
3032 - */
3033 -#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt)           \
3034 -static int __fops ## _open(struct inode *inode, struct file *file)     \
3035 -{                                                                      \
3036 -       __simple_attr_check_format(__fmt, 0ull);                        \
3037 -       return simple_attr_open(inode, file, __get, __set, __fmt);      \
3038 -}                                                                      \
3039 -static struct file_operations __fops = {                               \
3040 -       .owner   = THIS_MODULE,                                         \
3041 -       .open    = __fops ## _open,                                     \
3042 -       .release = simple_attr_release,                                 \
3043 -       .read    = simple_attr_read,                                    \
3044 -       .write   = simple_attr_write,                                   \
3045 -};
3046 -
3047 -static inline void __attribute__((format(printf, 1, 2)))
3048 -__simple_attr_check_format(const char *fmt, ...)
3049 -{
3050 -       /* don't do anything, just let the compiler check the arguments; */
3051 -}
3052 -
3053 -int simple_attr_open(struct inode *inode, struct file *file,
3054 -                    int (*get)(void *, u64 *), int (*set)(void *, u64),
3055 -                    const char *fmt);
3056 -int simple_attr_release(struct inode *inode, struct file *file);
3057 -ssize_t simple_attr_read(struct file *file, char __user *buf,
3058 -                        size_t len, loff_t *ppos);
3059 -ssize_t simple_attr_write(struct file *file, const char __user *buf,
3060 -                         size_t len, loff_t *ppos);
3061 -
3062 -
3063 -#ifdef CONFIG_SECURITY
3064 -static inline char *alloc_secdata(void)
3065 -{
3066 -       return (char *)get_zeroed_page(GFP_KERNEL);
3067 -}
3068 -
3069 -static inline void free_secdata(void *secdata)
3070 -{
3071 -       free_page((unsigned long)secdata);
3072 -}
3073 -#else
3074 -static inline char *alloc_secdata(void)
3075 -{
3076 -       return (char *)1;
3077 -}
3078 -
3079 -static inline void free_secdata(void *secdata)
3080 -{ }
3081 -#endif /* CONFIG_SECURITY */
3082 -
3083 -struct ctl_table;
3084 -int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
3085 -                 void __user *buffer, size_t *lenp, loff_t *ppos);
3086 -
3087 -int get_filesystem_list(char * buf);
3088 -
3089 -#endif /* __KERNEL__ */
3090 -#endif /* _LINUX_FS_H */
3091 diff -Nurb linux-2.6.27-720/include/linux/highmem.h linux-2.6.27-710/include/linux/highmem.h
3092 --- linux-2.6.27-720/include/linux/highmem.h    2009-05-04 12:18:34.000000000 -0400
3093 +++ linux-2.6.27-710/include/linux/highmem.h    2008-10-09 18:13:53.000000000 -0400
3094 @@ -165,8 +165,8 @@
3095  {
3096         char *vfrom, *vto;
3097  
3098 -       vfrom = (char*)kmap_atomic(from, KM_USER0);
3099 -       vto = (char*)kmap_atomic(to, KM_USER1);
3100 +       vfrom = kmap_atomic(from, KM_USER0);
3101 +       vto = kmap_atomic(to, KM_USER1);
3102         copy_user_page(vto, vfrom, vaddr, to);
3103         kunmap_atomic(vfrom, KM_USER0);
3104         kunmap_atomic(vto, KM_USER1);
3105 @@ -178,8 +178,8 @@
3106  {
3107         char *vfrom, *vto;
3108  
3109 -       vfrom = (char*)kmap_atomic(from, KM_USER0);
3110 -       vto = (char*)kmap_atomic(to, KM_USER1);
3111 +       vfrom = kmap_atomic(from, KM_USER0);
3112 +       vto = kmap_atomic(to, KM_USER1);
3113         copy_page(vto, vfrom);
3114         kunmap_atomic(vfrom, KM_USER0);
3115         kunmap_atomic(vto, KM_USER1);
3116 diff -Nurb linux-2.6.27-720/include/linux/hrtimer.h linux-2.6.27-710/include/linux/hrtimer.h
3117 --- linux-2.6.27-720/include/linux/hrtimer.h    2009-05-04 12:18:34.000000000 -0400
3118 +++ linux-2.6.27-710/include/linux/hrtimer.h    2008-10-09 18:13:53.000000000 -0400
3119 @@ -384,7 +384,7 @@
3120  static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
3121  {
3122         timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
3123 -                                (void *) timer->function, timer->start_comm, 0);
3124 +                                timer->function, timer->start_comm, 0);
3125  }
3126  
3127  extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
3128 diff -Nurb linux-2.6.27-720/include/linux/inetdevice.h linux-2.6.27-710/include/linux/inetdevice.h
3129 --- linux-2.6.27-720/include/linux/inetdevice.h 2009-05-04 12:18:34.000000000 -0400
3130 +++ linux-2.6.27-710/include/linux/inetdevice.h 2008-10-09 18:13:53.000000000 -0400
3131 @@ -166,7 +166,7 @@
3132  
3133  static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev)
3134  {
3135 -       struct in_device *in_dev = (struct in_device *) dev->ip_ptr;
3136 +       struct in_device *in_dev = dev->ip_ptr;
3137         if (in_dev)
3138                 in_dev = rcu_dereference(in_dev);
3139         return in_dev;
3140 diff -Nurb linux-2.6.27-720/include/linux/jhash.h linux-2.6.27-710/include/linux/jhash.h
3141 --- linux-2.6.27-720/include/linux/jhash.h      2009-05-04 12:18:34.000000000 -0400
3142 +++ linux-2.6.27-710/include/linux/jhash.h      2008-10-09 18:13:53.000000000 -0400
3143 @@ -44,7 +44,7 @@
3144  static inline u32 jhash(const void *key, u32 length, u32 initval)
3145  {
3146         u32 a, b, c, len;
3147 -       const u8 *k = (const u8 *) key;
3148 +       const u8 *k = key;
3149  
3150         len = length;
3151         a = b = JHASH_GOLDEN_RATIO;
3152 diff -Nurb linux-2.6.27-720/include/linux/kernel.h linux-2.6.27-710/include/linux/kernel.h
3153 --- linux-2.6.27-720/include/linux/kernel.h     2009-05-04 12:18:34.000000000 -0400
3154 +++ linux-2.6.27-710/include/linux/kernel.h     2008-10-09 18:13:53.000000000 -0400
3155 @@ -213,7 +213,7 @@
3156                 { return false; }
3157  #endif
3158  
3159 -asmlinkage void __attribute__((format(printf, 1, 2)))
3160 +extern void asmlinkage __attribute__((format(printf, 1, 2)))
3161         early_printk(const char *fmt, ...);
3162  
3163  unsigned long int_sqrt(unsigned long);
3164 diff -Nurb linux-2.6.27-720/include/linux/ktime.h linux-2.6.27-710/include/linux/ktime.h
3165 --- linux-2.6.27-720/include/linux/ktime.h      2009-05-04 12:18:34.000000000 -0400
3166 +++ linux-2.6.27-710/include/linux/ktime.h      2008-10-09 18:13:53.000000000 -0400
3167 @@ -71,12 +71,6 @@
3168  
3169  #if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)
3170  
3171 -#ifdef __cplusplus
3172 -# define KTIME_TV64(__s)       ({ ktime_t __kt; __kt.tv64 = (__s); __kt; })
3173 -#else
3174 -# define KTIME_TV64(__s)       ((ktime_t) { .tv64 = (__s) })
3175 -#endif
3176 -
3177  /**
3178   * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
3179   * @secs:      seconds to set
3180 @@ -88,37 +82,32 @@
3181  {
3182  #if (BITS_PER_LONG == 64)
3183         if (unlikely(secs >= KTIME_SEC_MAX))
3184 -               return KTIME_TV64(KTIME_MAX);
3185 +               return (ktime_t){ .tv64 = KTIME_MAX };
3186  #endif
3187 -       return KTIME_TV64((s64)secs * NSEC_PER_SEC + (s64)nsecs);
3188 +       return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs };
3189  }
3190  
3191  /* Subtract two ktime_t variables. rem = lhs -rhs: */
3192  #define ktime_sub(lhs, rhs) \
3193 -               KTIME_TV64((lhs).tv64 - (rhs).tv64)
3194 +               ({ (ktime_t){ .tv64 = (lhs).tv64 - (rhs).tv64 }; })
3195  
3196  /* Add two ktime_t variables. res = lhs + rhs: */
3197  #define ktime_add(lhs, rhs) \
3198 -               KTIME_TV64((lhs).tv64 + (rhs).tv64)
3199 +               ({ (ktime_t){ .tv64 = (lhs).tv64 + (rhs).tv64 }; })
3200  
3201  /*
3202   * Add a ktime_t variable and a scalar nanosecond value.
3203   * res = kt + nsval:
3204   */
3205  #define ktime_add_ns(kt, nsval) \
3206 -               KTIME_TV64((kt).tv64 + (nsval))
3207 +               ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
3208  
3209  /*
3210   * Subtract a scalar nanosecod from a ktime_t variable
3211   * res = kt - nsval:
3212   */
3213 -#ifdef __cplusplus
3214 -#define ktime_sub_ns(kt, nsval) \
3215 -               ({ktime_t duh; duh.tv64 = (kt).tv64 - (nsval); duh; })
3216 -#else
3217  #define ktime_sub_ns(kt, nsval) \
3218                 ({ (ktime_t){ .tv64 = (kt).tv64 - (nsval) }; })
3219 -#endif
3220  
3221  /* convert a timespec to ktime_t format: */
3222  static inline ktime_t timespec_to_ktime(struct timespec ts)
3223 @@ -143,18 +132,6 @@
3224  
3225  #else
3226  
3227 -#ifdef __cplusplus
3228 -# define KTIME_TV64(__s)               ({ ktime_t __kt; __kt.tv64 = (__s); __kt; })
3229 -# define KTIME_SEC_NSEC(__sec, __nsec) ({ ktime_t __kt; __kt.tv.sec = (__sec); __kt.tv.nsec = (__nsec); __kt; })
3230 -# define TIMEVAL_SEC_USEC(__sec, __usec) ({ struct timeval __tv; __tv.tv_sec = (__sec); __tv.tv_usec = (__usec); __tv; })
3231 -# define TIMESPEC_SEC_NSEC(__sec, __nsec) ({ struct timespec __ts; __ts.tv_sec = (__sec); __ts.tv_nsec = (__nsec); __ts; })
3232 -#else
3233 -# define KTIME_TV64(__s)               ((ktime_t) { .tv64 = (__s) })
3234 -# define KTIME_SEC_NSEC(__sec, __nsec) ((ktime_t) { .tv = { .sec = (__sec), .nsec = (__nsec) } })
3235 -# define TIMEVAL_SEC_USEC(__sec, __usec) ((struct timeval) { .tv_sec = (__sec), .tv_usec = (__usec) })
3236 -# define TIMESPEC_SEC_NSEC(__sec, __nsec) ((struct timespec) { .tv_sec = (__sec), .tv_nsec = (__nsec) })
3237 -#endif
3238 -
3239  /*
3240   * Helper macros/inlines to get the ktime_t math right in the timespec
3241   * representation. The macros are sometimes ugly - their actual use is
3242 @@ -173,7 +150,7 @@
3243  /* Set a ktime_t variable to a value in sec/nsec representation: */
3244  static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
3245  {
3246 -       return KTIME_SEC_NSEC(secs, nsecs);
3247 +       return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
3248  }
3249  
3250  /**
3251 @@ -246,7 +223,8 @@
3252   */
3253  static inline ktime_t timespec_to_ktime(const struct timespec ts)
3254  {
3255 -       return KTIME_SEC_NSEC((s32)ts.tv_sec, (s32)ts.tv_nsec);
3256 +       return (ktime_t) { .tv = { .sec = (s32)ts.tv_sec,
3257 +                                  .nsec = (s32)ts.tv_nsec } };
3258  }
3259  
3260  /**
3261 @@ -257,7 +235,8 @@
3262   */
3263  static inline ktime_t timeval_to_ktime(const struct timeval tv)
3264  {
3265 -       return KTIME_SEC_NSEC((s32)tv.tv_sec, (s32)tv.tv_usec * 1000);
3266 +       return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
3267 +                                  .nsec = (s32)tv.tv_usec * 1000 } };
3268  }
3269  
3270  /**
3271 @@ -268,7 +247,8 @@
3272   */
3273  static inline struct timespec ktime_to_timespec(const ktime_t kt)
3274  {
3275 -       return TIMESPEC_SEC_NSEC((time_t) kt.tv.sec, (long) kt.tv.nsec);
3276 +       return (struct timespec) { .tv_sec = (time_t) kt.tv.sec,
3277 +                                  .tv_nsec = (long) kt.tv.nsec };
3278  }
3279  
3280  /**
3281 @@ -279,8 +259,9 @@
3282   */
3283  static inline struct timeval ktime_to_timeval(const ktime_t kt)
3284  {
3285 -       return TIMEVAL_SEC_USEC((time_t) kt.tv.sec,
3286 -                               (suseconds_t) (kt.tv.nsec / NSEC_PER_USEC));
3287 +       return (struct timeval) {
3288 +               .tv_sec = (time_t) kt.tv.sec,
3289 +               .tv_usec = (suseconds_t) (kt.tv.nsec / NSEC_PER_USEC) };
3290  }
3291  
3292  /**
3293 @@ -348,7 +329,7 @@
3294  
3295  static inline ktime_t ns_to_ktime(u64 ns)
3296  {
3297 -       static const ktime_t ktime_zero = ({ktime_t duh; duh.tv64 = 0;duh;});
3298 +       static const ktime_t ktime_zero = { .tv64 = 0 };
3299         return ktime_add_ns(ktime_zero, ns);
3300  }
3301  
3302 diff -Nurb linux-2.6.27-720/include/linux/linkage.h linux-2.6.27-710/include/linux/linkage.h
3303 --- linux-2.6.27-720/include/linux/linkage.h    2009-05-04 12:18:34.000000000 -0400
3304 +++ linux-2.6.27-710/include/linux/linkage.h    2008-10-09 18:13:53.000000000 -0400
3305 @@ -11,13 +11,6 @@
3306  #else
3307  #define CPP_ASMLINKAGE
3308  #endif
3309 -#ifndef extern_asmlinkage
3310 -# ifdef __cplusplus
3311 -#  define extern_asmlinkage asmlinkage
3312 -# else
3313 -#  define extern_asmlinkage extern asmlinkage
3314 -# endif
3315 -#endif
3316  
3317  #ifndef asmlinkage
3318  #define asmlinkage CPP_ASMLINKAGE
3319 diff -Nurb linux-2.6.27-720/include/linux/list.h linux-2.6.27-710/include/linux/list.h
3320 --- linux-2.6.27-720/include/linux/list.h       2009-05-04 12:18:34.000000000 -0400
3321 +++ linux-2.6.27-710/include/linux/list.h       2008-10-09 18:13:53.000000000 -0400
3322 @@ -20,11 +20,7 @@
3323         struct list_head *next, *prev;
3324  };
3325  
3326 -#ifdef __cplusplus
3327 -#define LIST_HEAD_INIT(name) ({struct list_head duh;duh.next=&(name);duh.prev=&(name);duh;})
3328 -#else
3329  #define LIST_HEAD_INIT(name) { &(name), &(name) }
3330 -#endif
3331  
3332  #define LIST_HEAD(name) \
3333         struct list_head name = LIST_HEAD_INIT(name)
3334 @@ -107,8 +103,8 @@
3335  static inline void list_del(struct list_head *entry)
3336  {
3337         __list_del(entry->prev, entry->next);
3338 -       entry->next = (struct list_head*)(LIST_POISON1);
3339 -       entry->prev = (struct list_head*)(LIST_POISON2);
3340 +       entry->next = LIST_POISON1;
3341 +       entry->prev = LIST_POISON2;
3342  }
3343  #else
3344  extern void list_del(struct list_head *entry);
3345 @@ -580,8 +576,8 @@
3346  static inline void hlist_del(struct hlist_node *n)
3347  {
3348         __hlist_del(n);
3349 -       n->next = (struct hlist_node*)(LIST_POISON1);
3350 -       n->pprev = (struct hlist_node**)(LIST_POISON2);
3351 +       n->next = LIST_POISON1;
3352 +       n->pprev = LIST_POISON2;
3353  }
3354  
3355  static inline void hlist_del_init(struct hlist_node *n)
3356 diff -Nurb linux-2.6.27-720/include/linux/mempolicy.h linux-2.6.27-710/include/linux/mempolicy.h
3357 --- linux-2.6.27-720/include/linux/mempolicy.h  2009-05-04 12:18:34.000000000 -0400
3358 +++ linux-2.6.27-710/include/linux/mempolicy.h  2008-10-09 18:13:53.000000000 -0400
3359 @@ -241,7 +241,7 @@
3360  
3361  #else
3362  
3363 -EMPTY_STRUCT_DECL(mempolicy);
3364 +struct mempolicy {};
3365  
3366  static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
3367  {
3368 @@ -271,7 +271,7 @@
3369         return NULL;
3370  }
3371  
3372 -EMPTY_STRUCT_DECL(shared_policy);
3373 +struct shared_policy {};
3374  
3375  static inline int mpol_set_shared_policy(struct shared_policy *info,
3376                                         struct vm_area_struct *vma,
3377 diff -Nurb linux-2.6.27-720/include/linux/mm.h linux-2.6.27-710/include/linux/mm.h
3378 --- linux-2.6.27-720/include/linux/mm.h 2009-05-04 12:18:34.000000000 -0400
3379 +++ linux-2.6.27-710/include/linux/mm.h 2009-05-04 12:15:01.000000000 -0400
3380 @@ -326,7 +326,7 @@
3381  static inline void set_compound_page_dtor(struct page *page,
3382                                                 compound_page_dtor *dtor)
3383  {
3384 -       page[1].lru.next = (struct list_head *)dtor;
3385 +       page[1].lru.next = (void *)dtor;
3386  }
3387  
3388  static inline compound_page_dtor *get_compound_page_dtor(struct page *page)
3389 @@ -343,7 +343,7 @@
3390  
3391  static inline void set_compound_order(struct page *page, unsigned long order)
3392  {
3393 -       page[1].lru.prev = (struct list_head  *)order;
3394 +       page[1].lru.prev = (void *)order;
3395  }
3396  
3397  /*
3398 @@ -493,7 +493,7 @@
3399  
3400  static inline enum zone_type page_zonenum(struct page *page)
3401  {
3402 -       return (enum zone_type) ((page->flags >> ZONES_PGSHIFT) & ZONES_MASK);
3403 +       return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
3404  }
3405  
3406  /*
3407 diff -Nurb linux-2.6.27-720/include/linux/mm.h.orig linux-2.6.27-710/include/linux/mm.h.orig
3408 --- linux-2.6.27-720/include/linux/mm.h.orig    2009-05-04 12:15:01.000000000 -0400
3409 +++ linux-2.6.27-710/include/linux/mm.h.orig    1969-12-31 19:00:00.000000000 -0500
3410 @@ -1,1289 +0,0 @@
3411 -#ifndef _LINUX_MM_H
3412 -#define _LINUX_MM_H
3413 -
3414 -#include <linux/errno.h>
3415 -
3416 -#ifdef __KERNEL__
3417 -
3418 -#include <linux/gfp.h>
3419 -#include <linux/list.h>
3420 -#include <linux/mmzone.h>
3421 -#include <linux/rbtree.h>
3422 -#include <linux/prio_tree.h>
3423 -#include <linux/debug_locks.h>
3424 -#include <linux/mm_types.h>
3425 -
3426 -struct mempolicy;
3427 -struct anon_vma;
3428 -struct file_ra_state;
3429 -struct user_struct;
3430 -struct writeback_control;
3431 -
3432 -#ifndef CONFIG_DISCONTIGMEM          /* Don't use mapnrs, do it properly */
3433 -extern unsigned long max_mapnr;
3434 -#endif
3435 -
3436 -extern unsigned long num_physpages;
3437 -extern void * high_memory;
3438 -extern int page_cluster;
3439 -
3440 -#ifdef CONFIG_SYSCTL
3441 -extern int sysctl_legacy_va_layout;
3442 -#else
3443 -#define sysctl_legacy_va_layout 0
3444 -#endif
3445 -
3446 -extern unsigned long mmap_min_addr;
3447 -
3448 -#include <asm/page.h>
3449 -#include <asm/pgtable.h>
3450 -#include <asm/processor.h>
3451 -
3452 -#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
3453 -
3454 -/* to align the pointer to the (next) page boundary */
3455 -#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
3456 -
3457 -/*
3458 - * Linux kernel virtual memory manager primitives.
3459 - * The idea being to have a "virtual" mm in the same way
3460 - * we have a virtual fs - giving a cleaner interface to the
3461 - * mm details, and allowing different kinds of memory mappings
3462 - * (from shared memory to executable loading to arbitrary
3463 - * mmap() functions).
3464 - */
3465 -
3466 -extern struct kmem_cache *vm_area_cachep;
3467 -
3468 -/*
3469 - * This struct defines the per-mm list of VMAs for uClinux. If CONFIG_MMU is
3470 - * disabled, then there's a single shared list of VMAs maintained by the
3471 - * system, and mm's subscribe to these individually
3472 - */
3473 -struct vm_list_struct {
3474 -       struct vm_list_struct   *next;
3475 -       struct vm_area_struct   *vma;
3476 -};
3477 -
3478 -#ifndef CONFIG_MMU
3479 -extern struct rb_root nommu_vma_tree;
3480 -extern struct rw_semaphore nommu_vma_sem;
3481 -
3482 -extern unsigned int kobjsize(const void *objp);
3483 -#endif
3484 -
3485 -/*
3486 - * vm_flags in vm_area_struct, see mm_types.h.
3487 - */
3488 -#define VM_READ                0x00000001      /* currently active flags */
3489 -#define VM_WRITE       0x00000002
3490 -#define VM_EXEC                0x00000004
3491 -#define VM_SHARED      0x00000008
3492 -
3493 -/* mprotect() hardcodes VM_MAYREAD >> 4 == VM_READ, and so for r/w/x bits. */
3494 -#define VM_MAYREAD     0x00000010      /* limits for mprotect() etc */
3495 -#define VM_MAYWRITE    0x00000020
3496 -#define VM_MAYEXEC     0x00000040
3497 -#define VM_MAYSHARE    0x00000080
3498 -
3499 -#define VM_GROWSDOWN   0x00000100      /* general info on the segment */
3500 -#define VM_GROWSUP     0x00000200
3501 -#define VM_PFNMAP      0x00000400      /* Page-ranges managed without "struct page", just pure PFN */
3502 -#define VM_DENYWRITE   0x00000800      /* ETXTBSY on write attempts.. */
3503 -
3504 -#define VM_EXECUTABLE  0x00001000
3505 -#define VM_LOCKED      0x00002000
3506 -#define VM_IO           0x00004000     /* Memory mapped I/O or similar */
3507 -
3508 -                                       /* Used by sys_madvise() */
3509 -#define VM_SEQ_READ    0x00008000      /* App will access data sequentially */
3510 -#define VM_RAND_READ   0x00010000      /* App will not benefit from clustered reads */
3511 -
3512 -#define VM_DONTCOPY    0x00020000      /* Do not copy this vma on fork */
3513 -#define VM_DONTEXPAND  0x00040000      /* Cannot expand with mremap() */
3514 -#define VM_RESERVED    0x00080000      /* Count as reserved_vm like IO */
3515 -#define VM_ACCOUNT     0x00100000      /* Is a VM accounted object */
3516 -#define VM_NORESERVE   0x00200000      /* should the VM suppress accounting */
3517 -#define VM_HUGETLB     0x00400000      /* Huge TLB Page VM */
3518 -#define VM_NONLINEAR   0x00800000      /* Is non-linear (remap_file_pages) */
3519 -#define VM_MAPPED_COPY 0x01000000      /* T if mapped copy of data (nommu mmap) */
3520 -#define VM_INSERTPAGE  0x02000000      /* The vma has had "vm_insert_page()" done on it */
3521 -#define VM_ALWAYSDUMP  0x04000000      /* Always include in core dumps */
3522 -
3523 -#define VM_CAN_NONLINEAR 0x08000000    /* Has ->fault & does nonlinear pages */
3524 -#define VM_MIXEDMAP    0x10000000      /* Can contain "struct page" and pure PFN pages */
3525 -#define VM_SAO         0x20000000      /* Strong Access Ordering (powerpc) */
3526 -
3527 -#ifndef VM_STACK_DEFAULT_FLAGS         /* arch can override this */
3528 -#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
3529 -#endif
3530 -
3531 -#ifdef CONFIG_STACK_GROWSUP
3532 -#define VM_STACK_FLAGS (VM_GROWSUP | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
3533 -#else
3534 -#define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
3535 -#endif
3536 -
3537 -#define VM_READHINTMASK                        (VM_SEQ_READ | VM_RAND_READ)
3538 -#define VM_ClearReadHint(v)            (v)->vm_flags &= ~VM_READHINTMASK
3539 -#define VM_NormalReadHint(v)           (!((v)->vm_flags & VM_READHINTMASK))
3540 -#define VM_SequentialReadHint(v)       ((v)->vm_flags & VM_SEQ_READ)
3541 -#define VM_RandomReadHint(v)           ((v)->vm_flags & VM_RAND_READ)
3542 -
3543 -/*
3544 - * mapping from the currently active vm_flags protection bits (the
3545 - * low four bits) to a page protection mask..
3546 - */
3547 -extern pgprot_t protection_map[16];
3548 -
3549 -#define FAULT_FLAG_WRITE       0x01    /* Fault was a write access */
3550 -#define FAULT_FLAG_NONLINEAR   0x02    /* Fault was via a nonlinear mapping */
3551 -
3552 -
3553 -/*
3554 - * vm_fault is filled by the the pagefault handler and passed to the vma's
3555 - * ->fault function. The vma's ->fault is responsible for returning a bitmask
3556 - * of VM_FAULT_xxx flags that give details about how the fault was handled.
3557 - *
3558 - * pgoff should be used in favour of virtual_address, if possible. If pgoff
3559 - * is used, one may set VM_CAN_NONLINEAR in the vma->vm_flags to get nonlinear
3560 - * mapping support.
3561 - */
3562 -struct vm_fault {
3563 -       unsigned int flags;             /* FAULT_FLAG_xxx flags */
3564 -       pgoff_t pgoff;                  /* Logical page offset based on vma */
3565 -       void __user *virtual_address;   /* Faulting virtual address */
3566 -
3567 -       struct page *page;              /* ->fault handlers should return a
3568 -                                        * page here, unless VM_FAULT_NOPAGE
3569 -                                        * is set (which is also implied by
3570 -                                        * VM_FAULT_ERROR).
3571 -                                        */
3572 -};
3573 -
3574 -/*
3575 - * These are the virtual MM functions - opening of an area, closing and
3576 - * unmapping it (needed to keep files on disk up-to-date etc), pointer
3577 - * to the functions called when a no-page or a wp-page exception occurs. 
3578 - */
3579 -struct vm_operations_struct {
3580 -       void (*open)(struct vm_area_struct * area);
3581 -       void (*close)(struct vm_area_struct * area);
3582 -       int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
3583 -
3584 -       /* notification that a previously read-only page is about to become
3585 -        * writable, if an error is returned it will cause a SIGBUS */
3586 -       int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
3587 -
3588 -       /* called by access_process_vm when get_user_pages() fails, typically
3589 -        * for use by special VMAs that can switch between memory and hardware
3590 -        */
3591 -       int (*access)(struct vm_area_struct *vma, unsigned long addr,
3592 -                     void *buf, int len, int write);
3593 -#ifdef CONFIG_NUMA
3594 -       /*
3595 -        * set_policy() op must add a reference to any non-NULL @new mempolicy
3596 -        * to hold the policy upon return.  Caller should pass NULL @new to
3597 -        * remove a policy and fall back to surrounding context--i.e. do not
3598 -        * install a MPOL_DEFAULT policy, nor the task or system default
3599 -        * mempolicy.
3600 -        */
3601 -       int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
3602 -
3603 -       /*
3604 -        * get_policy() op must add reference [mpol_get()] to any policy at
3605 -        * (vma,addr) marked as MPOL_SHARED.  The shared policy infrastructure
3606 -        * in mm/mempolicy.c will do this automatically.
3607 -        * get_policy() must NOT add a ref if the policy at (vma,addr) is not
3608 -        * marked as MPOL_SHARED. vma policies are protected by the mmap_sem.
3609 -        * If no [shared/vma] mempolicy exists at the addr, get_policy() op
3610 -        * must return NULL--i.e., do not "fallback" to task or system default
3611 -        * policy.
3612 -        */
3613 -       struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
3614 -                                       unsigned long addr);
3615 -       int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
3616 -               const nodemask_t *to, unsigned long flags);
3617 -#endif
3618 -};
3619 -
3620 -struct mmu_gather;
3621 -struct inode;
3622 -
3623 -#define page_private(page)             ((page)->private)
3624 -#define set_page_private(page, v)      ((page)->private = (v))
3625 -
3626 -/*
3627 - * FIXME: take this include out, include page-flags.h in
3628 - * files which need it (119 of them)
3629 - */
3630 -#include <linux/page-flags.h>
3631 -
3632 -#ifdef CONFIG_DEBUG_VM
3633 -#define VM_BUG_ON(cond) BUG_ON(cond)
3634 -#else
3635 -#define VM_BUG_ON(condition) do { } while(0)
3636 -#endif
3637 -
3638 -/*
3639 - * Methods to modify the page usage count.
3640 - *
3641 - * What counts for a page usage:
3642 - * - cache mapping   (page->mapping)
3643 - * - private data    (page->private)
3644 - * - page mapped in a task's page tables, each mapping
3645 - *   is counted separately
3646 - *
3647 - * Also, many kernel routines increase the page count before a critical
3648 - * routine so they can be sure the page doesn't go away from under them.
3649 - */
3650 -
3651 -/*
3652 - * Drop a ref, return true if the refcount fell to zero (the page has no users)
3653 - */
3654 -static inline int put_page_testzero(struct page *page)
3655 -{
3656 -       VM_BUG_ON(atomic_read(&page->_count) == 0);
3657 -       return atomic_dec_and_test(&page->_count);
3658 -}
3659 -
3660 -/*
3661 - * Try to grab a ref unless the page has a refcount of zero, return false if
3662 - * that is the case.
3663 - */
3664 -static inline int get_page_unless_zero(struct page *page)
3665 -{
3666 -       return atomic_inc_not_zero(&page->_count);
3667 -}
3668 -
3669 -/* Support for virtually mapped pages */
3670 -struct page *vmalloc_to_page(const void *addr);
3671 -unsigned long vmalloc_to_pfn(const void *addr);
3672 -
3673 -/*
3674 - * Determine if an address is within the vmalloc range
3675 - *
3676 - * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
3677 - * is no special casing required.
3678 - */
3679 -static inline int is_vmalloc_addr(const void *x)
3680 -{
3681 -#ifdef CONFIG_MMU
3682 -       unsigned long addr = (unsigned long)x;
3683 -
3684 -       return addr >= VMALLOC_START && addr < VMALLOC_END;
3685 -#else
3686 -       return 0;
3687 -#endif
3688 -}
3689 -
3690 -static inline struct page *compound_head(struct page *page)
3691 -{
3692 -       if (unlikely(PageTail(page)))
3693 -               return page->first_page;
3694 -       return page;
3695 -}
3696 -
3697 -static inline int page_count(struct page *page)
3698 -{
3699 -       return atomic_read(&compound_head(page)->_count);
3700 -}
3701 -
3702 -static inline void get_page(struct page *page)
3703 -{
3704 -       page = compound_head(page);
3705 -       VM_BUG_ON(atomic_read(&page->_count) == 0);
3706 -       atomic_inc(&page->_count);
3707 -}
3708 -
3709 -static inline struct page *virt_to_head_page(const void *x)
3710 -{
3711 -       struct page *page = virt_to_page(x);
3712 -       return compound_head(page);
3713 -}
3714 -
3715 -/*
3716 - * Setup the page count before being freed into the page allocator for
3717 - * the first time (boot or memory hotplug)
3718 - */
3719 -static inline void init_page_count(struct page *page)
3720 -{
3721 -       atomic_set(&page->_count, 1);
3722 -}
3723 -
3724 -void put_page(struct page *page);
3725 -void put_pages_list(struct list_head *pages);
3726 -
3727 -void split_page(struct page *page, unsigned int order);
3728 -
3729 -/*
3730 - * Compound pages have a destructor function.  Provide a
3731 - * prototype for that function and accessor functions.
3732 - * These are _only_ valid on the head of a PG_compound page.
3733 - */
3734 -typedef void compound_page_dtor(struct page *);
3735 -
3736 -static inline void set_compound_page_dtor(struct page *page,
3737 -                                               compound_page_dtor *dtor)
3738 -{
3739 -       page[1].lru.next = (void *)dtor;
3740 -}
3741 -
3742 -static inline compound_page_dtor *get_compound_page_dtor(struct page *page)
3743 -{
3744 -       return (compound_page_dtor *)page[1].lru.next;
3745 -}
3746 -
3747 -static inline int compound_order(struct page *page)
3748 -{
3749 -       if (!PageHead(page))
3750 -               return 0;
3751 -       return (unsigned long)page[1].lru.prev;
3752 -}
3753 -
3754 -static inline void set_compound_order(struct page *page, unsigned long order)
3755 -{
3756 -       page[1].lru.prev = (void *)order;
3757 -}
3758 -
3759 -/*
3760 - * Multiple processes may "see" the same page. E.g. for untouched
3761 - * mappings of /dev/null, all processes see the same page full of
3762 - * zeroes, and text pages of executables and shared libraries have
3763 - * only one copy in memory, at most, normally.
3764 - *
3765 - * For the non-reserved pages, page_count(page) denotes a reference count.
3766 - *   page_count() == 0 means the page is free. page->lru is then used for
3767 - *   freelist management in the buddy allocator.
3768 - *   page_count() > 0  means the page has been allocated.
3769 - *
3770 - * Pages are allocated by the slab allocator in order to provide memory
3771 - * to kmalloc and kmem_cache_alloc. In this case, the management of the
3772 - * page, and the fields in 'struct page' are the responsibility of mm/slab.c
3773 - * unless a particular usage is carefully commented. (the responsibility of
3774 - * freeing the kmalloc memory is the caller's, of course).
3775 - *
3776 - * A page may be used by anyone else who does a __get_free_page().
3777 - * In this case, page_count still tracks the references, and should only
3778 - * be used through the normal accessor functions. The top bits of page->flags
3779 - * and page->virtual store page management information, but all other fields
3780 - * are unused and could be used privately, carefully. The management of this
3781 - * page is the responsibility of the one who allocated it, and those who have
3782 - * subsequently been given references to it.
3783 - *
3784 - * The other pages (we may call them "pagecache pages") are completely
3785 - * managed by the Linux memory manager: I/O, buffers, swapping etc.
3786 - * The following discussion applies only to them.
3787 - *
3788 - * A pagecache page contains an opaque `private' member, which belongs to the
3789 - * page's address_space. Usually, this is the address of a circular list of
3790 - * the page's disk buffers. PG_private must be set to tell the VM to call
3791 - * into the filesystem to release these pages.
3792 - *
3793 - * A page may belong to an inode's memory mapping. In this case, page->mapping
3794 - * is the pointer to the inode, and page->index is the file offset of the page,
3795 - * in units of PAGE_CACHE_SIZE.
3796 - *
3797 - * If pagecache pages are not associated with an inode, they are said to be
3798 - * anonymous pages. These may become associated with the swapcache, and in that
3799 - * case PG_swapcache is set, and page->private is an offset into the swapcache.
3800 - *
3801 - * In either case (swapcache or inode backed), the pagecache itself holds one
3802 - * reference to the page. Setting PG_private should also increment the
3803 - * refcount. The each user mapping also has a reference to the page.
3804 - *
3805 - * The pagecache pages are stored in a per-mapping radix tree, which is
3806 - * rooted at mapping->page_tree, and indexed by offset.
3807 - * Where 2.4 and early 2.6 kernels kept dirty/clean pages in per-address_space
3808 - * lists, we instead now tag pages as dirty/writeback in the radix tree.
3809 - *
3810 - * All pagecache pages may be subject to I/O:
3811 - * - inode pages may need to be read from disk,
3812 - * - inode pages which have been modified and are MAP_SHARED may need
3813 - *   to be written back to the inode on disk,
3814 - * - anonymous pages (including MAP_PRIVATE file mappings) which have been
3815 - *   modified may need to be swapped out to swap space and (later) to be read
3816 - *   back into memory.
3817 - */
3818 -
3819 -/*
3820 - * The zone field is never updated after free_area_init_core()
3821 - * sets it, so none of the operations on it need to be atomic.
3822 - */
3823 -
3824 -
3825 -/*
3826 - * page->flags layout:
3827 - *
3828 - * There are three possibilities for how page->flags get
3829 - * laid out.  The first is for the normal case, without
3830 - * sparsemem.  The second is for sparsemem when there is
3831 - * plenty of space for node and section.  The last is when
3832 - * we have run out of space and have to fall back to an
3833 - * alternate (slower) way of determining the node.
3834 - *
3835 - * No sparsemem or sparsemem vmemmap: |       NODE     | ZONE | ... | FLAGS |
3836 - * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
3837 - * classic sparse no space for node:  | SECTION |     ZONE    | ... | FLAGS |
3838 - */
3839 -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
3840 -#define SECTIONS_WIDTH         SECTIONS_SHIFT
3841 -#else
3842 -#define SECTIONS_WIDTH         0
3843 -#endif
3844 -
3845 -#define ZONES_WIDTH            ZONES_SHIFT
3846 -
3847 -#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
3848 -#define NODES_WIDTH            NODES_SHIFT
3849 -#else
3850 -#ifdef CONFIG_SPARSEMEM_VMEMMAP
3851 -#error "Vmemmap: No space for nodes field in page flags"
3852 -#endif
3853 -#define NODES_WIDTH            0
3854 -#endif
3855 -
3856 -/* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */
3857 -#define SECTIONS_PGOFF         ((sizeof(unsigned long)*8) - SECTIONS_WIDTH)
3858 -#define NODES_PGOFF            (SECTIONS_PGOFF - NODES_WIDTH)
3859 -#define ZONES_PGOFF            (NODES_PGOFF - ZONES_WIDTH)
3860 -
3861 -/*
3862 - * We are going to use the flags for the page to node mapping if its in
3863 - * there.  This includes the case where there is no node, so it is implicit.
3864 - */
3865 -#if !(NODES_WIDTH > 0 || NODES_SHIFT == 0)
3866 -#define NODE_NOT_IN_PAGE_FLAGS
3867 -#endif
3868 -
3869 -#ifndef PFN_SECTION_SHIFT
3870 -#define PFN_SECTION_SHIFT 0
3871 -#endif
3872 -
3873 -/*
3874 - * Define the bit shifts to access each section.  For non-existant
3875 - * sections we define the shift as 0; that plus a 0 mask ensures
3876 - * the compiler will optimise away reference to them.
3877 - */
3878 -#define SECTIONS_PGSHIFT       (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0))
3879 -#define NODES_PGSHIFT          (NODES_PGOFF * (NODES_WIDTH != 0))
3880 -#define ZONES_PGSHIFT          (ZONES_PGOFF * (ZONES_WIDTH != 0))
3881 -
3882 -/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allcator */
3883 -#ifdef NODE_NOT_IN_PAGEFLAGS
3884 -#define ZONEID_SHIFT           (SECTIONS_SHIFT + ZONES_SHIFT)
3885 -#define ZONEID_PGOFF           ((SECTIONS_PGOFF < ZONES_PGOFF)? \
3886 -                                               SECTIONS_PGOFF : ZONES_PGOFF)
3887 -#else
3888 -#define ZONEID_SHIFT           (NODES_SHIFT + ZONES_SHIFT)
3889 -#define ZONEID_PGOFF           ((NODES_PGOFF < ZONES_PGOFF)? \
3890 -                                               NODES_PGOFF : ZONES_PGOFF)
3891 -#endif
3892 -
3893 -#define ZONEID_PGSHIFT         (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
3894 -
3895 -#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
3896 -#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
3897 -#endif
3898 -
3899 -#define ZONES_MASK             ((1UL << ZONES_WIDTH) - 1)
3900 -#define NODES_MASK             ((1UL << NODES_WIDTH) - 1)
3901 -#define SECTIONS_MASK          ((1UL << SECTIONS_WIDTH) - 1)
3902 -#define ZONEID_MASK            ((1UL << ZONEID_SHIFT) - 1)
3903 -
3904 -static inline enum zone_type page_zonenum(struct page *page)
3905 -{
3906 -       return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
3907 -}
3908 -
3909 -/*
3910 - * The identification function is only used by the buddy allocator for
3911 - * determining if two pages could be buddies. We are not really
3912 - * identifying a zone since we could be using a the section number
3913 - * id if we have not node id available in page flags.
3914 - * We guarantee only that it will return the same value for two
3915 - * combinable pages in a zone.
3916 - */
3917 -static inline int page_zone_id(struct page *page)
3918 -{
3919 -       return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
3920 -}
3921 -
3922 -static inline int zone_to_nid(struct zone *zone)
3923 -{
3924 -#ifdef CONFIG_NUMA
3925 -       return zone->node;
3926 -#else
3927 -       return 0;
3928 -#endif
3929 -}
3930 -
3931 -#ifdef NODE_NOT_IN_PAGE_FLAGS
3932 -extern int page_to_nid(struct page *page);
3933 -#else
3934 -static inline int page_to_nid(struct page *page)
3935 -{
3936 -       return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
3937 -}
3938 -#endif
3939 -
3940 -static inline struct zone *page_zone(struct page *page)
3941 -{
3942 -       return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
3943 -}
3944 -
3945 -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
3946 -static inline unsigned long page_to_section(struct page *page)
3947 -{
3948 -       return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
3949 -}
3950 -#endif
3951 -
3952 -static inline void set_page_zone(struct page *page, enum zone_type zone)
3953 -{
3954 -       page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
3955 -       page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
3956 -}
3957 -
3958 -static inline void set_page_node(struct page *page, unsigned long node)
3959 -{
3960 -       page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
3961 -       page->flags |= (node & NODES_MASK) << NODES_PGSHIFT;
3962 -}
3963 -
3964 -static inline void set_page_section(struct page *page, unsigned long section)
3965 -{
3966 -       page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
3967 -       page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
3968 -}
3969 -
3970 -static inline void set_page_links(struct page *page, enum zone_type zone,
3971 -       unsigned long node, unsigned long pfn)
3972 -{
3973 -       set_page_zone(page, zone);
3974 -       set_page_node(page, node);
3975 -       set_page_section(page, pfn_to_section_nr(pfn));
3976 -}
3977 -
3978 -/*
3979 - * If a hint addr is less than mmap_min_addr change hint to be as
3980 - * low as possible but still greater than mmap_min_addr
3981 - */
3982 -static inline unsigned long round_hint_to_min(unsigned long hint)
3983 -{
3984 -#ifdef CONFIG_SECURITY
3985 -       hint &= PAGE_MASK;
3986 -       if (((void *)hint != NULL) &&
3987 -           (hint < mmap_min_addr))
3988 -               return PAGE_ALIGN(mmap_min_addr);
3989 -#endif
3990 -       return hint;
3991 -}
3992 -
3993 -/*
3994 - * Some inline functions in vmstat.h depend on page_zone()
3995 - */
3996 -#include <linux/vmstat.h>
3997 -
3998 -static __always_inline void *lowmem_page_address(struct page *page)
3999 -{
4000 -       return __va(page_to_pfn(page) << PAGE_SHIFT);
4001 -}
4002 -
4003 -#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
4004 -#define HASHED_PAGE_VIRTUAL
4005 -#endif
4006 -
4007 -#if defined(WANT_PAGE_VIRTUAL)
4008 -#define page_address(page) ((page)->virtual)
4009 -#define set_page_address(page, address)                        \
4010 -       do {                                            \
4011 -               (page)->virtual = (address);            \
4012 -       } while(0)
4013 -#define page_address_init()  do { } while(0)
4014 -#endif
4015 -
4016 -#if defined(HASHED_PAGE_VIRTUAL)
4017 -void *page_address(struct page *page);
4018 -void set_page_address(struct page *page, void *virtual);
4019 -void page_address_init(void);
4020 -#endif
4021 -
4022 -#if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL)
4023 -#define page_address(page) lowmem_page_address(page)
4024 -#define set_page_address(page, address)  do { } while(0)
4025 -#define page_address_init()  do { } while(0)
4026 -#endif
4027 -
4028 -/*
4029 - * On an anonymous page mapped into a user virtual memory area,
4030 - * page->mapping points to its anon_vma, not to a struct address_space;
4031 - * with the PAGE_MAPPING_ANON bit set to distinguish it.
4032 - *
4033 - * Please note that, confusingly, "page_mapping" refers to the inode
4034 - * address_space which maps the page from disk; whereas "page_mapped"
4035 - * refers to user virtual address space into which the page is mapped.
4036 - */
4037 -#define PAGE_MAPPING_ANON      1
4038 -
4039 -extern struct address_space swapper_space;
4040 -static inline struct address_space *page_mapping(struct page *page)
4041 -{
4042 -       struct address_space *mapping = page->mapping;
4043 -
4044 -       VM_BUG_ON(PageSlab(page));
4045 -#ifdef CONFIG_SWAP
4046 -       if (unlikely(PageSwapCache(page)))
4047 -               mapping = &swapper_space;
4048 -       else
4049 -#endif
4050 -       if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
4051 -               mapping = NULL;
4052 -       return mapping;
4053 -}
4054 -
4055 -static inline int PageAnon(struct page *page)
4056 -{
4057 -       return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
4058 -}
4059 -
4060 -/*
4061 - * Return the pagecache index of the passed page.  Regular pagecache pages
4062 - * use ->index whereas swapcache pages use ->private
4063 - */
4064 -static inline pgoff_t page_index(struct page *page)
4065 -{
4066 -       if (unlikely(PageSwapCache(page)))
4067 -               return page_private(page);
4068 -       return page->index;
4069 -}
4070 -
4071 -/*
4072 - * The atomic page->_mapcount, like _count, starts from -1:
4073 - * so that transitions both from it and to it can be tracked,
4074 - * using atomic_inc_and_test and atomic_add_negative(-1).
4075 - */
4076 -static inline void reset_page_mapcount(struct page *page)
4077 -{
4078 -       atomic_set(&(page)->_mapcount, -1);
4079 -}
4080 -
4081 -static inline int page_mapcount(struct page *page)
4082 -{
4083 -       return atomic_read(&(page)->_mapcount) + 1;
4084 -}
4085 -
4086 -/*
4087 - * Return true if this page is mapped into pagetables.
4088 - */
4089 -static inline int page_mapped(struct page *page)
4090 -{
4091 -       return atomic_read(&(page)->_mapcount) >= 0;
4092 -}
4093 -
4094 -/*
4095 - * Different kinds of faults, as returned by handle_mm_fault().
4096 - * Used to decide whether a process gets delivered SIGBUS or
4097 - * just gets major/minor fault counters bumped up.
4098 - */
4099 -
4100 -#define VM_FAULT_MINOR 0 /* For backwards compat. Remove me quickly. */
4101 -
4102 -#define VM_FAULT_OOM   0x0001
4103 -#define VM_FAULT_SIGBUS        0x0002
4104 -#define VM_FAULT_MAJOR 0x0004
4105 -#define VM_FAULT_WRITE 0x0008  /* Special case for get_user_pages */
4106 -
4107 -#define VM_FAULT_NOPAGE        0x0100  /* ->fault installed the pte, not return page */
4108 -#define VM_FAULT_LOCKED        0x0200  /* ->fault locked the returned page */
4109 -
4110 -#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS)
4111 -
4112 -#define offset_in_page(p)      ((unsigned long)(p) & ~PAGE_MASK)
4113 -
4114 -extern void show_free_areas(void);
4115 -
4116 -#ifdef CONFIG_SHMEM
4117 -int shmem_lock(struct file *file, int lock, struct user_struct *user);
4118 -#else
4119 -static inline int shmem_lock(struct file *file, int lock,
4120 -                            struct user_struct *user)
4121 -{
4122 -       return 0;
4123 -}
4124 -#endif
4125 -struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags);
4126 -
4127 -int shmem_zero_setup(struct vm_area_struct *);
4128 -
4129 -#ifndef CONFIG_MMU
4130 -extern unsigned long shmem_get_unmapped_area(struct file *file,
4131 -                                            unsigned long addr,
4132 -                                            unsigned long len,
4133 -                                            unsigned long pgoff,
4134 -                                            unsigned long flags);
4135 -#endif
4136 -
4137 -extern int can_do_mlock(void);
4138 -extern int user_shm_lock(size_t, struct user_struct *);
4139 -extern void user_shm_unlock(size_t, struct user_struct *);
4140 -
4141 -/*
4142 - * Parameter block passed down to zap_pte_range in exceptional cases.
4143 - */
4144 -struct zap_details {
4145 -       struct vm_area_struct *nonlinear_vma;   /* Check page->index if set */
4146 -       struct address_space *check_mapping;    /* Check page->mapping if set */
4147 -       pgoff_t first_index;                    /* Lowest page->index to unmap */
4148 -       pgoff_t last_index;                     /* Highest page->index to unmap */
4149 -       spinlock_t *i_mmap_lock;                /* For unmap_mapping_range: */
4150 -       unsigned long truncate_count;           /* Compare vm_truncate_count */
4151 -};
4152 -
4153 -struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
4154 -               pte_t pte);
4155 -
4156 -int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
4157 -               unsigned long size);
4158 -unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
4159 -               unsigned long size, struct zap_details *);
4160 -unsigned long unmap_vmas(struct mmu_gather **tlb,
4161 -               struct vm_area_struct *start_vma, unsigned long start_addr,
4162 -               unsigned long end_addr, unsigned long *nr_accounted,
4163 -               struct zap_details *);
4164 -
4165 -/**
4166 - * mm_walk - callbacks for walk_page_range
4167 - * @pgd_entry: if set, called for each non-empty PGD (top-level) entry
4168 - * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry
4169 - * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry
4170 - * @pte_entry: if set, called for each non-empty PTE (4th-level) entry
4171 - * @pte_hole: if set, called for each hole at all levels
4172 - *
4173 - * (see walk_page_range for more details)
4174 - */
4175 -struct mm_walk {
4176 -       int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, struct mm_walk *);
4177 -       int (*pud_entry)(pud_t *, unsigned long, unsigned long, struct mm_walk *);
4178 -       int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *);
4179 -       int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *);
4180 -       int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *);
4181 -       struct mm_struct *mm;
4182 -       void *private;
4183 -};
4184 -
4185 -int walk_page_range(unsigned long addr, unsigned long end,
4186 -               struct mm_walk *walk);
4187 -void free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
4188 -               unsigned long end, unsigned long floor, unsigned long ceiling);
4189 -int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
4190 -                       struct vm_area_struct *vma);
4191 -void unmap_mapping_range(struct address_space *mapping,
4192 -               loff_t const holebegin, loff_t const holelen, int even_cows);
4193 -int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
4194 -                       void *buf, int len, int write);
4195 -
4196 -static inline void unmap_shared_mapping_range(struct address_space *mapping,
4197 -               loff_t const holebegin, loff_t const holelen)
4198 -{
4199 -       unmap_mapping_range(mapping, holebegin, holelen, 0);
4200 -}
4201 -
4202 -extern int vmtruncate(struct inode * inode, loff_t offset);
4203 -extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
4204 -
4205 -#ifdef CONFIG_MMU
4206 -extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
4207 -                       unsigned long address, int write_access);
4208 -#else
4209 -static inline int handle_mm_fault(struct mm_struct *mm,
4210 -                       struct vm_area_struct *vma, unsigned long address,
4211 -                       int write_access)
4212 -{
4213 -       /* should never happen if there's no MMU */
4214 -       BUG();
4215 -       return VM_FAULT_SIGBUS;
4216 -}
4217 -#endif
4218 -
4219 -extern int make_pages_present(unsigned long addr, unsigned long end);
4220 -extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
4221 -
4222 -int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
4223 -               int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
4224 -
4225 -extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
4226 -extern void do_invalidatepage(struct page *page, unsigned long offset);
4227 -
4228 -int __set_page_dirty_nobuffers(struct page *page);
4229 -int __set_page_dirty_no_writeback(struct page *page);
4230 -int redirty_page_for_writepage(struct writeback_control *wbc,
4231 -                               struct page *page);
4232 -int set_page_dirty(struct page *page);
4233 -int set_page_dirty_lock(struct page *page);
4234 -int clear_page_dirty_for_io(struct page *page);
4235 -
4236 -extern unsigned long move_page_tables(struct vm_area_struct *vma,
4237 -               unsigned long old_addr, struct vm_area_struct *new_vma,
4238 -               unsigned long new_addr, unsigned long len);
4239 -extern unsigned long do_mremap(unsigned long addr,
4240 -                              unsigned long old_len, unsigned long new_len,
4241 -                              unsigned long flags, unsigned long new_addr);
4242 -extern int mprotect_fixup(struct vm_area_struct *vma,
4243 -                         struct vm_area_struct **pprev, unsigned long start,
4244 -                         unsigned long end, unsigned long newflags);
4245 -
4246 -/*
4247 - * get_user_pages_fast provides equivalent functionality to get_user_pages,
4248 - * operating on current and current->mm (force=0 and doesn't return any vmas).
4249 - *
4250 - * get_user_pages_fast may take mmap_sem and page tables, so no assumptions
4251 - * can be made about locking. get_user_pages_fast is to be implemented in a
4252 - * way that is advantageous (vs get_user_pages()) when the user memory area is
4253 - * already faulted in and present in ptes. However if the pages have to be
4254 - * faulted in, it may turn out to be slightly slower).
4255 - */
4256 -int get_user_pages_fast(unsigned long start, int nr_pages, int write,
4257 -                       struct page **pages);
4258 -
4259 -/*
4260 - * A callback you can register to apply pressure to ageable caches.
4261 - *
4262 - * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'.  It should
4263 - * look through the least-recently-used 'nr_to_scan' entries and
4264 - * attempt to free them up.  It should return the number of objects
4265 - * which remain in the cache.  If it returns -1, it means it cannot do
4266 - * any scanning at this time (eg. there is a risk of deadlock).
4267 - *
4268 - * The 'gfpmask' refers to the allocation we are currently trying to
4269 - * fulfil.
4270 - *
4271 - * Note that 'shrink' will be passed nr_to_scan == 0 when the VM is
4272 - * querying the cache size, so a fastpath for that case is appropriate.
4273 - */
4274 -struct shrinker {
4275 -       int (*shrink)(int nr_to_scan, gfp_t gfp_mask);
4276 -       int seeks;      /* seeks to recreate an obj */
4277 -
4278 -       /* These are for internal use */
4279 -       struct list_head list;
4280 -       long nr;        /* objs pending delete */
4281 -};
4282 -#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */
4283 -extern void register_shrinker(struct shrinker *);
4284 -extern void unregister_shrinker(struct shrinker *);
4285 -
4286 -int vma_wants_writenotify(struct vm_area_struct *vma);
4287 -
4288 -extern pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl);
4289 -
4290 -#ifdef __PAGETABLE_PUD_FOLDED
4291 -static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
4292 -                                               unsigned long address)
4293 -{
4294 -       return 0;
4295 -}
4296 -#else
4297 -int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
4298 -#endif
4299 -
4300 -#ifdef __PAGETABLE_PMD_FOLDED
4301 -static inline int __pmd_alloc(struct mm_struct *mm, pud_t *pud,
4302 -                                               unsigned long address)
4303 -{
4304 -       return 0;
4305 -}
4306 -#else
4307 -int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address);
4308 -#endif
4309 -
4310 -int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address);
4311 -int __pte_alloc_kernel(pmd_t *pmd, unsigned long address);
4312 -
4313 -/*
4314 - * The following ifdef needed to get the 4level-fixup.h header to work.
4315 - * Remove it when 4level-fixup.h has been removed.
4316 - */
4317 -#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
4318 -static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
4319 -{
4320 -       return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address))?
4321 -               NULL: pud_offset(pgd, address);
4322 -}
4323 -
4324 -static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
4325 -{
4326 -       return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))?
4327 -               NULL: pmd_offset(pud, address);
4328 -}
4329 -#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
4330 -
4331 -#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
4332 -/*
4333 - * We tuck a spinlock to guard each pagetable page into its struct page,
4334 - * at page->private, with BUILD_BUG_ON to make sure that this will not
4335 - * overflow into the next struct page (as it might with DEBUG_SPINLOCK).
4336 - * When freeing, reset page->mapping so free_pages_check won't complain.
4337 - */
4338 -#define __pte_lockptr(page)    &((page)->ptl)
4339 -#define pte_lock_init(_page)   do {                                    \
4340 -       spin_lock_init(__pte_lockptr(_page));                           \
4341 -} while (0)
4342 -#define pte_lock_deinit(page)  ((page)->mapping = NULL)
4343 -#define pte_lockptr(mm, pmd)   ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));})
4344 -#else
4345 -/*
4346 - * We use mm->page_table_lock to guard all pagetable pages of the mm.
4347 - */
4348 -#define pte_lock_init(page)    do {} while (0)
4349 -#define pte_lock_deinit(page)  do {} while (0)
4350 -#define pte_lockptr(mm, pmd)   ({(void)(pmd); &(mm)->page_table_lock;})
4351 -#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
4352 -
4353 -static inline void pgtable_page_ctor(struct page *page)
4354 -{
4355 -       pte_lock_init(page);
4356 -       inc_zone_page_state(page, NR_PAGETABLE);
4357 -}
4358 -
4359 -static inline void pgtable_page_dtor(struct page *page)
4360 -{
4361 -       pte_lock_deinit(page);
4362 -       dec_zone_page_state(page, NR_PAGETABLE);
4363 -}
4364 -
4365 -#define pte_offset_map_lock(mm, pmd, address, ptlp)    \
4366 -({                                                     \
4367 -       spinlock_t *__ptl = pte_lockptr(mm, pmd);       \
4368 -       pte_t *__pte = pte_offset_map(pmd, address);    \
4369 -       *(ptlp) = __ptl;                                \
4370 -       spin_lock(__ptl);                               \
4371 -       __pte;                                          \
4372 -})
4373 -
4374 -#define pte_unmap_unlock(pte, ptl)     do {            \
4375 -       spin_unlock(ptl);                               \
4376 -       pte_unmap(pte);                                 \
4377 -} while (0)
4378 -
4379 -#define pte_alloc_map(mm, pmd, address)                        \
4380 -       ((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \
4381 -               NULL: pte_offset_map(pmd, address))
4382 -
4383 -#define pte_alloc_map_lock(mm, pmd, address, ptlp)     \
4384 -       ((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \
4385 -               NULL: pte_offset_map_lock(mm, pmd, address, ptlp))
4386 -
4387 -#define pte_alloc_kernel(pmd, address)                 \
4388 -       ((unlikely(!pmd_present(*(pmd))) && __pte_alloc_kernel(pmd, address))? \
4389 -               NULL: pte_offset_kernel(pmd, address))
4390 -
4391 -extern void free_area_init(unsigned long * zones_size);
4392 -extern void free_area_init_node(int nid, unsigned long * zones_size,
4393 -               unsigned long zone_start_pfn, unsigned long *zholes_size);
4394 -#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
4395 -/*
4396 - * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its
4397 - * zones, allocate the backing mem_map and account for memory holes in a more
4398 - * architecture independent manner. This is a substitute for creating the
4399 - * zone_sizes[] and zholes_size[] arrays and passing them to
4400 - * free_area_init_node()
4401 - *
4402 - * An architecture is expected to register range of page frames backed by
4403 - * physical memory with add_active_range() before calling
4404 - * free_area_init_nodes() passing in the PFN each zone ends at. At a basic
4405 - * usage, an architecture is expected to do something like
4406 - *
4407 - * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
4408 - *                                                      max_highmem_pfn};
4409 - * for_each_valid_physical_page_range()
4410 - *     add_active_range(node_id, start_pfn, end_pfn)
4411 - * free_area_init_nodes(max_zone_pfns);
4412 - *
4413 - * If the architecture guarantees that there are no holes in the ranges
4414 - * registered with add_active_range(), free_bootmem_active_regions()
4415 - * will call free_bootmem_node() for each registered physical page range.
4416 - * Similarly sparse_memory_present_with_active_regions() calls
4417 - * memory_present() for each range when SPARSEMEM is enabled.
4418 - *
4419 - * See mm/page_alloc.c for more information on each function exposed by
4420 - * CONFIG_ARCH_POPULATES_NODE_MAP
4421 - */
4422 -extern void free_area_init_nodes(unsigned long *max_zone_pfn);
4423 -extern void add_active_range(unsigned int nid, unsigned long start_pfn,
4424 -                                       unsigned long end_pfn);
4425 -extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
4426 -                                       unsigned long end_pfn);
4427 -extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn,
4428 -                                       unsigned long end_pfn);
4429 -extern void remove_all_active_ranges(void);
4430 -extern unsigned long absent_pages_in_range(unsigned long start_pfn,
4431 -                                               unsigned long end_pfn);
4432 -extern void get_pfn_range_for_nid(unsigned int nid,
4433 -                       unsigned long *start_pfn, unsigned long *end_pfn);
4434 -extern unsigned long find_min_pfn_with_active_regions(void);
4435 -extern void free_bootmem_with_active_regions(int nid,
4436 -                                               unsigned long max_low_pfn);
4437 -typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
4438 -extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
4439 -extern void sparse_memory_present_with_active_regions(int nid);
4440 -#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
4441 -extern int early_pfn_to_nid(unsigned long pfn);
4442 -#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
4443 -#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
4444 -extern void set_dma_reserve(unsigned long new_dma_reserve);
4445 -extern void memmap_init_zone(unsigned long, int, unsigned long,
4446 -                               unsigned long, enum memmap_context);
4447 -extern void setup_per_zone_pages_min(void);
4448 -extern void mem_init(void);
4449 -extern void show_mem(void);
4450 -extern void si_meminfo(struct sysinfo * val);
4451 -extern void si_meminfo_node(struct sysinfo *val, int nid);
4452 -extern int after_bootmem;
4453 -
4454 -#ifdef CONFIG_NUMA
4455 -extern void setup_per_cpu_pageset(void);
4456 -#else
4457 -static inline void setup_per_cpu_pageset(void) {}
4458 -#endif
4459 -
4460 -/* prio_tree.c */
4461 -void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
4462 -void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *);
4463 -void vma_prio_tree_remove(struct vm_area_struct *, struct prio_tree_root *);
4464 -struct vm_area_struct *vma_prio_tree_next(struct vm_area_struct *vma,
4465 -       struct prio_tree_iter *iter);
4466 -
4467 -#define vma_prio_tree_foreach(vma, iter, root, begin, end)     \
4468 -       for (prio_tree_iter_init(iter, root, begin, end), vma = NULL;   \
4469 -               (vma = vma_prio_tree_next(vma, iter)); )
4470 -
4471 -static inline void vma_nonlinear_insert(struct vm_area_struct *vma,
4472 -                                       struct list_head *list)
4473 -{
4474 -       vma->shared.vm_set.parent = NULL;
4475 -       list_add_tail(&vma->shared.vm_set.list, list);
4476 -}
4477 -
4478 -/* mmap.c */
4479 -extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin);
4480 -extern void vma_adjust(struct vm_area_struct *vma, unsigned long start,
4481 -       unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert);
4482 -extern struct vm_area_struct *vma_merge(struct mm_struct *,
4483 -       struct vm_area_struct *prev, unsigned long addr, unsigned long end,
4484 -       unsigned long vm_flags, struct anon_vma *, struct file *, pgoff_t,
4485 -       struct mempolicy *);
4486 -extern struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *);
4487 -extern int split_vma(struct mm_struct *,
4488 -       struct vm_area_struct *, unsigned long addr, int new_below);
4489 -extern int insert_vm_struct(struct mm_struct *, struct vm_area_struct *);
4490 -extern void __vma_link_rb(struct mm_struct *, struct vm_area_struct *,
4491 -       struct rb_node **, struct rb_node *);
4492 -extern void unlink_file_vma(struct vm_area_struct *);
4493 -extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
4494 -       unsigned long addr, unsigned long len, pgoff_t pgoff);
4495 -extern void exit_mmap(struct mm_struct *);
4496 -
4497 -extern int mm_take_all_locks(struct mm_struct *mm);
4498 -extern void mm_drop_all_locks(struct mm_struct *mm);
4499 -
4500 -#ifdef CONFIG_PROC_FS
4501 -/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */
4502 -extern void added_exe_file_vma(struct mm_struct *mm);
4503 -extern void removed_exe_file_vma(struct mm_struct *mm);
4504 -#else
4505 -static inline void added_exe_file_vma(struct mm_struct *mm)
4506 -{}
4507 -
4508 -static inline void removed_exe_file_vma(struct mm_struct *mm)
4509 -{}
4510 -#endif /* CONFIG_PROC_FS */
4511 -
4512 -extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
4513 -extern int install_special_mapping(struct mm_struct *mm,
4514 -                                  unsigned long addr, unsigned long len,
4515 -                                  unsigned long flags, struct page **pages);
4516 -
4517 -extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
4518 -
4519 -extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
4520 -       unsigned long len, unsigned long prot,
4521 -       unsigned long flag, unsigned long pgoff);
4522 -extern unsigned long mmap_region(struct file *file, unsigned long addr,
4523 -       unsigned long len, unsigned long flags,
4524 -       unsigned int vm_flags, unsigned long pgoff,
4525 -       int accountable);
4526 -
4527 -static inline unsigned long do_mmap(struct file *file, unsigned long addr,
4528 -       unsigned long len, unsigned long prot,
4529 -       unsigned long flag, unsigned long offset)
4530 -{
4531 -       unsigned long ret = -EINVAL;
4532 -       if ((offset + PAGE_ALIGN(len)) < offset)
4533 -               goto out;
4534 -       if (!(offset & ~PAGE_MASK))
4535 -               ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
4536 -out:
4537 -       return ret;
4538 -}
4539 -
4540 -extern int do_munmap(struct mm_struct *, unsigned long, size_t);
4541 -
4542 -extern unsigned long do_brk(unsigned long, unsigned long);
4543 -
4544 -/* filemap.c */
4545 -extern unsigned long page_unuse(struct page *);
4546 -extern void truncate_inode_pages(struct address_space *, loff_t);
4547 -extern void truncate_inode_pages_range(struct address_space *,
4548 -                                      loff_t lstart, loff_t lend);
4549 -
4550 -/* generic vm_area_ops exported for stackable file systems */
4551 -extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
4552 -
4553 -/* mm/page-writeback.c */
4554 -int write_one_page(struct page *page, int wait);
4555 -
4556 -/* readahead.c */
4557 -#define VM_MAX_READAHEAD       128     /* kbytes */
4558 -#define VM_MIN_READAHEAD       16      /* kbytes (includes current page) */
4559 -
4560 -int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
4561 -                       pgoff_t offset, unsigned long nr_to_read);
4562 -int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
4563 -                       pgoff_t offset, unsigned long nr_to_read);
4564 -
4565 -void page_cache_sync_readahead(struct address_space *mapping,
4566 -                              struct file_ra_state *ra,
4567 -                              struct file *filp,
4568 -                              pgoff_t offset,
4569 -                              unsigned long size);
4570 -
4571 -void page_cache_async_readahead(struct address_space *mapping,
4572 -                               struct file_ra_state *ra,
4573 -                               struct file *filp,
4574 -                               struct page *pg,
4575 -                               pgoff_t offset,
4576 -                               unsigned long size);
4577 -
4578 -unsigned long max_sane_readahead(unsigned long nr);
4579 -
4580 -/* Do stack extension */
4581 -extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
4582 -#ifdef CONFIG_IA64
4583 -extern int expand_upwards(struct vm_area_struct *vma, unsigned long address);
4584 -#endif
4585 -extern int expand_stack_downwards(struct vm_area_struct *vma,
4586 -                                 unsigned long address);
4587 -
4588 -/* Look up the first VMA which satisfies  addr < vm_end,  NULL if none. */
4589 -extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr);
4590 -extern struct vm_area_struct * find_vma_prev(struct mm_struct * mm, unsigned long addr,
4591 -                                            struct vm_area_struct **pprev);
4592 -
4593 -/* Look up the first VMA which intersects the interval start_addr..end_addr-1,
4594 -   NULL if none.  Assume start_addr < end_addr. */
4595 -static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * mm, unsigned long start_addr, unsigned long end_addr)
4596 -{
4597 -       struct vm_area_struct * vma = find_vma(mm,start_addr);
4598 -
4599 -       if (vma && end_addr <= vma->vm_start)
4600 -               vma = NULL;
4601 -       return vma;
4602 -}
4603 -
4604 -static inline unsigned long vma_pages(struct vm_area_struct *vma)
4605 -{
4606 -       return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
4607 -}
4608 -
4609 -pgprot_t vm_get_page_prot(unsigned long vm_flags);
4610 -struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
4611 -int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
4612 -                       unsigned long pfn, unsigned long size, pgprot_t);
4613 -int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
4614 -int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
4615 -                       unsigned long pfn);
4616 -int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
4617 -                       unsigned long pfn);
4618 -
4619 -struct page *follow_page(struct vm_area_struct *, unsigned long address,
4620 -                       unsigned int foll_flags);
4621 -#define FOLL_WRITE     0x01    /* check pte is writable */
4622 -#define FOLL_TOUCH     0x02    /* mark page accessed */
4623 -#define FOLL_GET       0x04    /* do get_page on page */
4624 -#define FOLL_ANON      0x08    /* give ZERO_PAGE if no pgtable */
4625 -
4626 -typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
4627 -                       void *data);
4628 -extern int apply_to_page_range(struct mm_struct *mm, unsigned long address,
4629 -                              unsigned long size, pte_fn_t fn, void *data);
4630 -
4631 -#ifdef CONFIG_PROC_FS
4632 -void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
4633 -#else
4634 -static inline void vm_stat_account(struct mm_struct *mm,
4635 -                       unsigned long flags, struct file *file, long pages)
4636 -{
4637 -}
4638 -#endif /* CONFIG_PROC_FS */
4639 -
4640 -#ifdef CONFIG_DEBUG_PAGEALLOC
4641 -extern int debug_pagealloc_enabled;
4642 -
4643 -extern void kernel_map_pages(struct page *page, int numpages, int enable);
4644 -
4645 -static inline void enable_debug_pagealloc(void)
4646 -{
4647 -       debug_pagealloc_enabled = 1;
4648 -}
4649 -#ifdef CONFIG_HIBERNATION
4650 -extern bool kernel_page_present(struct page *page);
4651 -#endif /* CONFIG_HIBERNATION */
4652 -#else
4653 -static inline void
4654 -kernel_map_pages(struct page *page, int numpages, int enable) {}
4655 -static inline void enable_debug_pagealloc(void)
4656 -{
4657 -}
4658 -#ifdef CONFIG_HIBERNATION
4659 -static inline bool kernel_page_present(struct page *page) { return true; }
4660 -#endif /* CONFIG_HIBERNATION */
4661 -#endif
4662 -
4663 -extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
4664 -#ifdef __HAVE_ARCH_GATE_AREA
4665 -int in_gate_area_no_task(unsigned long addr);
4666 -int in_gate_area(struct task_struct *task, unsigned long addr);
4667 -#else
4668 -int in_gate_area_no_task(unsigned long addr);
4669 -#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
4670 -#endif /* __HAVE_ARCH_GATE_AREA */
4671 -
4672 -int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
4673 -                                       void __user *, size_t *, loff_t *);
4674 -unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
4675 -                       unsigned long lru_pages);
4676 -
4677 -#ifndef CONFIG_MMU
4678 -#define randomize_va_space 0
4679 -#else
4680 -extern int randomize_va_space;
4681 -#endif
4682 -
4683 -const char * arch_vma_name(struct vm_area_struct *vma);
4684 -void print_vma_addr(char *prefix, unsigned long rip);
4685 -
4686 -struct page *sparse_mem_map_populate(unsigned long pnum, int nid);
4687 -pgd_t *vmemmap_pgd_populate(unsigned long addr, int node);
4688 -pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node);
4689 -pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node);
4690 -pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node);
4691 -void *vmemmap_alloc_block(unsigned long size, int node);
4692 -void vmemmap_verify(pte_t *, int, unsigned long, unsigned long);
4693 -int vmemmap_populate_basepages(struct page *start_page,
4694 -                                               unsigned long pages, int node);
4695 -int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
4696 -void vmemmap_populate_print_last(void);
4697 -
4698 -#endif /* __KERNEL__ */
4699 -#endif /* _LINUX_MM_H */
4700 diff -Nurb linux-2.6.27-720/include/linux/netdevice.h linux-2.6.27-710/include/linux/netdevice.h
4701 --- linux-2.6.27-720/include/linux/netdevice.h  2009-05-04 12:18:34.000000000 -0400
4702 +++ linux-2.6.27-710/include/linux/netdevice.h  2009-05-04 12:16:04.000000000 -0400
4703 @@ -735,46 +735,6 @@
4704         /* GARP */
4705         struct garp_port        *garp_port;
4706  
4707 -       /* Click polling support */
4708 -       /*
4709 -        * polling is < 0 if the device does not support polling, == 0 if the
4710 -        * device supports polling but interrupts are on, and > 0 if polling
4711 -        * is on.
4712 -        */
4713 -       int                     polling;
4714 -       int                     (*poll_on)(struct net_device *);
4715 -       int                     (*poll_off)(struct net_device *);
4716 -       /*
4717 -        * rx_poll returns to caller a linked list of sk_buff objects received
4718 -        * by the device. on call, the want argument specifies the number of
4719 -        * packets wanted. on return, the want argument specifies the number
4720 -        * of packets actually returned.
4721 -        */
4722 -       struct sk_buff *        (*rx_poll)(struct net_device*, int *want);
4723 -       /* refill rx dma ring using the given sk_buff list. returns 0 if
4724 -        * successful, or if there are more entries need to be cleaned,
4725 -        * returns the number of dirty entries. the ptr to the sk_buff list is
4726 -        * updated by the driver to point to any unused skbs.
4727 -        */
4728 -       int                     (*rx_refill)(struct net_device*, struct sk_buff**);
4729 -       /*
4730 -        * place sk_buff on the transmit ring. returns 0 if successful, 1
4731 -        * otherwise
4732 -        */
4733 -       int                     (*tx_queue)(struct net_device *, struct sk_buff *);
4734 -       /*
4735 -        * clean tx dma ring. returns the list of skb objects cleaned
4736 -        */
4737 -       struct sk_buff*         (*tx_clean)(struct net_device *);
4738 -       /*
4739 -        * start transmission. returns 0 if successful, 1 otherwise
4740 -        */
4741 -       int                     (*tx_start)(struct net_device *);
4742 -       /*
4743 -        * tell device the end of a batch of packets
4744 -        */
4745 -       int                     (*tx_eob)(struct net_device *);
4746 -
4747         /* class/net/name entry */
4748         struct device           dev;
4749         /* space for optional statistics and wireless sysfs groups */
4750 @@ -959,11 +919,6 @@
4751  extern int             dev_queue_xmit(struct sk_buff *skb);
4752  extern int             register_netdevice(struct net_device *dev);
4753  extern void            unregister_netdevice(struct net_device *dev);
4754 -
4755 -extern int             register_net_in(struct notifier_block *nb); /* Click */
4756 -extern int             unregister_net_in(struct notifier_block *nb); /* Click */
4757 -extern int             ptype_dispatch(struct sk_buff *skb, unsigned short type); /* Click */
4758 -
4759  extern void            free_netdev(struct net_device *dev);
4760  extern void            synchronize_net(void);
4761  extern int             register_netdevice_notifier(struct notifier_block *nb);
4762 @@ -1262,10 +1217,7 @@
4763  extern int             netif_rx(struct sk_buff *skb);
4764  extern int             netif_rx_ni(struct sk_buff *skb);
4765  #define HAVE_NETIF_RECEIVE_SKB 1
4766 -//extern int           netif_receive_skb(struct sk_buff *skb);
4767 -#define HAVE___NETIF_RECEIVE_SKB 1
4768 -extern int             __netif_receive_skb(struct sk_buff *skb, unsigned short protocol, int ignore_notifiers);
4769 -
4770 +extern int             netif_receive_skb(struct sk_buff *skb);
4771  extern void            netif_nit_deliver(struct sk_buff *skb);
4772  extern int             dev_valid_name(const char *name);
4773  extern int             dev_ioctl(struct net *net, unsigned int cmd, void __user *);
4774 @@ -1406,11 +1358,6 @@
4775  
4776  extern void netif_device_attach(struct net_device *dev);
4777  
4778 -static inline int netif_receive_skb(struct sk_buff *skb)
4779 -{
4780 -       return __netif_receive_skb(skb, skb->protocol, 0);
4781 -}
4782 -
4783  /*
4784   * Network interface message level settings
4785   */
4786 diff -Nurb linux-2.6.27-720/include/linux/netdevice.h.orig linux-2.6.27-710/include/linux/netdevice.h.orig
4787 --- linux-2.6.27-720/include/linux/netdevice.h.orig     2009-05-04 12:16:04.000000000 -0400
4788 +++ linux-2.6.27-710/include/linux/netdevice.h.orig     1969-12-31 19:00:00.000000000 -0500
4789 @@ -1,1732 +0,0 @@
4790 -/*
4791 - * INET                An implementation of the TCP/IP protocol suite for the LINUX
4792 - *             operating system.  INET is implemented using the  BSD Socket
4793 - *             interface as the means of communication with the user level.
4794 - *
4795 - *             Definitions for the Interfaces handler.
4796 - *
4797 - * Version:    @(#)dev.h       1.0.10  08/12/93
4798 - *
4799 - * Authors:    Ross Biro
4800 - *             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
4801 - *             Corey Minyard <wf-rch!minyard@relay.EU.net>
4802 - *             Donald J. Becker, <becker@cesdis.gsfc.nasa.gov>
4803 - *             Alan Cox, <Alan.Cox@linux.org>
4804 - *             Bjorn Ekwall. <bj0rn@blox.se>
4805 - *              Pekka Riikonen <priikone@poseidon.pspt.fi>
4806 - *
4807 - *             This program is free software; you can redistribute it and/or
4808 - *             modify it under the terms of the GNU General Public License
4809 - *             as published by the Free Software Foundation; either version
4810 - *             2 of the License, or (at your option) any later version.
4811 - *
4812 - *             Moved to /usr/include/linux for NET3
4813 - */
4814 -#ifndef _LINUX_NETDEVICE_H
4815 -#define _LINUX_NETDEVICE_H
4816 -
4817 -#include <linux/if.h>
4818 -#include <linux/if_ether.h>
4819 -#include <linux/if_packet.h>
4820 -
4821 -#ifdef __KERNEL__
4822 -#include <linux/timer.h>
4823 -#include <linux/delay.h>
4824 -#include <asm/atomic.h>
4825 -#include <asm/cache.h>
4826 -#include <asm/byteorder.h>
4827 -
4828 -#include <linux/device.h>
4829 -#include <linux/percpu.h>
4830 -#include <linux/dmaengine.h>
4831 -#include <linux/workqueue.h>
4832 -
4833 -#include <net/net_namespace.h>
4834 -
4835 -struct vlan_group;
4836 -struct ethtool_ops;
4837 -struct netpoll_info;
4838 -/* 802.11 specific */
4839 -struct wireless_dev;
4840 -                                       /* source back-compat hooks */
4841 -#define SET_ETHTOOL_OPS(netdev,ops) \
4842 -       ( (netdev)->ethtool_ops = (ops) )
4843 -
4844 -#define HAVE_ALLOC_NETDEV              /* feature macro: alloc_xxxdev
4845 -                                          functions are available. */
4846 -#define HAVE_FREE_NETDEV               /* free_netdev() */
4847 -#define HAVE_NETDEV_PRIV               /* netdev_priv() */
4848 -
4849 -#define NET_XMIT_SUCCESS       0
4850 -#define NET_XMIT_DROP          1       /* skb dropped                  */
4851 -#define NET_XMIT_CN            2       /* congestion notification      */
4852 -#define NET_XMIT_POLICED       3       /* skb is shot by police        */
4853 -#define NET_XMIT_MASK          0xFFFF  /* qdisc flags in net/sch_generic.h */
4854 -
4855 -/* Backlog congestion levels */
4856 -#define NET_RX_SUCCESS         0   /* keep 'em coming, baby */
4857 -#define NET_RX_DROP            1  /* packet dropped */
4858 -#define NET_RX_CN_LOW          2   /* storm alert, just in case */
4859 -#define NET_RX_CN_MOD          3   /* Storm on its way! */
4860 -#define NET_RX_CN_HIGH         4   /* The storm is here */
4861 -#define NET_RX_BAD             5  /* packet dropped due to kernel error */
4862 -
4863 -/* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It
4864 - * indicates that the device will soon be dropping packets, or already drops
4865 - * some packets of the same priority; prompting us to send less aggressively. */
4866 -#define net_xmit_eval(e)       ((e) == NET_XMIT_CN? 0 : (e))
4867 -#define net_xmit_errno(e)      ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
4868 -
4869 -#endif
4870 -
4871 -#define MAX_ADDR_LEN   32              /* Largest hardware address length */
4872 -
4873 -/* Driver transmit return codes */
4874 -#define NETDEV_TX_OK 0         /* driver took care of packet */
4875 -#define NETDEV_TX_BUSY 1       /* driver tx path was busy*/
4876 -#define NETDEV_TX_LOCKED -1    /* driver tx lock was already taken */
4877 -
4878 -#ifdef  __KERNEL__
4879 -
4880 -/*
4881 - *     Compute the worst case header length according to the protocols
4882 - *     used.
4883 - */
4884
4885 -#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
4886 -# if defined(CONFIG_MAC80211_MESH)
4887 -#  define LL_MAX_HEADER 128
4888 -# else
4889 -#  define LL_MAX_HEADER 96
4890 -# endif
4891 -#elif defined(CONFIG_TR)
4892 -# define LL_MAX_HEADER 48
4893 -#else
4894 -# define LL_MAX_HEADER 32
4895 -#endif
4896 -
4897 -#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \
4898 -    !defined(CONFIG_NET_IPGRE) &&  !defined(CONFIG_NET_IPGRE_MODULE) && \
4899 -    !defined(CONFIG_IPV6_SIT) && !defined(CONFIG_IPV6_SIT_MODULE) && \
4900 -    !defined(CONFIG_IPV6_TUNNEL) && !defined(CONFIG_IPV6_TUNNEL_MODULE)
4901 -#define MAX_HEADER LL_MAX_HEADER
4902 -#else
4903 -#define MAX_HEADER (LL_MAX_HEADER + 48)
4904 -#endif
4905 -
4906 -#endif  /*  __KERNEL__  */
4907 -
4908 -/*
4909 - *     Network device statistics. Akin to the 2.0 ether stats but
4910 - *     with byte counters.
4911 - */
4912
4913 -struct net_device_stats
4914 -{
4915 -       unsigned long   rx_packets;             /* total packets received       */
4916 -       unsigned long   tx_packets;             /* total packets transmitted    */
4917 -       unsigned long   rx_bytes;               /* total bytes received         */
4918 -       unsigned long   tx_bytes;               /* total bytes transmitted      */
4919 -       unsigned long   rx_errors;              /* bad packets received         */
4920 -       unsigned long   tx_errors;              /* packet transmit problems     */
4921 -       unsigned long   rx_dropped;             /* no space in linux buffers    */
4922 -       unsigned long   tx_dropped;             /* no space available in linux  */
4923 -       unsigned long   multicast;              /* multicast packets received   */
4924 -       unsigned long   collisions;
4925 -
4926 -       /* detailed rx_errors: */
4927 -       unsigned long   rx_length_errors;
4928 -       unsigned long   rx_over_errors;         /* receiver ring buff overflow  */
4929 -       unsigned long   rx_crc_errors;          /* recved pkt with crc error    */
4930 -       unsigned long   rx_frame_errors;        /* recv'd frame alignment error */
4931 -       unsigned long   rx_fifo_errors;         /* recv'r fifo overrun          */
4932 -       unsigned long   rx_missed_errors;       /* receiver missed packet       */
4933 -
4934 -       /* detailed tx_errors */
4935 -       unsigned long   tx_aborted_errors;
4936 -       unsigned long   tx_carrier_errors;
4937 -       unsigned long   tx_fifo_errors;
4938 -       unsigned long   tx_heartbeat_errors;
4939 -       unsigned long   tx_window_errors;
4940 -       
4941 -       /* for cslip etc */
4942 -       unsigned long   rx_compressed;
4943 -       unsigned long   tx_compressed;
4944 -};
4945 -
4946 -
4947 -/* Media selection options. */
4948 -enum {
4949 -        IF_PORT_UNKNOWN = 0,
4950 -        IF_PORT_10BASE2,
4951 -        IF_PORT_10BASET,
4952 -        IF_PORT_AUI,
4953 -        IF_PORT_100BASET,
4954 -        IF_PORT_100BASETX,
4955 -        IF_PORT_100BASEFX
4956 -};
4957 -
4958 -#ifdef __KERNEL__
4959 -
4960 -#include <linux/cache.h>
4961 -#include <linux/skbuff.h>
4962 -
4963 -struct neighbour;
4964 -struct neigh_parms;
4965 -struct sk_buff;
4966 -
4967 -struct netif_rx_stats
4968 -{
4969 -       unsigned total;
4970 -       unsigned dropped;
4971 -       unsigned time_squeeze;
4972 -       unsigned cpu_collision;
4973 -};
4974 -
4975 -DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
4976 -
4977 -struct dev_addr_list
4978 -{
4979 -       struct dev_addr_list    *next;
4980 -       u8                      da_addr[MAX_ADDR_LEN];
4981 -       u8                      da_addrlen;
4982 -       u8                      da_synced;
4983 -       int                     da_users;
4984 -       int                     da_gusers;
4985 -};
4986 -
4987 -/*
4988 - *     We tag multicasts with these structures.
4989 - */
4990 -
4991 -#define dev_mc_list    dev_addr_list
4992 -#define dmi_addr       da_addr
4993 -#define dmi_addrlen    da_addrlen
4994 -#define dmi_users      da_users
4995 -#define dmi_gusers     da_gusers
4996 -
4997 -struct hh_cache
4998 -{
4999 -       struct hh_cache *hh_next;       /* Next entry                        */
5000 -       atomic_t        hh_refcnt;      /* number of users                   */
5001 -/*
5002 - * We want hh_output, hh_len, hh_lock and hh_data be a in a separate
5003 - * cache line on SMP.
5004 - * They are mostly read, but hh_refcnt may be changed quite frequently,
5005 - * incurring cache line ping pongs.
5006 - */
5007 -       __be16          hh_type ____cacheline_aligned_in_smp;
5008 -                                       /* protocol identifier, f.e ETH_P_IP
5009 -                                         *  NOTE:  For VLANs, this will be the
5010 -                                         *  encapuslated type. --BLG
5011 -                                         */
5012 -       u16             hh_len;         /* length of header */
5013 -       int             (*hh_output)(struct sk_buff *skb);
5014 -       seqlock_t       hh_lock;
5015 -
5016 -       /* cached hardware header; allow for machine alignment needs.        */
5017 -#define HH_DATA_MOD    16
5018 -#define HH_DATA_OFF(__len) \
5019 -       (HH_DATA_MOD - (((__len - 1) & (HH_DATA_MOD - 1)) + 1))
5020 -#define HH_DATA_ALIGN(__len) \
5021 -       (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1))
5022 -       unsigned long   hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)];
5023 -};
5024 -
5025 -/* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much.
5026 - * Alternative is:
5027 - *   dev->hard_header_len ? (dev->hard_header_len +
5028 - *                           (HH_DATA_MOD - 1)) & ~(HH_DATA_MOD - 1) : 0
5029 - *
5030 - * We could use other alignment values, but we must maintain the
5031 - * relationship HH alignment <= LL alignment.
5032 - *
5033 - * LL_ALLOCATED_SPACE also takes into account the tailroom the device
5034 - * may need.
5035 - */
5036 -#define LL_RESERVED_SPACE(dev) \
5037 -       ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
5038 -#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
5039 -       ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
5040 -#define LL_ALLOCATED_SPACE(dev) \
5041 -       ((((dev)->hard_header_len+(dev)->needed_headroom+(dev)->needed_tailroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
5042 -
5043 -struct header_ops {
5044 -       int     (*create) (struct sk_buff *skb, struct net_device *dev,
5045 -                          unsigned short type, const void *daddr,
5046 -                          const void *saddr, unsigned len);
5047 -       int     (*parse)(const struct sk_buff *skb, unsigned char *haddr);
5048 -       int     (*rebuild)(struct sk_buff *skb);
5049 -#define HAVE_HEADER_CACHE
5050 -       int     (*cache)(const struct neighbour *neigh, struct hh_cache *hh);
5051 -       void    (*cache_update)(struct hh_cache *hh,
5052 -                               const struct net_device *dev,
5053 -                               const unsigned char *haddr);
5054 -};
5055 -
5056 -/* These flag bits are private to the generic network queueing
5057 - * layer, they may not be explicitly referenced by any other
5058 - * code.
5059 - */
5060 -
5061 -enum netdev_state_t
5062 -{
5063 -       __LINK_STATE_START,
5064 -       __LINK_STATE_PRESENT,
5065 -       __LINK_STATE_NOCARRIER,
5066 -       __LINK_STATE_LINKWATCH_PENDING,
5067 -       __LINK_STATE_DORMANT,
5068 -};
5069 -
5070 -
5071 -/*
5072 - * This structure holds at boot time configured netdevice settings. They
5073 - * are then used in the device probing. 
5074 - */
5075 -struct netdev_boot_setup {
5076 -       char name[IFNAMSIZ];
5077 -       struct ifmap map;
5078 -};
5079 -#define NETDEV_BOOT_SETUP_MAX 8
5080 -
5081 -extern int __init netdev_boot_setup(char *str);
5082 -
5083 -/*
5084 - * Structure for NAPI scheduling similar to tasklet but with weighting
5085 - */
5086 -struct napi_struct {
5087 -       /* The poll_list must only be managed by the entity which
5088 -        * changes the state of the NAPI_STATE_SCHED bit.  This means
5089 -        * whoever atomically sets that bit can add this napi_struct
5090 -        * to the per-cpu poll_list, and whoever clears that bit
5091 -        * can remove from the list right before clearing the bit.
5092 -        */
5093 -       struct list_head        poll_list;
5094 -
5095 -       unsigned long           state;
5096 -       int                     weight;
5097 -       int                     (*poll)(struct napi_struct *, int);
5098 -#ifdef CONFIG_NETPOLL
5099 -       spinlock_t              poll_lock;
5100 -       int                     poll_owner;
5101 -       struct net_device       *dev;
5102 -       struct list_head        dev_list;
5103 -#endif
5104 -};
5105 -
5106 -enum
5107 -{
5108 -       NAPI_STATE_SCHED,       /* Poll is scheduled */
5109 -       NAPI_STATE_DISABLE,     /* Disable pending */
5110 -};
5111 -
5112 -extern void __napi_schedule(struct napi_struct *n);
5113 -
5114 -static inline int napi_disable_pending(struct napi_struct *n)
5115 -{
5116 -       return test_bit(NAPI_STATE_DISABLE, &n->state);
5117 -}
5118 -
5119 -/**
5120 - *     napi_schedule_prep - check if napi can be scheduled
5121 - *     @n: napi context
5122 - *
5123 - * Test if NAPI routine is already running, and if not mark
5124 - * it as running.  This is used as a condition variable
5125 - * insure only one NAPI poll instance runs.  We also make
5126 - * sure there is no pending NAPI disable.
5127 - */
5128 -static inline int napi_schedule_prep(struct napi_struct *n)
5129 -{
5130 -       return !napi_disable_pending(n) &&
5131 -               !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
5132 -}
5133 -
5134 -/**
5135 - *     napi_schedule - schedule NAPI poll
5136 - *     @n: napi context
5137 - *
5138 - * Schedule NAPI poll routine to be called if it is not already
5139 - * running.
5140 - */
5141 -static inline void napi_schedule(struct napi_struct *n)
5142 -{
5143 -       if (napi_schedule_prep(n))
5144 -               __napi_schedule(n);
5145 -}
5146 -
5147 -/* Try to reschedule poll. Called by dev->poll() after napi_complete().  */
5148 -static inline int napi_reschedule(struct napi_struct *napi)
5149 -{
5150 -       if (napi_schedule_prep(napi)) {
5151 -               __napi_schedule(napi);
5152 -               return 1;
5153 -       }
5154 -       return 0;
5155 -}
5156 -
5157 -/**
5158 - *     napi_complete - NAPI processing complete
5159 - *     @n: napi context
5160 - *
5161 - * Mark NAPI processing as complete.
5162 - */
5163 -static inline void __napi_complete(struct napi_struct *n)
5164 -{
5165 -       BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
5166 -       list_del(&n->poll_list);
5167 -       smp_mb__before_clear_bit();
5168 -       clear_bit(NAPI_STATE_SCHED, &n->state);
5169 -}
5170 -
5171 -static inline void napi_complete(struct napi_struct *n)
5172 -{
5173 -       unsigned long flags;
5174 -
5175 -       local_irq_save(flags);
5176 -       __napi_complete(n);
5177 -       local_irq_restore(flags);
5178 -}
5179 -
5180 -/**
5181 - *     napi_disable - prevent NAPI from scheduling
5182 - *     @n: napi context
5183 - *
5184 - * Stop NAPI from being scheduled on this context.
5185 - * Waits till any outstanding processing completes.
5186 - */
5187 -static inline void napi_disable(struct napi_struct *n)
5188 -{
5189 -       set_bit(NAPI_STATE_DISABLE, &n->state);
5190 -       while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
5191 -               msleep(1);
5192 -       clear_bit(NAPI_STATE_DISABLE, &n->state);
5193 -}
5194 -
5195 -/**
5196 - *     napi_enable - enable NAPI scheduling
5197 - *     @n: napi context
5198 - *
5199 - * Resume NAPI from being scheduled on this context.
5200 - * Must be paired with napi_disable.
5201 - */
5202 -static inline void napi_enable(struct napi_struct *n)
5203 -{
5204 -       BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
5205 -       smp_mb__before_clear_bit();
5206 -       clear_bit(NAPI_STATE_SCHED, &n->state);
5207 -}
5208 -
5209 -#ifdef CONFIG_SMP
5210 -/**
5211 - *     napi_synchronize - wait until NAPI is not running
5212 - *     @n: napi context
5213 - *
5214 - * Wait until NAPI is done being scheduled on this context.
5215 - * Waits till any outstanding processing completes but
5216 - * does not disable future activations.
5217 - */
5218 -static inline void napi_synchronize(const struct napi_struct *n)
5219 -{
5220 -       while (test_bit(NAPI_STATE_SCHED, &n->state))
5221 -               msleep(1);
5222 -}
5223 -#else
5224 -# define napi_synchronize(n)   barrier()
5225 -#endif
5226 -
5227 -enum netdev_queue_state_t
5228 -{
5229 -       __QUEUE_STATE_XOFF,
5230 -       __QUEUE_STATE_FROZEN,
5231 -};
5232 -
5233 -struct netdev_queue {
5234 -       struct net_device       *dev;
5235 -       struct Qdisc            *qdisc;
5236 -       unsigned long           state;
5237 -       spinlock_t              _xmit_lock;
5238 -       int                     xmit_lock_owner;
5239 -       struct Qdisc            *qdisc_sleeping;
5240 -} ____cacheline_aligned_in_smp;
5241 -
5242 -/*
5243 - *     The DEVICE structure.
5244 - *     Actually, this whole structure is a big mistake.  It mixes I/O
5245 - *     data with strictly "high-level" data, and it has to know about
5246 - *     almost every data structure used in the INET module.
5247 - *
5248 - *     FIXME: cleanup struct net_device such that network protocol info
5249 - *     moves out.
5250 - */
5251 -
5252 -struct net_device
5253 -{
5254 -
5255 -       /*
5256 -        * This is the first field of the "visible" part of this structure
5257 -        * (i.e. as seen by users in the "Space.c" file).  It is the name
5258 -        * the interface.
5259 -        */
5260 -       char                    name[IFNAMSIZ];
5261 -       /* device name hash chain */
5262 -       struct hlist_node       name_hlist;
5263 -
5264 -       /*
5265 -        *      I/O specific fields
5266 -        *      FIXME: Merge these and struct ifmap into one
5267 -        */
5268 -       unsigned long           mem_end;        /* shared mem end       */
5269 -       unsigned long           mem_start;      /* shared mem start     */
5270 -       unsigned long           base_addr;      /* device I/O address   */
5271 -       unsigned int            irq;            /* device IRQ number    */
5272 -
5273 -       /*
5274 -        *      Some hardware also needs these fields, but they are not
5275 -        *      part of the usual set specified in Space.c.
5276 -        */
5277 -
5278 -       unsigned char           if_port;        /* Selectable AUI, TP,..*/
5279 -       unsigned char           dma;            /* DMA channel          */
5280 -
5281 -       unsigned long           state;
5282 -
5283 -       struct list_head        dev_list;
5284 -#ifdef CONFIG_NETPOLL
5285 -       struct list_head        napi_list;
5286 -#endif
5287 -       
5288 -       /* The device initialization function. Called only once. */
5289 -       int                     (*init)(struct net_device *dev);
5290 -
5291 -       /* ------- Fields preinitialized in Space.c finish here ------- */
5292 -
5293 -       /* Net device features */
5294 -       unsigned long           features;
5295 -#define NETIF_F_SG             1       /* Scatter/gather IO. */
5296 -#define NETIF_F_IP_CSUM                2       /* Can checksum TCP/UDP over IPv4. */
5297 -#define NETIF_F_NO_CSUM                4       /* Does not require checksum. F.e. loopack. */
5298 -#define NETIF_F_HW_CSUM                8       /* Can checksum all the packets. */
5299 -#define NETIF_F_IPV6_CSUM      16      /* Can checksum TCP/UDP over IPV6 */
5300 -#define NETIF_F_HIGHDMA                32      /* Can DMA to high memory. */
5301 -#define NETIF_F_FRAGLIST       64      /* Scatter/gather IO. */
5302 -#define NETIF_F_HW_VLAN_TX     128     /* Transmit VLAN hw acceleration */
5303 -#define NETIF_F_HW_VLAN_RX     256     /* Receive VLAN hw acceleration */
5304 -#define NETIF_F_HW_VLAN_FILTER 512     /* Receive filtering on VLAN */
5305 -#define NETIF_F_VLAN_CHALLENGED        1024    /* Device cannot handle VLAN packets */
5306 -#define NETIF_F_GSO            2048    /* Enable software GSO. */
5307 -#define NETIF_F_LLTX           4096    /* LockLess TX - deprecated. Please */
5308 -                                       /* do not use LLTX in new drivers */
5309 -#define NETIF_F_NETNS_LOCAL    8192    /* Does not change network namespaces */
5310 -#define NETIF_F_LRO            32768   /* large receive offload */
5311 -
5312 -       /* Segmentation offload features */
5313 -#define NETIF_F_GSO_SHIFT      16
5314 -#define NETIF_F_GSO_MASK       0xffff0000
5315 -#define NETIF_F_TSO            (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
5316 -#define NETIF_F_UFO            (SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
5317 -#define NETIF_F_GSO_ROBUST     (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
5318 -#define NETIF_F_TSO_ECN                (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
5319 -#define NETIF_F_TSO6           (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
5320 -
5321 -       /* List of features with software fallbacks. */
5322 -#define NETIF_F_GSO_SOFTWARE   (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
5323 -
5324 -
5325 -#define NETIF_F_GEN_CSUM       (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
5326 -#define NETIF_F_V4_CSUM                (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
5327 -#define NETIF_F_V6_CSUM                (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
5328 -#define NETIF_F_ALL_CSUM       (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
5329 -
5330 -       /* Interface index. Unique device identifier    */
5331 -       int                     ifindex;
5332 -       int                     iflink;
5333 -
5334 -
5335 -       struct net_device_stats* (*get_stats)(struct net_device *dev);
5336 -       struct net_device_stats stats;
5337 -
5338 -#ifdef CONFIG_WIRELESS_EXT
5339 -       /* List of functions to handle Wireless Extensions (instead of ioctl).
5340 -        * See <net/iw_handler.h> for details. Jean II */
5341 -       const struct iw_handler_def *   wireless_handlers;
5342 -       /* Instance data managed by the core of Wireless Extensions. */
5343 -       struct iw_public_data * wireless_data;
5344 -#endif
5345 -       const struct ethtool_ops *ethtool_ops;
5346 -
5347 -       /* Hardware header description */
5348 -       const struct header_ops *header_ops;
5349 -
5350 -       /*
5351 -        * This marks the end of the "visible" part of the structure. All
5352 -        * fields hereafter are internal to the system, and may change at
5353 -        * will (read: may be cleaned up at will).
5354 -        */
5355 -
5356 -
5357 -       unsigned int            flags;  /* interface flags (a la BSD)   */
5358 -       unsigned short          gflags;
5359 -        unsigned short          priv_flags; /* Like 'flags' but invisible to userspace. */
5360 -       unsigned short          padded; /* How much padding added by alloc_netdev() */
5361 -
5362 -       unsigned char           operstate; /* RFC2863 operstate */
5363 -       unsigned char           link_mode; /* mapping policy to operstate */
5364 -
5365 -       unsigned                mtu;    /* interface MTU value          */
5366 -       unsigned short          type;   /* interface hardware type      */
5367 -       unsigned short          hard_header_len;        /* hardware hdr length  */
5368 -
5369 -       /* extra head- and tailroom the hardware may need, but not in all cases
5370 -        * can this be guaranteed, especially tailroom. Some cases also use
5371 -        * LL_MAX_HEADER instead to allocate the skb.
5372 -        */
5373 -       unsigned short          needed_headroom;
5374 -       unsigned short          needed_tailroom;
5375 -
5376 -       struct net_device       *master; /* Pointer to master device of a group,
5377 -                                         * which this device is member of.
5378 -                                         */
5379 -
5380 -       /* Interface address info. */
5381 -       unsigned char           perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
5382 -       unsigned char           addr_len;       /* hardware address length      */
5383 -       unsigned short          dev_id;         /* for shared network cards */
5384 -
5385 -       spinlock_t              addr_list_lock;
5386 -       struct dev_addr_list    *uc_list;       /* Secondary unicast mac addresses */
5387 -       int                     uc_count;       /* Number of installed ucasts   */
5388 -       int                     uc_promisc;
5389 -       struct dev_addr_list    *mc_list;       /* Multicast mac addresses      */
5390 -       int                     mc_count;       /* Number of installed mcasts   */
5391 -       unsigned int            promiscuity;
5392 -       unsigned int            allmulti;
5393 -
5394 -
5395 -       /* Protocol specific pointers */
5396 -       
5397 -       void                    *atalk_ptr;     /* AppleTalk link       */
5398 -       void                    *ip_ptr;        /* IPv4 specific data   */  
5399 -       void                    *dn_ptr;        /* DECnet specific data */
5400 -       void                    *ip6_ptr;       /* IPv6 specific data */
5401 -       void                    *ec_ptr;        /* Econet specific data */
5402 -       void                    *ax25_ptr;      /* AX.25 specific data */
5403 -       struct wireless_dev     *ieee80211_ptr; /* IEEE 802.11 specific data,
5404 -                                                  assign before registering */
5405 -
5406 -/*
5407 - * Cache line mostly used on receive path (including eth_type_trans())
5408 - */
5409 -       unsigned long           last_rx;        /* Time of last Rx      */
5410 -       /* Interface address info used in eth_type_trans() */
5411 -       unsigned char           dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 
5412 -                                                       because most packets are unicast) */
5413 -
5414 -       unsigned char           broadcast[MAX_ADDR_LEN];        /* hw bcast add */
5415 -
5416 -       struct netdev_queue     rx_queue;
5417 -
5418 -       struct netdev_queue     *_tx ____cacheline_aligned_in_smp;
5419 -
5420 -       /* Number of TX queues allocated at alloc_netdev_mq() time  */
5421 -       unsigned int            num_tx_queues;
5422 -
5423 -       /* Number of TX queues currently active in device  */
5424 -       unsigned int            real_num_tx_queues;
5425 -
5426 -       unsigned long           tx_queue_len;   /* Max frames per queue allowed */
5427 -       spinlock_t              tx_global_lock;
5428 -/*
5429 - * One part is mostly used on xmit path (device)
5430 - */
5431 -       void                    *priv;  /* pointer to private data      */
5432 -       int                     (*hard_start_xmit) (struct sk_buff *skb,
5433 -                                                   struct net_device *dev);
5434 -       /* These may be needed for future network-power-down code. */
5435 -       unsigned long           trans_start;    /* Time (in jiffies) of last Tx */
5436 -
5437 -       int                     watchdog_timeo; /* used by dev_watchdog() */
5438 -       struct timer_list       watchdog_timer;
5439 -
5440 -/*
5441 - * refcnt is a very hot point, so align it on SMP
5442 - */
5443 -       /* Number of references to this device */
5444 -       atomic_t                refcnt ____cacheline_aligned_in_smp;
5445 -
5446 -       /* delayed register/unregister */
5447 -       struct list_head        todo_list;
5448 -       /* device index hash chain */
5449 -       struct hlist_node       index_hlist;
5450 -
5451 -       struct net_device       *link_watch_next;
5452 -
5453 -       /* register/unregister state machine */
5454 -       enum { NETREG_UNINITIALIZED=0,
5455 -              NETREG_REGISTERED,       /* completed register_netdevice */
5456 -              NETREG_UNREGISTERING,    /* called unregister_netdevice */
5457 -              NETREG_UNREGISTERED,     /* completed unregister todo */
5458 -              NETREG_RELEASED,         /* called free_netdev */
5459 -       } reg_state;
5460 -
5461 -       /* Called after device is detached from network. */
5462 -       void                    (*uninit)(struct net_device *dev);
5463 -       /* Called after last user reference disappears. */
5464 -       void                    (*destructor)(struct net_device *dev);
5465 -
5466 -       /* Pointers to interface service routines.      */
5467 -       int                     (*open)(struct net_device *dev);
5468 -       int                     (*stop)(struct net_device *dev);
5469 -#define HAVE_NETDEV_POLL
5470 -#define HAVE_CHANGE_RX_FLAGS
5471 -       void                    (*change_rx_flags)(struct net_device *dev,
5472 -                                                  int flags);
5473 -#define HAVE_SET_RX_MODE
5474 -       void                    (*set_rx_mode)(struct net_device *dev);
5475 -#define HAVE_MULTICAST                  
5476 -       void                    (*set_multicast_list)(struct net_device *dev);
5477 -#define HAVE_SET_MAC_ADDR               
5478 -       int                     (*set_mac_address)(struct net_device *dev,
5479 -                                                  void *addr);
5480 -#define HAVE_VALIDATE_ADDR
5481 -       int                     (*validate_addr)(struct net_device *dev);
5482 -#define HAVE_PRIVATE_IOCTL
5483 -       int                     (*do_ioctl)(struct net_device *dev,
5484 -                                           struct ifreq *ifr, int cmd);
5485 -#define HAVE_SET_CONFIG
5486 -       int                     (*set_config)(struct net_device *dev,
5487 -                                             struct ifmap *map);
5488 -#define HAVE_CHANGE_MTU
5489 -       int                     (*change_mtu)(struct net_device *dev, int new_mtu);
5490 -
5491 -#define HAVE_TX_TIMEOUT
5492 -       void                    (*tx_timeout) (struct net_device *dev);
5493 -
5494 -       void                    (*vlan_rx_register)(struct net_device *dev,
5495 -                                                   struct vlan_group *grp);
5496 -       void                    (*vlan_rx_add_vid)(struct net_device *dev,
5497 -                                                  unsigned short vid);
5498 -       void                    (*vlan_rx_kill_vid)(struct net_device *dev,
5499 -                                                   unsigned short vid);
5500 -
5501 -       int                     (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
5502 -#ifdef CONFIG_NETPOLL
5503 -       struct netpoll_info     *npinfo;
5504 -#endif
5505 -#ifdef CONFIG_NET_POLL_CONTROLLER
5506 -       void                    (*poll_controller)(struct net_device *dev);
5507 -#endif
5508 -
5509 -       u16                     (*select_queue)(struct net_device *dev,
5510 -                                               struct sk_buff *skb);
5511 -
5512 -#ifdef CONFIG_NET_NS
5513 -       /* Network namespace this network device is inside */
5514 -       struct net              *nd_net;
5515 -#endif
5516 -
5517 -       /* mid-layer private */
5518 -       void                    *ml_priv;
5519 -
5520 -       /* bridge stuff */
5521 -       struct net_bridge_port  *br_port;
5522 -       /* macvlan */
5523 -       struct macvlan_port     *macvlan_port;
5524 -       /* GARP */
5525 -       struct garp_port        *garp_port;
5526 -
5527 -       /* class/net/name entry */
5528 -       struct device           dev;
5529 -       /* space for optional statistics and wireless sysfs groups */
5530 -       struct attribute_group  *sysfs_groups[3];
5531 -
5532 -       /* rtnetlink link ops */
5533 -       const struct rtnl_link_ops *rtnl_link_ops;
5534 -
5535 -       /* VLAN feature mask */
5536 -       unsigned long vlan_features;
5537 -
5538 -       /* for setting kernel sock attribute on TCP connection setup */
5539 -#define GSO_MAX_SIZE           65536
5540 -       unsigned int            gso_max_size;
5541 -};
5542 -#define to_net_dev(d) container_of(d, struct net_device, dev)
5543 -
5544 -#define        NETDEV_ALIGN            32
5545 -#define        NETDEV_ALIGN_CONST      (NETDEV_ALIGN - 1)
5546 -
5547 -static inline
5548 -struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
5549 -                                        unsigned int index)
5550 -{
5551 -       return &dev->_tx[index];
5552 -}
5553 -
5554 -static inline void netdev_for_each_tx_queue(struct net_device *dev,
5555 -                                           void (*f)(struct net_device *,
5556 -                                                     struct netdev_queue *,
5557 -                                                     void *),
5558 -                                           void *arg)
5559 -{
5560 -       unsigned int i;
5561 -
5562 -       for (i = 0; i < dev->num_tx_queues; i++)
5563 -               f(dev, &dev->_tx[i], arg);
5564 -}
5565 -
5566 -/*
5567 - * Net namespace inlines
5568 - */
5569 -static inline
5570 -struct net *dev_net(const struct net_device *dev)
5571 -{
5572 -#ifdef CONFIG_NET_NS
5573 -       return dev->nd_net;
5574 -#else
5575 -       return &init_net;
5576 -#endif
5577 -}
5578 -
5579 -static inline
5580 -void dev_net_set(struct net_device *dev, struct net *net)
5581 -{
5582 -#ifdef CONFIG_NET_NS
5583 -       release_net(dev->nd_net);
5584 -       dev->nd_net = hold_net(net);
5585 -#endif
5586 -}
5587 -
5588 -/**
5589 - *     netdev_priv - access network device private data
5590 - *     @dev: network device
5591 - *
5592 - * Get network device private data
5593 - */
5594 -static inline void *netdev_priv(const struct net_device *dev)
5595 -{
5596 -       return (char *)dev + ((sizeof(struct net_device)
5597 -                              + NETDEV_ALIGN_CONST)
5598 -                             & ~NETDEV_ALIGN_CONST);
5599 -}
5600 -
5601 -/* Set the sysfs physical device reference for the network logical device
5602 - * if set prior to registration will cause a symlink during initialization.
5603 - */
5604 -#define SET_NETDEV_DEV(net, pdev)      ((net)->dev.parent = (pdev))
5605 -
5606 -/**
5607 - *     netif_napi_add - initialize a napi context
5608 - *     @dev:  network device
5609 - *     @napi: napi context
5610 - *     @poll: polling function
5611 - *     @weight: default weight
5612 - *
5613 - * netif_napi_add() must be used to initialize a napi context prior to calling
5614 - * *any* of the other napi related functions.
5615 - */
5616 -static inline void netif_napi_add(struct net_device *dev,
5617 -                                 struct napi_struct *napi,
5618 -                                 int (*poll)(struct napi_struct *, int),
5619 -                                 int weight)
5620 -{
5621 -       INIT_LIST_HEAD(&napi->poll_list);
5622 -       napi->poll = poll;
5623 -       napi->weight = weight;
5624 -#ifdef CONFIG_NETPOLL
5625 -       napi->dev = dev;
5626 -       list_add(&napi->dev_list, &dev->napi_list);
5627 -       spin_lock_init(&napi->poll_lock);
5628 -       napi->poll_owner = -1;
5629 -#endif
5630 -       set_bit(NAPI_STATE_SCHED, &napi->state);
5631 -}
5632 -
5633 -/**
5634 - *  netif_napi_del - remove a napi context
5635 - *  @napi: napi context
5636 - *
5637 - *  netif_napi_del() removes a napi context from the network device napi list
5638 - */
5639 -static inline void netif_napi_del(struct napi_struct *napi)
5640 -{
5641 -#ifdef CONFIG_NETPOLL
5642 -       list_del(&napi->dev_list);
5643 -#endif
5644 -}
5645 -
5646 -struct packet_type {
5647 -       __be16                  type;   /* This is really htons(ether_type). */
5648 -       struct net_device       *dev;   /* NULL is wildcarded here           */
5649 -       unsigned char           sknid_elevator; 
5650 -       int                     (*func) (struct sk_buff *,
5651 -                                        struct net_device *,
5652 -                                        struct packet_type *,
5653 -                                        struct net_device *);
5654 -       struct sk_buff          *(*gso_segment)(struct sk_buff *skb,
5655 -                                               int features);
5656 -       int                     (*gso_send_check)(struct sk_buff *skb);
5657 -       void                    *af_packet_priv;
5658 -       struct list_head        list;
5659 -};
5660 -
5661 -#include <linux/interrupt.h>
5662 -#include <linux/notifier.h>
5663 -
5664 -extern rwlock_t                                dev_base_lock;          /* Device list lock */
5665 -
5666 -
5667 -#define for_each_netdev(net, d)                \
5668 -               list_for_each_entry(d, &(net)->dev_base_head, dev_list)
5669 -#define for_each_netdev_safe(net, d, n)        \
5670 -               list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list)
5671 -#define for_each_netdev_continue(net, d)               \
5672 -               list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
5673 -#define net_device_entry(lh)   list_entry(lh, struct net_device, dev_list)
5674 -
5675 -static inline struct net_device *next_net_device(struct net_device *dev)
5676 -{
5677 -       struct list_head *lh;
5678 -       struct net *net;
5679 -
5680 -       net = dev_net(dev);
5681 -       lh = dev->dev_list.next;
5682 -       return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
5683 -}
5684 -
5685 -static inline struct net_device *first_net_device(struct net *net)
5686 -{
5687 -       return list_empty(&net->dev_base_head) ? NULL :
5688 -               net_device_entry(net->dev_base_head.next);
5689 -}
5690 -
5691 -extern int                     netdev_boot_setup_check(struct net_device *dev);
5692 -extern unsigned long           netdev_boot_base(const char *prefix, int unit);
5693 -extern struct net_device    *dev_getbyhwaddr(struct net *net, unsigned short type, char *hwaddr);
5694 -extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
5695 -extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
5696 -extern void            dev_add_pack(struct packet_type *pt);
5697 -extern void            dev_remove_pack(struct packet_type *pt);
5698 -extern void            __dev_remove_pack(struct packet_type *pt);
5699 -
5700 -extern struct net_device       *dev_get_by_flags(struct net *net, unsigned short flags,
5701 -                                                 unsigned short mask);
5702 -extern struct net_device       *dev_get_by_name(struct net *net, const char *name);
5703 -extern struct net_device       *__dev_get_by_name(struct net *net, const char *name);
5704 -extern int             dev_alloc_name(struct net_device *dev, const char *name);
5705 -extern int             dev_open(struct net_device *dev);
5706 -extern int             dev_close(struct net_device *dev);
5707 -extern void            dev_disable_lro(struct net_device *dev);
5708 -extern int             dev_queue_xmit(struct sk_buff *skb);
5709 -extern int             register_netdevice(struct net_device *dev);
5710 -extern void            unregister_netdevice(struct net_device *dev);
5711 -extern void            free_netdev(struct net_device *dev);
5712 -extern void            synchronize_net(void);
5713 -extern int             register_netdevice_notifier(struct notifier_block *nb);
5714 -extern int             unregister_netdevice_notifier(struct notifier_block *nb);
5715 -extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
5716 -extern struct net_device       *dev_get_by_index(struct net *net, int ifindex);
5717 -extern struct net_device       *__dev_get_by_index(struct net *net, int ifindex);
5718 -extern int             dev_restart(struct net_device *dev);
5719 -#ifdef CONFIG_NETPOLL_TRAP
5720 -extern int             netpoll_trap(void);
5721 -#endif
5722 -
5723 -static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
5724 -                                 unsigned short type,
5725 -                                 const void *daddr, const void *saddr,
5726 -                                 unsigned len)
5727 -{
5728 -       if (!dev->header_ops || !dev->header_ops->create)
5729 -               return 0;
5730 -
5731 -       return dev->header_ops->create(skb, dev, type, daddr, saddr, len);
5732 -}
5733 -
5734 -static inline int dev_parse_header(const struct sk_buff *skb,
5735 -                                  unsigned char *haddr)
5736 -{
5737 -       const struct net_device *dev = skb->dev;
5738 -
5739 -       if (!dev->header_ops || !dev->header_ops->parse)
5740 -               return 0;
5741 -       return dev->header_ops->parse(skb, haddr);
5742 -}
5743 -
5744 -typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
5745 -extern int             register_gifconf(unsigned int family, gifconf_func_t * gifconf);
5746 -static inline int unregister_gifconf(unsigned int family)
5747 -{
5748 -       return register_gifconf(family, NULL);
5749 -}
5750 -
5751 -/*
5752 - * Incoming packets are placed on per-cpu queues so that
5753 - * no locking is needed.
5754 - */
5755 -struct softnet_data
5756 -{
5757 -       struct Qdisc            *output_queue;
5758 -       struct sk_buff_head     input_pkt_queue;
5759 -       struct list_head        poll_list;
5760 -       struct sk_buff          *completion_queue;
5761 -
5762 -       struct napi_struct      backlog;
5763 -#ifdef CONFIG_NET_DMA
5764 -       struct dma_chan         *net_dma;
5765 -#endif
5766 -};
5767 -
5768 -DECLARE_PER_CPU(struct softnet_data,softnet_data);
5769 -
5770 -#define HAVE_NETIF_QUEUE
5771 -
5772 -extern void __netif_schedule(struct Qdisc *q);
5773 -
5774 -static inline void netif_schedule_queue(struct netdev_queue *txq)
5775 -{
5776 -       if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
5777 -               __netif_schedule(txq->qdisc);
5778 -}
5779 -
5780 -static inline void netif_tx_schedule_all(struct net_device *dev)
5781 -{
5782 -       unsigned int i;
5783 -
5784 -       for (i = 0; i < dev->num_tx_queues; i++)
5785 -               netif_schedule_queue(netdev_get_tx_queue(dev, i));
5786 -}
5787 -
5788 -static inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
5789 -{
5790 -       clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
5791 -}
5792 -
5793 -/**
5794 - *     netif_start_queue - allow transmit
5795 - *     @dev: network device
5796 - *
5797 - *     Allow upper layers to call the device hard_start_xmit routine.
5798 - */
5799 -static inline void netif_start_queue(struct net_device *dev)
5800 -{
5801 -       netif_tx_start_queue(netdev_get_tx_queue(dev, 0));
5802 -}
5803 -
5804 -static inline void netif_tx_start_all_queues(struct net_device *dev)
5805 -{
5806 -       unsigned int i;
5807 -
5808 -       for (i = 0; i < dev->num_tx_queues; i++) {
5809 -               struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
5810 -               netif_tx_start_queue(txq);
5811 -       }
5812 -}
5813 -
5814 -static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
5815 -{
5816 -#ifdef CONFIG_NETPOLL_TRAP
5817 -       if (netpoll_trap()) {
5818 -               clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
5819 -               return;
5820 -       }
5821 -#endif
5822 -       if (test_and_clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state))
5823 -               __netif_schedule(dev_queue->qdisc);
5824 -}
5825 -
5826 -/**
5827 - *     netif_wake_queue - restart transmit
5828 - *     @dev: network device
5829 - *
5830 - *     Allow upper layers to call the device hard_start_xmit routine.
5831 - *     Used for flow control when transmit resources are available.
5832 - */
5833 -static inline void netif_wake_queue(struct net_device *dev)
5834 -{
5835 -       netif_tx_wake_queue(netdev_get_tx_queue(dev, 0));
5836 -}
5837 -
5838 -static inline void netif_tx_wake_all_queues(struct net_device *dev)
5839 -{
5840 -       unsigned int i;
5841 -
5842 -       for (i = 0; i < dev->num_tx_queues; i++) {
5843 -               struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
5844 -               netif_tx_wake_queue(txq);
5845 -       }
5846 -}
5847 -
5848 -static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
5849 -{
5850 -       set_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
5851 -}
5852 -
5853 -/**
5854 - *     netif_stop_queue - stop transmitted packets
5855 - *     @dev: network device
5856 - *
5857 - *     Stop upper layers calling the device hard_start_xmit routine.
5858 - *     Used for flow control when transmit resources are unavailable.
5859 - */
5860 -static inline void netif_stop_queue(struct net_device *dev)
5861 -{
5862 -       netif_tx_stop_queue(netdev_get_tx_queue(dev, 0));
5863 -}
5864 -
5865 -static inline void netif_tx_stop_all_queues(struct net_device *dev)
5866 -{
5867 -       unsigned int i;
5868 -
5869 -       for (i = 0; i < dev->num_tx_queues; i++) {
5870 -               struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
5871 -               netif_tx_stop_queue(txq);
5872 -       }
5873 -}
5874 -
5875 -static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
5876 -{
5877 -       return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
5878 -}
5879 -
5880 -/**
5881 - *     netif_queue_stopped - test if transmit queue is flowblocked
5882 - *     @dev: network device
5883 - *
5884 - *     Test if transmit queue on device is currently unable to send.
5885 - */
5886 -static inline int netif_queue_stopped(const struct net_device *dev)
5887 -{
5888 -       return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
5889 -}
5890 -
5891 -static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue)
5892 -{
5893 -       return test_bit(__QUEUE_STATE_FROZEN, &dev_queue->state);
5894 -}
5895 -
5896 -/**
5897 - *     netif_running - test if up
5898 - *     @dev: network device
5899 - *
5900 - *     Test if the device has been brought up.
5901 - */
5902 -static inline int netif_running(const struct net_device *dev)
5903 -{
5904 -       return test_bit(__LINK_STATE_START, &dev->state);
5905 -}
5906 -
5907 -/*
5908 - * Routines to manage the subqueues on a device.  We only need start
5909 - * stop, and a check if it's stopped.  All other device management is
5910 - * done at the overall netdevice level.
5911 - * Also test the device if we're multiqueue.
5912 - */
5913 -
5914 -/**
5915 - *     netif_start_subqueue - allow sending packets on subqueue
5916 - *     @dev: network device
5917 - *     @queue_index: sub queue index
5918 - *
5919 - * Start individual transmit queue of a device with multiple transmit queues.
5920 - */
5921 -static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
5922 -{
5923 -       struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
5924 -       clear_bit(__QUEUE_STATE_XOFF, &txq->state);
5925 -}
5926 -
5927 -/**
5928 - *     netif_stop_subqueue - stop sending packets on subqueue
5929 - *     @dev: network device
5930 - *     @queue_index: sub queue index
5931 - *
5932 - * Stop individual transmit queue of a device with multiple transmit queues.
5933 - */
5934 -static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
5935 -{
5936 -       struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
5937 -#ifdef CONFIG_NETPOLL_TRAP
5938 -       if (netpoll_trap())
5939 -               return;
5940 -#endif
5941 -       set_bit(__QUEUE_STATE_XOFF, &txq->state);
5942 -}
5943 -
5944 -/**
5945 - *     netif_subqueue_stopped - test status of subqueue
5946 - *     @dev: network device
5947 - *     @queue_index: sub queue index
5948 - *
5949 - * Check individual transmit queue of a device with multiple transmit queues.
5950 - */
5951 -static inline int __netif_subqueue_stopped(const struct net_device *dev,
5952 -                                        u16 queue_index)
5953 -{
5954 -       struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
5955 -       return test_bit(__QUEUE_STATE_XOFF, &txq->state);
5956 -}
5957 -
5958 -static inline int netif_subqueue_stopped(const struct net_device *dev,
5959 -                                        struct sk_buff *skb)
5960 -{
5961 -       return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
5962 -}
5963 -
5964 -/**
5965 - *     netif_wake_subqueue - allow sending packets on subqueue
5966 - *     @dev: network device
5967 - *     @queue_index: sub queue index
5968 - *
5969 - * Resume individual transmit queue of a device with multiple transmit queues.
5970 - */
5971 -static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
5972 -{
5973 -       struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
5974 -#ifdef CONFIG_NETPOLL_TRAP
5975 -       if (netpoll_trap())
5976 -               return;
5977 -#endif
5978 -       if (test_and_clear_bit(__QUEUE_STATE_XOFF, &txq->state))
5979 -               __netif_schedule(txq->qdisc);
5980 -}
5981 -
5982 -/**
5983 - *     netif_is_multiqueue - test if device has multiple transmit queues
5984 - *     @dev: network device
5985 - *
5986 - * Check if device has multiple transmit queues
5987 - */
5988 -static inline int netif_is_multiqueue(const struct net_device *dev)
5989 -{
5990 -       return (dev->num_tx_queues > 1);
5991 -}
5992 -
5993 -/* Use this variant when it is known for sure that it
5994 - * is executing from hardware interrupt context or with hardware interrupts
5995 - * disabled.
5996 - */
5997 -extern void dev_kfree_skb_irq(struct sk_buff *skb);
5998 -
5999 -/* Use this variant in places where it could be invoked
6000 - * from either hardware interrupt or other context, with hardware interrupts
6001 - * either disabled or enabled.
6002 - */
6003 -extern void dev_kfree_skb_any(struct sk_buff *skb);
6004 -
6005 -#define HAVE_NETIF_RX 1
6006 -extern int             netif_rx(struct sk_buff *skb);
6007 -extern int             netif_rx_ni(struct sk_buff *skb);
6008 -#define HAVE_NETIF_RECEIVE_SKB 1
6009 -extern int             netif_receive_skb(struct sk_buff *skb);
6010 -extern void            netif_nit_deliver(struct sk_buff *skb);
6011 -extern int             dev_valid_name(const char *name);
6012 -extern int             dev_ioctl(struct net *net, unsigned int cmd, void __user *);
6013 -extern int             dev_ethtool(struct net *net, struct ifreq *);
6014 -extern unsigned                dev_get_flags(const struct net_device *);
6015 -extern int             dev_change_flags(struct net_device *, unsigned);
6016 -extern int             dev_change_name(struct net_device *, char *);
6017 -extern int             dev_change_net_namespace(struct net_device *,
6018 -                                                struct net *, const char *);
6019 -extern int             dev_set_mtu(struct net_device *, int);
6020 -extern int             dev_set_mac_address(struct net_device *,
6021 -                                           struct sockaddr *);
6022 -extern int             dev_hard_start_xmit(struct sk_buff *skb,
6023 -                                           struct net_device *dev,
6024 -                                           struct netdev_queue *txq);
6025 -
6026 -extern int             netdev_budget;
6027 -
6028 -/* Called by rtnetlink.c:rtnl_unlock() */
6029 -extern void netdev_run_todo(void);
6030 -
6031 -/**
6032 - *     dev_put - release reference to device
6033 - *     @dev: network device
6034 - *
6035 - * Release reference to device to allow it to be freed.
6036 - */
6037 -static inline void dev_put(struct net_device *dev)
6038 -{
6039 -       atomic_dec(&dev->refcnt);
6040 -}
6041 -
6042 -/**
6043 - *     dev_hold - get reference to device
6044 - *     @dev: network device
6045 - *
6046 - * Hold reference to device to keep it from being freed.
6047 - */
6048 -static inline void dev_hold(struct net_device *dev)
6049 -{
6050 -       atomic_inc(&dev->refcnt);
6051 -}
6052 -
6053 -/* Carrier loss detection, dial on demand. The functions netif_carrier_on
6054 - * and _off may be called from IRQ context, but it is caller
6055 - * who is responsible for serialization of these calls.
6056 - *
6057 - * The name carrier is inappropriate, these functions should really be
6058 - * called netif_lowerlayer_*() because they represent the state of any
6059 - * kind of lower layer not just hardware media.
6060 - */
6061 -
6062 -extern void linkwatch_fire_event(struct net_device *dev);
6063 -
6064 -/**
6065 - *     netif_carrier_ok - test if carrier present
6066 - *     @dev: network device
6067 - *
6068 - * Check if carrier is present on device
6069 - */
6070 -static inline int netif_carrier_ok(const struct net_device *dev)
6071 -{
6072 -       return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
6073 -}
6074 -
6075 -extern void __netdev_watchdog_up(struct net_device *dev);
6076 -
6077 -extern void netif_carrier_on(struct net_device *dev);
6078 -
6079 -extern void netif_carrier_off(struct net_device *dev);
6080 -
6081 -/**
6082 - *     netif_dormant_on - mark device as dormant.
6083 - *     @dev: network device
6084 - *
6085 - * Mark device as dormant (as per RFC2863).
6086 - *
6087 - * The dormant state indicates that the relevant interface is not
6088 - * actually in a condition to pass packets (i.e., it is not 'up') but is
6089 - * in a "pending" state, waiting for some external event.  For "on-
6090 - * demand" interfaces, this new state identifies the situation where the
6091 - * interface is waiting for events to place it in the up state.
6092 - *
6093 - */
6094 -static inline void netif_dormant_on(struct net_device *dev)
6095 -{
6096 -       if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state))
6097 -               linkwatch_fire_event(dev);
6098 -}
6099 -
6100 -/**
6101 - *     netif_dormant_off - set device as not dormant.
6102 - *     @dev: network device
6103 - *
6104 - * Device is not in dormant state.
6105 - */
6106 -static inline void netif_dormant_off(struct net_device *dev)
6107 -{
6108 -       if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state))
6109 -               linkwatch_fire_event(dev);
6110 -}
6111 -
6112 -/**
6113 - *     netif_dormant - test if carrier present
6114 - *     @dev: network device
6115 - *
6116 - * Check if carrier is present on device
6117 - */
6118 -static inline int netif_dormant(const struct net_device *dev)
6119 -{
6120 -       return test_bit(__LINK_STATE_DORMANT, &dev->state);
6121 -}
6122 -
6123 -
6124 -/**
6125 - *     netif_oper_up - test if device is operational
6126 - *     @dev: network device
6127 - *
6128 - * Check if carrier is operational
6129 - */
6130 -static inline int netif_oper_up(const struct net_device *dev) {
6131 -       return (dev->operstate == IF_OPER_UP ||
6132 -               dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
6133 -}
6134 -
6135 -/**
6136 - *     netif_device_present - is device available or removed
6137 - *     @dev: network device
6138 - *
6139 - * Check if device has not been removed from system.
6140 - */
6141 -static inline int netif_device_present(struct net_device *dev)
6142 -{
6143 -       return test_bit(__LINK_STATE_PRESENT, &dev->state);
6144 -}
6145 -
6146 -extern void netif_device_detach(struct net_device *dev);
6147 -
6148 -extern void netif_device_attach(struct net_device *dev);
6149 -
6150 -/*
6151 - * Network interface message level settings
6152 - */
6153 -#define HAVE_NETIF_MSG 1
6154 -
6155 -enum {
6156 -       NETIF_MSG_DRV           = 0x0001,
6157 -       NETIF_MSG_PROBE         = 0x0002,
6158 -       NETIF_MSG_LINK          = 0x0004,
6159 -       NETIF_MSG_TIMER         = 0x0008,
6160 -       NETIF_MSG_IFDOWN        = 0x0010,
6161 -       NETIF_MSG_IFUP          = 0x0020,
6162 -       NETIF_MSG_RX_ERR        = 0x0040,
6163 -       NETIF_MSG_TX_ERR        = 0x0080,
6164 -       NETIF_MSG_TX_QUEUED     = 0x0100,
6165 -       NETIF_MSG_INTR          = 0x0200,
6166 -       NETIF_MSG_TX_DONE       = 0x0400,
6167 -       NETIF_MSG_RX_STATUS     = 0x0800,
6168 -       NETIF_MSG_PKTDATA       = 0x1000,
6169 -       NETIF_MSG_HW            = 0x2000,
6170 -       NETIF_MSG_WOL           = 0x4000,
6171 -};
6172 -
6173 -#define netif_msg_drv(p)       ((p)->msg_enable & NETIF_MSG_DRV)
6174 -#define netif_msg_probe(p)     ((p)->msg_enable & NETIF_MSG_PROBE)
6175 -#define netif_msg_link(p)      ((p)->msg_enable & NETIF_MSG_LINK)
6176 -#define netif_msg_timer(p)     ((p)->msg_enable & NETIF_MSG_TIMER)
6177 -#define netif_msg_ifdown(p)    ((p)->msg_enable & NETIF_MSG_IFDOWN)
6178 -#define netif_msg_ifup(p)      ((p)->msg_enable & NETIF_MSG_IFUP)
6179 -#define netif_msg_rx_err(p)    ((p)->msg_enable & NETIF_MSG_RX_ERR)
6180 -#define netif_msg_tx_err(p)    ((p)->msg_enable & NETIF_MSG_TX_ERR)
6181 -#define netif_msg_tx_queued(p) ((p)->msg_enable & NETIF_MSG_TX_QUEUED)
6182 -#define netif_msg_intr(p)      ((p)->msg_enable & NETIF_MSG_INTR)
6183 -#define netif_msg_tx_done(p)   ((p)->msg_enable & NETIF_MSG_TX_DONE)
6184 -#define netif_msg_rx_status(p) ((p)->msg_enable & NETIF_MSG_RX_STATUS)
6185 -#define netif_msg_pktdata(p)   ((p)->msg_enable & NETIF_MSG_PKTDATA)
6186 -#define netif_msg_hw(p)                ((p)->msg_enable & NETIF_MSG_HW)
6187 -#define netif_msg_wol(p)       ((p)->msg_enable & NETIF_MSG_WOL)
6188 -
6189 -static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
6190 -{
6191 -       /* use default */
6192 -       if (debug_value < 0 || debug_value >= (sizeof(u32) * 8))
6193 -               return default_msg_enable_bits;
6194 -       if (debug_value == 0)   /* no output */
6195 -               return 0;
6196 -       /* set low N bits */
6197 -       return (1 << debug_value) - 1;
6198 -}
6199 -
6200 -/* Test if receive needs to be scheduled but only if up */
6201 -static inline int netif_rx_schedule_prep(struct net_device *dev,
6202 -                                        struct napi_struct *napi)
6203 -{
6204 -       return napi_schedule_prep(napi);
6205 -}
6206 -
6207 -/* Add interface to tail of rx poll list. This assumes that _prep has
6208 - * already been called and returned 1.
6209 - */
6210 -static inline void __netif_rx_schedule(struct net_device *dev,
6211 -                                      struct napi_struct *napi)
6212 -{
6213 -       __napi_schedule(napi);
6214 -}
6215 -
6216 -/* Try to reschedule poll. Called by irq handler. */
6217 -
6218 -static inline void netif_rx_schedule(struct net_device *dev,
6219 -                                    struct napi_struct *napi)
6220 -{
6221 -       if (netif_rx_schedule_prep(dev, napi))
6222 -               __netif_rx_schedule(dev, napi);
6223 -}
6224 -
6225 -/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete().  */
6226 -static inline int netif_rx_reschedule(struct net_device *dev,
6227 -                                     struct napi_struct *napi)
6228 -{
6229 -       if (napi_schedule_prep(napi)) {
6230 -               __netif_rx_schedule(dev, napi);
6231 -               return 1;
6232 -       }
6233 -       return 0;
6234 -}
6235 -
6236 -/* same as netif_rx_complete, except that local_irq_save(flags)
6237 - * has already been issued
6238 - */
6239 -static inline void __netif_rx_complete(struct net_device *dev,
6240 -                                      struct napi_struct *napi)
6241 -{
6242 -       __napi_complete(napi);
6243 -}
6244 -
6245 -/* Remove interface from poll list: it must be in the poll list
6246 - * on current cpu. This primitive is called by dev->poll(), when
6247 - * it completes the work. The device cannot be out of poll list at this
6248 - * moment, it is BUG().
6249 - */
6250 -static inline void netif_rx_complete(struct net_device *dev,
6251 -                                    struct napi_struct *napi)
6252 -{
6253 -       unsigned long flags;
6254 -
6255 -       local_irq_save(flags);
6256 -       __netif_rx_complete(dev, napi);
6257 -       local_irq_restore(flags);
6258 -}
6259 -
6260 -static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
6261 -{
6262 -       spin_lock(&txq->_xmit_lock);
6263 -       txq->xmit_lock_owner = cpu;
6264 -}
6265 -
6266 -static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
6267 -{
6268 -       spin_lock_bh(&txq->_xmit_lock);
6269 -       txq->xmit_lock_owner = smp_processor_id();
6270 -}
6271 -
6272 -static inline int __netif_tx_trylock(struct netdev_queue *txq)
6273 -{
6274 -       int ok = spin_trylock(&txq->_xmit_lock);
6275 -       if (likely(ok))
6276 -               txq->xmit_lock_owner = smp_processor_id();
6277 -       return ok;
6278 -}
6279 -
6280 -static inline void __netif_tx_unlock(struct netdev_queue *txq)
6281 -{
6282 -       txq->xmit_lock_owner = -1;
6283 -       spin_unlock(&txq->_xmit_lock);
6284 -}
6285 -
6286 -static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
6287 -{
6288 -       txq->xmit_lock_owner = -1;
6289 -       spin_unlock_bh(&txq->_xmit_lock);
6290 -}
6291 -
6292 -/**
6293 - *     netif_tx_lock - grab network device transmit lock
6294 - *     @dev: network device
6295 - *     @cpu: cpu number of lock owner
6296 - *
6297 - * Get network device transmit lock
6298 - */
6299 -static inline void netif_tx_lock(struct net_device *dev)
6300 -{
6301 -       unsigned int i;
6302 -       int cpu;
6303 -
6304 -       spin_lock(&dev->tx_global_lock);
6305 -       cpu = smp_processor_id();
6306 -       for (i = 0; i < dev->num_tx_queues; i++) {
6307 -               struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
6308 -
6309 -               /* We are the only thread of execution doing a
6310 -                * freeze, but we have to grab the _xmit_lock in
6311 -                * order to synchronize with threads which are in
6312 -                * the ->hard_start_xmit() handler and already
6313 -                * checked the frozen bit.
6314 -                */
6315 -               __netif_tx_lock(txq, cpu);
6316 -               set_bit(__QUEUE_STATE_FROZEN, &txq->state);
6317 -               __netif_tx_unlock(txq);
6318 -       }
6319 -}
6320 -
6321 -static inline void netif_tx_lock_bh(struct net_device *dev)
6322 -{
6323 -       local_bh_disable();
6324 -       netif_tx_lock(dev);
6325 -}
6326 -
6327 -static inline void netif_tx_unlock(struct net_device *dev)
6328 -{
6329 -       unsigned int i;
6330 -
6331 -       for (i = 0; i < dev->num_tx_queues; i++) {
6332 -               struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
6333 -
6334 -               /* No need to grab the _xmit_lock here.  If the
6335 -                * queue is not stopped for another reason, we
6336 -                * force a schedule.
6337 -                */
6338 -               clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
6339 -               if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
6340 -                       __netif_schedule(txq->qdisc);
6341 -       }
6342 -       spin_unlock(&dev->tx_global_lock);
6343 -}
6344 -
6345 -static inline void netif_tx_unlock_bh(struct net_device *dev)
6346 -{
6347 -       netif_tx_unlock(dev);
6348 -       local_bh_enable();
6349 -}
6350 -
6351 -#define HARD_TX_LOCK(dev, txq, cpu) {                  \
6352 -       if ((dev->features & NETIF_F_LLTX) == 0) {      \
6353 -               __netif_tx_lock(txq, cpu);              \
6354 -       }                                               \
6355 -}
6356 -
6357 -#define HARD_TX_UNLOCK(dev, txq) {                     \
6358 -       if ((dev->features & NETIF_F_LLTX) == 0) {      \
6359 -               __netif_tx_unlock(txq);                 \
6360 -       }                                               \
6361 -}
6362 -
6363 -static inline void netif_tx_disable(struct net_device *dev)
6364 -{
6365 -       unsigned int i;
6366 -       int cpu;
6367 -
6368 -       local_bh_disable();
6369 -       cpu = smp_processor_id();
6370 -       for (i = 0; i < dev->num_tx_queues; i++) {
6371 -               struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
6372 -
6373 -               __netif_tx_lock(txq, cpu);
6374 -               netif_tx_stop_queue(txq);
6375 -               __netif_tx_unlock(txq);
6376 -       }
6377 -       local_bh_enable();
6378 -}
6379 -
6380 -static inline void netif_addr_lock(struct net_device *dev)
6381 -{
6382 -       spin_lock(&dev->addr_list_lock);
6383 -}
6384 -
6385 -static inline void netif_addr_lock_bh(struct net_device *dev)
6386 -{
6387 -       spin_lock_bh(&dev->addr_list_lock);
6388 -}
6389 -
6390 -static inline void netif_addr_unlock(struct net_device *dev)
6391 -{
6392 -       spin_unlock(&dev->addr_list_lock);
6393 -}
6394 -
6395 -static inline void netif_addr_unlock_bh(struct net_device *dev)
6396 -{
6397 -       spin_unlock_bh(&dev->addr_list_lock);
6398 -}
6399 -
6400 -/* These functions live elsewhere (drivers/net/net_init.c, but related) */
6401 -
6402 -extern void            ether_setup(struct net_device *dev);
6403 -
6404 -/* Support for loadable net-drivers */
6405 -extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
6406 -                                      void (*setup)(struct net_device *),
6407 -                                      unsigned int queue_count);
6408 -#define alloc_netdev(sizeof_priv, name, setup) \
6409 -       alloc_netdev_mq(sizeof_priv, name, setup, 1)
6410 -extern int             register_netdev(struct net_device *dev);
6411 -extern void            unregister_netdev(struct net_device *dev);
6412 -/* Functions used for secondary unicast and multicast support */
6413 -extern void            dev_set_rx_mode(struct net_device *dev);
6414 -extern void            __dev_set_rx_mode(struct net_device *dev);
6415 -extern int             dev_unicast_delete(struct net_device *dev, void *addr, int alen);
6416 -extern int             dev_unicast_add(struct net_device *dev, void *addr, int alen);
6417 -extern int             dev_unicast_sync(struct net_device *to, struct net_device *from);
6418 -extern void            dev_unicast_unsync(struct net_device *to, struct net_device *from);
6419 -extern int             dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
6420 -extern int             dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
6421 -extern int             dev_mc_sync(struct net_device *to, struct net_device *from);
6422 -extern void            dev_mc_unsync(struct net_device *to, struct net_device *from);
6423 -extern int             __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
6424 -extern int             __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
6425 -extern int             __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
6426 -extern void            __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
6427 -extern int             dev_set_promiscuity(struct net_device *dev, int inc);
6428 -extern int             dev_set_allmulti(struct net_device *dev, int inc);
6429 -extern void            netdev_state_change(struct net_device *dev);
6430 -extern void            netdev_bonding_change(struct net_device *dev);
6431 -extern void            netdev_features_change(struct net_device *dev);
6432 -/* Load a device via the kmod */
6433 -extern void            dev_load(struct net *net, const char *name);
6434 -extern void            dev_mcast_init(void);
6435 -extern int             netdev_max_backlog;
6436 -extern int             weight_p;
6437 -extern int             netdev_set_master(struct net_device *dev, struct net_device *master);
6438 -extern int skb_checksum_help(struct sk_buff *skb);
6439 -extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features);
6440 -#ifdef CONFIG_BUG
6441 -extern void netdev_rx_csum_fault(struct net_device *dev);
6442 -#else
6443 -static inline void netdev_rx_csum_fault(struct net_device *dev)
6444 -{
6445 -}
6446 -#endif
6447 -/* rx skb timestamps */
6448 -extern void            net_enable_timestamp(void);
6449 -extern void            net_disable_timestamp(void);
6450 -
6451 -#ifdef CONFIG_PROC_FS
6452 -extern void *dev_seq_start(struct seq_file *seq, loff_t *pos);
6453 -extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos);
6454 -extern void dev_seq_stop(struct seq_file *seq, void *v);
6455 -#endif
6456 -
6457 -extern int netdev_class_create_file(struct class_attribute *class_attr);
6458 -extern void netdev_class_remove_file(struct class_attribute *class_attr);
6459 -
6460 -extern char *netdev_drivername(struct net_device *dev, char *buffer, int len);
6461 -
6462 -extern void linkwatch_run_queue(void);
6463 -
6464 -extern int netdev_compute_features(unsigned long all, unsigned long one);
6465 -
6466 -static inline int net_gso_ok(int features, int gso_type)
6467 -{
6468 -       int feature = gso_type << NETIF_F_GSO_SHIFT;
6469 -       return (features & feature) == feature;
6470 -}
6471 -
6472 -static inline int skb_gso_ok(struct sk_buff *skb, int features)
6473 -{
6474 -       return net_gso_ok(features, skb_shinfo(skb)->gso_type);
6475 -}
6476 -
6477 -static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
6478 -{
6479 -       return skb_is_gso(skb) &&
6480 -              (!skb_gso_ok(skb, dev->features) ||
6481 -               unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
6482 -}
6483 -
6484 -static inline void netif_set_gso_max_size(struct net_device *dev,
6485 -                                         unsigned int size)
6486 -{
6487 -       dev->gso_max_size = size;
6488 -}
6489 -
6490 -/* On bonding slaves other than the currently active slave, suppress
6491 - * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
6492 - * ARP on active-backup slaves with arp_validate enabled.
6493 - */
6494 -static inline int skb_bond_should_drop(struct sk_buff *skb)
6495 -{
6496 -       struct net_device *dev = skb->dev;
6497 -       struct net_device *master = dev->master;
6498 -
6499 -       if (master &&
6500 -           (dev->priv_flags & IFF_SLAVE_INACTIVE)) {
6501 -               if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
6502 -                   skb->protocol == __constant_htons(ETH_P_ARP))
6503 -                       return 0;
6504 -
6505 -               if (master->priv_flags & IFF_MASTER_ALB) {
6506 -                       if (skb->pkt_type != PACKET_BROADCAST &&
6507 -                           skb->pkt_type != PACKET_MULTICAST)
6508 -                               return 0;
6509 -               }
6510 -               if (master->priv_flags & IFF_MASTER_8023AD &&
6511 -                   skb->protocol == __constant_htons(ETH_P_SLOW))
6512 -                       return 0;
6513 -
6514 -               return 1;
6515 -       }
6516 -       return 0;
6517 -}
6518 -
6519 -#endif /* __KERNEL__ */
6520 -
6521 -#endif /* _LINUX_DEV_H */
6522 diff -Nurb linux-2.6.27-720/include/linux/netlink.h linux-2.6.27-710/include/linux/netlink.h
6523 --- linux-2.6.27-720/include/linux/netlink.h    2009-05-04 12:18:34.000000000 -0400
6524 +++ linux-2.6.27-710/include/linux/netlink.h    2008-10-09 18:13:53.000000000 -0400
6525 @@ -242,7 +242,7 @@
6526         nlh->nlmsg_flags = flags;
6527         nlh->nlmsg_pid = pid;
6528         nlh->nlmsg_seq = seq;
6529 -       memset((char*) NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
6530 +       memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
6531         return nlh;
6532  }
6533  
6534 diff -Nurb linux-2.6.27-720/include/linux/page-flags.h linux-2.6.27-710/include/linux/page-flags.h
6535 --- linux-2.6.27-720/include/linux/page-flags.h 2009-05-04 12:18:34.000000000 -0400
6536 +++ linux-2.6.27-710/include/linux/page-flags.h 2008-10-09 18:13:53.000000000 -0400
6537 @@ -174,10 +174,8 @@
6538  PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned)    /* Xen */
6539  PAGEFLAG(SavePinned, savepinned);                      /* Xen */
6540  PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
6541 -#ifndef __cplusplus
6542  PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
6543         __SETPAGEFLAG(Private, private)
6544 -#endif
6545  
6546  __PAGEFLAG(SlobPage, slob_page)
6547  __PAGEFLAG(SlobFree, slob_free)
6548 diff -Nurb linux-2.6.27-720/include/linux/prefetch.h linux-2.6.27-710/include/linux/prefetch.h
6549 --- linux-2.6.27-720/include/linux/prefetch.h   2009-05-04 12:18:34.000000000 -0400
6550 +++ linux-2.6.27-710/include/linux/prefetch.h   2008-10-09 18:13:53.000000000 -0400
6551 @@ -54,9 +54,9 @@
6552  {
6553  #ifdef ARCH_HAS_PREFETCH
6554         char *cp;
6555 -       char *end = (char*)(addr) + len;
6556 +       char *end = addr + len;
6557  
6558 -       for (cp = (char*)(addr); cp < end; cp += PREFETCH_STRIDE)
6559 +       for (cp = addr; cp < end; cp += PREFETCH_STRIDE)
6560                 prefetch(cp);
6561  #endif
6562  }
6563 diff -Nurb linux-2.6.27-720/include/linux/proc_fs.h linux-2.6.27-710/include/linux/proc_fs.h
6564 --- linux-2.6.27-720/include/linux/proc_fs.h    2009-05-04 12:18:34.000000000 -0400
6565 +++ linux-2.6.27-710/include/linux/proc_fs.h    2009-05-04 12:15:13.000000000 -0400
6566 @@ -315,7 +315,7 @@
6567  
6568  static inline struct net *PDE_NET(struct proc_dir_entry *pde)
6569  {
6570 -       return (struct net *) pde->parent->data;
6571 +       return pde->parent->data;
6572  }
6573  
6574  struct proc_maps_private {
6575 diff -Nurb linux-2.6.27-720/include/linux/rculist.h linux-2.6.27-710/include/linux/rculist.h
6576 --- linux-2.6.27-720/include/linux/rculist.h    2009-05-04 12:18:34.000000000 -0400
6577 +++ linux-2.6.27-710/include/linux/rculist.h    2008-10-09 18:13:53.000000000 -0400
6578 @@ -94,7 +94,7 @@
6579  static inline void list_del_rcu(struct list_head *entry)
6580  {
6581         __list_del(entry->prev, entry->next);
6582 -       entry->prev = (struct list_head *) LIST_POISON2;
6583 +       entry->prev = LIST_POISON2;
6584  }
6585  
6586  /**
6587 @@ -140,7 +140,7 @@
6588         new->prev = old->prev;
6589         rcu_assign_pointer(new->prev->next, new);
6590         new->next->prev = new;
6591 -       old->prev = (struct list_head *) LIST_POISON2;
6592 +       old->prev = LIST_POISON2;
6593  }
6594  
6595  /**
6596 @@ -271,7 +271,7 @@
6597  static inline void hlist_del_rcu(struct hlist_node *n)
6598  {
6599         __hlist_del(n);
6600 -       n->pprev = (struct hlist_node **) LIST_POISON2;
6601 +       n->pprev = LIST_POISON2;
6602  }
6603  
6604  /**
6605 @@ -291,7 +291,7 @@
6606         rcu_assign_pointer(*new->pprev, new);
6607         if (next)
6608                 new->next->pprev = &new->next;
6609 -       old->pprev = (struct hlist_node **) LIST_POISON2;
6610 +       old->pprev = LIST_POISON2;
6611  }
6612  
6613  /**
6614 diff -Nurb linux-2.6.27-720/include/linux/reiserfs_fs_sb.h linux-2.6.27-710/include/linux/reiserfs_fs_sb.h
6615 --- linux-2.6.27-720/include/linux/reiserfs_fs_sb.h     2009-05-04 12:18:34.000000000 -0400
6616 +++ linux-2.6.27-710/include/linux/reiserfs_fs_sb.h     2009-05-04 12:15:13.000000000 -0400
6617 @@ -337,7 +337,8 @@
6618         } journal;
6619  } reiserfs_proc_info_data_t;
6620  #else
6621 -typedef EMPTY_STRUCT_DECL(reiserfs_proc_info_data) reiserfs_proc_info_data_t;
6622 +typedef struct reiserfs_proc_info_data {
6623 +} reiserfs_proc_info_data_t;
6624  #endif
6625  
6626  /* reiserfs union of in-core super block data */
6627 diff -Nurb linux-2.6.27-720/include/linux/rtnetlink.h linux-2.6.27-710/include/linux/rtnetlink.h
6628 --- linux-2.6.27-720/include/linux/rtnetlink.h  2009-05-04 12:18:34.000000000 -0400
6629 +++ linux-2.6.27-710/include/linux/rtnetlink.h  2008-10-09 18:13:53.000000000 -0400
6630 @@ -727,7 +727,7 @@
6631         rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size));
6632         rta->rta_type = attrtype;
6633         rta->rta_len = size;
6634 -       memset((char*) RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
6635 +       memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
6636         return rta;
6637  }
6638  
6639 diff -Nurb linux-2.6.27-720/include/linux/scatterlist.h linux-2.6.27-710/include/linux/scatterlist.h
6640 --- linux-2.6.27-720/include/linux/scatterlist.h        2009-05-04 12:18:34.000000000 -0400
6641 +++ linux-2.6.27-710/include/linux/scatterlist.h        2008-10-09 18:13:53.000000000 -0400
6642 @@ -196,7 +196,7 @@
6643   **/
6644  static inline void *sg_virt(struct scatterlist *sg)
6645  {
6646 -       return (char *) page_address(sg_page(sg)) + sg->offset;
6647 +       return page_address(sg_page(sg)) + sg->offset;
6648  }
6649  
6650  struct scatterlist *sg_next(struct scatterlist *);
6651 diff -Nurb linux-2.6.27-720/include/linux/sched.h linux-2.6.27-710/include/linux/sched.h
6652 --- linux-2.6.27-720/include/linux/sched.h      2009-05-04 12:18:34.000000000 -0400
6653 +++ linux-2.6.27-710/include/linux/sched.h      2009-05-04 12:15:13.000000000 -0400
6654 @@ -242,12 +242,7 @@
6655  
6656  extern void sched_init(void);
6657  extern void sched_init_smp(void);
6658 -#ifdef __cplusplus
6659 -asmlinkage void schedule_tail(struct task_struct *prev);
6660 -#else
6661  extern asmlinkage void schedule_tail(struct task_struct *prev);
6662 -#endif
6663 -
6664  extern void init_idle(struct task_struct *idle, int cpu);
6665  extern void init_idle_bootup_task(struct task_struct *idle);
6666  
6667 @@ -1982,7 +1977,7 @@
6668  
6669  static inline unsigned long *end_of_stack(struct task_struct *p)
6670  {
6671 -       return (unsigned long *)((char *) task_thread_info(p) + 1);
6672 +       return (unsigned long *)(task_thread_info(p) + 1);
6673  }
6674  
6675  #endif
6676 @@ -1991,7 +1986,7 @@
6677  {
6678         void *stack = task_stack_page(current);
6679  
6680 -       return (obj >= stack) && ((char *) obj < ((char *) stack + THREAD_SIZE));
6681 +       return (obj >= stack) && (obj < (stack + THREAD_SIZE));
6682  }
6683  
6684  extern void thread_info_cache_init(void);
6685 diff -Nurb linux-2.6.27-720/include/linux/sched.h.orig linux-2.6.27-710/include/linux/sched.h.orig
6686 --- linux-2.6.27-720/include/linux/sched.h.orig 2009-05-04 12:15:13.000000000 -0400
6687 +++ linux-2.6.27-710/include/linux/sched.h.orig 1969-12-31 19:00:00.000000000 -0500
6688 @@ -1,2244 +0,0 @@
6689 -#ifndef _LINUX_SCHED_H
6690 -#define _LINUX_SCHED_H
6691 -
6692 -/*
6693 - * cloning flags:
6694 - */
6695 -#define CSIGNAL                0x000000ff      /* signal mask to be sent at exit */
6696 -#define CLONE_VM       0x00000100      /* set if VM shared between processes */
6697 -#define CLONE_FS       0x00000200      /* set if fs info shared between processes */
6698 -#define CLONE_FILES    0x00000400      /* set if open files shared between processes */
6699 -#define CLONE_SIGHAND  0x00000800      /* set if signal handlers and blocked signals shared */
6700 -#define CLONE_PTRACE   0x00002000      /* set if we want to let tracing continue on the child too */
6701 -#define CLONE_VFORK    0x00004000      /* set if the parent wants the child to wake it up on mm_release */
6702 -#define CLONE_PARENT   0x00008000      /* set if we want to have the same parent as the cloner */
6703 -#define CLONE_THREAD   0x00010000      /* Same thread group? */
6704 -#define CLONE_NEWNS    0x00020000      /* New namespace group? */
6705 -#define CLONE_SYSVSEM  0x00040000      /* share system V SEM_UNDO semantics */
6706 -#define CLONE_SETTLS   0x00080000      /* create a new TLS for the child */
6707 -#define CLONE_PARENT_SETTID    0x00100000      /* set the TID in the parent */
6708 -#define CLONE_CHILD_CLEARTID   0x00200000      /* clear the TID in the child */
6709 -#define CLONE_DETACHED         0x00400000      /* Unused, ignored */
6710 -#define CLONE_UNTRACED         0x00800000      /* set if the tracing process can't force CLONE_PTRACE on this clone */
6711 -#define CLONE_CHILD_SETTID     0x01000000      /* set the TID in the child */
6712 -#define CLONE_STOPPED          0x02000000      /* Start in stopped state */
6713 -#define CLONE_NEWUTS           0x04000000      /* New utsname group? */
6714 -#define CLONE_NEWIPC           0x08000000      /* New ipcs */
6715 -#define CLONE_NEWUSER          0x10000000      /* New user namespace */
6716 -#define CLONE_NEWPID           0x20000000      /* New pid namespace */
6717 -#define CLONE_NEWNET           0x40000000      /* New network namespace */
6718 -#define CLONE_IO               0x80000000      /* Clone io context */
6719 -
6720 -/*
6721 - * Scheduling policies
6722 - */
6723 -#define SCHED_NORMAL           0
6724 -#define SCHED_FIFO             1
6725 -#define SCHED_RR               2
6726 -#define SCHED_BATCH            3
6727 -/* SCHED_ISO: reserved but not implemented yet */
6728 -#define SCHED_IDLE             5
6729 -
6730 -#ifdef __KERNEL__
6731 -
6732 -struct sched_param {
6733 -       int sched_priority;
6734 -};
6735 -
6736 -#include <asm/param.h> /* for HZ */
6737 -
6738 -#include <linux/capability.h>
6739 -#include <linux/threads.h>
6740 -#include <linux/kernel.h>
6741 -#include <linux/types.h>
6742 -#include <linux/timex.h>
6743 -#include <linux/jiffies.h>
6744 -#include <linux/rbtree.h>
6745 -#include <linux/thread_info.h>
6746 -#include <linux/cpumask.h>
6747 -#include <linux/errno.h>
6748 -#include <linux/nodemask.h>
6749 -#include <linux/mm_types.h>
6750 -
6751 -#include <asm/system.h>
6752 -#include <asm/page.h>
6753 -#include <asm/ptrace.h>
6754 -#include <asm/cputime.h>
6755 -
6756 -#include <linux/smp.h>
6757 -#include <linux/sem.h>
6758 -#include <linux/signal.h>
6759 -#include <linux/fs_struct.h>
6760 -#include <linux/compiler.h>
6761 -#include <linux/completion.h>
6762 -#include <linux/percpu.h>
6763 -#include <linux/topology.h>
6764 -#include <linux/proportions.h>
6765 -#include <linux/seccomp.h>
6766 -#include <linux/rcupdate.h>
6767 -#include <linux/rtmutex.h>
6768 -
6769 -#include <linux/time.h>
6770 -#include <linux/param.h>
6771 -#include <linux/resource.h>
6772 -#include <linux/timer.h>
6773 -#include <linux/hrtimer.h>
6774 -#include <linux/task_io_accounting.h>
6775 -#include <linux/kobject.h>
6776 -#include <linux/latencytop.h>
6777 -#include <linux/cred.h>
6778 -#include <linux/pid.h>
6779 -
6780 -#include <asm/processor.h>
6781 -
6782 -struct mem_cgroup;
6783 -struct exec_domain;
6784 -struct futex_pi_state;
6785 -struct robust_list_head;
6786 -struct bio;
6787 -
6788 -/*
6789 - * List of flags we want to share for kernel threads,
6790 - * if only because they are not used by them anyway.
6791 - */
6792 -#define CLONE_KERNEL   (CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
6793 -
6794 -/*
6795 - * These are the constant used to fake the fixed-point load-average
6796 - * counting. Some notes:
6797 - *  - 11 bit fractions expand to 22 bits by the multiplies: this gives
6798 - *    a load-average precision of 10 bits integer + 11 bits fractional
6799 - *  - if you want to count load-averages more often, you need more
6800 - *    precision, or rounding will get you. With 2-second counting freq,
6801 - *    the EXP_n values would be 1981, 2034 and 2043 if still using only
6802 - *    11 bit fractions.
6803 - */
6804 -extern unsigned long avenrun[];                /* Load averages */
6805 -
6806 -#define FSHIFT         11              /* nr of bits of precision */
6807 -#define FIXED_1                (1<<FSHIFT)     /* 1.0 as fixed-point */
6808 -#define LOAD_FREQ      (5*HZ+1)        /* 5 sec intervals */
6809 -#define EXP_1          1884            /* 1/exp(5sec/1min) as fixed-point */
6810 -#define EXP_5          2014            /* 1/exp(5sec/5min) */
6811 -#define EXP_15         2037            /* 1/exp(5sec/15min) */
6812 -
6813 -#define CALC_LOAD(load,exp,n) \
6814 -       load *= exp; \
6815 -       load += n*(FIXED_1-exp); \
6816 -       load >>= FSHIFT;
6817 -
6818 -extern unsigned long total_forks;
6819 -extern int nr_threads;
6820 -DECLARE_PER_CPU(unsigned long, process_counts);
6821 -extern int nr_processes(void);
6822 -extern unsigned long nr_running(void);
6823 -extern unsigned long nr_uninterruptible(void);
6824 -extern unsigned long nr_active(void);
6825 -extern unsigned long nr_iowait(void);
6826 -
6827 -struct seq_file;
6828 -struct cfs_rq;
6829 -struct task_group;
6830 -#ifdef CONFIG_SCHED_DEBUG
6831 -extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m);
6832 -extern void proc_sched_set_task(struct task_struct *p);
6833 -extern void
6834 -print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
6835 -#else
6836 -static inline void
6837 -proc_sched_show_task(struct task_struct *p, struct seq_file *m)
6838 -{
6839 -}
6840 -static inline void proc_sched_set_task(struct task_struct *p)
6841 -{
6842 -}
6843 -static inline void
6844 -print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
6845 -{
6846 -}
6847 -#endif
6848 -
6849 -extern unsigned long long time_sync_thresh;
6850 -
6851 -/*
6852 - * Task state bitmask. NOTE! These bits are also
6853 - * encoded in fs/proc/array.c: get_task_state().
6854 - *
6855 - * We have two separate sets of flags: task->state
6856 - * is about runnability, while task->exit_state are
6857 - * about the task exiting. Confusing, but this way
6858 - * modifying one set can't modify the other one by
6859 - * mistake.
6860 - */
6861 -#define TASK_RUNNING           0
6862 -#define TASK_INTERRUPTIBLE     1
6863 -#define TASK_UNINTERRUPTIBLE   2
6864 -#define __TASK_STOPPED         4
6865 -#define __TASK_TRACED          8
6866 -/* in tsk->exit_state */
6867 -#define EXIT_ZOMBIE            16
6868 -#define EXIT_DEAD              32
6869 -/* in tsk->state again */
6870 -#define TASK_DEAD              64
6871 -#define TASK_WAKEKILL          128
6872 -
6873 -/* Convenience macros for the sake of set_task_state */
6874 -#define TASK_KILLABLE          (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
6875 -#define TASK_STOPPED           (TASK_WAKEKILL | __TASK_STOPPED)
6876 -#define TASK_TRACED            (TASK_WAKEKILL | __TASK_TRACED)
6877 -
6878 -/* Convenience macros for the sake of wake_up */
6879 -#define TASK_NORMAL            (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE)
6880 -#define TASK_ALL               (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED)
6881 -
6882 -/* get_task_state() */
6883 -#define TASK_REPORT            (TASK_RUNNING | TASK_INTERRUPTIBLE | \
6884 -                                TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \
6885 -                                __TASK_TRACED)
6886 -
6887 -#define task_is_traced(task)   ((task->state & __TASK_TRACED) != 0)
6888 -#define task_is_stopped(task)  ((task->state & __TASK_STOPPED) != 0)
6889 -#define task_is_stopped_or_traced(task)        \
6890 -                       ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
6891 -#define task_contributes_to_load(task) \
6892 -                               ((task->state & TASK_UNINTERRUPTIBLE) != 0)
6893 -
6894 -#define __set_task_state(tsk, state_value)             \
6895 -       do { (tsk)->state = (state_value); } while (0)
6896 -#define set_task_state(tsk, state_value)               \
6897 -       set_mb((tsk)->state, (state_value))
6898 -
6899 -/*
6900 - * set_current_state() includes a barrier so that the write of current->state
6901 - * is correctly serialised wrt the caller's subsequent test of whether to
6902 - * actually sleep:
6903 - *
6904 - *     set_current_state(TASK_UNINTERRUPTIBLE);
6905 - *     if (do_i_need_to_sleep())
6906 - *             schedule();
6907 - *
6908 - * If the caller does not need such serialisation then use __set_current_state()
6909 - */
6910 -#define __set_current_state(state_value)                       \
6911 -       do { current->state = (state_value); } while (0)
6912 -#define set_current_state(state_value)         \
6913 -       set_mb(current->state, (state_value))
6914 -
6915 -/* Task command name length */
6916 -#define TASK_COMM_LEN 16
6917 -
6918 -#include <linux/spinlock.h>
6919 -
6920 -/*
6921 - * This serializes "schedule()" and also protects
6922 - * the run-queue from deletions/modifications (but
6923 - * _adding_ to the beginning of the run-queue has
6924 - * a separate lock).
6925 - */
6926 -extern rwlock_t tasklist_lock;
6927 -extern spinlock_t mmlist_lock;
6928 -
6929 -struct task_struct;
6930 -
6931 -extern void sched_init(void);
6932 -extern void sched_init_smp(void);
6933 -extern asmlinkage void schedule_tail(struct task_struct *prev);
6934 -extern void init_idle(struct task_struct *idle, int cpu);
6935 -extern void init_idle_bootup_task(struct task_struct *idle);
6936 -
6937 -extern int runqueue_is_locked(void);
6938 -
6939 -extern cpumask_t nohz_cpu_mask;
6940 -#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
6941 -extern int select_nohz_load_balancer(int cpu);
6942 -#else
6943 -static inline int select_nohz_load_balancer(int cpu)
6944 -{
6945 -       return 0;
6946 -}
6947 -#endif
6948 -
6949 -extern unsigned long rt_needs_cpu(int cpu);
6950 -
6951 -/*
6952 - * Only dump TASK_* tasks. (0 for all tasks)
6953 - */
6954 -extern void show_state_filter(unsigned long state_filter);
6955 -
6956 -static inline void show_state(void)
6957 -{
6958 -       show_state_filter(0);
6959 -}
6960 -
6961 -extern void show_regs(struct pt_regs *);
6962 -
6963 -/*
6964 - * TASK is a pointer to the task whose backtrace we want to see (or NULL for current
6965 - * task), SP is the stack pointer of the first frame that should be shown in the back
6966 - * trace (or NULL if the entire call-chain of the task should be shown).
6967 - */
6968 -extern void show_stack(struct task_struct *task, unsigned long *sp);
6969 -
6970 -void io_schedule(void);
6971 -long io_schedule_timeout(long timeout);
6972 -
6973 -extern void cpu_init (void);
6974 -extern void trap_init(void);
6975 -extern void account_process_tick(struct task_struct *task, int user);
6976 -extern void update_process_times(int user);
6977 -extern void scheduler_tick(void);
6978 -extern void hrtick_resched(void);
6979 -
6980 -extern void sched_show_task(struct task_struct *p);
6981 -
6982 -#ifdef CONFIG_DETECT_SOFTLOCKUP
6983 -extern void softlockup_tick(void);
6984 -extern void touch_softlockup_watchdog(void);
6985 -extern void touch_all_softlockup_watchdogs(void);
6986 -extern unsigned int  softlockup_panic;
6987 -extern unsigned long sysctl_hung_task_check_count;
6988 -extern unsigned long sysctl_hung_task_timeout_secs;
6989 -extern unsigned long sysctl_hung_task_warnings;
6990 -extern int softlockup_thresh;
6991 -#else
6992 -static inline void softlockup_tick(void)
6993 -{
6994 -}
6995 -static inline void spawn_softlockup_task(void)
6996 -{
6997 -}
6998 -static inline void touch_softlockup_watchdog(void)
6999 -{
7000 -}
7001 -static inline void touch_all_softlockup_watchdogs(void)
7002 -{
7003 -}
7004 -#endif
7005 -
7006 -
7007 -/* Attach to any functions which should be ignored in wchan output. */
7008 -#define __sched                __attribute__((__section__(".sched.text")))
7009 -
7010 -/* Linker adds these: start and end of __sched functions */
7011 -extern char __sched_text_start[], __sched_text_end[];
7012 -
7013 -/* Is this address in the __sched functions? */
7014 -extern int in_sched_functions(unsigned long addr);
7015 -
7016 -#define        MAX_SCHEDULE_TIMEOUT    LONG_MAX
7017 -extern signed long schedule_timeout(signed long timeout);
7018 -extern signed long schedule_timeout_interruptible(signed long timeout);
7019 -extern signed long schedule_timeout_killable(signed long timeout);
7020 -extern signed long schedule_timeout_uninterruptible(signed long timeout);
7021 -asmlinkage void schedule(void);
7022 -
7023 -struct nsproxy;
7024 -struct user_namespace;
7025 -
7026 -/* Maximum number of active map areas.. This is a random (large) number */
7027 -#define DEFAULT_MAX_MAP_COUNT  65536
7028 -
7029 -extern int sysctl_max_map_count;
7030 -
7031 -#include <linux/aio.h>
7032 -
7033 -extern unsigned long
7034 -arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
7035 -                      unsigned long, unsigned long);
7036 -extern unsigned long
7037 -arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
7038 -                         unsigned long len, unsigned long pgoff,
7039 -                         unsigned long flags);
7040 -extern void arch_unmap_area(struct mm_struct *, unsigned long);
7041 -extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
7042 -
7043 -#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
7044 -/*
7045 - * The mm counters are not protected by its page_table_lock,
7046 - * so must be incremented atomically.
7047 - */
7048 -#define __set_mm_counter(mm, member, value) \
7049 -       atomic_long_set(&(mm)->_##member, value)
7050 -#define get_mm_counter(mm, member) \
7051 -       ((unsigned long)atomic_long_read(&(mm)->_##member))
7052 -#else  /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
7053 -/*
7054 - * The mm counters are protected by its page_table_lock,
7055 - * so can be incremented directly.
7056 - */
7057 -#define __set_mm_counter(mm, member, value) (mm)->_##member = (value)
7058 -#define get_mm_counter(mm, member) ((mm)->_##member)
7059 -
7060 -#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
7061 -
7062 -#define set_mm_counter(mm, member, value) \
7063 -       vx_ ## member ## pages_sub((mm), (get_mm_counter(mm, member) - value))
7064 -#define add_mm_counter(mm, member, value) \
7065 -       vx_ ## member ## pages_add((mm), (value))
7066 -#define inc_mm_counter(mm, member) vx_ ## member ## pages_inc((mm))
7067 -#define dec_mm_counter(mm, member) vx_ ## member ## pages_dec((mm))
7068 -
7069 -#define get_mm_rss(mm)                                 \
7070 -       (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
7071 -#define update_hiwater_rss(mm) do {                    \
7072 -       unsigned long _rss = get_mm_rss(mm);            \
7073 -       if ((mm)->hiwater_rss < _rss)                   \
7074 -               (mm)->hiwater_rss = _rss;               \
7075 -} while (0)
7076 -#define update_hiwater_vm(mm)  do {                    \
7077 -       if ((mm)->hiwater_vm < (mm)->total_vm)          \
7078 -               (mm)->hiwater_vm = (mm)->total_vm;      \
7079 -} while (0)
7080 -
7081 -extern void set_dumpable(struct mm_struct *mm, int value);
7082 -extern int get_dumpable(struct mm_struct *mm);
7083 -
7084 -/* mm flags */
7085 -/* dumpable bits */
7086 -#define MMF_DUMPABLE      0  /* core dump is permitted */
7087 -#define MMF_DUMP_SECURELY 1  /* core file is readable only by root */
7088 -#define MMF_DUMPABLE_BITS 2
7089 -
7090 -/* coredump filter bits */
7091 -#define MMF_DUMP_ANON_PRIVATE  2
7092 -#define MMF_DUMP_ANON_SHARED   3
7093 -#define MMF_DUMP_MAPPED_PRIVATE        4
7094 -#define MMF_DUMP_MAPPED_SHARED 5
7095 -#define MMF_DUMP_ELF_HEADERS   6
7096 -#define MMF_DUMP_FILTER_SHIFT  MMF_DUMPABLE_BITS
7097 -#define MMF_DUMP_FILTER_BITS   5
7098 -#define MMF_DUMP_FILTER_MASK \
7099 -       (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT)
7100 -#define MMF_DUMP_FILTER_DEFAULT \
7101 -       ((1 << MMF_DUMP_ANON_PRIVATE) | (1 << MMF_DUMP_ANON_SHARED))
7102 -
7103 -struct sighand_struct {
7104 -       atomic_t                count;
7105 -       struct k_sigaction      action[_NSIG];
7106 -       spinlock_t              siglock;
7107 -       wait_queue_head_t       signalfd_wqh;
7108 -};
7109 -
7110 -struct pacct_struct {
7111 -       int                     ac_flag;
7112 -       long                    ac_exitcode;
7113 -       unsigned long           ac_mem;
7114 -       cputime_t               ac_utime, ac_stime;
7115 -       unsigned long           ac_minflt, ac_majflt;
7116 -};
7117 -
7118 -/*
7119 - * NOTE! "signal_struct" does not have it's own
7120 - * locking, because a shared signal_struct always
7121 - * implies a shared sighand_struct, so locking
7122 - * sighand_struct is always a proper superset of
7123 - * the locking of signal_struct.
7124 - */
7125 -struct signal_struct {
7126 -       atomic_t                count;
7127 -       atomic_t                live;
7128 -
7129 -       wait_queue_head_t       wait_chldexit;  /* for wait4() */
7130 -
7131 -       /* current thread group signal load-balancing target: */
7132 -       struct task_struct      *curr_target;
7133 -
7134 -       /* shared signal handling: */
7135 -       struct sigpending       shared_pending;
7136 -
7137 -       /* thread group exit support */
7138 -       int                     group_exit_code;
7139 -       /* overloaded:
7140 -        * - notify group_exit_task when ->count is equal to notify_count
7141 -        * - everyone except group_exit_task is stopped during signal delivery
7142 -        *   of fatal signals, group_exit_task processes the signal.
7143 -        */
7144 -       struct task_struct      *group_exit_task;
7145 -       int                     notify_count;
7146 -
7147 -       /* thread group stop support, overloads group_exit_code too */
7148 -       int                     group_stop_count;
7149 -       unsigned int            flags; /* see SIGNAL_* flags below */
7150 -
7151 -       /* POSIX.1b Interval Timers */
7152 -       struct list_head posix_timers;
7153 -
7154 -       /* ITIMER_REAL timer for the process */
7155 -       struct hrtimer real_timer;
7156 -       struct pid *leader_pid;
7157 -       ktime_t it_real_incr;
7158 -
7159 -       /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
7160 -       cputime_t it_prof_expires, it_virt_expires;
7161 -       cputime_t it_prof_incr, it_virt_incr;
7162 -
7163 -       /* job control IDs */
7164 -
7165 -       /*
7166 -        * pgrp and session fields are deprecated.
7167 -        * use the task_session_Xnr and task_pgrp_Xnr routines below
7168 -        */
7169 -
7170 -       union {
7171 -               pid_t pgrp __deprecated;
7172 -               pid_t __pgrp;
7173 -       };
7174 -
7175 -       struct pid *tty_old_pgrp;
7176 -
7177 -       union {
7178 -               pid_t session __deprecated;
7179 -               pid_t __session;
7180 -       };
7181 -
7182 -       /* boolean value for session group leader */
7183 -       int leader;
7184 -
7185 -       struct tty_struct *tty; /* NULL if no tty */
7186 -
7187 -       /*
7188 -        * Cumulative resource counters for dead threads in the group,
7189 -        * and for reaped dead child processes forked by this group.
7190 -        * Live threads maintain their own counters and add to these
7191 -        * in __exit_signal, except for the group leader.
7192 -        */
7193 -       cputime_t utime, stime, cutime, cstime;
7194 -       cputime_t gtime;
7195 -       cputime_t cgtime;
7196 -       unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
7197 -       unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
7198 -       unsigned long inblock, oublock, cinblock, coublock;
7199 -       struct task_io_accounting ioac;
7200 -
7201 -       /*
7202 -        * Cumulative ns of scheduled CPU time for dead threads in the
7203 -        * group, not including a zombie group leader.  (This only differs
7204 -        * from jiffies_to_ns(utime + stime) if sched_clock uses something
7205 -        * other than jiffies.)
7206 -        */
7207 -       unsigned long long sum_sched_runtime;
7208 -
7209 -       /*
7210 -        * We don't bother to synchronize most readers of this at all,
7211 -        * because there is no reader checking a limit that actually needs
7212 -        * to get both rlim_cur and rlim_max atomically, and either one
7213 -        * alone is a single word that can safely be read normally.
7214 -        * getrlimit/setrlimit use task_lock(current->group_leader) to
7215 -        * protect this instead of the siglock, because they really
7216 -        * have no need to disable irqs.
7217 -        */
7218 -       struct rlimit rlim[RLIM_NLIMITS];
7219 -
7220 -       struct list_head cpu_timers[3];
7221 -
7222 -       /* keep the process-shared keyrings here so that they do the right
7223 -        * thing in threads created with CLONE_THREAD */
7224 -#ifdef CONFIG_KEYS
7225 -       struct key *session_keyring;    /* keyring inherited over fork */
7226 -       struct key *process_keyring;    /* keyring private to this process */
7227 -#endif
7228 -#ifdef CONFIG_BSD_PROCESS_ACCT
7229 -       struct pacct_struct pacct;      /* per-process accounting information */
7230 -#endif
7231 -#ifdef CONFIG_TASKSTATS
7232 -       struct taskstats *stats;
7233 -#endif
7234 -#ifdef CONFIG_AUDIT
7235 -       unsigned audit_tty;
7236 -       struct tty_audit_buf *tty_audit_buf;
7237 -#endif
7238 -};
7239 -
7240 -/* Context switch must be unlocked if interrupts are to be enabled */
7241 -#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
7242 -# define __ARCH_WANT_UNLOCKED_CTXSW
7243 -#endif
7244 -
7245 -/*
7246 - * Bits in flags field of signal_struct.
7247 - */
7248 -#define SIGNAL_STOP_STOPPED    0x00000001 /* job control stop in effect */
7249 -#define SIGNAL_STOP_DEQUEUED   0x00000002 /* stop signal dequeued */
7250 -#define SIGNAL_STOP_CONTINUED  0x00000004 /* SIGCONT since WCONTINUED reap */
7251 -#define SIGNAL_GROUP_EXIT      0x00000008 /* group exit in progress */
7252 -/*
7253 - * Pending notifications to parent.
7254 - */
7255 -#define SIGNAL_CLD_STOPPED     0x00000010
7256 -#define SIGNAL_CLD_CONTINUED   0x00000020
7257 -#define SIGNAL_CLD_MASK                (SIGNAL_CLD_STOPPED|SIGNAL_CLD_CONTINUED)
7258 -
7259 -#define SIGNAL_UNKILLABLE      0x00000040 /* for init: ignore fatal signals */
7260 -
7261 -/* If true, all threads except ->group_exit_task have pending SIGKILL */
7262 -static inline int signal_group_exit(const struct signal_struct *sig)
7263 -{
7264 -       return  (sig->flags & SIGNAL_GROUP_EXIT) ||
7265 -               (sig->group_exit_task != NULL);
7266 -}
7267 -
7268 -/*
7269 - * Some day this will be a full-fledged user tracking system..
7270 - */
7271 -struct user_struct {
7272 -       atomic_t __count;       /* reference count */
7273 -       atomic_t processes;     /* How many processes does this user have? */
7274 -       atomic_t files;         /* How many open files does this user have? */
7275 -       atomic_t sigpending;    /* How many pending signals does this user have? */
7276 -#ifdef CONFIG_INOTIFY_USER
7277 -       atomic_t inotify_watches; /* How many inotify watches does this user have? */
7278 -       atomic_t inotify_devs;  /* How many inotify devs does this user have opened? */
7279 -#endif
7280 -#ifdef CONFIG_EPOLL
7281 -       atomic_t epoll_watches; /* The number of file descriptors currently watched */
7282 -#endif
7283 -#ifdef CONFIG_POSIX_MQUEUE
7284 -       /* protected by mq_lock */
7285 -       unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */
7286 -#endif
7287 -       unsigned long locked_shm; /* How many pages of mlocked shm ? */
7288 -
7289 -#ifdef CONFIG_KEYS
7290 -       struct key *uid_keyring;        /* UID specific keyring */
7291 -       struct key *session_keyring;    /* UID's default session keyring */
7292 -#endif
7293 -
7294 -       /* Hash table maintenance information */
7295 -       struct hlist_node uidhash_node;
7296 -       uid_t uid;
7297 -
7298 -#ifdef CONFIG_USER_SCHED
7299 -       struct task_group *tg;
7300 -#ifdef CONFIG_SYSFS
7301 -       struct kobject kobj;
7302 -       struct work_struct work;
7303 -#endif
7304 -#endif
7305 -};
7306 -
7307 -extern int uids_sysfs_init(void);
7308 -
7309 -extern struct user_struct *find_user(uid_t);
7310 -
7311 -extern struct user_struct root_user;
7312 -#define INIT_USER (&root_user)
7313 -
7314 -struct backing_dev_info;
7315 -struct reclaim_state;
7316 -
7317 -#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
7318 -struct sched_info {
7319 -       /* cumulative counters */
7320 -       unsigned long pcount;         /* # of times run on this cpu */
7321 -       unsigned long long cpu_time,  /* time spent on the cpu */
7322 -                          run_delay; /* time spent waiting on a runqueue */
7323 -
7324 -       /* timestamps */
7325 -       unsigned long long last_arrival,/* when we last ran on a cpu */
7326 -                          last_queued; /* when we were last queued to run */
7327 -#ifdef CONFIG_SCHEDSTATS
7328 -       /* BKL stats */
7329 -       unsigned int bkl_count;
7330 -#endif
7331 -};
7332 -#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
7333 -
7334 -#ifdef CONFIG_SCHEDSTATS
7335 -extern const struct file_operations proc_schedstat_operations;
7336 -#endif /* CONFIG_SCHEDSTATS */
7337 -
7338 -#ifdef CONFIG_TASK_DELAY_ACCT
7339 -struct task_delay_info {
7340 -       spinlock_t      lock;
7341 -       unsigned int    flags;  /* Private per-task flags */
7342 -
7343 -       /* For each stat XXX, add following, aligned appropriately
7344 -        *
7345 -        * struct timespec XXX_start, XXX_end;
7346 -        * u64 XXX_delay;
7347 -        * u32 XXX_count;
7348 -        *
7349 -        * Atomicity of updates to XXX_delay, XXX_count protected by
7350 -        * single lock above (split into XXX_lock if contention is an issue).
7351 -        */
7352 -
7353 -       /*
7354 -        * XXX_count is incremented on every XXX operation, the delay
7355 -        * associated with the operation is added to XXX_delay.
7356 -        * XXX_delay contains the accumulated delay time in nanoseconds.
7357 -        */
7358 -       struct timespec blkio_start, blkio_end; /* Shared by blkio, swapin */
7359 -       u64 blkio_delay;        /* wait for sync block io completion */
7360 -       u64 swapin_delay;       /* wait for swapin block io completion */
7361 -       u32 blkio_count;        /* total count of the number of sync block */
7362 -                               /* io operations performed */
7363 -       u32 swapin_count;       /* total count of the number of swapin block */
7364 -                               /* io operations performed */
7365 -
7366 -       struct timespec freepages_start, freepages_end;
7367 -       u64 freepages_delay;    /* wait for memory reclaim */
7368 -       u32 freepages_count;    /* total count of memory reclaim */
7369 -};
7370 -#endif /* CONFIG_TASK_DELAY_ACCT */
7371 -
7372 -static inline int sched_info_on(void)
7373 -{
7374 -#ifdef CONFIG_SCHEDSTATS
7375 -       return 1;
7376 -#elif defined(CONFIG_TASK_DELAY_ACCT)
7377 -       extern int delayacct_on;
7378 -       return delayacct_on;
7379 -#else
7380 -       return 0;
7381 -#endif
7382 -}
7383 -
7384 -enum cpu_idle_type {
7385 -       CPU_IDLE,
7386 -       CPU_NOT_IDLE,
7387 -       CPU_NEWLY_IDLE,
7388 -       CPU_MAX_IDLE_TYPES
7389 -};
7390 -
7391 -/*
7392 - * sched-domains (multiprocessor balancing) declarations:
7393 - */
7394 -
7395 -/*
7396 - * Increase resolution of nice-level calculations:
7397 - */
7398 -#define SCHED_LOAD_SHIFT       10
7399 -#define SCHED_LOAD_SCALE       (1L << SCHED_LOAD_SHIFT)
7400 -
7401 -#define SCHED_LOAD_SCALE_FUZZ  SCHED_LOAD_SCALE
7402 -
7403 -#ifdef CONFIG_SMP
7404 -#define SD_LOAD_BALANCE                1       /* Do load balancing on this domain. */
7405 -#define SD_BALANCE_NEWIDLE     2       /* Balance when about to become idle */
7406 -#define SD_BALANCE_EXEC                4       /* Balance on exec */
7407 -#define SD_BALANCE_FORK                8       /* Balance on fork, clone */
7408 -#define SD_WAKE_IDLE           16      /* Wake to idle CPU on task wakeup */
7409 -#define SD_WAKE_AFFINE         32      /* Wake task to waking CPU */
7410 -#define SD_WAKE_BALANCE                64      /* Perform balancing at task wakeup */
7411 -#define SD_SHARE_CPUPOWER      128     /* Domain members share cpu power */
7412 -#define SD_POWERSAVINGS_BALANCE        256     /* Balance for power savings */
7413 -#define SD_SHARE_PKG_RESOURCES 512     /* Domain members share cpu pkg resources */
7414 -#define SD_SERIALIZE           1024    /* Only a single load balancing instance */
7415 -#define SD_WAKE_IDLE_FAR       2048    /* Gain latency sacrificing cache hit */
7416 -
7417 -#define BALANCE_FOR_MC_POWER   \
7418 -       (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0)
7419 -
7420 -#define BALANCE_FOR_PKG_POWER  \
7421 -       ((sched_mc_power_savings || sched_smt_power_savings) ?  \
7422 -        SD_POWERSAVINGS_BALANCE : 0)
7423 -
7424 -#define test_sd_parent(sd, flag)       ((sd->parent &&         \
7425 -                                        (sd->parent->flags & flag)) ? 1 : 0)
7426 -
7427 -
7428 -struct sched_group {
7429 -       struct sched_group *next;       /* Must be a circular list */
7430 -       cpumask_t cpumask;
7431 -
7432 -       /*
7433 -        * CPU power of this group, SCHED_LOAD_SCALE being max power for a
7434 -        * single CPU. This is read only (except for setup, hotplug CPU).
7435 -        * Note : Never change cpu_power without recompute its reciprocal
7436 -        */
7437 -       unsigned int __cpu_power;
7438 -       /*
7439 -        * reciprocal value of cpu_power to avoid expensive divides
7440 -        * (see include/linux/reciprocal_div.h)
7441 -        */
7442 -       u32 reciprocal_cpu_power;
7443 -};
7444 -
7445 -enum sched_domain_level {
7446 -       SD_LV_NONE = 0,
7447 -       SD_LV_SIBLING,
7448 -       SD_LV_MC,
7449 -       SD_LV_CPU,
7450 -       SD_LV_NODE,
7451 -       SD_LV_ALLNODES,
7452 -       SD_LV_MAX
7453 -};
7454 -
7455 -struct sched_domain_attr {
7456 -       int relax_domain_level;
7457 -};
7458 -
7459 -#define SD_ATTR_INIT   (struct sched_domain_attr) {    \
7460 -       .relax_domain_level = -1,                       \
7461 -}
7462 -
7463 -struct sched_domain {
7464 -       /* These fields must be setup */
7465 -       struct sched_domain *parent;    /* top domain must be null terminated */
7466 -       struct sched_domain *child;     /* bottom domain must be null terminated */
7467 -       struct sched_group *groups;     /* the balancing groups of the domain */
7468 -       cpumask_t span;                 /* span of all CPUs in this domain */
7469 -       unsigned long min_interval;     /* Minimum balance interval ms */
7470 -       unsigned long max_interval;     /* Maximum balance interval ms */
7471 -       unsigned int busy_factor;       /* less balancing by factor if busy */
7472 -       unsigned int imbalance_pct;     /* No balance until over watermark */
7473 -       unsigned int cache_nice_tries;  /* Leave cache hot tasks for # tries */
7474 -       unsigned int busy_idx;
7475 -       unsigned int idle_idx;
7476 -       unsigned int newidle_idx;
7477 -       unsigned int wake_idx;
7478 -       unsigned int forkexec_idx;
7479 -       int flags;                      /* See SD_* */
7480 -       enum sched_domain_level level;
7481 -
7482 -       /* Runtime fields. */
7483 -       unsigned long last_balance;     /* init to jiffies. units in jiffies */
7484 -       unsigned int balance_interval;  /* initialise to 1. units in ms. */
7485 -       unsigned int nr_balance_failed; /* initialise to 0 */
7486 -
7487 -       u64 last_update;
7488 -
7489 -#ifdef CONFIG_SCHEDSTATS
7490 -       /* load_balance() stats */
7491 -       unsigned int lb_count[CPU_MAX_IDLE_TYPES];
7492 -       unsigned int lb_failed[CPU_MAX_IDLE_TYPES];
7493 -       unsigned int lb_balanced[CPU_MAX_IDLE_TYPES];
7494 -       unsigned int lb_imbalance[CPU_MAX_IDLE_TYPES];
7495 -       unsigned int lb_gained[CPU_MAX_IDLE_TYPES];
7496 -       unsigned int lb_hot_gained[CPU_MAX_IDLE_TYPES];
7497 -       unsigned int lb_nobusyg[CPU_MAX_IDLE_TYPES];
7498 -       unsigned int lb_nobusyq[CPU_MAX_IDLE_TYPES];
7499 -
7500 -       /* Active load balancing */
7501 -       unsigned int alb_count;
7502 -       unsigned int alb_failed;
7503 -       unsigned int alb_pushed;
7504 -
7505 -       /* SD_BALANCE_EXEC stats */
7506 -       unsigned int sbe_count;
7507 -       unsigned int sbe_balanced;
7508 -       unsigned int sbe_pushed;
7509 -
7510 -       /* SD_BALANCE_FORK stats */
7511 -       unsigned int sbf_count;
7512 -       unsigned int sbf_balanced;
7513 -       unsigned int sbf_pushed;
7514 -
7515 -       /* try_to_wake_up() stats */
7516 -       unsigned int ttwu_wake_remote;
7517 -       unsigned int ttwu_move_affine;
7518 -       unsigned int ttwu_move_balance;
7519 -#endif
7520 -};
7521 -
7522 -extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
7523 -                                   struct sched_domain_attr *dattr_new);
7524 -extern int arch_reinit_sched_domains(void);
7525 -
7526 -#else /* CONFIG_SMP */
7527 -
7528 -struct sched_domain_attr;
7529 -
7530 -static inline void
7531 -partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
7532 -                       struct sched_domain_attr *dattr_new)
7533 -{
7534 -}
7535 -#endif /* !CONFIG_SMP */
7536 -
7537 -struct io_context;                     /* See blkdev.h */
7538 -#define NGROUPS_SMALL          32
7539 -#define NGROUPS_PER_BLOCK      ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
7540 -struct group_info {
7541 -       int ngroups;
7542 -       atomic_t usage;
7543 -       gid_t small_block[NGROUPS_SMALL];
7544 -       int nblocks;
7545 -       gid_t *blocks[0];
7546 -};
7547 -
7548 -/*
7549 - * get_group_info() must be called with the owning task locked (via task_lock())
7550 - * when task != current.  The reason being that the vast majority of callers are
7551 - * looking at current->group_info, which can not be changed except by the
7552 - * current task.  Changing current->group_info requires the task lock, too.
7553 - */
7554 -#define get_group_info(group_info) do { \
7555 -       atomic_inc(&(group_info)->usage); \
7556 -} while (0)
7557 -
7558 -#define put_group_info(group_info) do { \
7559 -       if (atomic_dec_and_test(&(group_info)->usage)) \
7560 -               groups_free(group_info); \
7561 -} while (0)
7562 -
7563 -extern struct group_info *groups_alloc(int gidsetsize);
7564 -extern void groups_free(struct group_info *group_info);
7565 -extern int set_current_groups(struct group_info *group_info);
7566 -extern int groups_search(struct group_info *group_info, gid_t grp);
7567 -/* access the groups "array" with this macro */
7568 -#define GROUP_AT(gi, i) \
7569 -    ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
7570 -
7571 -#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK
7572 -extern void prefetch_stack(struct task_struct *t);
7573 -#else
7574 -static inline void prefetch_stack(struct task_struct *t) { }
7575 -#endif
7576 -
7577 -struct audit_context;          /* See audit.c */
7578 -struct mempolicy;
7579 -struct pipe_inode_info;
7580 -struct uts_namespace;
7581 -
7582 -struct rq;
7583 -struct sched_domain;
7584 -
7585 -struct sched_class {
7586 -       const struct sched_class *next;
7587 -
7588 -       void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
7589 -       void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
7590 -       void (*yield_task) (struct rq *rq);
7591 -       int  (*select_task_rq)(struct task_struct *p, int sync);
7592 -
7593 -       void (*check_preempt_curr) (struct rq *rq, struct task_struct *p);
7594 -
7595 -       struct task_struct * (*pick_next_task) (struct rq *rq);
7596 -       void (*put_prev_task) (struct rq *rq, struct task_struct *p);
7597 -
7598 -#ifdef CONFIG_SMP
7599 -       unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
7600 -                       struct rq *busiest, unsigned long max_load_move,
7601 -                       struct sched_domain *sd, enum cpu_idle_type idle,
7602 -                       int *all_pinned, int *this_best_prio);
7603 -
7604 -       int (*move_one_task) (struct rq *this_rq, int this_cpu,
7605 -                             struct rq *busiest, struct sched_domain *sd,
7606 -                             enum cpu_idle_type idle);
7607 -       void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
7608 -       void (*post_schedule) (struct rq *this_rq);
7609 -       void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
7610 -#endif
7611 -
7612 -       void (*set_curr_task) (struct rq *rq);
7613 -       void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
7614 -       void (*task_new) (struct rq *rq, struct task_struct *p);
7615 -       void (*set_cpus_allowed)(struct task_struct *p,
7616 -                                const cpumask_t *newmask);
7617 -
7618 -       void (*rq_online)(struct rq *rq);
7619 -       void (*rq_offline)(struct rq *rq);
7620 -
7621 -       void (*switched_from) (struct rq *this_rq, struct task_struct *task,
7622 -                              int running);
7623 -       void (*switched_to) (struct rq *this_rq, struct task_struct *task,
7624 -                            int running);
7625 -       void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
7626 -                            int oldprio, int running);
7627 -
7628 -#ifdef CONFIG_FAIR_GROUP_SCHED
7629 -       void (*moved_group) (struct task_struct *p);
7630 -#endif
7631 -};
7632 -
7633 -struct load_weight {
7634 -       unsigned long weight, inv_weight;
7635 -};
7636 -
7637 -/*
7638 - * CFS stats for a schedulable entity (task, task-group etc)
7639 - *
7640 - * Current field usage histogram:
7641 - *
7642 - *     4 se->block_start
7643 - *     4 se->run_node
7644 - *     4 se->sleep_start
7645 - *     6 se->load.weight
7646 - */
7647 -struct sched_entity {
7648 -       struct load_weight      load;           /* for load-balancing */
7649 -       struct rb_node          run_node;
7650 -       struct list_head        group_node;
7651 -       unsigned int            on_rq;
7652 -
7653 -       u64                     exec_start;
7654 -       u64                     sum_exec_runtime;
7655 -       u64                     vruntime;
7656 -       u64                     prev_sum_exec_runtime;
7657 -
7658 -       u64                     last_wakeup;
7659 -       u64                     avg_overlap;
7660 -
7661 -#ifdef CONFIG_SCHEDSTATS
7662 -       u64                     wait_start;
7663 -       u64                     wait_max;
7664 -       u64                     wait_count;
7665 -       u64                     wait_sum;
7666 -
7667 -       u64                     sleep_start;
7668 -       u64                     sleep_max;
7669 -       s64                     sum_sleep_runtime;
7670 -
7671 -       u64                     block_start;
7672 -       u64                     block_max;
7673 -       u64                     exec_max;
7674 -       u64                     slice_max;
7675 -
7676 -       u64                     nr_migrations;
7677 -       u64                     nr_migrations_cold;
7678 -       u64                     nr_failed_migrations_affine;
7679 -       u64                     nr_failed_migrations_running;
7680 -       u64                     nr_failed_migrations_hot;
7681 -       u64                     nr_forced_migrations;
7682 -       u64                     nr_forced2_migrations;
7683 -
7684 -       u64                     nr_wakeups;
7685 -       u64                     nr_wakeups_sync;
7686 -       u64                     nr_wakeups_migrate;
7687 -       u64                     nr_wakeups_local;
7688 -       u64                     nr_wakeups_remote;
7689 -       u64                     nr_wakeups_affine;
7690 -       u64                     nr_wakeups_affine_attempts;
7691 -       u64                     nr_wakeups_passive;
7692 -       u64                     nr_wakeups_idle;
7693 -#endif
7694 -
7695 -#ifdef CONFIG_FAIR_GROUP_SCHED
7696 -       struct sched_entity     *parent;
7697 -       /* rq on which this entity is (to be) queued: */
7698 -       struct cfs_rq           *cfs_rq;
7699 -       /* rq "owned" by this entity/group: */
7700 -       struct cfs_rq           *my_q;
7701 -#endif
7702 -};
7703 -
7704 -struct sched_rt_entity {
7705 -       struct list_head run_list;
7706 -       unsigned int time_slice;
7707 -       unsigned long timeout;
7708 -       int nr_cpus_allowed;
7709 -
7710 -       struct sched_rt_entity *back;
7711 -#ifdef CONFIG_RT_GROUP_SCHED
7712 -       struct sched_rt_entity  *parent;
7713 -       /* rq on which this entity is (to be) queued: */
7714 -       struct rt_rq            *rt_rq;
7715 -       /* rq "owned" by this entity/group: */
7716 -       struct rt_rq            *my_q;
7717 -#endif
7718 -};
7719 -
7720 -struct task_struct {
7721 -       volatile long state;    /* -1 unrunnable, 0 runnable, >0 stopped */
7722 -       void *stack;
7723 -       atomic_t usage;
7724 -       unsigned int flags;     /* per process flags, defined below */
7725 -       unsigned int ptrace;
7726 -
7727 -       int lock_depth;         /* BKL lock depth */
7728 -
7729 -#ifdef CONFIG_SMP
7730 -#ifdef __ARCH_WANT_UNLOCKED_CTXSW
7731 -       int oncpu;
7732 -#endif
7733 -#endif
7734 -
7735 -       int prio, static_prio, normal_prio;
7736 -       unsigned int rt_priority;
7737 -       const struct sched_class *sched_class;
7738 -       struct sched_entity se;
7739 -       struct sched_rt_entity rt;
7740 -
7741 -#ifdef CONFIG_PREEMPT_NOTIFIERS
7742 -       /* list of struct preempt_notifier: */
7743 -       struct hlist_head preempt_notifiers;
7744 -#endif
7745 -
7746 -       /*
7747 -        * fpu_counter contains the number of consecutive context switches
7748 -        * that the FPU is used. If this is over a threshold, the lazy fpu
7749 -        * saving becomes unlazy to save the trap. This is an unsigned char
7750 -        * so that after 256 times the counter wraps and the behavior turns
7751 -        * lazy again; this to deal with bursty apps that only use FPU for
7752 -        * a short time
7753 -        */
7754 -       unsigned char fpu_counter;
7755 -       s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
7756 -#ifdef CONFIG_BLK_DEV_IO_TRACE
7757 -       unsigned int btrace_seq;
7758 -#endif
7759 -
7760 -       unsigned int policy;
7761 -       cpumask_t cpus_allowed;
7762 -
7763 -#ifdef CONFIG_PREEMPT_RCU
7764 -       int rcu_read_lock_nesting;
7765 -       int rcu_flipctr_idx;
7766 -#endif /* #ifdef CONFIG_PREEMPT_RCU */
7767 -
7768 -#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
7769 -       struct sched_info sched_info;
7770 -#endif
7771 -
7772 -       struct list_head tasks;
7773 -
7774 -       struct mm_struct *mm, *active_mm;
7775 -
7776 -/* task state */
7777 -       struct linux_binfmt *binfmt;
7778 -       int exit_state;
7779 -       int exit_code, exit_signal;
7780 -       int pdeath_signal;  /*  The signal sent when the parent dies  */
7781 -       /* ??? */
7782 -       unsigned int personality;
7783 -       unsigned did_exec:1;
7784 -       pid_t pid;
7785 -       pid_t tgid;
7786 -
7787 -#ifdef CONFIG_CC_STACKPROTECTOR
7788 -       /* Canary value for the -fstack-protector gcc feature */
7789 -       unsigned long stack_canary;
7790 -#endif
7791 -       /* 
7792 -        * pointers to (original) parent process, youngest child, younger sibling,
7793 -        * older sibling, respectively.  (p->father can be replaced with 
7794 -        * p->real_parent->pid)
7795 -        */
7796 -       struct task_struct *real_parent; /* real parent process */
7797 -       struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */
7798 -       /*
7799 -        * children/sibling forms the list of my natural children
7800 -        */
7801 -       struct list_head children;      /* list of my children */
7802 -       struct list_head sibling;       /* linkage in my parent's children list */
7803 -       struct task_struct *group_leader;       /* threadgroup leader */
7804 -
7805 -       /*
7806 -        * ptraced is the list of tasks this task is using ptrace on.
7807 -        * This includes both natural children and PTRACE_ATTACH targets.
7808 -        * p->ptrace_entry is p's link on the p->parent->ptraced list.
7809 -        */
7810 -       struct list_head ptraced;
7811 -       struct list_head ptrace_entry;
7812 -
7813 -       /* PID/PID hash table linkage. */
7814 -       struct pid_link pids[PIDTYPE_MAX];
7815 -       struct list_head thread_group;
7816 -
7817 -       struct completion *vfork_done;          /* for vfork() */
7818 -       int __user *set_child_tid;              /* CLONE_CHILD_SETTID */
7819 -       int __user *clear_child_tid;            /* CLONE_CHILD_CLEARTID */
7820 -
7821 -       cputime_t utime, stime, utimescaled, stimescaled;
7822 -       cputime_t gtime;
7823 -       cputime_t prev_utime, prev_stime;
7824 -       unsigned long nvcsw, nivcsw; /* context switch counts */
7825 -       struct timespec start_time;             /* monotonic time */
7826 -       struct timespec real_start_time;        /* boot based time */
7827 -/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
7828 -       unsigned long min_flt, maj_flt;
7829 -
7830 -       cputime_t it_prof_expires, it_virt_expires;
7831 -       unsigned long long it_sched_expires;
7832 -       struct list_head cpu_timers[3];
7833 -
7834 -/* process credentials */
7835 -       uid_t uid,euid,suid,fsuid;
7836 -       gid_t gid,egid,sgid,fsgid;
7837 -       struct group_info *group_info;
7838 -       kernel_cap_t   cap_effective, cap_inheritable, cap_permitted, cap_bset;
7839 -       struct user_struct *user;
7840 -       unsigned securebits;
7841 -#ifdef CONFIG_KEYS
7842 -       unsigned char jit_keyring;      /* default keyring to attach requested keys to */
7843 -       struct key *request_key_auth;   /* assumed request_key authority */
7844 -       struct key *thread_keyring;     /* keyring private to this thread */
7845 -#endif
7846 -       char comm[TASK_COMM_LEN]; /* executable name excluding path
7847 -                                    - access with [gs]et_task_comm (which lock
7848 -                                      it with task_lock())
7849 -                                    - initialized normally by flush_old_exec */
7850 -/* file system info */
7851 -       int link_count, total_link_count;
7852 -#ifdef CONFIG_SYSVIPC
7853 -/* ipc stuff */
7854 -       struct sysv_sem sysvsem;
7855 -#endif
7856 -#ifdef CONFIG_DETECT_SOFTLOCKUP
7857 -/* hung task detection */
7858 -       unsigned long last_switch_timestamp;
7859 -       unsigned long last_switch_count;
7860 -#endif
7861 -/* CPU-specific state of this task */
7862 -       struct thread_struct thread;
7863 -/* filesystem information */
7864 -       struct fs_struct *fs;
7865 -/* open file information */
7866 -       struct files_struct *files;
7867 -/* namespaces */
7868 -       struct nsproxy *nsproxy;
7869 -/* signal handlers */
7870 -       struct signal_struct *signal;
7871 -       struct sighand_struct *sighand;
7872 -
7873 -       sigset_t blocked, real_blocked;
7874 -       sigset_t saved_sigmask; /* restored if set_restore_sigmask() was used */
7875 -       struct sigpending pending;
7876 -
7877 -       unsigned long sas_ss_sp;
7878 -       size_t sas_ss_size;
7879 -       int (*notifier)(void *priv);
7880 -       void *notifier_data;
7881 -       sigset_t *notifier_mask;
7882 -#ifdef CONFIG_SECURITY
7883 -       void *security;
7884 -#endif
7885 -       struct audit_context *audit_context;
7886 -#ifdef CONFIG_AUDITSYSCALL
7887 -       uid_t loginuid;
7888 -       unsigned int sessionid;
7889 -#endif
7890 -       seccomp_t seccomp;
7891 -
7892 -/* vserver context data */
7893 -       struct vx_info *vx_info;
7894 -       struct nx_info *nx_info;
7895 -
7896 -       xid_t xid;
7897 -       nid_t nid;
7898 -       tag_t tag;
7899 -
7900 -/* Thread group tracking */
7901 -       u32 parent_exec_id;
7902 -       u32 self_exec_id;
7903 -/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
7904 -       spinlock_t alloc_lock;
7905 -
7906 -       /* Protection of the PI data structures: */
7907 -       spinlock_t pi_lock;
7908 -
7909 -#ifdef CONFIG_RT_MUTEXES
7910 -       /* PI waiters blocked on a rt_mutex held by this task */
7911 -       struct plist_head pi_waiters;
7912 -       /* Deadlock detection and priority inheritance handling */
7913 -       struct rt_mutex_waiter *pi_blocked_on;
7914 -#endif
7915 -
7916 -#ifdef CONFIG_DEBUG_MUTEXES
7917 -       /* mutex deadlock detection */
7918 -       struct mutex_waiter *blocked_on;
7919 -#endif
7920 -#ifdef CONFIG_TRACE_IRQFLAGS
7921 -       unsigned int irq_events;
7922 -       int hardirqs_enabled;
7923 -       unsigned long hardirq_enable_ip;
7924 -       unsigned int hardirq_enable_event;
7925 -       unsigned long hardirq_disable_ip;
7926 -       unsigned int hardirq_disable_event;
7927 -       int softirqs_enabled;
7928 -       unsigned long softirq_disable_ip;
7929 -       unsigned int softirq_disable_event;
7930 -       unsigned long softirq_enable_ip;
7931 -       unsigned int softirq_enable_event;
7932 -       int hardirq_context;
7933 -       int softirq_context;
7934 -#endif
7935 -#ifdef CONFIG_LOCKDEP
7936 -# define MAX_LOCK_DEPTH 48UL
7937 -       u64 curr_chain_key;
7938 -       int lockdep_depth;
7939 -       unsigned int lockdep_recursion;
7940 -       struct held_lock held_locks[MAX_LOCK_DEPTH];
7941 -#endif
7942 -
7943 -/* journalling filesystem info */
7944 -       void *journal_info;
7945 -
7946 -/* stacked block device info */
7947 -       struct bio *bio_list, **bio_tail;
7948 -
7949 -/* VM state */
7950 -       struct reclaim_state *reclaim_state;
7951 -
7952 -       struct backing_dev_info *backing_dev_info;
7953 -
7954 -       struct io_context *io_context;
7955 -
7956 -       unsigned long ptrace_message;
7957 -       siginfo_t *last_siginfo; /* For ptrace use.  */
7958 -       struct task_io_accounting ioac;
7959 -#if defined(CONFIG_TASK_XACCT)
7960 -       u64 acct_rss_mem1;      /* accumulated rss usage */
7961 -       u64 acct_vm_mem1;       /* accumulated virtual memory usage */
7962 -       cputime_t acct_timexpd; /* stime + utime since last update */
7963 -#endif
7964 -#ifdef CONFIG_CPUSETS
7965 -       nodemask_t mems_allowed;
7966 -       int cpuset_mems_generation;
7967 -       int cpuset_mem_spread_rotor;
7968 -#endif
7969 -#ifdef CONFIG_CGROUPS
7970 -       /* Control Group info protected by css_set_lock */
7971 -       struct css_set *cgroups;
7972 -       /* cg_list protected by css_set_lock and tsk->alloc_lock */
7973 -       struct list_head cg_list;
7974 -#endif
7975 -#ifdef CONFIG_FUTEX
7976 -       struct robust_list_head __user *robust_list;
7977 -#ifdef CONFIG_COMPAT
7978 -       struct compat_robust_list_head __user *compat_robust_list;
7979 -#endif
7980 -       struct list_head pi_state_list;
7981 -       struct futex_pi_state *pi_state_cache;
7982 -#endif
7983 -#ifdef CONFIG_NUMA
7984 -       struct mempolicy *mempolicy;
7985 -       short il_next;
7986 -#endif
7987 -       atomic_t fs_excl;       /* holding fs exclusive resources */
7988 -       struct rcu_head rcu;
7989 -
7990 -       struct list_head        *scm_work_list;
7991 -
7992 -/*
7993 -        * cache last used pipe for splice
7994 -        */
7995 -       struct pipe_inode_info *splice_pipe;
7996 -#ifdef CONFIG_TASK_DELAY_ACCT
7997 -       struct task_delay_info *delays;
7998 -#endif
7999 -#ifdef CONFIG_FAULT_INJECTION
8000 -       int make_it_fail;
8001 -#endif
8002 -       struct prop_local_single dirties;
8003 -#ifdef CONFIG_LATENCYTOP
8004 -       int latency_record_count;
8005 -       struct latency_record latency_record[LT_SAVECOUNT];
8006 -#endif
8007 -};
8008 -
8009 -/*
8010 - * Priority of a process goes from 0..MAX_PRIO-1, valid RT
8011 - * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
8012 - * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
8013 - * values are inverted: lower p->prio value means higher priority.
8014 - *
8015 - * The MAX_USER_RT_PRIO value allows the actual maximum
8016 - * RT priority to be separate from the value exported to
8017 - * user-space.  This allows kernel threads to set their
8018 - * priority to a value higher than any user task. Note:
8019 - * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
8020 - */
8021 -
8022 -#define MAX_USER_RT_PRIO       100
8023 -#define MAX_RT_PRIO            MAX_USER_RT_PRIO
8024 -
8025 -#define MAX_PRIO               (MAX_RT_PRIO + 40)
8026 -#define DEFAULT_PRIO           (MAX_RT_PRIO + 20)
8027 -
8028 -static inline int rt_prio(int prio)
8029 -{
8030 -       if (unlikely(prio < MAX_RT_PRIO))
8031 -               return 1;
8032 -       return 0;
8033 -}
8034 -
8035 -static inline int rt_task(struct task_struct *p)
8036 -{
8037 -       return rt_prio(p->prio);
8038 -}
8039 -
8040 -static inline void set_task_session(struct task_struct *tsk, pid_t session)
8041 -{
8042 -       tsk->signal->__session = session;
8043 -}
8044 -
8045 -static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp)
8046 -{
8047 -       tsk->signal->__pgrp = pgrp;
8048 -}
8049 -
8050 -static inline struct pid *task_pid(struct task_struct *task)
8051 -{
8052 -       return task->pids[PIDTYPE_PID].pid;
8053 -}
8054 -
8055 -static inline struct pid *task_tgid(struct task_struct *task)
8056 -{
8057 -       return task->group_leader->pids[PIDTYPE_PID].pid;
8058 -}
8059 -
8060 -static inline struct pid *task_pgrp(struct task_struct *task)
8061 -{
8062 -       return task->group_leader->pids[PIDTYPE_PGID].pid;
8063 -}
8064 -
8065 -static inline struct pid *task_session(struct task_struct *task)
8066 -{
8067 -       return task->group_leader->pids[PIDTYPE_SID].pid;
8068 -}
8069 -
8070 -struct pid_namespace;
8071 -
8072 -/*
8073 - * the helpers to get the task's different pids as they are seen
8074 - * from various namespaces
8075 - *
8076 - * task_xid_nr()     : global id, i.e. the id seen from the init namespace;
8077 - * task_xid_vnr()    : virtual id, i.e. the id seen from the pid namespace of
8078 - *                     current.
8079 - * task_xid_nr_ns()  : id seen from the ns specified;
8080 - *
8081 - * set_task_vxid()   : assigns a virtual id to a task;
8082 - *
8083 - * see also pid_nr() etc in include/linux/pid.h
8084 - */
8085 -
8086 -#include <linux/vserver/base.h>
8087 -#include <linux/vserver/context.h>
8088 -#include <linux/vserver/debug.h>
8089 -#include <linux/vserver/pid.h>
8090 -
8091 -static inline pid_t task_pid_nr(struct task_struct *tsk)
8092 -{
8093 -       return tsk->pid;
8094 -}
8095 -
8096 -pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
8097 -
8098 -static inline pid_t task_pid_vnr(struct task_struct *tsk)
8099 -{
8100 -       return vx_map_pid(pid_vnr(task_pid(tsk)));
8101 -}
8102 -
8103 -
8104 -static inline pid_t task_tgid_nr(struct task_struct *tsk)
8105 -{
8106 -       return tsk->tgid;
8107 -}
8108 -
8109 -pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
8110 -
8111 -static inline pid_t task_tgid_vnr(struct task_struct *tsk)
8112 -{
8113 -       return vx_map_tgid(pid_vnr(task_tgid(tsk)));
8114 -}
8115 -
8116 -
8117 -static inline pid_t task_pgrp_nr(struct task_struct *tsk)
8118 -{
8119 -       return tsk->signal->__pgrp;
8120 -}
8121 -
8122 -pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
8123 -
8124 -static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
8125 -{
8126 -       return pid_vnr(task_pgrp(tsk));
8127 -}
8128 -
8129 -
8130 -static inline pid_t task_session_nr(struct task_struct *tsk)
8131 -{
8132 -       return tsk->signal->__session;
8133 -}
8134 -
8135 -pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
8136 -
8137 -static inline pid_t task_session_vnr(struct task_struct *tsk)
8138 -{
8139 -       return pid_vnr(task_session(tsk));
8140 -}
8141 -
8142 -
8143 -/**
8144 - * pid_alive - check that a task structure is not stale
8145 - * @p: Task structure to be checked.
8146 - *
8147 - * Test if a process is not yet dead (at most zombie state)
8148 - * If pid_alive fails, then pointers within the task structure
8149 - * can be stale and must not be dereferenced.
8150 - */
8151 -static inline int pid_alive(struct task_struct *p)
8152 -{
8153 -       return p->pids[PIDTYPE_PID].pid != NULL;
8154 -}
8155 -
8156 -/**
8157 - * is_global_init - check if a task structure is init
8158 - * @tsk: Task structure to be checked.
8159 - *
8160 - * Check if a task structure is the first user space task the kernel created.
8161 - */
8162 -static inline int is_global_init(struct task_struct *tsk)
8163 -{
8164 -       return tsk->pid == 1;
8165 -}
8166 -
8167 -/*
8168 - * is_container_init:
8169 - * check whether in the task is init in its own pid namespace.
8170 - */
8171 -extern int is_container_init(struct task_struct *tsk);
8172 -
8173 -extern struct pid *cad_pid;
8174 -
8175 -extern void free_task(struct task_struct *tsk);
8176 -#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
8177 -
8178 -extern void __put_task_struct(struct task_struct *t);
8179 -
8180 -static inline void put_task_struct(struct task_struct *t)
8181 -{
8182 -       if (atomic_dec_and_test(&t->usage))
8183 -               __put_task_struct(t);
8184 -}
8185 -
8186 -extern cputime_t task_utime(struct task_struct *p);
8187 -extern cputime_t task_stime(struct task_struct *p);
8188 -extern cputime_t task_gtime(struct task_struct *p);
8189 -
8190 -/*
8191 - * Per process flags
8192 - */
8193 -#define PF_ALIGNWARN   0x00000001      /* Print alignment warning msgs */
8194 -                                       /* Not implemented yet, only for 486*/
8195 -#define PF_STARTING    0x00000002      /* being created */
8196 -#define PF_EXITING     0x00000004      /* getting shut down */
8197 -#define PF_EXITPIDONE  0x00000008      /* pi exit done on shut down */
8198 -#define PF_VCPU                0x00000010      /* I'm a virtual CPU */
8199 -#define PF_FORKNOEXEC  0x00000040      /* forked but didn't exec */
8200 -#define PF_SUPERPRIV   0x00000100      /* used super-user privileges */
8201 -#define PF_DUMPCORE    0x00000200      /* dumped core */
8202 -#define PF_SIGNALED    0x00000400      /* killed by a signal */
8203 -#define PF_MEMALLOC    0x00000800      /* Allocating memory */
8204 -#define PF_FLUSHER     0x00001000      /* responsible for disk writeback */
8205 -#define PF_USED_MATH   0x00002000      /* if unset the fpu must be initialized before use */
8206 -#define PF_NOFREEZE    0x00008000      /* this thread should not be frozen */
8207 -#define PF_FROZEN      0x00010000      /* frozen for system suspend */
8208 -#define PF_FSTRANS     0x00020000      /* inside a filesystem transaction */
8209 -#define PF_KSWAPD      0x00040000      /* I am kswapd */
8210 -#define PF_SWAPOFF     0x00080000      /* I am in swapoff */
8211 -#define PF_LESS_THROTTLE 0x00100000    /* Throttle me less: I clean memory */
8212 -#define PF_KTHREAD     0x00200000      /* I am a kernel thread */
8213 -#define PF_RANDOMIZE   0x00400000      /* randomize virtual address space */
8214 -#define PF_SWAPWRITE   0x00800000      /* Allowed to write to swap */
8215 -#define PF_SPREAD_PAGE 0x01000000      /* Spread page cache over cpuset */
8216 -#define PF_SPREAD_SLAB 0x02000000      /* Spread some slab caches over cpuset */
8217 -#define PF_THREAD_BOUND        0x04000000      /* Thread bound to specific cpu */
8218 -#define PF_MEMPOLICY   0x10000000      /* Non-default NUMA mempolicy */
8219 -#define PF_MUTEX_TESTER        0x20000000      /* Thread belongs to the rt mutex tester */
8220 -#define PF_FREEZER_SKIP        0x40000000      /* Freezer should not count it as freezeable */
8221 -#define PF_FREEZER_NOSIG 0x80000000    /* Freezer won't send signals to it */
8222 -
8223 -/*
8224 - * Only the _current_ task can read/write to tsk->flags, but other
8225 - * tasks can access tsk->flags in readonly mode for example
8226 - * with tsk_used_math (like during threaded core dumping).
8227 - * There is however an exception to this rule during ptrace
8228 - * or during fork: the ptracer task is allowed to write to the
8229 - * child->flags of its traced child (same goes for fork, the parent
8230 - * can write to the child->flags), because we're guaranteed the
8231 - * child is not running and in turn not changing child->flags
8232 - * at the same time the parent does it.
8233 - */
8234 -#define clear_stopped_child_used_math(child) do { (child)->flags &= ~PF_USED_MATH; } while (0)
8235 -#define set_stopped_child_used_math(child) do { (child)->flags |= PF_USED_MATH; } while (0)
8236 -#define clear_used_math() clear_stopped_child_used_math(current)
8237 -#define set_used_math() set_stopped_child_used_math(current)
8238 -#define conditional_stopped_child_used_math(condition, child) \
8239 -       do { (child)->flags &= ~PF_USED_MATH, (child)->flags |= (condition) ? PF_USED_MATH : 0; } while (0)
8240 -#define conditional_used_math(condition) \
8241 -       conditional_stopped_child_used_math(condition, current)
8242 -#define copy_to_stopped_child_used_math(child) \
8243 -       do { (child)->flags &= ~PF_USED_MATH, (child)->flags |= current->flags & PF_USED_MATH; } while (0)
8244 -/* NOTE: this will return 0 or PF_USED_MATH, it will never return 1 */
8245 -#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
8246 -#define used_math() tsk_used_math(current)
8247 -
8248 -#ifdef CONFIG_SMP
8249 -extern int set_cpus_allowed_ptr(struct task_struct *p,
8250 -                               const cpumask_t *new_mask);
8251 -#else
8252 -static inline int set_cpus_allowed_ptr(struct task_struct *p,
8253 -                                      const cpumask_t *new_mask)
8254 -{
8255 -       if (!cpu_isset(0, *new_mask))
8256 -               return -EINVAL;
8257 -       return 0;
8258 -}
8259 -#endif
8260 -static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
8261 -{
8262 -       return set_cpus_allowed_ptr(p, &new_mask);
8263 -}
8264 -
8265 -extern unsigned long long sched_clock(void);
8266 -
8267 -extern void sched_clock_init(void);
8268 -extern u64 sched_clock_cpu(int cpu);
8269 -
8270 -#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
8271 -static inline void sched_clock_tick(void)
8272 -{
8273 -}
8274 -
8275 -static inline void sched_clock_idle_sleep_event(void)
8276 -{
8277 -}
8278 -
8279 -static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
8280 -{
8281 -}
8282 -#else
8283 -extern void sched_clock_tick(void);
8284 -extern void sched_clock_idle_sleep_event(void);
8285 -extern void sched_clock_idle_wakeup_event(u64 delta_ns);
8286 -#endif
8287 -
8288 -/*
8289 - * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
8290 - * clock constructed from sched_clock():
8291 - */
8292 -extern unsigned long long cpu_clock(int cpu);
8293 -
8294 -extern unsigned long long
8295 -task_sched_runtime(struct task_struct *task);
8296 -
8297 -/* sched_exec is called by processes performing an exec */
8298 -#ifdef CONFIG_SMP
8299 -extern void sched_exec(void);
8300 -#else
8301 -#define sched_exec()   {}
8302 -#endif
8303 -
8304 -extern void sched_clock_idle_sleep_event(void);
8305 -extern void sched_clock_idle_wakeup_event(u64 delta_ns);
8306 -
8307 -#ifdef CONFIG_HOTPLUG_CPU
8308 -extern void idle_task_exit(void);
8309 -#else
8310 -static inline void idle_task_exit(void) {}
8311 -#endif
8312 -
8313 -extern void sched_idle_next(void);
8314 -
8315 -#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
8316 -extern void wake_up_idle_cpu(int cpu);
8317 -#else
8318 -static inline void wake_up_idle_cpu(int cpu) { }
8319 -#endif
8320 -
8321 -#ifdef CONFIG_SCHED_DEBUG
8322 -extern unsigned int sysctl_sched_latency;
8323 -extern unsigned int sysctl_sched_min_granularity;
8324 -extern unsigned int sysctl_sched_wakeup_granularity;
8325 -extern unsigned int sysctl_sched_child_runs_first;
8326 -extern unsigned int sysctl_sched_features;
8327 -extern unsigned int sysctl_sched_migration_cost;
8328 -extern unsigned int sysctl_sched_nr_migrate;
8329 -extern unsigned int sysctl_sched_shares_ratelimit;
8330 -
8331 -int sched_nr_latency_handler(struct ctl_table *table, int write,
8332 -               struct file *file, void __user *buffer, size_t *length,
8333 -               loff_t *ppos);
8334 -#endif
8335 -extern unsigned int sysctl_sched_rt_period;
8336 -extern int sysctl_sched_rt_runtime;
8337 -
8338 -int sched_rt_handler(struct ctl_table *table, int write,
8339 -               struct file *filp, void __user *buffer, size_t *lenp,
8340 -               loff_t *ppos);
8341 -
8342 -extern unsigned int sysctl_sched_compat_yield;
8343 -
8344 -#ifdef CONFIG_RT_MUTEXES
8345 -extern int rt_mutex_getprio(struct task_struct *p);
8346 -extern void rt_mutex_setprio(struct task_struct *p, int prio);
8347 -extern void rt_mutex_adjust_pi(struct task_struct *p);
8348 -#else
8349 -static inline int rt_mutex_getprio(struct task_struct *p)
8350 -{
8351 -       return p->normal_prio;
8352 -}
8353 -# define rt_mutex_adjust_pi(p)         do { } while (0)
8354 -#endif
8355 -
8356 -extern void set_user_nice(struct task_struct *p, long nice);
8357 -extern int task_prio(const struct task_struct *p);
8358 -extern int task_nice(const struct task_struct *p);
8359 -extern int can_nice(const struct task_struct *p, const int nice);
8360 -extern int task_curr(const struct task_struct *p);
8361 -extern int idle_cpu(int cpu);
8362 -extern int sched_setscheduler(struct task_struct *, int, struct sched_param *);
8363 -extern int sched_setscheduler_nocheck(struct task_struct *, int,
8364 -                                     struct sched_param *);
8365 -extern struct task_struct *idle_task(int cpu);
8366 -extern struct task_struct *curr_task(int cpu);
8367 -extern void set_curr_task(int cpu, struct task_struct *p);
8368 -
8369 -void yield(void);
8370 -
8371 -/*
8372 - * The default (Linux) execution domain.
8373 - */
8374 -extern struct exec_domain      default_exec_domain;
8375 -
8376 -union thread_union {
8377 -       struct thread_info thread_info;
8378 -       unsigned long stack[THREAD_SIZE/sizeof(long)];
8379 -};
8380 -
8381 -#ifndef __HAVE_ARCH_KSTACK_END
8382 -static inline int kstack_end(void *addr)
8383 -{
8384 -       /* Reliable end of stack detection:
8385 -        * Some APM bios versions misalign the stack
8386 -        */
8387 -       return !(((unsigned long)addr+sizeof(void*)-1) & (THREAD_SIZE-sizeof(void*)));
8388 -}
8389 -#endif
8390 -
8391 -extern union thread_union init_thread_union;
8392 -extern struct task_struct init_task;
8393 -
8394 -extern struct   mm_struct init_mm;
8395 -
8396 -extern struct pid_namespace init_pid_ns;
8397 -
8398 -/*
8399 - * find a task by one of its numerical ids
8400 - *
8401 - * find_task_by_pid_type_ns():
8402 - *      it is the most generic call - it finds a task by all id,
8403 - *      type and namespace specified
8404 - * find_task_by_pid_ns():
8405 - *      finds a task by its pid in the specified namespace
8406 - * find_task_by_vpid():
8407 - *      finds a task by its virtual pid
8408 - *
8409 - * see also find_vpid() etc in include/linux/pid.h
8410 - */
8411 -
8412 -extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
8413 -               struct pid_namespace *ns);
8414 -
8415 -extern struct task_struct *find_task_by_vpid(pid_t nr);
8416 -extern struct task_struct *find_task_by_pid_ns(pid_t nr,
8417 -               struct pid_namespace *ns);
8418 -
8419 -extern void __set_special_pids(struct pid *pid);
8420 -
8421 -/* per-UID process charging. */
8422 -extern struct user_struct * alloc_uid(struct user_namespace *, uid_t);
8423 -static inline struct user_struct *get_uid(struct user_struct *u)
8424 -{
8425 -       atomic_inc(&u->__count);
8426 -       return u;
8427 -}
8428 -extern void free_uid(struct user_struct *);
8429 -extern void switch_uid(struct user_struct *);
8430 -extern void release_uids(struct user_namespace *ns);
8431 -
8432 -#include <asm/current.h>
8433 -
8434 -extern void do_timer(unsigned long ticks);
8435 -
8436 -extern int wake_up_state(struct task_struct *tsk, unsigned int state);
8437 -extern int wake_up_process(struct task_struct *tsk);
8438 -extern void wake_up_new_task(struct task_struct *tsk,
8439 -                               unsigned long clone_flags);
8440 -#ifdef CONFIG_SMP
8441 - extern void kick_process(struct task_struct *tsk);
8442 -#else
8443 - static inline void kick_process(struct task_struct *tsk) { }
8444 -#endif
8445 -extern void sched_fork(struct task_struct *p, int clone_flags);
8446 -extern void sched_dead(struct task_struct *p);
8447 -
8448 -extern int in_group_p(gid_t);
8449 -extern int in_egroup_p(gid_t);
8450 -
8451 -extern void proc_caches_init(void);
8452 -extern void flush_signals(struct task_struct *);
8453 -extern void ignore_signals(struct task_struct *);
8454 -extern void flush_signal_handlers(struct task_struct *, int force_default);
8455 -extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info);
8456 -
8457 -static inline int dequeue_signal_lock(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
8458 -{
8459 -       unsigned long flags;
8460 -       int ret;
8461 -
8462 -       spin_lock_irqsave(&tsk->sighand->siglock, flags);
8463 -       ret = dequeue_signal(tsk, mask, info);
8464 -       spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
8465 -
8466 -       return ret;
8467 -}      
8468 -
8469 -extern void block_all_signals(int (*notifier)(void *priv), void *priv,
8470 -                             sigset_t *mask);
8471 -extern void unblock_all_signals(void);
8472 -extern void release_task(struct task_struct * p);
8473 -extern int send_sig_info(int, struct siginfo *, struct task_struct *);
8474 -extern int force_sigsegv(int, struct task_struct *);
8475 -extern int force_sig_info(int, struct siginfo *, struct task_struct *);
8476 -extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
8477 -extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
8478 -extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32);
8479 -extern int kill_pgrp(struct pid *pid, int sig, int priv);
8480 -extern int kill_pid(struct pid *pid, int sig, int priv);
8481 -extern int kill_proc_info(int, struct siginfo *, pid_t);
8482 -extern int do_notify_parent(struct task_struct *, int);
8483 -extern void force_sig(int, struct task_struct *);
8484 -extern void force_sig_specific(int, struct task_struct *);
8485 -extern int send_sig(int, struct task_struct *, int);
8486 -extern void zap_other_threads(struct task_struct *p);
8487 -extern struct sigqueue *sigqueue_alloc(void);
8488 -extern void sigqueue_free(struct sigqueue *);
8489 -extern int send_sigqueue(struct sigqueue *,  struct task_struct *, int group);
8490 -extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
8491 -extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
8492 -
8493 -static inline int kill_cad_pid(int sig, int priv)
8494 -{
8495 -       return kill_pid(cad_pid, sig, priv);
8496 -}
8497 -
8498 -/* These can be the second arg to send_sig_info/send_group_sig_info.  */
8499 -#define SEND_SIG_NOINFO ((struct siginfo *) 0)
8500 -#define SEND_SIG_PRIV  ((struct siginfo *) 1)
8501 -#define SEND_SIG_FORCED        ((struct siginfo *) 2)
8502 -
8503 -static inline int is_si_special(const struct siginfo *info)
8504 -{
8505 -       return info <= SEND_SIG_FORCED;
8506 -}
8507 -
8508 -/* True if we are on the alternate signal stack.  */
8509 -
8510 -static inline int on_sig_stack(unsigned long sp)
8511 -{
8512 -       return (sp - current->sas_ss_sp < current->sas_ss_size);
8513 -}
8514 -
8515 -static inline int sas_ss_flags(unsigned long sp)
8516 -{
8517 -       return (current->sas_ss_size == 0 ? SS_DISABLE
8518 -               : on_sig_stack(sp) ? SS_ONSTACK : 0);
8519 -}
8520 -
8521 -/*
8522 - * Routines for handling mm_structs
8523 - */
8524 -extern struct mm_struct * mm_alloc(void);
8525 -
8526 -/* mmdrop drops the mm and the page tables */
8527 -extern void __mmdrop(struct mm_struct *);
8528 -static inline void mmdrop(struct mm_struct * mm)
8529 -{
8530 -       if (unlikely(atomic_dec_and_test(&mm->mm_count)))
8531 -               __mmdrop(mm);
8532 -}
8533 -
8534 -/* mmput gets rid of the mappings and all user-space */
8535 -extern void mmput(struct mm_struct *);
8536 -/* Grab a reference to a task's mm, if it is not already going away */
8537 -extern struct mm_struct *get_task_mm(struct task_struct *task);
8538 -/* Remove the current tasks stale references to the old mm_struct */
8539 -extern void mm_release(struct task_struct *, struct mm_struct *);
8540 -/* Allocate a new mm structure and copy contents from tsk->mm */
8541 -extern struct mm_struct *dup_mm(struct task_struct *tsk);
8542 -
8543 -extern int  copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *);
8544 -extern void flush_thread(void);
8545 -extern void exit_thread(void);
8546 -
8547 -extern void exit_files(struct task_struct *);
8548 -extern void __cleanup_signal(struct signal_struct *);
8549 -extern void __cleanup_sighand(struct sighand_struct *);
8550 -
8551 -extern void exit_itimers(struct signal_struct *);
8552 -extern void flush_itimer_signals(void);
8553 -
8554 -extern NORET_TYPE void do_group_exit(int);
8555 -
8556 -extern void daemonize(const char *, ...);
8557 -extern int allow_signal(int);
8558 -extern int disallow_signal(int);
8559 -
8560 -extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *);
8561 -extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
8562 -struct task_struct *fork_idle(int);
8563 -
8564 -extern void set_task_comm(struct task_struct *tsk, char *from);
8565 -extern char *get_task_comm(char *to, struct task_struct *tsk);
8566 -
8567 -#ifdef CONFIG_SMP
8568 -extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
8569 -#else
8570 -static inline unsigned long wait_task_inactive(struct task_struct *p,
8571 -                                              long match_state)
8572 -{
8573 -       return 1;
8574 -}
8575 -#endif
8576 -
8577 -#define next_task(p)   list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
8578 -
8579 -#define for_each_process(p) \
8580 -       for (p = &init_task ; (p = next_task(p)) != &init_task ; )
8581 -
8582 -/*
8583 - * Careful: do_each_thread/while_each_thread is a double loop so
8584 - *          'break' will not work as expected - use goto instead.
8585 - */
8586 -#define do_each_thread(g, t) \
8587 -       for (g = t = &init_task ; (g = t = next_task(g)) != &init_task ; ) do
8588 -
8589 -#define while_each_thread(g, t) \
8590 -       while ((t = next_thread(t)) != g)
8591 -
8592 -/* de_thread depends on thread_group_leader not being a pid based check */
8593 -#define thread_group_leader(p) (p == p->group_leader)
8594 -
8595 -/* Do to the insanities of de_thread it is possible for a process
8596 - * to have the pid of the thread group leader without actually being
8597 - * the thread group leader.  For iteration through the pids in proc
8598 - * all we care about is that we have a task with the appropriate
8599 - * pid, we don't actually care if we have the right task.
8600 - */
8601 -static inline int has_group_leader_pid(struct task_struct *p)
8602 -{
8603 -       return p->pid == p->tgid;
8604 -}
8605 -
8606 -static inline
8607 -int same_thread_group(struct task_struct *p1, struct task_struct *p2)
8608 -{
8609 -       return p1->tgid == p2->tgid;
8610 -}
8611 -
8612 -static inline struct task_struct *next_thread(const struct task_struct *p)
8613 -{
8614 -       return list_entry(rcu_dereference(p->thread_group.next),
8615 -                         struct task_struct, thread_group);
8616 -}
8617 -
8618 -static inline int thread_group_empty(struct task_struct *p)
8619 -{
8620 -       return list_empty(&p->thread_group);
8621 -}
8622 -
8623 -#define delay_group_leader(p) \
8624 -               (thread_group_leader(p) && !thread_group_empty(p))
8625 -
8626 -/*
8627 - * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
8628 - * subscriptions and synchronises with wait4().  Also used in procfs.  Also
8629 - * pins the final release of task.io_context.  Also protects ->cpuset and
8630 - * ->cgroup.subsys[].
8631 - *
8632 - * Nests both inside and outside of read_lock(&tasklist_lock).
8633 - * It must not be nested with write_lock_irq(&tasklist_lock),
8634 - * neither inside nor outside.
8635 - */
8636 -static inline void task_lock(struct task_struct *p)
8637 -{
8638 -       spin_lock(&p->alloc_lock);
8639 -}
8640 -
8641 -static inline void task_unlock(struct task_struct *p)
8642 -{
8643 -       spin_unlock(&p->alloc_lock);
8644 -}
8645 -
8646 -extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
8647 -                                                       unsigned long *flags);
8648 -
8649 -static inline void unlock_task_sighand(struct task_struct *tsk,
8650 -                                               unsigned long *flags)
8651 -{
8652 -       spin_unlock_irqrestore(&tsk->sighand->siglock, *flags);
8653 -}
8654 -
8655 -#ifndef __HAVE_THREAD_FUNCTIONS
8656 -
8657 -#define task_thread_info(task) ((struct thread_info *)(task)->stack)
8658 -#define task_stack_page(task)  ((task)->stack)
8659 -
8660 -static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org)
8661 -{
8662 -       *task_thread_info(p) = *task_thread_info(org);
8663 -       task_thread_info(p)->task = p;
8664 -}
8665 -
8666 -static inline unsigned long *end_of_stack(struct task_struct *p)
8667 -{
8668 -       return (unsigned long *)(task_thread_info(p) + 1);
8669 -}
8670 -
8671 -#endif
8672 -
8673 -static inline int object_is_on_stack(void *obj)
8674 -{
8675 -       void *stack = task_stack_page(current);
8676 -
8677 -       return (obj >= stack) && (obj < (stack + THREAD_SIZE));
8678 -}
8679 -
8680 -extern void thread_info_cache_init(void);
8681 -
8682 -/* set thread flags in other task's structures
8683 - * - see asm/thread_info.h for TIF_xxxx flags available
8684 - */
8685 -static inline void set_tsk_thread_flag(struct task_struct *tsk, int flag)
8686 -{
8687 -       set_ti_thread_flag(task_thread_info(tsk), flag);
8688 -}
8689 -
8690 -static inline void clear_tsk_thread_flag(struct task_struct *tsk, int flag)
8691 -{
8692 -       clear_ti_thread_flag(task_thread_info(tsk), flag);
8693 -}
8694 -
8695 -static inline int test_and_set_tsk_thread_flag(struct task_struct *tsk, int flag)
8696 -{
8697 -       return test_and_set_ti_thread_flag(task_thread_info(tsk), flag);
8698 -}
8699 -
8700 -static inline int test_and_clear_tsk_thread_flag(struct task_struct *tsk, int flag)
8701 -{
8702 -       return test_and_clear_ti_thread_flag(task_thread_info(tsk), flag);
8703 -}
8704 -
8705 -static inline int test_tsk_thread_flag(struct task_struct *tsk, int flag)
8706 -{
8707 -       return test_ti_thread_flag(task_thread_info(tsk), flag);
8708 -}
8709 -
8710 -static inline void set_tsk_need_resched(struct task_struct *tsk)
8711 -{
8712 -       set_tsk_thread_flag(tsk,TIF_NEED_RESCHED);
8713 -}
8714 -
8715 -static inline void clear_tsk_need_resched(struct task_struct *tsk)
8716 -{
8717 -       clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED);
8718 -}
8719 -
8720 -static inline int test_tsk_need_resched(struct task_struct *tsk)
8721 -{
8722 -       return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED));
8723 -}
8724 -
8725 -static inline int signal_pending(struct task_struct *p)
8726 -{
8727 -       return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
8728 -}
8729 -
8730 -extern int __fatal_signal_pending(struct task_struct *p);
8731 -
8732 -static inline int fatal_signal_pending(struct task_struct *p)
8733 -{
8734 -       return signal_pending(p) && __fatal_signal_pending(p);
8735 -}
8736 -
8737 -static inline int signal_pending_state(long state, struct task_struct *p)
8738 -{
8739 -       if (!(state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
8740 -               return 0;
8741 -       if (!signal_pending(p))
8742 -               return 0;
8743 -
8744 -       return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
8745 -}
8746 -
8747 -static inline int need_resched(void)
8748 -{
8749 -       return unlikely(test_thread_flag(TIF_NEED_RESCHED));
8750 -}
8751 -
8752 -/*
8753 - * cond_resched() and cond_resched_lock(): latency reduction via
8754 - * explicit rescheduling in places that are safe. The return
8755 - * value indicates whether a reschedule was done in fact.
8756 - * cond_resched_lock() will drop the spinlock before scheduling,
8757 - * cond_resched_softirq() will enable bhs before scheduling.
8758 - */
8759 -extern int _cond_resched(void);
8760 -#ifdef CONFIG_PREEMPT_BKL
8761 -static inline int cond_resched(void)
8762 -{
8763 -       return 0;
8764 -}
8765 -#else
8766 -static inline int cond_resched(void)
8767 -{
8768 -       return _cond_resched();
8769 -}
8770 -#endif
8771 -extern int cond_resched_lock(spinlock_t * lock);
8772 -extern int cond_resched_softirq(void);
8773 -static inline int cond_resched_bkl(void)
8774 -{
8775 -       return _cond_resched();
8776 -}
8777 -
8778 -/*
8779 - * Does a critical section need to be broken due to another
8780 - * task waiting?: (technically does not depend on CONFIG_PREEMPT,
8781 - * but a general need for low latency)
8782 - */
8783 -static inline int spin_needbreak(spinlock_t *lock)
8784 -{
8785 -#ifdef CONFIG_PREEMPT
8786 -       return spin_is_contended(lock);
8787 -#else
8788 -       return 0;
8789 -#endif
8790 -}
8791 -
8792 -/*
8793 - * Reevaluate whether the task has signals pending delivery.
8794 - * Wake the task if so.
8795 - * This is required every time the blocked sigset_t changes.
8796 - * callers must hold sighand->siglock.
8797 - */
8798 -extern void recalc_sigpending_and_wake(struct task_struct *t);
8799 -extern void recalc_sigpending(void);
8800 -
8801 -extern void signal_wake_up(struct task_struct *t, int resume_stopped);
8802 -
8803 -/*
8804 - * Wrappers for p->thread_info->cpu access. No-op on UP.
8805 - */
8806 -#ifdef CONFIG_SMP
8807 -
8808 -static inline unsigned int task_cpu(const struct task_struct *p)
8809 -{
8810 -       return task_thread_info(p)->cpu;
8811 -}
8812 -
8813 -extern void set_task_cpu(struct task_struct *p, unsigned int cpu);
8814 -
8815 -#else
8816 -
8817 -static inline unsigned int task_cpu(const struct task_struct *p)
8818 -{
8819 -       return 0;
8820 -}
8821 -
8822 -static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
8823 -{
8824 -}
8825 -
8826 -#endif /* CONFIG_SMP */
8827 -
8828 -extern void arch_pick_mmap_layout(struct mm_struct *mm);
8829 -
8830 -#ifdef CONFIG_TRACING
8831 -extern void
8832 -__trace_special(void *__tr, void *__data,
8833 -               unsigned long arg1, unsigned long arg2, unsigned long arg3);
8834 -#else
8835 -static inline void
8836 -__trace_special(void *__tr, void *__data,
8837 -               unsigned long arg1, unsigned long arg2, unsigned long arg3)
8838 -{
8839 -}
8840 -#endif
8841 -
8842 -extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask);
8843 -extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
8844 -
8845 -extern int sched_mc_power_savings, sched_smt_power_savings;
8846 -
8847 -extern void normalize_rt_tasks(void);
8848 -
8849 -#ifdef CONFIG_GROUP_SCHED
8850 -
8851 -extern struct task_group init_task_group;
8852 -#ifdef CONFIG_USER_SCHED
8853 -extern struct task_group root_task_group;
8854 -#endif
8855 -
8856 -extern struct task_group *sched_create_group(struct task_group *parent);
8857 -extern void sched_destroy_group(struct task_group *tg);
8858 -extern void sched_move_task(struct task_struct *tsk);
8859 -#ifdef CONFIG_FAIR_GROUP_SCHED
8860 -extern int sched_group_set_shares(struct task_group *tg, unsigned long shares);
8861 -extern unsigned long sched_group_shares(struct task_group *tg);
8862 -#endif
8863 -#ifdef CONFIG_RT_GROUP_SCHED
8864 -extern int sched_group_set_rt_runtime(struct task_group *tg,
8865 -                                     long rt_runtime_us);
8866 -extern long sched_group_rt_runtime(struct task_group *tg);
8867 -extern int sched_group_set_rt_period(struct task_group *tg,
8868 -                                     long rt_period_us);
8869 -extern long sched_group_rt_period(struct task_group *tg);
8870 -#endif
8871 -#endif
8872 -
8873 -#ifdef CONFIG_TASK_XACCT
8874 -static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
8875 -{
8876 -       tsk->ioac.rchar += amt;
8877 -}
8878 -
8879 -static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
8880 -{
8881 -       tsk->ioac.wchar += amt;
8882 -}
8883 -
8884 -static inline void inc_syscr(struct task_struct *tsk)
8885 -{
8886 -       tsk->ioac.syscr++;
8887 -}
8888 -
8889 -static inline void inc_syscw(struct task_struct *tsk)
8890 -{
8891 -       tsk->ioac.syscw++;
8892 -}
8893 -#else
8894 -static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
8895 -{
8896 -}
8897 -
8898 -static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
8899 -{
8900 -}
8901 -
8902 -static inline void inc_syscr(struct task_struct *tsk)
8903 -{
8904 -}
8905 -
8906 -static inline void inc_syscw(struct task_struct *tsk)
8907 -{
8908 -}
8909 -#endif
8910 -
8911 -#ifndef TASK_SIZE_OF
8912 -#define TASK_SIZE_OF(tsk)      TASK_SIZE
8913 -#endif
8914 -
8915 -#ifdef CONFIG_MM_OWNER
8916 -extern void mm_update_next_owner(struct mm_struct *mm);
8917 -extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
8918 -#else
8919 -static inline void mm_update_next_owner(struct mm_struct *mm)
8920 -{
8921 -}
8922 -
8923 -static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
8924 -{
8925 -}
8926 -#endif /* CONFIG_MM_OWNER */
8927 -
8928 -#define TASK_STATE_TO_CHAR_STR "RSDTtZX"
8929 -
8930 -#endif /* __KERNEL__ */
8931 -
8932 -#endif
8933 diff -Nurb linux-2.6.27-720/include/linux/seccomp.h linux-2.6.27-710/include/linux/seccomp.h
8934 --- linux-2.6.27-720/include/linux/seccomp.h    2009-05-04 12:18:34.000000000 -0400
8935 +++ linux-2.6.27-710/include/linux/seccomp.h    2008-10-09 18:13:53.000000000 -0400
8936 @@ -21,7 +21,7 @@
8937  
8938  #else /* CONFIG_SECCOMP */
8939  
8940 -typedef EMPTY_STRUCT_DECL(/* unnamed */) seccomp_t;
8941 +typedef struct { } seccomp_t;
8942  
8943  #define secure_computing(x) do { } while (0)
8944  
8945 diff -Nurb linux-2.6.27-720/include/linux/security.h linux-2.6.27-710/include/linux/security.h
8946 --- linux-2.6.27-720/include/linux/security.h   2009-05-04 12:18:34.000000000 -0400
8947 +++ linux-2.6.27-710/include/linux/security.h   2008-10-09 18:13:53.000000000 -0400
8948 @@ -2427,7 +2427,7 @@
8949  static inline struct dentry *securityfs_create_dir(const char *name,
8950                                         struct dentry *parent)
8951  {
8952 -       return (struct dentry *) ERR_PTR(-ENODEV);
8953 +       return ERR_PTR(-ENODEV);
8954  }
8955  
8956  static inline struct dentry *securityfs_create_file(const char *name,
8957 @@ -2436,7 +2436,7 @@
8958                                                 void *data,
8959                                                 const struct file_operations *fops)
8960  {
8961 -       return (struct dentry *) ERR_PTR(-ENODEV);
8962 +       return ERR_PTR(-ENODEV);
8963  }
8964  
8965  static inline void securityfs_remove(struct dentry *dentry)
8966 diff -Nurb linux-2.6.27-720/include/linux/semaphore.h linux-2.6.27-710/include/linux/semaphore.h
8967 --- linux-2.6.27-720/include/linux/semaphore.h  2009-05-04 12:18:34.000000000 -0400
8968 +++ linux-2.6.27-710/include/linux/semaphore.h  2008-10-09 18:13:53.000000000 -0400
8969 @@ -19,21 +19,12 @@
8970         struct list_head        wait_list;
8971  };
8972  
8973 -#ifdef __cplusplus
8974 -#define __SEMAPHORE_INITIALIZER(name, n)                               \
8975 -({ struct semaphore duh;                                                                       \
8976 -       duh.lock                = __SPIN_LOCK_UNLOCKED((name).lock),            \
8977 -       duh.count               = n,                                            \
8978 -       duh.wait_list   = LIST_HEAD_INIT((name).wait_list),             \
8979 -    duh;})
8980 -#else
8981  #define __SEMAPHORE_INITIALIZER(name, n)                               \
8982  {                                                                      \
8983         .lock           = __SPIN_LOCK_UNLOCKED((name).lock),            \
8984         .count          = n,                                            \
8985         .wait_list      = LIST_HEAD_INIT((name).wait_list),             \
8986  }
8987 -#endif
8988  
8989  #define DECLARE_MUTEX(name)    \
8990         struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
8991 diff -Nurb linux-2.6.27-720/include/linux/skbuff.h linux-2.6.27-710/include/linux/skbuff.h
8992 --- linux-2.6.27-720/include/linux/skbuff.h     2009-05-04 12:18:34.000000000 -0400
8993 +++ linux-2.6.27-710/include/linux/skbuff.h     2009-05-04 12:15:31.000000000 -0400
8994 @@ -194,12 +194,6 @@
8995  typedef unsigned char *sk_buff_data_t;
8996  #endif
8997  
8998 -/* Click: overload sk_buff.pkt_type to contain information about whether
8999 -   a packet is clean. Clean packets have the following fields zero:
9000 -   dst, destructor, pkt_bridged, prev, list, sk, security, priority. */
9001 -#define PACKET_CLEAN           128             /* Is packet clean? */
9002 -#define PACKET_TYPE_MASK       127             /* Actual packet type */
9003 -
9004  /** 
9005   *     struct sk_buff - socket buffer
9006   *     @next: Next buffer in list
9007 @@ -383,7 +377,6 @@
9008                                 gfp_t priority);
9009  extern struct sk_buff *pskb_copy(struct sk_buff *skb,
9010                                  gfp_t gfp_mask);
9011 -extern struct sk_buff *skb_recycle(struct sk_buff *skb);
9012  extern int            pskb_expand_head(struct sk_buff *skb,
9013                                         int nhead, int ntail,
9014                                         gfp_t gfp_mask);
9015 @@ -1333,7 +1326,7 @@
9016  }
9017  
9018  static inline int skb_add_data(struct sk_buff *skb,
9019 -                              unsigned char __user *from, int copy)
9020 +                              char __user *from, int copy)
9021  {
9022         const int off = skb->len;
9023  
9024 @@ -1409,7 +1402,7 @@
9025                                       const void *start, unsigned int len)
9026  {
9027         if (skb->ip_summed == CHECKSUM_COMPLETE)
9028 -               skb->csum = csum_sub(skb->csum, csum_partial((const unsigned char *) start, len, 0));
9029 +               skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
9030  }
9031  
9032  unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
9033 diff -Nurb linux-2.6.27-720/include/linux/skbuff.h.orig linux-2.6.27-710/include/linux/skbuff.h.orig
9034 --- linux-2.6.27-720/include/linux/skbuff.h.orig        2009-05-04 12:15:31.000000000 -0400
9035 +++ linux-2.6.27-710/include/linux/skbuff.h.orig        1969-12-31 19:00:00.000000000 -0500
9036 @@ -1,1730 +0,0 @@
9037 -/*
9038 - *     Definitions for the 'struct sk_buff' memory handlers.
9039 - *
9040 - *     Authors:
9041 - *             Alan Cox, <gw4pts@gw4pts.ampr.org>
9042 - *             Florian La Roche, <rzsfl@rz.uni-sb.de>
9043 - *
9044 - *     This program is free software; you can redistribute it and/or
9045 - *     modify it under the terms of the GNU General Public License
9046 - *     as published by the Free Software Foundation; either version
9047 - *     2 of the License, or (at your option) any later version.
9048 - */
9049 -
9050 -#ifndef _LINUX_SKBUFF_H
9051 -#define _LINUX_SKBUFF_H
9052 -
9053 -#include <linux/kernel.h>
9054 -#include <linux/compiler.h>
9055 -#include <linux/time.h>
9056 -#include <linux/cache.h>
9057 -
9058 -#include <asm/atomic.h>
9059 -#include <asm/types.h>
9060 -#include <linux/spinlock.h>
9061 -#include <linux/net.h>
9062 -#include <linux/textsearch.h>
9063 -#include <net/checksum.h>
9064 -#include <linux/rcupdate.h>
9065 -#include <linux/dmaengine.h>
9066 -#include <linux/hrtimer.h>
9067 -
9068 -#define HAVE_ALLOC_SKB         /* For the drivers to know */
9069 -#define HAVE_ALIGNABLE_SKB     /* Ditto 8)                */
9070 -
9071 -/* Don't change this without changing skb_csum_unnecessary! */
9072 -#define CHECKSUM_NONE 0
9073 -#define CHECKSUM_UNNECESSARY 1
9074 -#define CHECKSUM_COMPLETE 2
9075 -#define CHECKSUM_PARTIAL 3
9076 -
9077 -#define SKB_DATA_ALIGN(X)      (((X) + (SMP_CACHE_BYTES - 1)) & \
9078 -                                ~(SMP_CACHE_BYTES - 1))
9079 -#define SKB_WITH_OVERHEAD(X)   \
9080 -       ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
9081 -#define SKB_MAX_ORDER(X, ORDER) \
9082 -       SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X))
9083 -#define SKB_MAX_HEAD(X)                (SKB_MAX_ORDER((X), 0))
9084 -#define SKB_MAX_ALLOC          (SKB_MAX_ORDER(0, 2))
9085 -
9086 -/* A. Checksumming of received packets by device.
9087 - *
9088 - *     NONE: device failed to checksum this packet.
9089 - *             skb->csum is undefined.
9090 - *
9091 - *     UNNECESSARY: device parsed packet and wouldbe verified checksum.
9092 - *             skb->csum is undefined.
9093 - *           It is bad option, but, unfortunately, many of vendors do this.
9094 - *           Apparently with secret goal to sell you new device, when you
9095 - *           will add new protocol to your host. F.e. IPv6. 8)
9096 - *
9097 - *     COMPLETE: the most generic way. Device supplied checksum of _all_
9098 - *         the packet as seen by netif_rx in skb->csum.
9099 - *         NOTE: Even if device supports only some protocols, but
9100 - *         is able to produce some skb->csum, it MUST use COMPLETE,
9101 - *         not UNNECESSARY.
9102 - *
9103 - *     PARTIAL: identical to the case for output below.  This may occur
9104 - *         on a packet received directly from another Linux OS, e.g.,
9105 - *         a virtualised Linux kernel on the same host.  The packet can
9106 - *         be treated in the same way as UNNECESSARY except that on
9107 - *         output (i.e., forwarding) the checksum must be filled in
9108 - *         by the OS or the hardware.
9109 - *
9110 - * B. Checksumming on output.
9111 - *
9112 - *     NONE: skb is checksummed by protocol or csum is not required.
9113 - *
9114 - *     PARTIAL: device is required to csum packet as seen by hard_start_xmit
9115 - *     from skb->csum_start to the end and to record the checksum
9116 - *     at skb->csum_start + skb->csum_offset.
9117 - *
9118 - *     Device must show its capabilities in dev->features, set
9119 - *     at device setup time.
9120 - *     NETIF_F_HW_CSUM - it is clever device, it is able to checksum
9121 - *                       everything.
9122 - *     NETIF_F_NO_CSUM - loopback or reliable single hop media.
9123 - *     NETIF_F_IP_CSUM - device is dumb. It is able to csum only
9124 - *                       TCP/UDP over IPv4. Sigh. Vendors like this
9125 - *                       way by an unknown reason. Though, see comment above
9126 - *                       about CHECKSUM_UNNECESSARY. 8)
9127 - *     NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead.
9128 - *
9129 - *     Any questions? No questions, good.              --ANK
9130 - */
9131 -
9132 -struct net_device;
9133 -struct scatterlist;
9134 -struct pipe_inode_info;
9135 -
9136 -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
9137 -struct nf_conntrack {
9138 -       atomic_t use;
9139 -};
9140 -#endif
9141 -
9142 -#ifdef CONFIG_BRIDGE_NETFILTER
9143 -struct nf_bridge_info {
9144 -       atomic_t use;
9145 -       struct net_device *physindev;
9146 -       struct net_device *physoutdev;
9147 -       unsigned int mask;
9148 -       unsigned long data[32 / sizeof(unsigned long)];
9149 -};
9150 -#endif
9151 -
9152 -struct sk_buff_head {
9153 -       /* These two members must be first. */
9154 -       struct sk_buff  *next;
9155 -       struct sk_buff  *prev;
9156 -
9157 -       __u32           qlen;
9158 -       spinlock_t      lock;
9159 -};
9160 -
9161 -struct sk_buff;
9162 -
9163 -/* To allow 64K frame to be packed as single skb without frag_list */
9164 -#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2)
9165 -
9166 -typedef struct skb_frag_struct skb_frag_t;
9167 -
9168 -struct skb_frag_struct {
9169 -       struct page *page;
9170 -       __u32 page_offset;
9171 -       __u32 size;
9172 -};
9173 -
9174 -/* This data is invariant across clones and lives at
9175 - * the end of the header data, ie. at skb->end.
9176 - */
9177 -struct skb_shared_info {
9178 -       atomic_t        dataref;
9179 -       unsigned short  nr_frags;
9180 -       unsigned short  gso_size;
9181 -       /* Warning: this field is not always filled in (UFO)! */
9182 -       unsigned short  gso_segs;
9183 -       unsigned short  gso_type;
9184 -       __be32          ip6_frag_id;
9185 -       struct sk_buff  *frag_list;
9186 -       skb_frag_t      frags[MAX_SKB_FRAGS];
9187 -};
9188 -
9189 -/* We divide dataref into two halves.  The higher 16 bits hold references
9190 - * to the payload part of skb->data.  The lower 16 bits hold references to
9191 - * the entire skb->data.  A clone of a headerless skb holds the length of
9192 - * the header in skb->hdr_len.
9193 - *
9194 - * All users must obey the rule that the skb->data reference count must be
9195 - * greater than or equal to the payload reference count.
9196 - *
9197 - * Holding a reference to the payload part means that the user does not
9198 - * care about modifications to the header part of skb->data.
9199 - */
9200 -#define SKB_DATAREF_SHIFT 16
9201 -#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
9202 -
9203 -
9204 -enum {
9205 -       SKB_FCLONE_UNAVAILABLE,
9206 -       SKB_FCLONE_ORIG,
9207 -       SKB_FCLONE_CLONE,
9208 -};
9209 -
9210 -enum {
9211 -       SKB_GSO_TCPV4 = 1 << 0,
9212 -       SKB_GSO_UDP = 1 << 1,
9213 -
9214 -       /* This indicates the skb is from an untrusted source. */
9215 -       SKB_GSO_DODGY = 1 << 2,
9216 -
9217 -       /* This indicates the tcp segment has CWR set. */
9218 -       SKB_GSO_TCP_ECN = 1 << 3,
9219 -
9220 -       SKB_GSO_TCPV6 = 1 << 4,
9221 -};
9222 -
9223 -#if BITS_PER_LONG > 32
9224 -#define NET_SKBUFF_DATA_USES_OFFSET 1
9225 -#endif
9226 -
9227 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
9228 -typedef unsigned int sk_buff_data_t;
9229 -#else
9230 -typedef unsigned char *sk_buff_data_t;
9231 -#endif
9232 -
9233 -/** 
9234 - *     struct sk_buff - socket buffer
9235 - *     @next: Next buffer in list
9236 - *     @prev: Previous buffer in list
9237 - *     @sk: Socket we are owned by
9238 - *     @tstamp: Time we arrived
9239 - *     @dev: Device we arrived on/are leaving by
9240 - *     @transport_header: Transport layer header
9241 - *     @network_header: Network layer header
9242 - *     @mac_header: Link layer header
9243 - *     @dst: destination entry
9244 - *     @sp: the security path, used for xfrm
9245 - *     @cb: Control buffer. Free for use by every layer. Put private vars here
9246 - *     @len: Length of actual data
9247 - *     @data_len: Data length
9248 - *     @mac_len: Length of link layer header
9249 - *     @hdr_len: writable header length of cloned skb
9250 - *     @csum: Checksum (must include start/offset pair)
9251 - *     @csum_start: Offset from skb->head where checksumming should start
9252 - *     @csum_offset: Offset from csum_start where checksum should be stored
9253 - *     @local_df: allow local fragmentation
9254 - *     @cloned: Head may be cloned (check refcnt to be sure)
9255 - *     @nohdr: Payload reference only, must not modify header
9256 - *     @pkt_type: Packet class
9257 - *     @fclone: skbuff clone status
9258 - *     @ip_summed: Driver fed us an IP checksum
9259 - *     @priority: Packet queueing priority
9260 - *     @users: User count - see {datagram,tcp}.c
9261 - *     @protocol: Packet protocol from driver
9262 - *     @truesize: Buffer size 
9263 - *     @head: Head of buffer
9264 - *     @data: Data head pointer
9265 - *     @tail: Tail pointer
9266 - *     @end: End pointer
9267 - *     @destructor: Destruct function
9268 - *     @mark: Generic packet mark
9269 - *     @nfct: Associated connection, if any
9270 - *     @ipvs_property: skbuff is owned by ipvs
9271 - *     @peeked: this packet has been seen already, so stats have been
9272 - *             done for it, don't do them again
9273 - *     @nf_trace: netfilter packet trace flag
9274 - *     @nfctinfo: Relationship of this skb to the connection
9275 - *     @nfct_reasm: netfilter conntrack re-assembly pointer
9276 - *     @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
9277 - *     @iif: ifindex of device we arrived on
9278 - *     @queue_mapping: Queue mapping for multiqueue devices
9279 - *     @tc_index: Traffic control index
9280 - *     @tc_verd: traffic control verdict
9281 - *     @ndisc_nodetype: router type (from link layer)
9282 - *     @do_not_encrypt: set to prevent encryption of this frame
9283 - *     @dma_cookie: a cookie to one of several possible DMA operations
9284 - *             done by skb DMA functions
9285 - *     @secmark: security marking
9286 - *     @vlan_tci: vlan tag control information
9287 - */
9288 -
9289 -struct sk_buff {
9290 -       /* These two members must be first. */
9291 -       struct sk_buff          *next;
9292 -       struct sk_buff          *prev;
9293 -
9294 -       struct sock             *sk;
9295 -       ktime_t                 tstamp;
9296 -       struct net_device       *dev;
9297 -
9298 -       union {
9299 -               struct  dst_entry       *dst;
9300 -               struct  rtable          *rtable;
9301 -       };
9302 -       struct  sec_path        *sp;
9303 -
9304 -       /*
9305 -        * This is the control buffer. It is free to use for every
9306 -        * layer. Please put your private variables there. If you
9307 -        * want to keep them across layers you have to do a skb_clone()
9308 -        * first. This is owned by whoever has the skb queued ATM.
9309 -        */
9310 -       char                    cb[48];
9311 -
9312 -       unsigned int            len,
9313 -                               data_len;
9314 -       __u16                   mac_len,
9315 -                               hdr_len;
9316 -       union {
9317 -               __wsum          csum;
9318 -               struct {
9319 -                       __u16   csum_start;
9320 -                       __u16   csum_offset;
9321 -               };
9322 -       };
9323 -       __u32                   priority;
9324 -       __u8                    local_df:1,
9325 -                               cloned:1,
9326 -                               ip_summed:2,
9327 -                               nohdr:1,
9328 -                               nfctinfo:3;
9329 -       __u8                    pkt_type:3,
9330 -                               fclone:2,
9331 -                               ipvs_property:1,
9332 -                               peeked:1,
9333 -                               nf_trace:1;
9334 -       __be16                  protocol;
9335 -
9336 -       void                    (*destructor)(struct sk_buff *skb);
9337 -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
9338 -       struct nf_conntrack     *nfct;
9339 -       struct sk_buff          *nfct_reasm;
9340 -#endif
9341 -#ifdef CONFIG_BRIDGE_NETFILTER
9342 -       struct nf_bridge_info   *nf_bridge;
9343 -#endif
9344 -
9345 -       int                     iif;
9346 -       __u16                   queue_mapping;
9347 -#ifdef CONFIG_NET_SCHED
9348 -       __u16                   tc_index;       /* traffic control index */
9349 -#ifdef CONFIG_NET_CLS_ACT
9350 -       __u16                   tc_verd;        /* traffic control verdict */
9351 -#endif
9352 -#endif
9353 -#ifdef CONFIG_IPV6_NDISC_NODETYPE
9354 -       __u8                    ndisc_nodetype:2;
9355 -#endif
9356 -#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
9357 -       __u8                    do_not_encrypt:1;
9358 -#endif
9359 -       /* 0/13/14 bit hole */
9360 -
9361 -#ifdef CONFIG_NET_DMA
9362 -       dma_cookie_t            dma_cookie;
9363 -#endif
9364 -#ifdef CONFIG_NETWORK_SECMARK
9365 -       __u32                   secmark;
9366 -#endif
9367 -
9368 -       __u32                   mark;
9369 -#define skb_tag                        mark
9370 -
9371 -       __u16                   vlan_tci;
9372 -
9373 -       sk_buff_data_t          transport_header;
9374 -       sk_buff_data_t          network_header;
9375 -       sk_buff_data_t          mac_header;
9376 -       /* These elements must be at the end, see alloc_skb() for details.  */
9377 -       sk_buff_data_t          tail;
9378 -       sk_buff_data_t          end;
9379 -       unsigned char           *head,
9380 -                               *data;
9381 -       unsigned int            truesize;
9382 -       atomic_t                users;
9383 -};
9384 -
9385 -#ifdef __KERNEL__
9386 -/*
9387 - *     Handling routines are only of interest to the kernel
9388 - */
9389 -#include <linux/slab.h>
9390 -
9391 -#include <asm/system.h>
9392 -
9393 -extern void kfree_skb(struct sk_buff *skb);
9394 -extern void           __kfree_skb(struct sk_buff *skb);
9395 -extern struct sk_buff *__alloc_skb(unsigned int size,
9396 -                                  gfp_t priority, int fclone, int node);
9397 -static inline struct sk_buff *alloc_skb(unsigned int size,
9398 -                                       gfp_t priority)
9399 -{
9400 -       return __alloc_skb(size, priority, 0, -1);
9401 -}
9402 -
9403 -static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
9404 -                                              gfp_t priority)
9405 -{
9406 -       return __alloc_skb(size, priority, 1, -1);
9407 -}
9408 -
9409 -extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
9410 -extern struct sk_buff *skb_clone(struct sk_buff *skb,
9411 -                                gfp_t priority);
9412 -extern struct sk_buff *skb_copy(const struct sk_buff *skb,
9413 -                               gfp_t priority);
9414 -extern struct sk_buff *pskb_copy(struct sk_buff *skb,
9415 -                                gfp_t gfp_mask);
9416 -extern int            pskb_expand_head(struct sk_buff *skb,
9417 -                                       int nhead, int ntail,
9418 -                                       gfp_t gfp_mask);
9419 -extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
9420 -                                           unsigned int headroom);
9421 -extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
9422 -                                      int newheadroom, int newtailroom,
9423 -                                      gfp_t priority);
9424 -extern int            skb_to_sgvec(struct sk_buff *skb,
9425 -                                   struct scatterlist *sg, int offset,
9426 -                                   int len);
9427 -extern int            skb_cow_data(struct sk_buff *skb, int tailbits,
9428 -                                   struct sk_buff **trailer);
9429 -extern int            skb_pad(struct sk_buff *skb, int pad);
9430 -#define dev_kfree_skb(a)       kfree_skb(a)
9431 -extern void          skb_over_panic(struct sk_buff *skb, int len,
9432 -                                    void *here);
9433 -extern void          skb_under_panic(struct sk_buff *skb, int len,
9434 -                                     void *here);
9435 -extern void          skb_truesize_bug(struct sk_buff *skb);
9436 -
9437 -static inline void skb_truesize_check(struct sk_buff *skb)
9438 -{
9439 -       int len = sizeof(struct sk_buff) + skb->len;
9440 -
9441 -       if (unlikely((int)skb->truesize < len))
9442 -               skb_truesize_bug(skb);
9443 -}
9444 -
9445 -extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
9446 -                       int getfrag(void *from, char *to, int offset,
9447 -                       int len,int odd, struct sk_buff *skb),
9448 -                       void *from, int length);
9449 -
9450 -struct skb_seq_state
9451 -{
9452 -       __u32           lower_offset;
9453 -       __u32           upper_offset;
9454 -       __u32           frag_idx;
9455 -       __u32           stepped_offset;
9456 -       struct sk_buff  *root_skb;
9457 -       struct sk_buff  *cur_skb;
9458 -       __u8            *frag_data;
9459 -};
9460 -
9461 -extern void          skb_prepare_seq_read(struct sk_buff *skb,
9462 -                                          unsigned int from, unsigned int to,
9463 -                                          struct skb_seq_state *st);
9464 -extern unsigned int   skb_seq_read(unsigned int consumed, const u8 **data,
9465 -                                  struct skb_seq_state *st);
9466 -extern void          skb_abort_seq_read(struct skb_seq_state *st);
9467 -
9468 -extern unsigned int   skb_find_text(struct sk_buff *skb, unsigned int from,
9469 -                                   unsigned int to, struct ts_config *config,
9470 -                                   struct ts_state *state);
9471 -
9472 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
9473 -static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
9474 -{
9475 -       return skb->head + skb->end;
9476 -}
9477 -#else
9478 -static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
9479 -{
9480 -       return skb->end;
9481 -}
9482 -#endif
9483 -
9484 -/* Internal */
9485 -#define skb_shinfo(SKB)        ((struct skb_shared_info *)(skb_end_pointer(SKB)))
9486 -
9487 -/**
9488 - *     skb_queue_empty - check if a queue is empty
9489 - *     @list: queue head
9490 - *
9491 - *     Returns true if the queue is empty, false otherwise.
9492 - */
9493 -static inline int skb_queue_empty(const struct sk_buff_head *list)
9494 -{
9495 -       return list->next == (struct sk_buff *)list;
9496 -}
9497 -
9498 -/**
9499 - *     skb_get - reference buffer
9500 - *     @skb: buffer to reference
9501 - *
9502 - *     Makes another reference to a socket buffer and returns a pointer
9503 - *     to the buffer.
9504 - */
9505 -static inline struct sk_buff *skb_get(struct sk_buff *skb)
9506 -{
9507 -       atomic_inc(&skb->users);
9508 -       return skb;
9509 -}
9510 -
9511 -/*
9512 - * If users == 1, we are the only owner and are can avoid redundant
9513 - * atomic change.
9514 - */
9515 -
9516 -/**
9517 - *     skb_cloned - is the buffer a clone
9518 - *     @skb: buffer to check
9519 - *
9520 - *     Returns true if the buffer was generated with skb_clone() and is
9521 - *     one of multiple shared copies of the buffer. Cloned buffers are
9522 - *     shared data so must not be written to under normal circumstances.
9523 - */
9524 -static inline int skb_cloned(const struct sk_buff *skb)
9525 -{
9526 -       return skb->cloned &&
9527 -              (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1;
9528 -}
9529 -
9530 -/**
9531 - *     skb_header_cloned - is the header a clone
9532 - *     @skb: buffer to check
9533 - *
9534 - *     Returns true if modifying the header part of the buffer requires
9535 - *     the data to be copied.
9536 - */
9537 -static inline int skb_header_cloned(const struct sk_buff *skb)
9538 -{
9539 -       int dataref;
9540 -
9541 -       if (!skb->cloned)
9542 -               return 0;
9543 -
9544 -       dataref = atomic_read(&skb_shinfo(skb)->dataref);
9545 -       dataref = (dataref & SKB_DATAREF_MASK) - (dataref >> SKB_DATAREF_SHIFT);
9546 -       return dataref != 1;
9547 -}
9548 -
9549 -/**
9550 - *     skb_header_release - release reference to header
9551 - *     @skb: buffer to operate on
9552 - *
9553 - *     Drop a reference to the header part of the buffer.  This is done
9554 - *     by acquiring a payload reference.  You must not read from the header
9555 - *     part of skb->data after this.
9556 - */
9557 -static inline void skb_header_release(struct sk_buff *skb)
9558 -{
9559 -       BUG_ON(skb->nohdr);
9560 -       skb->nohdr = 1;
9561 -       atomic_add(1 << SKB_DATAREF_SHIFT, &skb_shinfo(skb)->dataref);
9562 -}
9563 -
9564 -/**
9565 - *     skb_shared - is the buffer shared
9566 - *     @skb: buffer to check
9567 - *
9568 - *     Returns true if more than one person has a reference to this
9569 - *     buffer.
9570 - */
9571 -static inline int skb_shared(const struct sk_buff *skb)
9572 -{
9573 -       return atomic_read(&skb->users) != 1;
9574 -}
9575 -
9576 -/**
9577 - *     skb_share_check - check if buffer is shared and if so clone it
9578 - *     @skb: buffer to check
9579 - *     @pri: priority for memory allocation
9580 - *
9581 - *     If the buffer is shared the buffer is cloned and the old copy
9582 - *     drops a reference. A new clone with a single reference is returned.
9583 - *     If the buffer is not shared the original buffer is returned. When
9584 - *     being called from interrupt status or with spinlocks held pri must
9585 - *     be GFP_ATOMIC.
9586 - *
9587 - *     NULL is returned on a memory allocation failure.
9588 - */
9589 -static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
9590 -                                             gfp_t pri)
9591 -{
9592 -       might_sleep_if(pri & __GFP_WAIT);
9593 -       if (skb_shared(skb)) {
9594 -               struct sk_buff *nskb = skb_clone(skb, pri);
9595 -               kfree_skb(skb);
9596 -               skb = nskb;
9597 -       }
9598 -       return skb;
9599 -}
9600 -
9601 -/*
9602 - *     Copy shared buffers into a new sk_buff. We effectively do COW on
9603 - *     packets to handle cases where we have a local reader and forward
9604 - *     and a couple of other messy ones. The normal one is tcpdumping
9605 - *     a packet thats being forwarded.
9606 - */
9607 -
9608 -/**
9609 - *     skb_unshare - make a copy of a shared buffer
9610 - *     @skb: buffer to check
9611 - *     @pri: priority for memory allocation
9612 - *
9613 - *     If the socket buffer is a clone then this function creates a new
9614 - *     copy of the data, drops a reference count on the old copy and returns
9615 - *     the new copy with the reference count at 1. If the buffer is not a clone
9616 - *     the original buffer is returned. When called with a spinlock held or
9617 - *     from interrupt state @pri must be %GFP_ATOMIC
9618 - *
9619 - *     %NULL is returned on a memory allocation failure.
9620 - */
9621 -static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
9622 -                                         gfp_t pri)
9623 -{
9624 -       might_sleep_if(pri & __GFP_WAIT);
9625 -       if (skb_cloned(skb)) {
9626 -               struct sk_buff *nskb = skb_copy(skb, pri);
9627 -               kfree_skb(skb); /* Free our shared copy */
9628 -               skb = nskb;
9629 -       }
9630 -       return skb;
9631 -}
9632 -
9633 -/**
9634 - *     skb_peek
9635 - *     @list_: list to peek at
9636 - *
9637 - *     Peek an &sk_buff. Unlike most other operations you _MUST_
9638 - *     be careful with this one. A peek leaves the buffer on the
9639 - *     list and someone else may run off with it. You must hold
9640 - *     the appropriate locks or have a private queue to do this.
9641 - *
9642 - *     Returns %NULL for an empty list or a pointer to the head element.
9643 - *     The reference count is not incremented and the reference is therefore
9644 - *     volatile. Use with caution.
9645 - */
9646 -static inline struct sk_buff *skb_peek(struct sk_buff_head *list_)
9647 -{
9648 -       struct sk_buff *list = ((struct sk_buff *)list_)->next;
9649 -       if (list == (struct sk_buff *)list_)
9650 -               list = NULL;
9651 -       return list;
9652 -}
9653 -
9654 -/**
9655 - *     skb_peek_tail
9656 - *     @list_: list to peek at
9657 - *
9658 - *     Peek an &sk_buff. Unlike most other operations you _MUST_
9659 - *     be careful with this one. A peek leaves the buffer on the
9660 - *     list and someone else may run off with it. You must hold
9661 - *     the appropriate locks or have a private queue to do this.
9662 - *
9663 - *     Returns %NULL for an empty list or a pointer to the tail element.
9664 - *     The reference count is not incremented and the reference is therefore
9665 - *     volatile. Use with caution.
9666 - */
9667 -static inline struct sk_buff *skb_peek_tail(struct sk_buff_head *list_)
9668 -{
9669 -       struct sk_buff *list = ((struct sk_buff *)list_)->prev;
9670 -       if (list == (struct sk_buff *)list_)
9671 -               list = NULL;
9672 -       return list;
9673 -}
9674 -
9675 -/**
9676 - *     skb_queue_len   - get queue length
9677 - *     @list_: list to measure
9678 - *
9679 - *     Return the length of an &sk_buff queue.
9680 - */
9681 -static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
9682 -{
9683 -       return list_->qlen;
9684 -}
9685 -
9686 -/*
9687 - * This function creates a split out lock class for each invocation;
9688 - * this is needed for now since a whole lot of users of the skb-queue
9689 - * infrastructure in drivers have different locking usage (in hardirq)
9690 - * than the networking core (in softirq only). In the long run either the
9691 - * network layer or drivers should need annotation to consolidate the
9692 - * main types of usage into 3 classes.
9693 - */
9694 -static inline void skb_queue_head_init(struct sk_buff_head *list)
9695 -{
9696 -       spin_lock_init(&list->lock);
9697 -       list->prev = list->next = (struct sk_buff *)list;
9698 -       list->qlen = 0;
9699 -}
9700 -
9701 -static inline void skb_queue_head_init_class(struct sk_buff_head *list,
9702 -               struct lock_class_key *class)
9703 -{
9704 -       skb_queue_head_init(list);
9705 -       lockdep_set_class(&list->lock, class);
9706 -}
9707 -
9708 -/*
9709 - *     Insert an sk_buff on a list.
9710 - *
9711 - *     The "__skb_xxxx()" functions are the non-atomic ones that
9712 - *     can only be called with interrupts disabled.
9713 - */
9714 -extern void        skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
9715 -static inline void __skb_insert(struct sk_buff *newsk,
9716 -                               struct sk_buff *prev, struct sk_buff *next,
9717 -                               struct sk_buff_head *list)
9718 -{
9719 -       newsk->next = next;
9720 -       newsk->prev = prev;
9721 -       next->prev  = prev->next = newsk;
9722 -       list->qlen++;
9723 -}
9724 -
9725 -/**
9726 - *     __skb_queue_after - queue a buffer at the list head
9727 - *     @list: list to use
9728 - *     @prev: place after this buffer
9729 - *     @newsk: buffer to queue
9730 - *
9731 - *     Queue a buffer int the middle of a list. This function takes no locks
9732 - *     and you must therefore hold required locks before calling it.
9733 - *
9734 - *     A buffer cannot be placed on two lists at the same time.
9735 - */
9736 -static inline void __skb_queue_after(struct sk_buff_head *list,
9737 -                                    struct sk_buff *prev,
9738 -                                    struct sk_buff *newsk)
9739 -{
9740 -       __skb_insert(newsk, prev, prev->next, list);
9741 -}
9742 -
9743 -extern void skb_append(struct sk_buff *old, struct sk_buff *newsk,
9744 -                      struct sk_buff_head *list);
9745 -
9746 -static inline void __skb_queue_before(struct sk_buff_head *list,
9747 -                                     struct sk_buff *next,
9748 -                                     struct sk_buff *newsk)
9749 -{
9750 -       __skb_insert(newsk, next->prev, next, list);
9751 -}
9752 -
9753 -/**
9754 - *     __skb_queue_head - queue a buffer at the list head
9755 - *     @list: list to use
9756 - *     @newsk: buffer to queue
9757 - *
9758 - *     Queue a buffer at the start of a list. This function takes no locks
9759 - *     and you must therefore hold required locks before calling it.
9760 - *
9761 - *     A buffer cannot be placed on two lists at the same time.
9762 - */
9763 -extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk);
9764 -static inline void __skb_queue_head(struct sk_buff_head *list,
9765 -                                   struct sk_buff *newsk)
9766 -{
9767 -       __skb_queue_after(list, (struct sk_buff *)list, newsk);
9768 -}
9769 -
9770 -/**
9771 - *     __skb_queue_tail - queue a buffer at the list tail
9772 - *     @list: list to use
9773 - *     @newsk: buffer to queue
9774 - *
9775 - *     Queue a buffer at the end of a list. This function takes no locks
9776 - *     and you must therefore hold required locks before calling it.
9777 - *
9778 - *     A buffer cannot be placed on two lists at the same time.
9779 - */
9780 -extern void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk);
9781 -static inline void __skb_queue_tail(struct sk_buff_head *list,
9782 -                                  struct sk_buff *newsk)
9783 -{
9784 -       __skb_queue_before(list, (struct sk_buff *)list, newsk);
9785 -}
9786 -
9787 -/*
9788 - * remove sk_buff from list. _Must_ be called atomically, and with
9789 - * the list known..
9790 - */
9791 -extern void       skb_unlink(struct sk_buff *skb, struct sk_buff_head *list);
9792 -static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
9793 -{
9794 -       struct sk_buff *next, *prev;
9795 -
9796 -       list->qlen--;
9797 -       next       = skb->next;
9798 -       prev       = skb->prev;
9799 -       skb->next  = skb->prev = NULL;
9800 -       next->prev = prev;
9801 -       prev->next = next;
9802 -}
9803 -
9804 -/**
9805 - *     __skb_dequeue - remove from the head of the queue
9806 - *     @list: list to dequeue from
9807 - *
9808 - *     Remove the head of the list. This function does not take any locks
9809 - *     so must be used with appropriate locks held only. The head item is
9810 - *     returned or %NULL if the list is empty.
9811 - */
9812 -extern struct sk_buff *skb_dequeue(struct sk_buff_head *list);
9813 -static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
9814 -{
9815 -       struct sk_buff *skb = skb_peek(list);
9816 -       if (skb)
9817 -               __skb_unlink(skb, list);
9818 -       return skb;
9819 -}
9820 -
9821 -/**
9822 - *     __skb_dequeue_tail - remove from the tail of the queue
9823 - *     @list: list to dequeue from
9824 - *
9825 - *     Remove the tail of the list. This function does not take any locks
9826 - *     so must be used with appropriate locks held only. The tail item is
9827 - *     returned or %NULL if the list is empty.
9828 - */
9829 -extern struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list);
9830 -static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list)
9831 -{
9832 -       struct sk_buff *skb = skb_peek_tail(list);
9833 -       if (skb)
9834 -               __skb_unlink(skb, list);
9835 -       return skb;
9836 -}
9837 -
9838 -
9839 -static inline int skb_is_nonlinear(const struct sk_buff *skb)
9840 -{
9841 -       return skb->data_len;
9842 -}
9843 -
9844 -static inline unsigned int skb_headlen(const struct sk_buff *skb)
9845 -{
9846 -       return skb->len - skb->data_len;
9847 -}
9848 -
9849 -static inline int skb_pagelen(const struct sk_buff *skb)
9850 -{
9851 -       int i, len = 0;
9852 -
9853 -       for (i = (int)skb_shinfo(skb)->nr_frags - 1; i >= 0; i--)
9854 -               len += skb_shinfo(skb)->frags[i].size;
9855 -       return len + skb_headlen(skb);
9856 -}
9857 -
9858 -static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
9859 -                                     struct page *page, int off, int size)
9860 -{
9861 -       skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
9862 -
9863 -       frag->page                = page;
9864 -       frag->page_offset         = off;
9865 -       frag->size                = size;
9866 -       skb_shinfo(skb)->nr_frags = i + 1;
9867 -}
9868 -
9869 -#define SKB_PAGE_ASSERT(skb)   BUG_ON(skb_shinfo(skb)->nr_frags)
9870 -#define SKB_FRAG_ASSERT(skb)   BUG_ON(skb_shinfo(skb)->frag_list)
9871 -#define SKB_LINEAR_ASSERT(skb)  BUG_ON(skb_is_nonlinear(skb))
9872 -
9873 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
9874 -static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
9875 -{
9876 -       return skb->head + skb->tail;
9877 -}
9878 -
9879 -static inline void skb_reset_tail_pointer(struct sk_buff *skb)
9880 -{
9881 -       skb->tail = skb->data - skb->head;
9882 -}
9883 -
9884 -static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
9885 -{
9886 -       skb_reset_tail_pointer(skb);
9887 -       skb->tail += offset;
9888 -}
9889 -#else /* NET_SKBUFF_DATA_USES_OFFSET */
9890 -static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
9891 -{
9892 -       return skb->tail;
9893 -}
9894 -
9895 -static inline void skb_reset_tail_pointer(struct sk_buff *skb)
9896 -{
9897 -       skb->tail = skb->data;
9898 -}
9899 -
9900 -static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
9901 -{
9902 -       skb->tail = skb->data + offset;
9903 -}
9904 -
9905 -#endif /* NET_SKBUFF_DATA_USES_OFFSET */
9906 -
9907 -/*
9908 - *     Add data to an sk_buff
9909 - */
9910 -extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
9911 -static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
9912 -{
9913 -       unsigned char *tmp = skb_tail_pointer(skb);
9914 -       SKB_LINEAR_ASSERT(skb);
9915 -       skb->tail += len;
9916 -       skb->len  += len;
9917 -       return tmp;
9918 -}
9919 -
9920 -extern unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
9921 -static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
9922 -{
9923 -       skb->data -= len;
9924 -       skb->len  += len;
9925 -       return skb->data;
9926 -}
9927 -
9928 -extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
9929 -static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
9930 -{
9931 -       skb->len -= len;
9932 -       BUG_ON(skb->len < skb->data_len);
9933 -       return skb->data += len;
9934 -}
9935 -
9936 -extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
9937 -
9938 -static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
9939 -{
9940 -       if (len > skb_headlen(skb) &&
9941 -           !__pskb_pull_tail(skb, len - skb_headlen(skb)))
9942 -               return NULL;
9943 -       skb->len -= len;
9944 -       return skb->data += len;
9945 -}
9946 -
9947 -static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len)
9948 -{
9949 -       return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len);
9950 -}
9951 -
9952 -static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
9953 -{
9954 -       if (likely(len <= skb_headlen(skb)))
9955 -               return 1;
9956 -       if (unlikely(len > skb->len))
9957 -               return 0;
9958 -       return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL;
9959 -}
9960 -
9961 -/**
9962 - *     skb_headroom - bytes at buffer head
9963 - *     @skb: buffer to check
9964 - *
9965 - *     Return the number of bytes of free space at the head of an &sk_buff.
9966 - */
9967 -static inline unsigned int skb_headroom(const struct sk_buff *skb)
9968 -{
9969 -       return skb->data - skb->head;
9970 -}
9971 -
9972 -/**
9973 - *     skb_tailroom - bytes at buffer end
9974 - *     @skb: buffer to check
9975 - *
9976 - *     Return the number of bytes of free space at the tail of an sk_buff
9977 - */
9978 -static inline int skb_tailroom(const struct sk_buff *skb)
9979 -{
9980 -       return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail;
9981 -}
9982 -
9983 -/**
9984 - *     skb_reserve - adjust headroom
9985 - *     @skb: buffer to alter
9986 - *     @len: bytes to move
9987 - *
9988 - *     Increase the headroom of an empty &sk_buff by reducing the tail
9989 - *     room. This is only allowed for an empty buffer.
9990 - */
9991 -static inline void skb_reserve(struct sk_buff *skb, int len)
9992 -{
9993 -       skb->data += len;
9994 -       skb->tail += len;
9995 -}
9996 -
9997 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
9998 -static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
9999 -{
10000 -       return skb->head + skb->transport_header;
10001 -}
10002 -
10003 -static inline void skb_reset_transport_header(struct sk_buff *skb)
10004 -{
10005 -       skb->transport_header = skb->data - skb->head;
10006 -}
10007 -
10008 -static inline void skb_set_transport_header(struct sk_buff *skb,
10009 -                                           const int offset)
10010 -{
10011 -       skb_reset_transport_header(skb);
10012 -       skb->transport_header += offset;
10013 -}
10014 -
10015 -static inline unsigned char *skb_network_header(const struct sk_buff *skb)
10016 -{
10017 -       return skb->head + skb->network_header;
10018 -}
10019 -
10020 -static inline void skb_reset_network_header(struct sk_buff *skb)
10021 -{
10022 -       skb->network_header = skb->data - skb->head;
10023 -}
10024 -
10025 -static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
10026 -{
10027 -       skb_reset_network_header(skb);
10028 -       skb->network_header += offset;
10029 -}
10030 -
10031 -static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
10032 -{
10033 -       return skb->head + skb->mac_header;
10034 -}
10035 -
10036 -static inline int skb_mac_header_was_set(const struct sk_buff *skb)
10037 -{
10038 -       return skb->mac_header != ~0U;
10039 -}
10040 -
10041 -static inline void skb_reset_mac_header(struct sk_buff *skb)
10042 -{
10043 -       skb->mac_header = skb->data - skb->head;
10044 -}
10045 -
10046 -static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
10047 -{
10048 -       skb_reset_mac_header(skb);
10049 -       skb->mac_header += offset;
10050 -}
10051 -
10052 -#else /* NET_SKBUFF_DATA_USES_OFFSET */
10053 -
10054 -static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
10055 -{
10056 -       return skb->transport_header;
10057 -}
10058 -
10059 -static inline void skb_reset_transport_header(struct sk_buff *skb)
10060 -{
10061 -       skb->transport_header = skb->data;
10062 -}
10063 -
10064 -static inline void skb_set_transport_header(struct sk_buff *skb,
10065 -                                           const int offset)
10066 -{
10067 -       skb->transport_header = skb->data + offset;
10068 -}
10069 -
10070 -static inline unsigned char *skb_network_header(const struct sk_buff *skb)
10071 -{
10072 -       return skb->network_header;
10073 -}
10074 -
10075 -static inline void skb_reset_network_header(struct sk_buff *skb)
10076 -{
10077 -       skb->network_header = skb->data;
10078 -}
10079 -
10080 -static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
10081 -{
10082 -       skb->network_header = skb->data + offset;
10083 -}
10084 -
10085 -static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
10086 -{
10087 -       return skb->mac_header;
10088 -}
10089 -
10090 -static inline int skb_mac_header_was_set(const struct sk_buff *skb)
10091 -{
10092 -       return skb->mac_header != NULL;
10093 -}
10094 -
10095 -static inline void skb_reset_mac_header(struct sk_buff *skb)
10096 -{
10097 -       skb->mac_header = skb->data;
10098 -}
10099 -
10100 -static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
10101 -{
10102 -       skb->mac_header = skb->data + offset;
10103 -}
10104 -#endif /* NET_SKBUFF_DATA_USES_OFFSET */
10105 -
10106 -static inline int skb_transport_offset(const struct sk_buff *skb)
10107 -{
10108 -       return skb_transport_header(skb) - skb->data;
10109 -}
10110 -
10111 -static inline u32 skb_network_header_len(const struct sk_buff *skb)
10112 -{
10113 -       return skb->transport_header - skb->network_header;
10114 -}
10115 -
10116 -static inline int skb_network_offset(const struct sk_buff *skb)
10117 -{
10118 -       return skb_network_header(skb) - skb->data;
10119 -}
10120 -
10121 -/*
10122 - * CPUs often take a performance hit when accessing unaligned memory
10123 - * locations. The actual performance hit varies, it can be small if the
10124 - * hardware handles it or large if we have to take an exception and fix it
10125 - * in software.
10126 - *
10127 - * Since an ethernet header is 14 bytes network drivers often end up with
10128 - * the IP header at an unaligned offset. The IP header can be aligned by
10129 - * shifting the start of the packet by 2 bytes. Drivers should do this
10130 - * with:
10131 - *
10132 - * skb_reserve(NET_IP_ALIGN);
10133 - *
10134 - * The downside to this alignment of the IP header is that the DMA is now
10135 - * unaligned. On some architectures the cost of an unaligned DMA is high
10136 - * and this cost outweighs the gains made by aligning the IP header.
10137 - * 
10138 - * Since this trade off varies between architectures, we allow NET_IP_ALIGN
10139 - * to be overridden.
10140 - */
10141 -#ifndef NET_IP_ALIGN
10142 -#define NET_IP_ALIGN   2
10143 -#endif
10144 -
10145 -/*
10146 - * The networking layer reserves some headroom in skb data (via
10147 - * dev_alloc_skb). This is used to avoid having to reallocate skb data when
10148 - * the header has to grow. In the default case, if the header has to grow
10149 - * 16 bytes or less we avoid the reallocation.
10150 - *
10151 - * Unfortunately this headroom changes the DMA alignment of the resulting
10152 - * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive
10153 - * on some architectures. An architecture can override this value,
10154 - * perhaps setting it to a cacheline in size (since that will maintain
10155 - * cacheline alignment of the DMA). It must be a power of 2.
10156 - *
10157 - * Various parts of the networking layer expect at least 16 bytes of
10158 - * headroom, you should not reduce this.
10159 - */
10160 -#ifndef NET_SKB_PAD
10161 -#define NET_SKB_PAD    16
10162 -#endif
10163 -
10164 -extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
10165 -
10166 -static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
10167 -{
10168 -       if (unlikely(skb->data_len)) {
10169 -               WARN_ON(1);
10170 -               return;
10171 -       }
10172 -       skb->len = len;
10173 -       skb_set_tail_pointer(skb, len);
10174 -}
10175 -
10176 -extern void skb_trim(struct sk_buff *skb, unsigned int len);
10177 -
10178 -static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
10179 -{
10180 -       if (skb->data_len)
10181 -               return ___pskb_trim(skb, len);
10182 -       __skb_trim(skb, len);
10183 -       return 0;
10184 -}
10185 -
10186 -static inline int pskb_trim(struct sk_buff *skb, unsigned int len)
10187 -{
10188 -       return (len < skb->len) ? __pskb_trim(skb, len) : 0;
10189 -}
10190 -
10191 -/**
10192 - *     pskb_trim_unique - remove end from a paged unique (not cloned) buffer
10193 - *     @skb: buffer to alter
10194 - *     @len: new length
10195 - *
10196 - *     This is identical to pskb_trim except that the caller knows that
10197 - *     the skb is not cloned so we should never get an error due to out-
10198 - *     of-memory.
10199 - */
10200 -static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len)
10201 -{
10202 -       int err = pskb_trim(skb, len);
10203 -       BUG_ON(err);
10204 -}
10205 -
10206 -/**
10207 - *     skb_orphan - orphan a buffer
10208 - *     @skb: buffer to orphan
10209 - *
10210 - *     If a buffer currently has an owner then we call the owner's
10211 - *     destructor function and make the @skb unowned. The buffer continues
10212 - *     to exist but is no longer charged to its former owner.
10213 - */
10214 -static inline void skb_orphan(struct sk_buff *skb)
10215 -{
10216 -       if (skb->destructor)
10217 -               skb->destructor(skb);
10218 -       skb->destructor = NULL;
10219 -       skb->sk         = NULL;
10220 -}
10221 -
10222 -/**
10223 - *     __skb_queue_purge - empty a list
10224 - *     @list: list to empty
10225 - *
10226 - *     Delete all buffers on an &sk_buff list. Each buffer is removed from
10227 - *     the list and one reference dropped. This function does not take the
10228 - *     list lock and the caller must hold the relevant locks to use it.
10229 - */
10230 -extern void skb_queue_purge(struct sk_buff_head *list);
10231 -static inline void __skb_queue_purge(struct sk_buff_head *list)
10232 -{
10233 -       struct sk_buff *skb;
10234 -       while ((skb = __skb_dequeue(list)) != NULL)
10235 -               kfree_skb(skb);
10236 -}
10237 -
10238 -/**
10239 - *     __dev_alloc_skb - allocate an skbuff for receiving
10240 - *     @length: length to allocate
10241 - *     @gfp_mask: get_free_pages mask, passed to alloc_skb
10242 - *
10243 - *     Allocate a new &sk_buff and assign it a usage count of one. The
10244 - *     buffer has unspecified headroom built in. Users should allocate
10245 - *     the headroom they think they need without accounting for the
10246 - *     built in space. The built in space is used for optimisations.
10247 - *
10248 - *     %NULL is returned if there is no free memory.
10249 - */
10250 -static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
10251 -                                             gfp_t gfp_mask)
10252 -{
10253 -       struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
10254 -       if (likely(skb))
10255 -               skb_reserve(skb, NET_SKB_PAD);
10256 -       return skb;
10257 -}
10258 -
10259 -extern struct sk_buff *dev_alloc_skb(unsigned int length);
10260 -
10261 -extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
10262 -               unsigned int length, gfp_t gfp_mask);
10263 -
10264 -/**
10265 - *     netdev_alloc_skb - allocate an skbuff for rx on a specific device
10266 - *     @dev: network device to receive on
10267 - *     @length: length to allocate
10268 - *
10269 - *     Allocate a new &sk_buff and assign it a usage count of one. The
10270 - *     buffer has unspecified headroom built in. Users should allocate
10271 - *     the headroom they think they need without accounting for the
10272 - *     built in space. The built in space is used for optimisations.
10273 - *
10274 - *     %NULL is returned if there is no free memory. Although this function
10275 - *     allocates memory it can be called from an interrupt.
10276 - */
10277 -static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
10278 -               unsigned int length)
10279 -{
10280 -       return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
10281 -}
10282 -
10283 -/**
10284 - *     skb_clone_writable - is the header of a clone writable
10285 - *     @skb: buffer to check
10286 - *     @len: length up to which to write
10287 - *
10288 - *     Returns true if modifying the header part of the cloned buffer
10289 - *     does not requires the data to be copied.
10290 - */
10291 -static inline int skb_clone_writable(struct sk_buff *skb, unsigned int len)
10292 -{
10293 -       return !skb_header_cloned(skb) &&
10294 -              skb_headroom(skb) + len <= skb->hdr_len;
10295 -}
10296 -
10297 -static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom,
10298 -                           int cloned)
10299 -{
10300 -       int delta = 0;
10301 -
10302 -       if (headroom < NET_SKB_PAD)
10303 -               headroom = NET_SKB_PAD;
10304 -       if (headroom > skb_headroom(skb))
10305 -               delta = headroom - skb_headroom(skb);
10306 -
10307 -       if (delta || cloned)
10308 -               return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0,
10309 -                                       GFP_ATOMIC);
10310 -       return 0;
10311 -}
10312 -
10313 -/**
10314 - *     skb_cow - copy header of skb when it is required
10315 - *     @skb: buffer to cow
10316 - *     @headroom: needed headroom
10317 - *
10318 - *     If the skb passed lacks sufficient headroom or its data part
10319 - *     is shared, data is reallocated. If reallocation fails, an error
10320 - *     is returned and original skb is not changed.
10321 - *
10322 - *     The result is skb with writable area skb->head...skb->tail
10323 - *     and at least @headroom of space at head.
10324 - */
10325 -static inline int skb_cow(struct sk_buff *skb, unsigned int headroom)
10326 -{
10327 -       return __skb_cow(skb, headroom, skb_cloned(skb));
10328 -}
10329 -
10330 -/**
10331 - *     skb_cow_head - skb_cow but only making the head writable
10332 - *     @skb: buffer to cow
10333 - *     @headroom: needed headroom
10334 - *
10335 - *     This function is identical to skb_cow except that we replace the
10336 - *     skb_cloned check by skb_header_cloned.  It should be used when
10337 - *     you only need to push on some header and do not need to modify
10338 - *     the data.
10339 - */
10340 -static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom)
10341 -{
10342 -       return __skb_cow(skb, headroom, skb_header_cloned(skb));
10343 -}
10344 -
10345 -/**
10346 - *     skb_padto       - pad an skbuff up to a minimal size
10347 - *     @skb: buffer to pad
10348 - *     @len: minimal length
10349 - *
10350 - *     Pads up a buffer to ensure the trailing bytes exist and are
10351 - *     blanked. If the buffer already contains sufficient data it
10352 - *     is untouched. Otherwise it is extended. Returns zero on
10353 - *     success. The skb is freed on error.
10354 - */
10355
10356 -static inline int skb_padto(struct sk_buff *skb, unsigned int len)
10357 -{
10358 -       unsigned int size = skb->len;
10359 -       if (likely(size >= len))
10360 -               return 0;
10361 -       return skb_pad(skb, len - size);
10362 -}
10363 -
10364 -static inline int skb_add_data(struct sk_buff *skb,
10365 -                              char __user *from, int copy)
10366 -{
10367 -       const int off = skb->len;
10368 -
10369 -       if (skb->ip_summed == CHECKSUM_NONE) {
10370 -               int err = 0;
10371 -               __wsum csum = csum_and_copy_from_user(from, skb_put(skb, copy),
10372 -                                                           copy, 0, &err);
10373 -               if (!err) {
10374 -                       skb->csum = csum_block_add(skb->csum, csum, off);
10375 -                       return 0;
10376 -               }
10377 -       } else if (!copy_from_user(skb_put(skb, copy), from, copy))
10378 -               return 0;
10379 -
10380 -       __skb_trim(skb, off);
10381 -       return -EFAULT;
10382 -}
10383 -
10384 -static inline int skb_can_coalesce(struct sk_buff *skb, int i,
10385 -                                  struct page *page, int off)
10386 -{
10387 -       if (i) {
10388 -               struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1];
10389 -
10390 -               return page == frag->page &&
10391 -                      off == frag->page_offset + frag->size;
10392 -       }
10393 -       return 0;
10394 -}
10395 -
10396 -static inline int __skb_linearize(struct sk_buff *skb)
10397 -{
10398 -       return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM;
10399 -}
10400 -
10401 -/**
10402 - *     skb_linearize - convert paged skb to linear one
10403 - *     @skb: buffer to linarize
10404 - *
10405 - *     If there is no free memory -ENOMEM is returned, otherwise zero
10406 - *     is returned and the old skb data released.
10407 - */
10408 -static inline int skb_linearize(struct sk_buff *skb)
10409 -{
10410 -       return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0;
10411 -}
10412 -
10413 -/**
10414 - *     skb_linearize_cow - make sure skb is linear and writable
10415 - *     @skb: buffer to process
10416 - *
10417 - *     If there is no free memory -ENOMEM is returned, otherwise zero
10418 - *     is returned and the old skb data released.
10419 - */
10420 -static inline int skb_linearize_cow(struct sk_buff *skb)
10421 -{
10422 -       return skb_is_nonlinear(skb) || skb_cloned(skb) ?
10423 -              __skb_linearize(skb) : 0;
10424 -}
10425 -
10426 -/**
10427 - *     skb_postpull_rcsum - update checksum for received skb after pull
10428 - *     @skb: buffer to update
10429 - *     @start: start of data before pull
10430 - *     @len: length of data pulled
10431 - *
10432 - *     After doing a pull on a received packet, you need to call this to
10433 - *     update the CHECKSUM_COMPLETE checksum, or set ip_summed to
10434 - *     CHECKSUM_NONE so that it can be recomputed from scratch.
10435 - */
10436 -
10437 -static inline void skb_postpull_rcsum(struct sk_buff *skb,
10438 -                                     const void *start, unsigned int len)
10439 -{
10440 -       if (skb->ip_summed == CHECKSUM_COMPLETE)
10441 -               skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
10442 -}
10443 -
10444 -unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
10445 -
10446 -/**
10447 - *     pskb_trim_rcsum - trim received skb and update checksum
10448 - *     @skb: buffer to trim
10449 - *     @len: new length
10450 - *
10451 - *     This is exactly the same as pskb_trim except that it ensures the
10452 - *     checksum of received packets are still valid after the operation.
10453 - */
10454 -
10455 -static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
10456 -{
10457 -       if (likely(len >= skb->len))
10458 -               return 0;
10459 -       if (skb->ip_summed == CHECKSUM_COMPLETE)
10460 -               skb->ip_summed = CHECKSUM_NONE;
10461 -       return __pskb_trim(skb, len);
10462 -}
10463 -
10464 -#define skb_queue_walk(queue, skb) \
10465 -               for (skb = (queue)->next;                                       \
10466 -                    prefetch(skb->next), (skb != (struct sk_buff *)(queue));   \
10467 -                    skb = skb->next)
10468 -
10469 -#define skb_queue_walk_safe(queue, skb, tmp)                                   \
10470 -               for (skb = (queue)->next, tmp = skb->next;                      \
10471 -                    skb != (struct sk_buff *)(queue);                          \
10472 -                    skb = tmp, tmp = skb->next)
10473 -
10474 -#define skb_queue_reverse_walk(queue, skb) \
10475 -               for (skb = (queue)->prev;                                       \
10476 -                    prefetch(skb->prev), (skb != (struct sk_buff *)(queue));   \
10477 -                    skb = skb->prev)
10478 -
10479 -
10480 -extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
10481 -                                          int *peeked, int *err);
10482 -extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
10483 -                                        int noblock, int *err);
10484 -extern unsigned int    datagram_poll(struct file *file, struct socket *sock,
10485 -                                    struct poll_table_struct *wait);
10486 -extern int            skb_copy_datagram_iovec(const struct sk_buff *from,
10487 -                                              int offset, struct iovec *to,
10488 -                                              int size);
10489 -extern int            skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
10490 -                                                       int hlen,
10491 -                                                       struct iovec *iov);
10492 -extern int            skb_copy_datagram_from_iovec(struct sk_buff *skb,
10493 -                                                   int offset,
10494 -                                                   struct iovec *from,
10495 -                                                   int len);
10496 -extern void           skb_free_datagram(struct sock *sk, struct sk_buff *skb);
10497 -extern int            skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
10498 -                                        unsigned int flags);
10499 -extern __wsum         skb_checksum(const struct sk_buff *skb, int offset,
10500 -                                   int len, __wsum csum);
10501 -extern int            skb_copy_bits(const struct sk_buff *skb, int offset,
10502 -                                    void *to, int len);
10503 -extern int            skb_store_bits(struct sk_buff *skb, int offset,
10504 -                                     const void *from, int len);
10505 -extern __wsum         skb_copy_and_csum_bits(const struct sk_buff *skb,
10506 -                                             int offset, u8 *to, int len,
10507 -                                             __wsum csum);
10508 -extern int             skb_splice_bits(struct sk_buff *skb,
10509 -                                               unsigned int offset,
10510 -                                               struct pipe_inode_info *pipe,
10511 -                                               unsigned int len,
10512 -                                               unsigned int flags);
10513 -extern void           skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
10514 -extern void           skb_split(struct sk_buff *skb,
10515 -                                struct sk_buff *skb1, const u32 len);
10516 -
10517 -extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
10518 -
10519 -static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
10520 -                                      int len, void *buffer)
10521 -{
10522 -       int hlen = skb_headlen(skb);
10523 -
10524 -       if (hlen - offset >= len)
10525 -               return skb->data + offset;
10526 -
10527 -       if (skb_copy_bits(skb, offset, buffer, len) < 0)
10528 -               return NULL;
10529 -
10530 -       return buffer;
10531 -}
10532 -
10533 -static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
10534 -                                            void *to,
10535 -                                            const unsigned int len)
10536 -{
10537 -       memcpy(to, skb->data, len);
10538 -}
10539 -
10540 -static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
10541 -                                                   const int offset, void *to,
10542 -                                                   const unsigned int len)
10543 -{
10544 -       memcpy(to, skb->data + offset, len);
10545 -}
10546 -
10547 -static inline void skb_copy_to_linear_data(struct sk_buff *skb,
10548 -                                          const void *from,
10549 -                                          const unsigned int len)
10550 -{
10551 -       memcpy(skb->data, from, len);
10552 -}
10553 -
10554 -static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
10555 -                                                 const int offset,
10556 -                                                 const void *from,
10557 -                                                 const unsigned int len)
10558 -{
10559 -       memcpy(skb->data + offset, from, len);
10560 -}
10561 -
10562 -extern void skb_init(void);
10563 -
10564 -/**
10565 - *     skb_get_timestamp - get timestamp from a skb
10566 - *     @skb: skb to get stamp from
10567 - *     @stamp: pointer to struct timeval to store stamp in
10568 - *
10569 - *     Timestamps are stored in the skb as offsets to a base timestamp.
10570 - *     This function converts the offset back to a struct timeval and stores
10571 - *     it in stamp.
10572 - */
10573 -static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
10574 -{
10575 -       *stamp = ktime_to_timeval(skb->tstamp);
10576 -}
10577 -
10578 -static inline void __net_timestamp(struct sk_buff *skb)
10579 -{
10580 -       skb->tstamp = ktime_get_real();
10581 -}
10582 -
10583 -static inline ktime_t net_timedelta(ktime_t t)
10584 -{
10585 -       return ktime_sub(ktime_get_real(), t);
10586 -}
10587 -
10588 -static inline ktime_t net_invalid_timestamp(void)
10589 -{
10590 -       return ktime_set(0, 0);
10591 -}
10592 -
10593 -extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
10594 -extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
10595 -
10596 -static inline int skb_csum_unnecessary(const struct sk_buff *skb)
10597 -{
10598 -       return skb->ip_summed & CHECKSUM_UNNECESSARY;
10599 -}
10600 -
10601 -/**
10602 - *     skb_checksum_complete - Calculate checksum of an entire packet
10603 - *     @skb: packet to process
10604 - *
10605 - *     This function calculates the checksum over the entire packet plus
10606 - *     the value of skb->csum.  The latter can be used to supply the
10607 - *     checksum of a pseudo header as used by TCP/UDP.  It returns the
10608 - *     checksum.
10609 - *
10610 - *     For protocols that contain complete checksums such as ICMP/TCP/UDP,
10611 - *     this function can be used to verify that checksum on received
10612 - *     packets.  In that case the function should return zero if the
10613 - *     checksum is correct.  In particular, this function will return zero
10614 - *     if skb->ip_summed is CHECKSUM_UNNECESSARY which indicates that the
10615 - *     hardware has already verified the correctness of the checksum.
10616 - */
10617 -static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
10618 -{
10619 -       return skb_csum_unnecessary(skb) ?
10620 -              0 : __skb_checksum_complete(skb);
10621 -}
10622 -
10623 -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
10624 -extern void nf_conntrack_destroy(struct nf_conntrack *nfct);
10625 -static inline void nf_conntrack_put(struct nf_conntrack *nfct)
10626 -{
10627 -       if (nfct && atomic_dec_and_test(&nfct->use))
10628 -               nf_conntrack_destroy(nfct);
10629 -}
10630 -static inline void nf_conntrack_get(struct nf_conntrack *nfct)
10631 -{
10632 -       if (nfct)
10633 -               atomic_inc(&nfct->use);
10634 -}
10635 -static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
10636 -{
10637 -       if (skb)
10638 -               atomic_inc(&skb->users);
10639 -}
10640 -static inline void nf_conntrack_put_reasm(struct sk_buff *skb)
10641 -{
10642 -       if (skb)
10643 -               kfree_skb(skb);
10644 -}
10645 -#endif
10646 -#ifdef CONFIG_BRIDGE_NETFILTER
10647 -static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
10648 -{
10649 -       if (nf_bridge && atomic_dec_and_test(&nf_bridge->use))
10650 -               kfree(nf_bridge);
10651 -}
10652 -static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
10653 -{
10654 -       if (nf_bridge)
10655 -               atomic_inc(&nf_bridge->use);
10656 -}
10657 -#endif /* CONFIG_BRIDGE_NETFILTER */
10658 -static inline void nf_reset(struct sk_buff *skb)
10659 -{
10660 -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
10661 -       nf_conntrack_put(skb->nfct);
10662 -       skb->nfct = NULL;
10663 -       nf_conntrack_put_reasm(skb->nfct_reasm);
10664 -       skb->nfct_reasm = NULL;
10665 -#endif
10666 -#ifdef CONFIG_BRIDGE_NETFILTER
10667 -       nf_bridge_put(skb->nf_bridge);
10668 -       skb->nf_bridge = NULL;
10669 -#endif
10670 -}
10671 -
10672 -/* Note: This doesn't put any conntrack and bridge info in dst. */
10673 -static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
10674 -{
10675 -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
10676 -       dst->nfct = src->nfct;
10677 -       nf_conntrack_get(src->nfct);
10678 -       dst->nfctinfo = src->nfctinfo;
10679 -       dst->nfct_reasm = src->nfct_reasm;
10680 -       nf_conntrack_get_reasm(src->nfct_reasm);
10681 -#endif
10682 -#ifdef CONFIG_BRIDGE_NETFILTER
10683 -       dst->nf_bridge  = src->nf_bridge;
10684 -       nf_bridge_get(src->nf_bridge);
10685 -#endif
10686 -}
10687 -
10688 -static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
10689 -{
10690 -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
10691 -       nf_conntrack_put(dst->nfct);
10692 -       nf_conntrack_put_reasm(dst->nfct_reasm);
10693 -#endif
10694 -#ifdef CONFIG_BRIDGE_NETFILTER
10695 -       nf_bridge_put(dst->nf_bridge);
10696 -#endif
10697 -       __nf_copy(dst, src);
10698 -}
10699 -
10700 -#ifdef CONFIG_NETWORK_SECMARK
10701 -static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
10702 -{
10703 -       to->secmark = from->secmark;
10704 -}
10705 -
10706 -static inline void skb_init_secmark(struct sk_buff *skb)
10707 -{
10708 -       skb->secmark = 0;
10709 -}
10710 -#else
10711 -static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
10712 -{ }
10713 -
10714 -static inline void skb_init_secmark(struct sk_buff *skb)
10715 -{ }
10716 -#endif
10717 -
10718 -static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
10719 -{
10720 -       skb->queue_mapping = queue_mapping;
10721 -}
10722 -
10723 -static inline u16 skb_get_queue_mapping(struct sk_buff *skb)
10724 -{
10725 -       return skb->queue_mapping;
10726 -}
10727 -
10728 -static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_buff *from)
10729 -{
10730 -       to->queue_mapping = from->queue_mapping;
10731 -}
10732 -
10733 -static inline int skb_is_gso(const struct sk_buff *skb)
10734 -{
10735 -       return skb_shinfo(skb)->gso_size;
10736 -}
10737 -
10738 -static inline int skb_is_gso_v6(const struct sk_buff *skb)
10739 -{
10740 -       return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
10741 -}
10742 -
10743 -extern void __skb_warn_lro_forwarding(const struct sk_buff *skb);
10744 -
10745 -static inline bool skb_warn_if_lro(const struct sk_buff *skb)
10746 -{
10747 -       /* LRO sets gso_size but not gso_type, whereas if GSO is really
10748 -        * wanted then gso_type will be set. */
10749 -       struct skb_shared_info *shinfo = skb_shinfo(skb);
10750 -       if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) {
10751 -               __skb_warn_lro_forwarding(skb);
10752 -               return true;
10753 -       }
10754 -       return false;
10755 -}
10756 -
10757 -static inline void skb_forward_csum(struct sk_buff *skb)
10758 -{
10759 -       /* Unfortunately we don't support this one.  Any brave souls? */
10760 -       if (skb->ip_summed == CHECKSUM_COMPLETE)
10761 -               skb->ip_summed = CHECKSUM_NONE;
10762 -}
10763 -
10764 -bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
10765 -#endif /* __KERNEL__ */
10766 -#endif /* _LINUX_SKBUFF_H */
10767 diff -Nurb linux-2.6.27-720/include/linux/spinlock.h linux-2.6.27-710/include/linux/spinlock.h
10768 --- linux-2.6.27-720/include/linux/spinlock.h   2009-05-04 12:18:34.000000000 -0400
10769 +++ linux-2.6.27-710/include/linux/spinlock.h   2008-10-09 18:13:53.000000000 -0400
10770 @@ -54,7 +54,6 @@
10771  #include <linux/kernel.h>
10772  #include <linux/stringify.h>
10773  #include <linux/bottom_half.h>
10774 -#include <linux/types.h>
10775  
10776  #include <asm/system.h>
10777  
10778 diff -Nurb linux-2.6.27-720/include/linux/spinlock_types.h linux-2.6.27-710/include/linux/spinlock_types.h
10779 --- linux-2.6.27-720/include/linux/spinlock_types.h     2009-05-04 12:18:34.000000000 -0400
10780 +++ linux-2.6.27-710/include/linux/spinlock_types.h     2008-10-09 18:13:53.000000000 -0400
10781 @@ -51,47 +51,37 @@
10782  
10783  #define SPINLOCK_OWNER_INIT    ((void *)-1L)
10784  
10785 -#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
10786 -# define SPINLOCK_BREAK_LOCK_INIT 0,
10787 -#else
10788 -# define SPINLOCK_BREAK_LOCK_INIT
10789 -#endif
10790 -
10791  #ifdef CONFIG_DEBUG_LOCK_ALLOC
10792 -# define SPIN_DEP_MAP_INIT(lockname)   { 0, 0, #lockname }
10793 +# define SPIN_DEP_MAP_INIT(lockname)   .dep_map = { .name = #lockname }
10794  #else
10795  # define SPIN_DEP_MAP_INIT(lockname)
10796  #endif
10797  
10798  #ifdef CONFIG_DEBUG_LOCK_ALLOC
10799 -# define RW_DEP_MAP_INIT(lockname)     { 0, 0, #lockname }
10800 +# define RW_DEP_MAP_INIT(lockname)     .dep_map = { .name = #lockname }
10801  #else
10802  # define RW_DEP_MAP_INIT(lockname)
10803  #endif
10804  
10805  #ifdef CONFIG_DEBUG_SPINLOCK
10806  # define __SPIN_LOCK_UNLOCKED(lockname)                                        \
10807 -       (spinlock_t)    { /*raw_lock*/  __RAW_SPIN_LOCK_UNLOCKED,       \
10808 -                         /*break_lock*/ SPINLOCK_BREAK_LOCK_INIT       \
10809 -                         /*magic*/     SPINLOCK_MAGIC,                 \
10810 -                         /*owner_cpu*/ -1,                             \
10811 -                         /*owner*/     SPINLOCK_OWNER_INIT,            \
10812 +       (spinlock_t)    {       .raw_lock = __RAW_SPIN_LOCK_UNLOCKED,   \
10813 +                               .magic = SPINLOCK_MAGIC,                \
10814 +                               .owner = SPINLOCK_OWNER_INIT,           \
10815 +                               .owner_cpu = -1,                        \
10816                                 SPIN_DEP_MAP_INIT(lockname) }
10817  #define __RW_LOCK_UNLOCKED(lockname)                                   \
10818 -       (rwlock_t)      { /*raw_lock*/  __RAW_RW_LOCK_UNLOCKED,         \
10819 -                         /*break_lock*/ SPINLOCK_BREAK_LOCK_INIT       \
10820 -                         /*magic*/     RWLOCK_MAGIC,                   \
10821 -                         /*owner_cpu*/ -1,                             \
10822 -                         /*owner*/     SPINLOCK_OWNER_INIT,            \
10823 +       (rwlock_t)      {       .raw_lock = __RAW_RW_LOCK_UNLOCKED,     \
10824 +                               .magic = RWLOCK_MAGIC,                  \
10825 +                               .owner = SPINLOCK_OWNER_INIT,           \
10826 +                               .owner_cpu = -1,                        \
10827                                 RW_DEP_MAP_INIT(lockname) }
10828  #else
10829  # define __SPIN_LOCK_UNLOCKED(lockname) \
10830 -       (spinlock_t)    { /*raw_lock*/  __RAW_SPIN_LOCK_UNLOCKED,       \
10831 -                         /*break_lock*/ SPINLOCK_BREAK_LOCK_INIT       \
10832 +       (spinlock_t)    {       .raw_lock = __RAW_SPIN_LOCK_UNLOCKED,   \
10833                                 SPIN_DEP_MAP_INIT(lockname) }
10834  #define __RW_LOCK_UNLOCKED(lockname) \
10835 -       (rwlock_t)      { /*raw_lock*/  __RAW_RW_LOCK_UNLOCKED,         \
10836 -                         /*break_lock*/ SPINLOCK_BREAK_LOCK_INIT       \
10837 +       (rwlock_t)      {       .raw_lock = __RAW_RW_LOCK_UNLOCKED,     \
10838                                 RW_DEP_MAP_INIT(lockname) }
10839  #endif
10840  
10841 diff -Nurb linux-2.6.27-720/include/linux/stddef.h linux-2.6.27-710/include/linux/stddef.h
10842 --- linux-2.6.27-720/include/linux/stddef.h     2009-05-04 12:18:34.000000000 -0400
10843 +++ linux-2.6.27-710/include/linux/stddef.h     2008-10-09 18:13:53.000000000 -0400
10844 @@ -12,12 +12,10 @@
10845  
10846  #ifdef __KERNEL__
10847  
10848 -#ifndef __cplusplus
10849  enum {
10850         false   = 0,
10851         true    = 1
10852  };
10853 -#endif
10854  
10855  #undef offsetof
10856  #ifdef __compiler_offsetof
10857 diff -Nurb linux-2.6.27-720/include/linux/sysctl.h linux-2.6.27-710/include/linux/sysctl.h
10858 --- linux-2.6.27-720/include/linux/sysctl.h     2009-05-04 12:18:34.000000000 -0400
10859 +++ linux-2.6.27-710/include/linux/sysctl.h     2009-05-04 12:15:30.000000000 -0400
10860 @@ -985,7 +985,7 @@
10861                          void __user *oldval, size_t __user *oldlenp,
10862                          void __user *newval, size_t newlen);
10863  
10864 -typedef int proc_handler_t (struct ctl_table *ctl, int write, struct file * filp,
10865 +typedef int proc_handler (struct ctl_table *ctl, int write, struct file * filp,
10866                           void __user *buffer, size_t *lenp, loff_t *ppos);
10867  
10868  extern int proc_dostring(struct ctl_table *, int, struct file *,
10869 @@ -1066,7 +1066,7 @@
10870         mode_t mode;
10871         struct ctl_table *child;
10872         struct ctl_table *parent;       /* Automatically set */
10873 -       proc_handler_t *proc_handler;   /* Callback for text formatting */
10874 +       proc_handler *proc_handler;     /* Callback for text formatting */
10875         ctl_handler *strategy;          /* Callback function for all r/w */
10876         void *extra1;
10877         void *extra2;
10878 diff -Nurb linux-2.6.27-720/include/linux/sysctl.h.orig linux-2.6.27-710/include/linux/sysctl.h.orig
10879 --- linux-2.6.27-720/include/linux/sysctl.h.orig        2009-05-04 12:15:30.000000000 -0400
10880 +++ linux-2.6.27-710/include/linux/sysctl.h.orig        1969-12-31 19:00:00.000000000 -0500
10881 @@ -1,1120 +0,0 @@
10882 -/*
10883 - * sysctl.h: General linux system control interface
10884 - *
10885 - * Begun 24 March 1995, Stephen Tweedie
10886 - *
10887 - ****************************************************************
10888 - ****************************************************************
10889 - **
10890 - **  WARNING:
10891 - **  The values in this file are exported to user space via 
10892 - **  the sysctl() binary interface.  Do *NOT* change the
10893 - **  numbering of any existing values here, and do not change
10894 - **  any numbers within any one set of values.  If you have to
10895 - **  redefine an existing interface, use a new number for it.
10896 - **  The kernel will then return -ENOTDIR to any application using
10897 - **  the old binary interface.
10898 - **
10899 - **  For new interfaces unless you really need a binary number
10900 - **  please use CTL_UNNUMBERED.
10901 - **
10902 - ****************************************************************
10903 - ****************************************************************
10904 - */
10905 -
10906 -#ifndef _LINUX_SYSCTL_H
10907 -#define _LINUX_SYSCTL_H
10908 -
10909 -#include <linux/kernel.h>
10910 -#include <linux/types.h>
10911 -#include <linux/compiler.h>
10912 -
10913 -struct file;
10914 -struct completion;
10915 -
10916 -#define CTL_MAXNAME 10         /* how many path components do we allow in a
10917 -                                  call to sysctl?   In other words, what is
10918 -                                  the largest acceptable value for the nlen
10919 -                                  member of a struct __sysctl_args to have? */
10920 -
10921 -struct __sysctl_args {
10922 -       int __user *name;
10923 -       int nlen;
10924 -       void __user *oldval;
10925 -       size_t __user *oldlenp;
10926 -       void __user *newval;
10927 -       size_t newlen;
10928 -       unsigned long __unused[4];
10929 -};
10930 -
10931 -/* Define sysctl names first */
10932 -
10933 -/* Top-level names: */
10934 -
10935 -/* For internal pattern-matching use only: */
10936 -#ifdef __KERNEL__
10937 -#define CTL_NONE       0
10938 -#define CTL_UNNUMBERED CTL_NONE        /* sysctl without a binary number */
10939 -#endif
10940 -
10941 -enum
10942 -{
10943 -       CTL_KERN=1,             /* General kernel info and control */
10944 -       CTL_VM=2,               /* VM management */
10945 -       CTL_NET=3,              /* Networking */
10946 -       CTL_PROC=4,             /* removal breaks strace(1) compilation */
10947 -       CTL_FS=5,               /* Filesystems */
10948 -       CTL_DEBUG=6,            /* Debugging */
10949 -       CTL_DEV=7,              /* Devices */
10950 -       CTL_BUS=8,              /* Busses */
10951 -       CTL_ABI=9,              /* Binary emulation */
10952 -       CTL_CPU=10,             /* CPU stuff (speed scaling, etc) */
10953 -       CTL_ARLAN=254,          /* arlan wireless driver */
10954 -       CTL_VSERVER=4242,       /* Linux-VServer debug */
10955 -       CTL_S390DBF=5677,       /* s390 debug */
10956 -       CTL_SUNRPC=7249,        /* sunrpc debug */
10957 -       CTL_PM=9899,            /* frv power management */
10958 -       CTL_FRV=9898,           /* frv specific sysctls */
10959 -};
10960 -
10961 -/* CTL_BUS names: */
10962 -enum
10963 -{
10964 -       CTL_BUS_ISA=1           /* ISA */
10965 -};
10966 -
10967 -/* /proc/sys/fs/inotify/ */
10968 -enum
10969 -{
10970 -       INOTIFY_MAX_USER_INSTANCES=1,   /* max instances per user */
10971 -       INOTIFY_MAX_USER_WATCHES=2,     /* max watches per user */
10972 -       INOTIFY_MAX_QUEUED_EVENTS=3     /* max queued events per instance */
10973 -};
10974 -
10975 -/* CTL_KERN names: */
10976 -enum
10977 -{
10978 -       KERN_OSTYPE=1,          /* string: system version */
10979 -       KERN_OSRELEASE=2,       /* string: system release */
10980 -       KERN_OSREV=3,           /* int: system revision */
10981 -       KERN_VERSION=4,         /* string: compile time info */
10982 -       KERN_SECUREMASK=5,      /* struct: maximum rights mask */
10983 -       KERN_PROF=6,            /* table: profiling information */
10984 -       KERN_NODENAME=7,
10985 -       KERN_DOMAINNAME=8,
10986 -
10987 -       KERN_PANIC=15,          /* int: panic timeout */
10988 -       KERN_REALROOTDEV=16,    /* real root device to mount after initrd */
10989 -       KERN_VSHELPER=17,       /* string: path to vshelper policy agent */
10990 -
10991 -       KERN_SPARC_REBOOT=21,   /* reboot command on Sparc */
10992 -       KERN_CTLALTDEL=22,      /* int: allow ctl-alt-del to reboot */
10993 -       KERN_PRINTK=23,         /* struct: control printk logging parameters */
10994 -       KERN_NAMETRANS=24,      /* Name translation */
10995 -       KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */
10996 -       KERN_PPC_ZEROPAGED=26,  /* turn idle page zeroing on/off on PPC */
10997 -       KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */
10998 -       KERN_MODPROBE=28,
10999 -       KERN_SG_BIG_BUFF=29,
11000 -       KERN_ACCT=30,           /* BSD process accounting parameters */
11001 -       KERN_PPC_L2CR=31,       /* l2cr register on PPC */
11002 -
11003 -       KERN_RTSIGNR=32,        /* Number of rt sigs queued */
11004 -       KERN_RTSIGMAX=33,       /* Max queuable */
11005 -       
11006 -       KERN_SHMMAX=34,         /* long: Maximum shared memory segment */
11007 -       KERN_MSGMAX=35,         /* int: Maximum size of a messege */
11008 -       KERN_MSGMNB=36,         /* int: Maximum message queue size */
11009 -       KERN_MSGPOOL=37,        /* int: Maximum system message pool size */
11010 -       KERN_SYSRQ=38,          /* int: Sysreq enable */
11011 -       KERN_MAX_THREADS=39,    /* int: Maximum nr of threads in the system */
11012 -       KERN_RANDOM=40,         /* Random driver */
11013 -       KERN_SHMALL=41,         /* int: Maximum size of shared memory */
11014 -       KERN_MSGMNI=42,         /* int: msg queue identifiers */
11015 -       KERN_SEM=43,            /* struct: sysv semaphore limits */
11016 -       KERN_SPARC_STOP_A=44,   /* int: Sparc Stop-A enable */
11017 -       KERN_SHMMNI=45,         /* int: shm array identifiers */
11018 -       KERN_OVERFLOWUID=46,    /* int: overflow UID */
11019 -       KERN_OVERFLOWGID=47,    /* int: overflow GID */
11020 -       KERN_SHMPATH=48,        /* string: path to shm fs */
11021 -       KERN_HOTPLUG=49,        /* string: path to uevent helper (deprecated) */
11022 -       KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
11023 -       KERN_S390_USER_DEBUG_LOGGING=51,  /* int: dumps of user faults */
11024 -       KERN_CORE_USES_PID=52,          /* int: use core or core.%pid */
11025 -       KERN_TAINTED=53,        /* int: various kernel tainted flags */
11026 -       KERN_CADPID=54,         /* int: PID of the process to notify on CAD */
11027 -       KERN_PIDMAX=55,         /* int: PID # limit */
11028 -       KERN_CORE_PATTERN=56,   /* string: pattern for core-file names */
11029 -       KERN_PANIC_ON_OOPS=57,  /* int: whether we will panic on an oops */
11030 -       KERN_HPPA_PWRSW=58,     /* int: hppa soft-power enable */
11031 -       KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */
11032 -       KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */
11033 -       KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */
11034 -       KERN_PTY=62,            /* dir: pty driver */
11035 -       KERN_NGROUPS_MAX=63,    /* int: NGROUPS_MAX */
11036 -       KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */
11037 -       KERN_HZ_TIMER=65,       /* int: hz timer on or off */
11038 -       KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
11039 -       KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
11040 -       KERN_RANDOMIZE=68, /* int: randomize virtual address space */
11041 -       KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
11042 -       KERN_SPIN_RETRY=70,     /* int: number of spinlock retries */
11043 -       KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
11044 -       KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
11045 -       KERN_COMPAT_LOG=73,     /* int: print compat layer  messages */
11046 -       KERN_MAX_LOCK_DEPTH=74,
11047 -       KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
11048 -       KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
11049 -};
11050 -
11051 -
11052 -
11053 -/* CTL_VM names: */
11054 -enum
11055 -{
11056 -       VM_UNUSED1=1,           /* was: struct: Set vm swapping control */
11057 -       VM_UNUSED2=2,           /* was; int: Linear or sqrt() swapout for hogs */
11058 -       VM_UNUSED3=3,           /* was: struct: Set free page thresholds */
11059 -       VM_UNUSED4=4,           /* Spare */
11060 -       VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */
11061 -       VM_UNUSED5=6,           /* was: struct: Set buffer memory thresholds */
11062 -       VM_UNUSED7=7,           /* was: struct: Set cache memory thresholds */
11063 -       VM_UNUSED8=8,           /* was: struct: Control kswapd behaviour */
11064 -       VM_UNUSED9=9,           /* was: struct: Set page table cache parameters */
11065 -       VM_PAGE_CLUSTER=10,     /* int: set number of pages to swap together */
11066 -       VM_DIRTY_BACKGROUND=11, /* dirty_background_ratio */
11067 -       VM_DIRTY_RATIO=12,      /* dirty_ratio */
11068 -       VM_DIRTY_WB_CS=13,      /* dirty_writeback_centisecs */
11069 -       VM_DIRTY_EXPIRE_CS=14,  /* dirty_expire_centisecs */
11070 -       VM_NR_PDFLUSH_THREADS=15, /* nr_pdflush_threads */
11071 -       VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */
11072 -       VM_PAGEBUF=17,          /* struct: Control pagebuf parameters */
11073 -       VM_HUGETLB_PAGES=18,    /* int: Number of available Huge Pages */
11074 -       VM_SWAPPINESS=19,       /* Tendency to steal mapped memory */
11075 -       VM_LOWMEM_RESERVE_RATIO=20,/* reservation ratio for lower memory zones */
11076 -       VM_MIN_FREE_KBYTES=21,  /* Minimum free kilobytes to maintain */
11077 -       VM_MAX_MAP_COUNT=22,    /* int: Maximum number of mmaps/address-space */
11078 -       VM_LAPTOP_MODE=23,      /* vm laptop mode */
11079 -       VM_BLOCK_DUMP=24,       /* block dump mode */
11080 -       VM_HUGETLB_GROUP=25,    /* permitted hugetlb group */
11081 -       VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */
11082 -       VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */
11083 -       VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */
11084 -       VM_DROP_PAGECACHE=29,   /* int: nuke lots of pagecache */
11085 -       VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
11086 -       VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
11087 -       VM_MIN_UNMAPPED=32,     /* Set min percent of unmapped pages */
11088 -       VM_PANIC_ON_OOM=33,     /* panic at out-of-memory */
11089 -       VM_VDSO_ENABLED=34,     /* map VDSO into new processes? */
11090 -       VM_MIN_SLAB=35,          /* Percent pages ignored by zone reclaim */
11091 -};
11092 -
11093 -
11094 -/* CTL_NET names: */
11095 -enum
11096 -{
11097 -       NET_CORE=1,
11098 -       NET_ETHER=2,
11099 -       NET_802=3,
11100 -       NET_UNIX=4,
11101 -       NET_IPV4=5,
11102 -       NET_IPX=6,
11103 -       NET_ATALK=7,
11104 -       NET_NETROM=8,
11105 -       NET_AX25=9,
11106 -       NET_BRIDGE=10,
11107 -       NET_ROSE=11,
11108 -       NET_IPV6=12,
11109 -       NET_X25=13,
11110 -       NET_TR=14,
11111 -       NET_DECNET=15,
11112 -       NET_ECONET=16,
11113 -       NET_SCTP=17,
11114 -       NET_LLC=18,
11115 -       NET_NETFILTER=19,
11116 -       NET_DCCP=20,
11117 -       NET_IRDA=412,
11118 -};
11119 -
11120 -/* /proc/sys/kernel/random */
11121 -enum
11122 -{
11123 -       RANDOM_POOLSIZE=1,
11124 -       RANDOM_ENTROPY_COUNT=2,
11125 -       RANDOM_READ_THRESH=3,
11126 -       RANDOM_WRITE_THRESH=4,
11127 -       RANDOM_BOOT_ID=5,
11128 -       RANDOM_UUID=6
11129 -};
11130 -
11131 -/* /proc/sys/kernel/pty */
11132 -enum
11133 -{
11134 -       PTY_MAX=1,
11135 -       PTY_NR=2
11136 -};
11137 -
11138 -/* /proc/sys/bus/isa */
11139 -enum
11140 -{
11141 -       BUS_ISA_MEM_BASE=1,
11142 -       BUS_ISA_PORT_BASE=2,
11143 -       BUS_ISA_PORT_SHIFT=3
11144 -};
11145 -
11146 -/* /proc/sys/net/core */
11147 -enum
11148 -{
11149 -       NET_CORE_WMEM_MAX=1,
11150 -       NET_CORE_RMEM_MAX=2,
11151 -       NET_CORE_WMEM_DEFAULT=3,
11152 -       NET_CORE_RMEM_DEFAULT=4,
11153 -/* was NET_CORE_DESTROY_DELAY */
11154 -       NET_CORE_MAX_BACKLOG=6,
11155 -       NET_CORE_FASTROUTE=7,
11156 -       NET_CORE_MSG_COST=8,
11157 -       NET_CORE_MSG_BURST=9,
11158 -       NET_CORE_OPTMEM_MAX=10,
11159 -       NET_CORE_HOT_LIST_LENGTH=11,
11160 -       NET_CORE_DIVERT_VERSION=12,
11161 -       NET_CORE_NO_CONG_THRESH=13,
11162 -       NET_CORE_NO_CONG=14,
11163 -       NET_CORE_LO_CONG=15,
11164 -       NET_CORE_MOD_CONG=16,
11165 -       NET_CORE_DEV_WEIGHT=17,
11166 -       NET_CORE_SOMAXCONN=18,
11167 -       NET_CORE_BUDGET=19,
11168 -       NET_CORE_AEVENT_ETIME=20,
11169 -       NET_CORE_AEVENT_RSEQTH=21,
11170 -       NET_CORE_WARNINGS=22,
11171 -};
11172 -
11173 -/* /proc/sys/net/ethernet */
11174 -
11175 -/* /proc/sys/net/802 */
11176 -
11177 -/* /proc/sys/net/unix */
11178 -
11179 -enum
11180 -{
11181 -       NET_UNIX_DESTROY_DELAY=1,
11182 -       NET_UNIX_DELETE_DELAY=2,
11183 -       NET_UNIX_MAX_DGRAM_QLEN=3,
11184 -};
11185 -
11186 -/* /proc/sys/net/netfilter */
11187 -enum
11188 -{
11189 -       NET_NF_CONNTRACK_MAX=1,
11190 -       NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2,
11191 -       NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3,
11192 -       NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4,
11193 -       NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5,
11194 -       NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6,
11195 -       NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7,
11196 -       NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8,
11197 -       NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9,
11198 -       NET_NF_CONNTRACK_UDP_TIMEOUT=10,
11199 -       NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11,
11200 -       NET_NF_CONNTRACK_ICMP_TIMEOUT=12,
11201 -       NET_NF_CONNTRACK_GENERIC_TIMEOUT=13,
11202 -       NET_NF_CONNTRACK_BUCKETS=14,
11203 -       NET_NF_CONNTRACK_LOG_INVALID=15,
11204 -       NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16,
11205 -       NET_NF_CONNTRACK_TCP_LOOSE=17,
11206 -       NET_NF_CONNTRACK_TCP_BE_LIBERAL=18,
11207 -       NET_NF_CONNTRACK_TCP_MAX_RETRANS=19,
11208 -       NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20,
11209 -       NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21,
11210 -       NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22,
11211 -       NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23,
11212 -       NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
11213 -       NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
11214 -       NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
11215 -       NET_NF_CONNTRACK_COUNT=27,
11216 -       NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28,
11217 -       NET_NF_CONNTRACK_FRAG6_TIMEOUT=29,
11218 -       NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30,
11219 -       NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31,
11220 -       NET_NF_CONNTRACK_CHECKSUM=32,
11221 -};
11222 -
11223 -/* /proc/sys/net/ipv4 */
11224 -enum
11225 -{
11226 -       /* v2.0 compatibile variables */
11227 -       NET_IPV4_FORWARD=8,
11228 -       NET_IPV4_DYNADDR=9,
11229 -
11230 -       NET_IPV4_CONF=16,
11231 -       NET_IPV4_NEIGH=17,
11232 -       NET_IPV4_ROUTE=18,
11233 -       NET_IPV4_FIB_HASH=19,
11234 -       NET_IPV4_NETFILTER=20,
11235 -
11236 -       NET_IPV4_TCP_TIMESTAMPS=33,
11237 -       NET_IPV4_TCP_WINDOW_SCALING=34,
11238 -       NET_IPV4_TCP_SACK=35,
11239 -       NET_IPV4_TCP_RETRANS_COLLAPSE=36,
11240 -       NET_IPV4_DEFAULT_TTL=37,
11241 -       NET_IPV4_AUTOCONFIG=38,
11242 -       NET_IPV4_NO_PMTU_DISC=39,
11243 -       NET_IPV4_TCP_SYN_RETRIES=40,
11244 -       NET_IPV4_IPFRAG_HIGH_THRESH=41,
11245 -       NET_IPV4_IPFRAG_LOW_THRESH=42,
11246 -       NET_IPV4_IPFRAG_TIME=43,
11247 -       NET_IPV4_TCP_MAX_KA_PROBES=44,
11248 -       NET_IPV4_TCP_KEEPALIVE_TIME=45,
11249 -       NET_IPV4_TCP_KEEPALIVE_PROBES=46,
11250 -       NET_IPV4_TCP_RETRIES1=47,
11251 -       NET_IPV4_TCP_RETRIES2=48,
11252 -       NET_IPV4_TCP_FIN_TIMEOUT=49,
11253 -       NET_IPV4_IP_MASQ_DEBUG=50,
11254 -       NET_TCP_SYNCOOKIES=51,
11255 -       NET_TCP_STDURG=52,
11256 -       NET_TCP_RFC1337=53,
11257 -       NET_TCP_SYN_TAILDROP=54,
11258 -       NET_TCP_MAX_SYN_BACKLOG=55,
11259 -       NET_IPV4_LOCAL_PORT_RANGE=56,
11260 -       NET_IPV4_ICMP_ECHO_IGNORE_ALL=57,
11261 -       NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58,
11262 -       NET_IPV4_ICMP_SOURCEQUENCH_RATE=59,
11263 -       NET_IPV4_ICMP_DESTUNREACH_RATE=60,
11264 -       NET_IPV4_ICMP_TIMEEXCEED_RATE=61,
11265 -       NET_IPV4_ICMP_PARAMPROB_RATE=62,
11266 -       NET_IPV4_ICMP_ECHOREPLY_RATE=63,
11267 -       NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64,
11268 -       NET_IPV4_IGMP_MAX_MEMBERSHIPS=65,
11269 -       NET_TCP_TW_RECYCLE=66,
11270 -       NET_IPV4_ALWAYS_DEFRAG=67,
11271 -       NET_IPV4_TCP_KEEPALIVE_INTVL=68,
11272 -       NET_IPV4_INET_PEER_THRESHOLD=69,
11273 -       NET_IPV4_INET_PEER_MINTTL=70,
11274 -       NET_IPV4_INET_PEER_MAXTTL=71,
11275 -       NET_IPV4_INET_PEER_GC_MINTIME=72,
11276 -       NET_IPV4_INET_PEER_GC_MAXTIME=73,
11277 -       NET_TCP_ORPHAN_RETRIES=74,
11278 -       NET_TCP_ABORT_ON_OVERFLOW=75,
11279 -       NET_TCP_SYNACK_RETRIES=76,
11280 -       NET_TCP_MAX_ORPHANS=77,
11281 -       NET_TCP_MAX_TW_BUCKETS=78,
11282 -       NET_TCP_FACK=79,
11283 -       NET_TCP_REORDERING=80,
11284 -       NET_TCP_ECN=81,
11285 -       NET_TCP_DSACK=82,
11286 -       NET_TCP_MEM=83,
11287 -       NET_TCP_WMEM=84,
11288 -       NET_TCP_RMEM=85,
11289 -       NET_TCP_APP_WIN=86,
11290 -       NET_TCP_ADV_WIN_SCALE=87,
11291 -       NET_IPV4_NONLOCAL_BIND=88,
11292 -       NET_IPV4_ICMP_RATELIMIT=89,
11293 -       NET_IPV4_ICMP_RATEMASK=90,
11294 -       NET_TCP_TW_REUSE=91,
11295 -       NET_TCP_FRTO=92,
11296 -       NET_TCP_LOW_LATENCY=93,
11297 -       NET_IPV4_IPFRAG_SECRET_INTERVAL=94,
11298 -       NET_IPV4_IGMP_MAX_MSF=96,
11299 -       NET_TCP_NO_METRICS_SAVE=97,
11300 -       NET_TCP_DEFAULT_WIN_SCALE=105,
11301 -       NET_TCP_MODERATE_RCVBUF=106,
11302 -       NET_TCP_TSO_WIN_DIVISOR=107,
11303 -       NET_TCP_BIC_BETA=108,
11304 -       NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
11305 -       NET_TCP_CONG_CONTROL=110,
11306 -       NET_TCP_ABC=111,
11307 -       NET_IPV4_IPFRAG_MAX_DIST=112,
11308 -       NET_TCP_MTU_PROBING=113,
11309 -       NET_TCP_BASE_MSS=114,
11310 -       NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
11311 -       NET_TCP_DMA_COPYBREAK=116,
11312 -       NET_TCP_SLOW_START_AFTER_IDLE=117,
11313 -       NET_CIPSOV4_CACHE_ENABLE=118,
11314 -       NET_CIPSOV4_CACHE_BUCKET_SIZE=119,
11315 -       NET_CIPSOV4_RBM_OPTFMT=120,
11316 -       NET_CIPSOV4_RBM_STRICTVALID=121,
11317 -       NET_TCP_AVAIL_CONG_CONTROL=122,
11318 -       NET_TCP_ALLOWED_CONG_CONTROL=123,
11319 -       NET_TCP_MAX_SSTHRESH=124,
11320 -       NET_TCP_FRTO_RESPONSE=125,
11321 -#ifdef CONFIG_ICMP_IPOD
11322 -       NET_IPV4_ICMP_IPOD_VERSION,
11323 -       NET_IPV4_ICMP_IPOD_ENABLED,
11324 -       NET_IPV4_ICMP_IPOD_HOST,
11325 -       NET_IPV4_ICMP_IPOD_MASK,
11326 -       NET_IPV4_ICMP_IPOD_KEY
11327 -#endif
11328 -};
11329 -
11330 -enum {
11331 -       NET_IPV4_ROUTE_FLUSH=1,
11332 -       NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */
11333 -       NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */
11334 -       NET_IPV4_ROUTE_GC_THRESH=4,
11335 -       NET_IPV4_ROUTE_MAX_SIZE=5,
11336 -       NET_IPV4_ROUTE_GC_MIN_INTERVAL=6,
11337 -       NET_IPV4_ROUTE_GC_TIMEOUT=7,
11338 -       NET_IPV4_ROUTE_GC_INTERVAL=8,
11339 -       NET_IPV4_ROUTE_REDIRECT_LOAD=9,
11340 -       NET_IPV4_ROUTE_REDIRECT_NUMBER=10,
11341 -       NET_IPV4_ROUTE_REDIRECT_SILENCE=11,
11342 -       NET_IPV4_ROUTE_ERROR_COST=12,
11343 -       NET_IPV4_ROUTE_ERROR_BURST=13,
11344 -       NET_IPV4_ROUTE_GC_ELASTICITY=14,
11345 -       NET_IPV4_ROUTE_MTU_EXPIRES=15,
11346 -       NET_IPV4_ROUTE_MIN_PMTU=16,
11347 -       NET_IPV4_ROUTE_MIN_ADVMSS=17,
11348 -       NET_IPV4_ROUTE_SECRET_INTERVAL=18,
11349 -       NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19,
11350 -};
11351 -
11352 -enum
11353 -{
11354 -       NET_PROTO_CONF_ALL=-2,
11355 -       NET_PROTO_CONF_DEFAULT=-3
11356 -
11357 -       /* And device ifindices ... */
11358 -};
11359 -
11360 -enum
11361 -{
11362 -       NET_IPV4_CONF_FORWARDING=1,
11363 -       NET_IPV4_CONF_MC_FORWARDING=2,
11364 -       NET_IPV4_CONF_PROXY_ARP=3,
11365 -       NET_IPV4_CONF_ACCEPT_REDIRECTS=4,
11366 -       NET_IPV4_CONF_SECURE_REDIRECTS=5,
11367 -       NET_IPV4_CONF_SEND_REDIRECTS=6,
11368 -       NET_IPV4_CONF_SHARED_MEDIA=7,
11369 -       NET_IPV4_CONF_RP_FILTER=8,
11370 -       NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9,
11371 -       NET_IPV4_CONF_BOOTP_RELAY=10,
11372 -       NET_IPV4_CONF_LOG_MARTIANS=11,
11373 -       NET_IPV4_CONF_TAG=12,
11374 -       NET_IPV4_CONF_ARPFILTER=13,
11375 -       NET_IPV4_CONF_MEDIUM_ID=14,
11376 -       NET_IPV4_CONF_NOXFRM=15,
11377 -       NET_IPV4_CONF_NOPOLICY=16,
11378 -       NET_IPV4_CONF_FORCE_IGMP_VERSION=17,
11379 -       NET_IPV4_CONF_ARP_ANNOUNCE=18,
11380 -       NET_IPV4_CONF_ARP_IGNORE=19,
11381 -       NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
11382 -       NET_IPV4_CONF_ARP_ACCEPT=21,
11383 -       __NET_IPV4_CONF_MAX
11384 -};
11385 -
11386 -/* /proc/sys/net/ipv4/netfilter */
11387 -enum
11388 -{
11389 -       NET_IPV4_NF_CONNTRACK_MAX=1,
11390 -       NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2,
11391 -       NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3,
11392 -       NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4,
11393 -       NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5,
11394 -       NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6,
11395 -       NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7,
11396 -       NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8,
11397 -       NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9,
11398 -       NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT=10,
11399 -       NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11,
11400 -       NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT=12,
11401 -       NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT=13,
11402 -       NET_IPV4_NF_CONNTRACK_BUCKETS=14,
11403 -       NET_IPV4_NF_CONNTRACK_LOG_INVALID=15,
11404 -       NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16,
11405 -       NET_IPV4_NF_CONNTRACK_TCP_LOOSE=17,
11406 -       NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL=18,
11407 -       NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS=19,
11408 -       NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20,
11409 -       NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21,
11410 -       NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22,
11411 -       NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23,
11412 -       NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
11413 -       NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
11414 -       NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
11415 -       NET_IPV4_NF_CONNTRACK_COUNT=27,
11416 -       NET_IPV4_NF_CONNTRACK_CHECKSUM=28,
11417 -};
11418
11419 -/* /proc/sys/net/ipv6 */
11420 -enum {
11421 -       NET_IPV6_CONF=16,
11422 -       NET_IPV6_NEIGH=17,
11423 -       NET_IPV6_ROUTE=18,
11424 -       NET_IPV6_ICMP=19,
11425 -       NET_IPV6_BINDV6ONLY=20,
11426 -       NET_IPV6_IP6FRAG_HIGH_THRESH=21,
11427 -       NET_IPV6_IP6FRAG_LOW_THRESH=22,
11428 -       NET_IPV6_IP6FRAG_TIME=23,
11429 -       NET_IPV6_IP6FRAG_SECRET_INTERVAL=24,
11430 -       NET_IPV6_MLD_MAX_MSF=25,
11431 -};
11432 -
11433 -enum {
11434 -       NET_IPV6_ROUTE_FLUSH=1,
11435 -       NET_IPV6_ROUTE_GC_THRESH=2,
11436 -       NET_IPV6_ROUTE_MAX_SIZE=3,
11437 -       NET_IPV6_ROUTE_GC_MIN_INTERVAL=4,
11438 -       NET_IPV6_ROUTE_GC_TIMEOUT=5,
11439 -       NET_IPV6_ROUTE_GC_INTERVAL=6,
11440 -       NET_IPV6_ROUTE_GC_ELASTICITY=7,
11441 -       NET_IPV6_ROUTE_MTU_EXPIRES=8,
11442 -       NET_IPV6_ROUTE_MIN_ADVMSS=9,
11443 -       NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS=10
11444 -};
11445 -
11446 -enum {
11447 -       NET_IPV6_FORWARDING=1,
11448 -       NET_IPV6_HOP_LIMIT=2,
11449 -       NET_IPV6_MTU=3,
11450 -       NET_IPV6_ACCEPT_RA=4,
11451 -       NET_IPV6_ACCEPT_REDIRECTS=5,
11452 -       NET_IPV6_AUTOCONF=6,
11453 -       NET_IPV6_DAD_TRANSMITS=7,
11454 -       NET_IPV6_RTR_SOLICITS=8,
11455 -       NET_IPV6_RTR_SOLICIT_INTERVAL=9,
11456 -       NET_IPV6_RTR_SOLICIT_DELAY=10,
11457 -       NET_IPV6_USE_TEMPADDR=11,
11458 -       NET_IPV6_TEMP_VALID_LFT=12,
11459 -       NET_IPV6_TEMP_PREFERED_LFT=13,
11460 -       NET_IPV6_REGEN_MAX_RETRY=14,
11461 -       NET_IPV6_MAX_DESYNC_FACTOR=15,
11462 -       NET_IPV6_MAX_ADDRESSES=16,
11463 -       NET_IPV6_FORCE_MLD_VERSION=17,
11464 -       NET_IPV6_ACCEPT_RA_DEFRTR=18,
11465 -       NET_IPV6_ACCEPT_RA_PINFO=19,
11466 -       NET_IPV6_ACCEPT_RA_RTR_PREF=20,
11467 -       NET_IPV6_RTR_PROBE_INTERVAL=21,
11468 -       NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
11469 -       NET_IPV6_PROXY_NDP=23,
11470 -       NET_IPV6_ACCEPT_SOURCE_ROUTE=25,
11471 -       __NET_IPV6_MAX
11472 -};
11473 -
11474 -/* /proc/sys/net/ipv6/icmp */
11475 -enum {
11476 -       NET_IPV6_ICMP_RATELIMIT=1
11477 -};
11478 -
11479 -/* /proc/sys/net/<protocol>/neigh/<dev> */
11480 -enum {
11481 -       NET_NEIGH_MCAST_SOLICIT=1,
11482 -       NET_NEIGH_UCAST_SOLICIT=2,
11483 -       NET_NEIGH_APP_SOLICIT=3,
11484 -       NET_NEIGH_RETRANS_TIME=4,
11485 -       NET_NEIGH_REACHABLE_TIME=5,
11486 -       NET_NEIGH_DELAY_PROBE_TIME=6,
11487 -       NET_NEIGH_GC_STALE_TIME=7,
11488 -       NET_NEIGH_UNRES_QLEN=8,
11489 -       NET_NEIGH_PROXY_QLEN=9,
11490 -       NET_NEIGH_ANYCAST_DELAY=10,
11491 -       NET_NEIGH_PROXY_DELAY=11,
11492 -       NET_NEIGH_LOCKTIME=12,
11493 -       NET_NEIGH_GC_INTERVAL=13,
11494 -       NET_NEIGH_GC_THRESH1=14,
11495 -       NET_NEIGH_GC_THRESH2=15,
11496 -       NET_NEIGH_GC_THRESH3=16,
11497 -       NET_NEIGH_RETRANS_TIME_MS=17,
11498 -       NET_NEIGH_REACHABLE_TIME_MS=18,
11499 -       __NET_NEIGH_MAX
11500 -};
11501 -
11502 -/* /proc/sys/net/dccp */
11503 -enum {
11504 -       NET_DCCP_DEFAULT=1,
11505 -};
11506 -
11507 -/* /proc/sys/net/ipx */
11508 -enum {
11509 -       NET_IPX_PPROP_BROADCASTING=1,
11510 -       NET_IPX_FORWARDING=2
11511 -};
11512 -
11513 -/* /proc/sys/net/llc */
11514 -enum {
11515 -       NET_LLC2=1,
11516 -       NET_LLC_STATION=2,
11517 -};
11518 -
11519 -/* /proc/sys/net/llc/llc2 */
11520 -enum {
11521 -       NET_LLC2_TIMEOUT=1,
11522 -};
11523 -
11524 -/* /proc/sys/net/llc/station */
11525 -enum {
11526 -       NET_LLC_STATION_ACK_TIMEOUT=1,
11527 -};
11528 -
11529 -/* /proc/sys/net/llc/llc2/timeout */
11530 -enum {
11531 -       NET_LLC2_ACK_TIMEOUT=1,
11532 -       NET_LLC2_P_TIMEOUT=2,
11533 -       NET_LLC2_REJ_TIMEOUT=3,
11534 -       NET_LLC2_BUSY_TIMEOUT=4,
11535 -};
11536 -
11537 -/* /proc/sys/net/appletalk */
11538 -enum {
11539 -       NET_ATALK_AARP_EXPIRY_TIME=1,
11540 -       NET_ATALK_AARP_TICK_TIME=2,
11541 -       NET_ATALK_AARP_RETRANSMIT_LIMIT=3,
11542 -       NET_ATALK_AARP_RESOLVE_TIME=4
11543 -};
11544 -
11545 -
11546 -/* /proc/sys/net/netrom */
11547 -enum {
11548 -       NET_NETROM_DEFAULT_PATH_QUALITY=1,
11549 -       NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2,
11550 -       NET_NETROM_NETWORK_TTL_INITIALISER=3,
11551 -       NET_NETROM_TRANSPORT_TIMEOUT=4,
11552 -       NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5,
11553 -       NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6,
11554 -       NET_NETROM_TRANSPORT_BUSY_DELAY=7,
11555 -       NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8,
11556 -       NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9,
11557 -       NET_NETROM_ROUTING_CONTROL=10,
11558 -       NET_NETROM_LINK_FAILS_COUNT=11,
11559 -       NET_NETROM_RESET=12
11560 -};
11561 -
11562 -/* /proc/sys/net/ax25 */
11563 -enum {
11564 -       NET_AX25_IP_DEFAULT_MODE=1,
11565 -       NET_AX25_DEFAULT_MODE=2,
11566 -       NET_AX25_BACKOFF_TYPE=3,
11567 -       NET_AX25_CONNECT_MODE=4,
11568 -       NET_AX25_STANDARD_WINDOW=5,
11569 -       NET_AX25_EXTENDED_WINDOW=6,
11570 -       NET_AX25_T1_TIMEOUT=7,
11571 -       NET_AX25_T2_TIMEOUT=8,
11572 -       NET_AX25_T3_TIMEOUT=9,
11573 -       NET_AX25_IDLE_TIMEOUT=10,
11574 -       NET_AX25_N2=11,
11575 -       NET_AX25_PACLEN=12,
11576 -       NET_AX25_PROTOCOL=13,
11577 -       NET_AX25_DAMA_SLAVE_TIMEOUT=14
11578 -};
11579 -
11580 -/* /proc/sys/net/rose */
11581 -enum {
11582 -       NET_ROSE_RESTART_REQUEST_TIMEOUT=1,
11583 -       NET_ROSE_CALL_REQUEST_TIMEOUT=2,
11584 -       NET_ROSE_RESET_REQUEST_TIMEOUT=3,
11585 -       NET_ROSE_CLEAR_REQUEST_TIMEOUT=4,
11586 -       NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5,
11587 -       NET_ROSE_ROUTING_CONTROL=6,
11588 -       NET_ROSE_LINK_FAIL_TIMEOUT=7,
11589 -       NET_ROSE_MAX_VCS=8,
11590 -       NET_ROSE_WINDOW_SIZE=9,
11591 -       NET_ROSE_NO_ACTIVITY_TIMEOUT=10
11592 -};
11593 -
11594 -/* /proc/sys/net/x25 */
11595 -enum {
11596 -       NET_X25_RESTART_REQUEST_TIMEOUT=1,
11597 -       NET_X25_CALL_REQUEST_TIMEOUT=2,
11598 -       NET_X25_RESET_REQUEST_TIMEOUT=3,
11599 -       NET_X25_CLEAR_REQUEST_TIMEOUT=4,
11600 -       NET_X25_ACK_HOLD_BACK_TIMEOUT=5,
11601 -       NET_X25_FORWARD=6
11602 -};
11603 -
11604 -/* /proc/sys/net/token-ring */
11605 -enum
11606 -{
11607 -       NET_TR_RIF_TIMEOUT=1
11608 -};
11609 -
11610 -/* /proc/sys/net/decnet/ */
11611 -enum {
11612 -       NET_DECNET_NODE_TYPE = 1,
11613 -       NET_DECNET_NODE_ADDRESS = 2,
11614 -       NET_DECNET_NODE_NAME = 3,
11615 -       NET_DECNET_DEFAULT_DEVICE = 4,
11616 -       NET_DECNET_TIME_WAIT = 5,
11617 -       NET_DECNET_DN_COUNT = 6,
11618 -       NET_DECNET_DI_COUNT = 7,
11619 -       NET_DECNET_DR_COUNT = 8,
11620 -       NET_DECNET_DST_GC_INTERVAL = 9,
11621 -       NET_DECNET_CONF = 10,
11622 -       NET_DECNET_NO_FC_MAX_CWND = 11,
11623 -       NET_DECNET_MEM = 12,
11624 -       NET_DECNET_RMEM = 13,
11625 -       NET_DECNET_WMEM = 14,
11626 -       NET_DECNET_DEBUG_LEVEL = 255
11627 -};
11628 -
11629 -/* /proc/sys/net/decnet/conf/<dev> */
11630 -enum {
11631 -       NET_DECNET_CONF_LOOPBACK = -2,
11632 -       NET_DECNET_CONF_DDCMP = -3,
11633 -       NET_DECNET_CONF_PPP = -4,
11634 -       NET_DECNET_CONF_X25 = -5,
11635 -       NET_DECNET_CONF_GRE = -6,
11636 -       NET_DECNET_CONF_ETHER = -7
11637 -
11638 -       /* ... and ifindex of devices */
11639 -};
11640 -
11641 -/* /proc/sys/net/decnet/conf/<dev>/ */
11642 -enum {
11643 -       NET_DECNET_CONF_DEV_PRIORITY = 1,
11644 -       NET_DECNET_CONF_DEV_T1 = 2,
11645 -       NET_DECNET_CONF_DEV_T2 = 3,
11646 -       NET_DECNET_CONF_DEV_T3 = 4,
11647 -       NET_DECNET_CONF_DEV_FORWARDING = 5,
11648 -       NET_DECNET_CONF_DEV_BLKSIZE = 6,
11649 -       NET_DECNET_CONF_DEV_STATE = 7
11650 -};
11651 -
11652 -/* /proc/sys/net/sctp */
11653 -enum {
11654 -       NET_SCTP_RTO_INITIAL = 1,
11655 -       NET_SCTP_RTO_MIN     = 2,
11656 -       NET_SCTP_RTO_MAX     = 3,
11657 -       NET_SCTP_RTO_ALPHA   = 4,
11658 -       NET_SCTP_RTO_BETA    = 5,
11659 -       NET_SCTP_VALID_COOKIE_LIFE       =  6,
11660 -       NET_SCTP_ASSOCIATION_MAX_RETRANS =  7,
11661 -       NET_SCTP_PATH_MAX_RETRANS        =  8,
11662 -       NET_SCTP_MAX_INIT_RETRANSMITS    =  9,
11663 -       NET_SCTP_HB_INTERVAL             = 10,
11664 -       NET_SCTP_PRESERVE_ENABLE         = 11,
11665 -       NET_SCTP_MAX_BURST               = 12,
11666 -       NET_SCTP_ADDIP_ENABLE            = 13,
11667 -       NET_SCTP_PRSCTP_ENABLE           = 14,
11668 -       NET_SCTP_SNDBUF_POLICY           = 15,
11669 -       NET_SCTP_SACK_TIMEOUT            = 16,
11670 -       NET_SCTP_RCVBUF_POLICY           = 17,
11671 -};
11672 -
11673 -/* /proc/sys/net/bridge */
11674 -enum {
11675 -       NET_BRIDGE_NF_CALL_ARPTABLES = 1,
11676 -       NET_BRIDGE_NF_CALL_IPTABLES = 2,
11677 -       NET_BRIDGE_NF_CALL_IP6TABLES = 3,
11678 -       NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
11679 -       NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
11680 -};
11681 -
11682 -/* proc/sys/net/irda */
11683 -enum {
11684 -       NET_IRDA_DISCOVERY=1,
11685 -       NET_IRDA_DEVNAME=2,
11686 -       NET_IRDA_DEBUG=3,
11687 -       NET_IRDA_FAST_POLL=4,
11688 -       NET_IRDA_DISCOVERY_SLOTS=5,
11689 -       NET_IRDA_DISCOVERY_TIMEOUT=6,
11690 -       NET_IRDA_SLOT_TIMEOUT=7,
11691 -       NET_IRDA_MAX_BAUD_RATE=8,
11692 -       NET_IRDA_MIN_TX_TURN_TIME=9,
11693 -       NET_IRDA_MAX_TX_DATA_SIZE=10,
11694 -       NET_IRDA_MAX_TX_WINDOW=11,
11695 -       NET_IRDA_MAX_NOREPLY_TIME=12,
11696 -       NET_IRDA_WARN_NOREPLY_TIME=13,
11697 -       NET_IRDA_LAP_KEEPALIVE_TIME=14,
11698 -};
11699 -
11700 -
11701 -/* CTL_FS names: */
11702 -enum
11703 -{
11704 -       FS_NRINODE=1,   /* int:current number of allocated inodes */
11705 -       FS_STATINODE=2,
11706 -       FS_MAXINODE=3,  /* int:maximum number of inodes that can be allocated */
11707 -       FS_NRDQUOT=4,   /* int:current number of allocated dquots */
11708 -       FS_MAXDQUOT=5,  /* int:maximum number of dquots that can be allocated */
11709 -       FS_NRFILE=6,    /* int:current number of allocated filedescriptors */
11710 -       FS_MAXFILE=7,   /* int:maximum number of filedescriptors that can be allocated */
11711 -       FS_DENTRY=8,
11712 -       FS_NRSUPER=9,   /* int:current number of allocated super_blocks */
11713 -       FS_MAXSUPER=10, /* int:maximum number of super_blocks that can be allocated */
11714 -       FS_OVERFLOWUID=11,      /* int: overflow UID */
11715 -       FS_OVERFLOWGID=12,      /* int: overflow GID */
11716 -       FS_LEASES=13,   /* int: leases enabled */
11717 -       FS_DIR_NOTIFY=14,       /* int: directory notification enabled */
11718 -       FS_LEASE_TIME=15,       /* int: maximum time to wait for a lease break */
11719 -       FS_DQSTATS=16,  /* disc quota usage statistics and control */
11720 -       FS_XFS=17,      /* struct: control xfs parameters */
11721 -       FS_AIO_NR=18,   /* current system-wide number of aio requests */
11722 -       FS_AIO_MAX_NR=19,       /* system-wide maximum number of aio requests */
11723 -       FS_INOTIFY=20,  /* inotify submenu */
11724 -       FS_OCFS2=988,   /* ocfs2 */
11725 -};
11726 -
11727 -/* /proc/sys/fs/quota/ */
11728 -enum {
11729 -       FS_DQ_LOOKUPS = 1,
11730 -       FS_DQ_DROPS = 2,
11731 -       FS_DQ_READS = 3,
11732 -       FS_DQ_WRITES = 4,
11733 -       FS_DQ_CACHE_HITS = 5,
11734 -       FS_DQ_ALLOCATED = 6,
11735 -       FS_DQ_FREE = 7,
11736 -       FS_DQ_SYNCS = 8,
11737 -       FS_DQ_WARNINGS = 9,
11738 -};
11739 -
11740 -/* CTL_DEBUG names: */
11741 -
11742 -/* CTL_DEV names: */
11743 -enum {
11744 -       DEV_CDROM=1,
11745 -       DEV_HWMON=2,
11746 -       DEV_PARPORT=3,
11747 -       DEV_RAID=4,
11748 -       DEV_MAC_HID=5,
11749 -       DEV_SCSI=6,
11750 -       DEV_IPMI=7,
11751 -};
11752 -
11753 -/* /proc/sys/dev/cdrom */
11754 -enum {
11755 -       DEV_CDROM_INFO=1,
11756 -       DEV_CDROM_AUTOCLOSE=2,
11757 -       DEV_CDROM_AUTOEJECT=3,
11758 -       DEV_CDROM_DEBUG=4,
11759 -       DEV_CDROM_LOCK=5,
11760 -       DEV_CDROM_CHECK_MEDIA=6
11761 -};
11762 -
11763 -/* /proc/sys/dev/parport */
11764 -enum {
11765 -       DEV_PARPORT_DEFAULT=-3
11766 -};
11767 -
11768 -/* /proc/sys/dev/raid */
11769 -enum {
11770 -       DEV_RAID_SPEED_LIMIT_MIN=1,
11771 -       DEV_RAID_SPEED_LIMIT_MAX=2
11772 -};
11773 -
11774 -/* /proc/sys/dev/parport/default */
11775 -enum {
11776 -       DEV_PARPORT_DEFAULT_TIMESLICE=1,
11777 -       DEV_PARPORT_DEFAULT_SPINTIME=2
11778 -};
11779 -
11780 -/* /proc/sys/dev/parport/parport n */
11781 -enum {
11782 -       DEV_PARPORT_SPINTIME=1,
11783 -       DEV_PARPORT_BASE_ADDR=2,
11784 -       DEV_PARPORT_IRQ=3,
11785 -       DEV_PARPORT_DMA=4,
11786 -       DEV_PARPORT_MODES=5,
11787 -       DEV_PARPORT_DEVICES=6,
11788 -       DEV_PARPORT_AUTOPROBE=16
11789 -};
11790 -
11791 -/* /proc/sys/dev/parport/parport n/devices/ */
11792 -enum {
11793 -       DEV_PARPORT_DEVICES_ACTIVE=-3,
11794 -};
11795 -
11796 -/* /proc/sys/dev/parport/parport n/devices/device n */
11797 -enum {
11798 -       DEV_PARPORT_DEVICE_TIMESLICE=1,
11799 -};
11800 -
11801 -/* /proc/sys/dev/mac_hid */
11802 -enum {
11803 -       DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1,
11804 -       DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2,
11805 -       DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3,
11806 -       DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4,
11807 -       DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
11808 -       DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6
11809 -};
11810 -
11811 -/* /proc/sys/dev/scsi */
11812 -enum {
11813 -       DEV_SCSI_LOGGING_LEVEL=1,
11814 -};
11815 -
11816 -/* /proc/sys/dev/ipmi */
11817 -enum {
11818 -       DEV_IPMI_POWEROFF_POWERCYCLE=1,
11819 -};
11820 -
11821 -/* /proc/sys/abi */
11822 -enum
11823 -{
11824 -       ABI_DEFHANDLER_COFF=1,  /* default handler for coff binaries */
11825 -       ABI_DEFHANDLER_ELF=2,   /* default handler for ELF binaries */
11826 -       ABI_DEFHANDLER_LCALL7=3,/* default handler for procs using lcall7 */
11827 -       ABI_DEFHANDLER_LIBCSO=4,/* default handler for an libc.so ELF interp */
11828 -       ABI_TRACE=5,            /* tracing flags */
11829 -       ABI_FAKE_UTSNAME=6,     /* fake target utsname information */
11830 -};
11831 -
11832 -#ifdef __KERNEL__
11833 -#include <linux/list.h>
11834 -
11835 -/* For the /proc/sys support */
11836 -struct ctl_table;
11837 -struct nsproxy;
11838 -struct ctl_table_root;
11839 -
11840 -struct ctl_table_set {
11841 -       struct list_head list;
11842 -       struct ctl_table_set *parent;
11843 -       int (*is_seen)(struct ctl_table_set *);
11844 -};
11845 -
11846 -extern void setup_sysctl_set(struct ctl_table_set *p,
11847 -       struct ctl_table_set *parent,
11848 -       int (*is_seen)(struct ctl_table_set *));
11849 -
11850 -struct ctl_table_header;
11851 -
11852 -extern void sysctl_head_get(struct ctl_table_header *);
11853 -extern void sysctl_head_put(struct ctl_table_header *);
11854 -extern int sysctl_is_seen(struct ctl_table_header *);
11855 -extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *);
11856 -extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
11857 -extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
11858 -                                               struct ctl_table_header *prev);
11859 -extern void sysctl_head_finish(struct ctl_table_header *prev);
11860 -extern int sysctl_perm(struct ctl_table_root *root,
11861 -               struct ctl_table *table, int op);
11862 -
11863 -typedef struct ctl_table ctl_table;
11864 -
11865 -typedef int ctl_handler (struct ctl_table *table, int __user *name, int nlen,
11866 -                        void __user *oldval, size_t __user *oldlenp,
11867 -                        void __user *newval, size_t newlen);
11868 -
11869 -typedef int proc_handler (struct ctl_table *ctl, int write, struct file * filp,
11870 -                         void __user *buffer, size_t *lenp, loff_t *ppos);
11871 -
11872 -extern int proc_dostring(struct ctl_table *, int, struct file *,
11873 -                        void __user *, size_t *, loff_t *);
11874 -extern int proc_dointvec(struct ctl_table *, int, struct file *,
11875 -                        void __user *, size_t *, loff_t *);
11876 -extern int proc_dointvec_minmax(struct ctl_table *, int, struct file *,
11877 -                               void __user *, size_t *, loff_t *);
11878 -extern int proc_dointvec_jiffies(struct ctl_table *, int, struct file *,
11879 -                                void __user *, size_t *, loff_t *);
11880 -extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int, struct file *,
11881 -                                       void __user *, size_t *, loff_t *);
11882 -extern int proc_dointvec_ms_jiffies(struct ctl_table *, int, struct file *,
11883 -                                   void __user *, size_t *, loff_t *);
11884 -extern int proc_doulongvec_minmax(struct ctl_table *, int, struct file *,
11885 -                                 void __user *, size_t *, loff_t *);
11886 -extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
11887 -                                     struct file *, void __user *, size_t *, loff_t *);
11888 -
11889 -extern int do_sysctl (int __user *name, int nlen,
11890 -                     void __user *oldval, size_t __user *oldlenp,
11891 -                     void __user *newval, size_t newlen);
11892 -
11893 -extern ctl_handler sysctl_data;
11894 -extern ctl_handler sysctl_string;
11895 -extern ctl_handler sysctl_intvec;
11896 -extern ctl_handler sysctl_jiffies;
11897 -extern ctl_handler sysctl_ms_jiffies;
11898 -
11899 -
11900 -/*
11901 - * Register a set of sysctl names by calling register_sysctl_table
11902 - * with an initialised array of struct ctl_table's.  An entry with zero
11903 - * ctl_name and NULL procname terminates the table.  table->de will be
11904 - * set up by the registration and need not be initialised in advance.
11905 - *
11906 - * sysctl names can be mirrored automatically under /proc/sys.  The
11907 - * procname supplied controls /proc naming.
11908 - *
11909 - * The table's mode will be honoured both for sys_sysctl(2) and
11910 - * proc-fs access.
11911 - *
11912 - * Leaf nodes in the sysctl tree will be represented by a single file
11913 - * under /proc; non-leaf nodes will be represented by directories.  A
11914 - * null procname disables /proc mirroring at this node.
11915 - *
11916 - * sysctl entries with a zero ctl_name will not be available through
11917 - * the binary sysctl interface.
11918 - *
11919 - * sysctl(2) can automatically manage read and write requests through
11920 - * the sysctl table.  The data and maxlen fields of the ctl_table
11921 - * struct enable minimal validation of the values being written to be
11922 - * performed, and the mode field allows minimal authentication.
11923 - * 
11924 - * More sophisticated management can be enabled by the provision of a
11925 - * strategy routine with the table entry.  This will be called before
11926 - * any automatic read or write of the data is performed.
11927 - * 
11928 - * The strategy routine may return:
11929 - * <0: Error occurred (error is passed to user process)
11930 - * 0:  OK - proceed with automatic read or write.
11931 - * >0: OK - read or write has been done by the strategy routine, so 
11932 - *     return immediately.
11933 - * 
11934 - * There must be a proc_handler routine for any terminal nodes
11935 - * mirrored under /proc/sys (non-terminals are handled by a built-in
11936 - * directory handler).  Several default handlers are available to
11937 - * cover common cases.
11938 - */
11939 -
11940 -/* A sysctl table is an array of struct ctl_table: */
11941 -struct ctl_table 
11942 -{
11943 -       int ctl_name;                   /* Binary ID */
11944 -       const char *procname;           /* Text ID for /proc/sys, or zero */
11945 -       void *data;
11946 -       int maxlen;
11947 -       mode_t mode;
11948 -       struct ctl_table *child;
11949 -       struct ctl_table *parent;       /* Automatically set */
11950 -       proc_handler *proc_handler;     /* Callback for text formatting */
11951 -       ctl_handler *strategy;          /* Callback function for all r/w */
11952 -       void *extra1;
11953 -       void *extra2;
11954 -};
11955 -
11956 -struct ctl_table_root {
11957 -       struct list_head root_list;
11958 -       struct ctl_table_set default_set;
11959 -       struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
11960 -                                          struct nsproxy *namespaces);
11961 -       int (*permissions)(struct ctl_table_root *root,
11962 -                       struct nsproxy *namespaces, struct ctl_table *table);
11963 -};
11964 -
11965 -/* struct ctl_table_header is used to maintain dynamic lists of
11966 -   struct ctl_table trees. */
11967 -struct ctl_table_header
11968 -{
11969 -       struct ctl_table *ctl_table;
11970 -       struct list_head ctl_entry;
11971 -       int used;
11972 -       int count;
11973 -       struct completion *unregistering;
11974 -       struct ctl_table *ctl_table_arg;
11975 -       struct ctl_table_root *root;
11976 -       struct ctl_table_set *set;
11977 -       struct ctl_table *attached_by;
11978 -       struct ctl_table *attached_to;
11979 -       struct ctl_table_header *parent;
11980 -};
11981 -
11982 -/* struct ctl_path describes where in the hierarchy a table is added */
11983 -struct ctl_path {
11984 -       const char *procname;
11985 -       int ctl_name;
11986 -};
11987 -
11988 -void register_sysctl_root(struct ctl_table_root *root);
11989 -struct ctl_table_header *__register_sysctl_paths(
11990 -       struct ctl_table_root *root, struct nsproxy *namespaces,
11991 -       const struct ctl_path *path, struct ctl_table *table);
11992 -struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
11993 -struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
11994 -                                               struct ctl_table *table);
11995 -
11996 -void unregister_sysctl_table(struct ctl_table_header * table);
11997 -int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table);
11998 -
11999 -#endif /* __KERNEL__ */
12000 -
12001 -#endif /* _LINUX_SYSCTL_H */
12002 diff -Nurb linux-2.6.27-720/include/linux/textsearch.h linux-2.6.27-710/include/linux/textsearch.h
12003 --- linux-2.6.27-720/include/linux/textsearch.h 2009-05-04 12:18:34.000000000 -0400
12004 +++ linux-2.6.27-710/include/linux/textsearch.h 2008-10-09 18:13:53.000000000 -0400
12005 @@ -162,9 +162,9 @@
12006  {
12007         struct ts_config *conf;
12008  
12009 -       conf = (struct ts_config *) kzalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask);
12010 +       conf = kzalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask);
12011         if (conf == NULL)
12012 -               return (struct ts_config *) ERR_PTR(-ENOMEM);
12013 +               return ERR_PTR(-ENOMEM);
12014  
12015         return conf;
12016  }
12017 diff -Nurb linux-2.6.27-720/include/linux/types.h linux-2.6.27-710/include/linux/types.h
12018 --- linux-2.6.27-720/include/linux/types.h      2009-05-04 12:18:34.000000000 -0400
12019 +++ linux-2.6.27-710/include/linux/types.h      2009-05-04 12:15:13.000000000 -0400
12020 @@ -30,9 +30,7 @@
12021  typedef __kernel_mqd_t         mqd_t;
12022  
12023  #ifdef __KERNEL__
12024 -#ifndef __cplusplus
12025  typedef _Bool                  bool;
12026 -#endif
12027  
12028  typedef __kernel_uid32_t       uid_t;
12029  typedef __kernel_gid32_t       gid_t;
12030 @@ -211,12 +209,4 @@
12031  
12032  #endif /* __KERNEL__ */
12033  
12034 -/*
12035 - * Click: Macros for defining empty structures. Needed because GCC's C and C++
12036 - * compilers have different ABIs for empty structures.
12037 - */
12038 -
12039 -#define EMPTY_STRUCT_DECL(s) struct s { int gcc_is_buggy; }
12040 -#define EMPTY_STRUCT_INIT(s) (s) { 0 }
12041 -
12042  #endif /* _LINUX_TYPES_H */
12043 diff -Nurb linux-2.6.27-720/include/linux/unwind.h linux-2.6.27-710/include/linux/unwind.h
12044 --- linux-2.6.27-720/include/linux/unwind.h     2009-05-04 12:18:34.000000000 -0400
12045 +++ linux-2.6.27-710/include/linux/unwind.h     2008-10-09 18:13:53.000000000 -0400
12046 @@ -14,7 +14,7 @@
12047  
12048  struct module;
12049  
12050 -EMPTY_STRUCT_DECL(unwind_frame_info);
12051 +struct unwind_frame_info {};
12052  
12053  static inline void unwind_init(void) {}
12054  static inline void unwind_setup(void) {}
12055 diff -Nurb linux-2.6.27-720/include/linux/wait.h linux-2.6.27-710/include/linux/wait.h
12056 --- linux-2.6.27-720/include/linux/wait.h       2009-05-04 12:18:34.000000000 -0400
12057 +++ linux-2.6.27-710/include/linux/wait.h       2008-10-09 18:13:53.000000000 -0400
12058 @@ -485,7 +485,7 @@
12059  static inline int wait_on_bit(void *word, int bit,
12060                                 int (*action)(void *), unsigned mode)
12061  {
12062 -       if (!test_bit(bit, (volatile unsigned long *) word))
12063 +       if (!test_bit(bit, word))
12064                 return 0;
12065         return out_of_line_wait_on_bit(word, bit, action, mode);
12066  }
12067 @@ -509,7 +509,7 @@
12068  static inline int wait_on_bit_lock(void *word, int bit,
12069                                 int (*action)(void *), unsigned mode)
12070  {
12071 -       if (!test_and_set_bit(bit, (volatile unsigned long *) word))
12072 +       if (!test_and_set_bit(bit, word))
12073                 return 0;
12074         return out_of_line_wait_on_bit_lock(word, bit, action, mode);
12075  }
12076 diff -Nurb linux-2.6.27-720/include/net/compat.h linux-2.6.27-710/include/net/compat.h
12077 --- linux-2.6.27-720/include/net/compat.h       2009-05-04 12:18:34.000000000 -0400
12078 +++ linux-2.6.27-710/include/net/compat.h       2008-10-09 18:13:53.000000000 -0400
12079 @@ -33,9 +33,9 @@
12080  
12081  extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
12082  extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int);
12083 -asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
12084 -asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
12085 -asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
12086 +extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
12087 +extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
12088 +extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
12089  extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
12090  
12091  extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
12092 diff -Nurb linux-2.6.27-720/include/net/neighbour.h linux-2.6.27-710/include/net/neighbour.h
12093 --- linux-2.6.27-720/include/net/neighbour.h    2009-05-04 12:18:34.000000000 -0400
12094 +++ linux-2.6.27-710/include/net/neighbour.h    2008-10-09 18:13:53.000000000 -0400
12095 @@ -275,7 +275,7 @@
12096                                                       struct neigh_parms *p,
12097                                                       int p_id, int pdev_id,
12098                                                       char *p_name,
12099 -                                                     proc_handler_t *proc_handler,
12100 +                                                     proc_handler *proc_handler,
12101                                                       ctl_handler *strategy);
12102  extern void                    neigh_sysctl_unregister(struct neigh_parms *p);
12103  
12104 diff -Nurb linux-2.6.27-720/include/net/netlink.h linux-2.6.27-710/include/net/netlink.h
12105 --- linux-2.6.27-720/include/net/netlink.h      2009-05-04 12:18:34.000000000 -0400
12106 +++ linux-2.6.27-710/include/net/netlink.h      2008-10-09 18:13:53.000000000 -0400
12107 @@ -315,7 +315,7 @@
12108  static inline struct nlattr *nlmsg_attrdata(const struct nlmsghdr *nlh,
12109                                             int hdrlen)
12110  {
12111 -       unsigned char *data = (unsigned char *)  nlmsg_data(nlh);
12112 +       unsigned char *data = nlmsg_data(nlh);
12113         return (struct nlattr *) (data + NLMSG_ALIGN(hdrlen));
12114  }
12115  
12116 @@ -732,7 +732,7 @@
12117   */
12118  static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
12119  {
12120 -       return nla_find((struct nlattr *) nla_data(nla), nla_len(nla), attrtype);
12121 +       return nla_find(nla_data(nla), nla_len(nla), attrtype);
12122  }
12123  
12124  /**
12125 @@ -748,7 +748,7 @@
12126                                    struct nlattr *nla,
12127                                    const struct nla_policy *policy)
12128  {
12129 -       return nla_parse(tb, maxtype, (struct nlattr *) nla_data(nla), nla_len(nla), policy);
12130 +       return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
12131  }
12132  
12133  /**
12134 @@ -775,7 +775,7 @@
12135         if (nested_len < 0)
12136                 return -EINVAL;
12137         if (nested_len >= nla_attr_size(0))
12138 -               return nla_parse(tb, maxtype, (struct nlattr *) nla_data(nla) + NLA_ALIGN(len),
12139 +               return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
12140                                  nested_len, policy);
12141         memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
12142         return 0;
12143 @@ -1069,7 +1069,7 @@
12144   */
12145  static inline int nla_nest_compat_end(struct sk_buff *skb, struct nlattr *start)
12146  {
12147 -       struct nlattr *nest = (struct nlattr *) (char *)start + NLMSG_ALIGN(start->nla_len);
12148 +       struct nlattr *nest = (void *)start + NLMSG_ALIGN(start->nla_len);
12149  
12150         start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start;
12151         return nla_nest_end(skb, nest);
12152 @@ -1103,7 +1103,7 @@
12153  static inline int nla_validate_nested(struct nlattr *start, int maxtype,
12154                                       const struct nla_policy *policy)
12155  {
12156 -       return nla_validate((struct nlattr *) nla_data(start), nla_len(start), maxtype, policy);
12157 +       return nla_validate(nla_data(start), nla_len(start), maxtype, policy);
12158  }
12159  
12160  /**
12161 diff -Nurb linux-2.6.27-720/include/net/pkt_cls.h linux-2.6.27-710/include/net/pkt_cls.h
12162 --- linux-2.6.27-720/include/net/pkt_cls.h      2009-05-04 12:18:34.000000000 -0400
12163 +++ linux-2.6.27-710/include/net/pkt_cls.h      2008-10-09 18:13:53.000000000 -0400
12164 @@ -302,7 +302,9 @@
12165  
12166  #else /* CONFIG_NET_EMATCH */
12167  
12168 -EMPTY_STRUCT_DECL(tcf_ematch_tree);
12169 +struct tcf_ematch_tree
12170 +{
12171 +};
12172  
12173  #define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0)
12174  #define tcf_em_tree_destroy(tp, t) do { (void)(t); } while(0)
12175 diff -Nurb linux-2.6.27-720/include/net/request_sock.h linux-2.6.27-710/include/net/request_sock.h
12176 --- linux-2.6.27-720/include/net/request_sock.h 2009-05-04 12:18:34.000000000 -0400
12177 +++ linux-2.6.27-710/include/net/request_sock.h 2008-10-09 18:13:53.000000000 -0400
12178 @@ -60,7 +60,7 @@
12179  
12180  static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *ops)
12181  {
12182 -       struct request_sock *req = (struct request_sock *) kmem_cache_alloc(ops->slab, GFP_ATOMIC);
12183 +       struct request_sock *req = kmem_cache_alloc(ops->slab, GFP_ATOMIC);
12184  
12185         if (req != NULL)
12186                 req->rsk_ops = ops;
12187 diff -Nurb linux-2.6.27-720/include/net/route.h linux-2.6.27-710/include/net/route.h
12188 --- linux-2.6.27-720/include/net/route.h        2009-05-04 12:18:34.000000000 -0400
12189 +++ linux-2.6.27-710/include/net/route.h        2009-05-04 12:15:13.000000000 -0400
12190 @@ -161,16 +161,6 @@
12191                                    __be16 sport, __be16 dport, struct sock *sk,
12192                                    int flags)
12193  {
12194 -#ifdef __cplusplus
12195 -       struct flowi fl;
12196 -       fl.oif = oif;
12197 -       fl.nl_u.ip4_u.daddr = dst;
12198 -       fl.nl_u.ip4_u.saddr = src;
12199 -       fl.nl_u.ip4_u.tos = tos;
12200 -       fl.proto = protocol;
12201 -       fl.uli_u.ports.sport = sport;
12202 -       fl.uli_u.ports.dport = dport;
12203 -#else
12204         struct flowi fl = { .oif = oif,
12205                             .mark = sk->sk_mark,
12206                             .nl_u = { .ip4_u = { .daddr = dst,
12207 @@ -180,7 +170,6 @@
12208                             .uli_u = { .ports =
12209                                        { .sport = sport,
12210                                          .dport = dport } } };
12211 -#endif
12212  
12213         int err;
12214         struct net *net = sock_net(sk);
12215 diff -Nurb linux-2.6.27-720/include/net/sock.h linux-2.6.27-710/include/net/sock.h
12216 --- linux-2.6.27-720/include/net/sock.h 2009-05-04 12:18:34.000000000 -0400
12217 +++ linux-2.6.27-710/include/net/sock.h 2009-05-04 12:15:13.000000000 -0400
12218 @@ -1104,13 +1104,13 @@
12219  {
12220         if (skb->ip_summed == CHECKSUM_NONE) {
12221                 int err = 0;
12222 -               __wsum csum = csum_and_copy_from_user((unsigned char *) from,
12223 -                                                    (unsigned char *) page_address(page) + off,
12224 +               __wsum csum = csum_and_copy_from_user(from,
12225 +                                                    page_address(page) + off,
12226                                                             copy, 0, &err);
12227                 if (err)
12228                         return err;
12229                 skb->csum = csum_block_add(skb->csum, csum, skb->len);
12230 -       } else if (copy_from_user((char *) page_address(page) + off, from, copy))
12231 +       } else if (copy_from_user(page_address(page) + off, from, copy))
12232                 return -EFAULT;
12233  
12234         skb->len             += copy;
12235 diff -Nurb linux-2.6.27-720/include/rdma/ib_user_verbs.h linux-2.6.27-710/include/rdma/ib_user_verbs.h
12236 --- linux-2.6.27-720/include/rdma/ib_user_verbs.h       2009-05-04 12:18:34.000000000 -0400
12237 +++ linux-2.6.27-710/include/rdma/ib_user_verbs.h       2008-10-09 18:13:53.000000000 -0400
12238 @@ -504,7 +504,8 @@
12239         __u64 driver_data[0];
12240  };
12241  
12242 -EMPTY_STRUCT_DECL(ib_uverbs_modify_qp_resp);
12243 +struct ib_uverbs_modify_qp_resp {
12244 +};
12245  
12246  struct ib_uverbs_destroy_qp {
12247         __u64 response;
12248 diff -Nurb linux-2.6.27-720/kernel/sched.c linux-2.6.27-710/kernel/sched.c
12249 --- linux-2.6.27-720/kernel/sched.c     2009-05-04 12:18:34.000000000 -0400
12250 +++ linux-2.6.27-710/kernel/sched.c     2009-05-04 12:15:14.000000000 -0400
12251 @@ -6298,7 +6298,7 @@
12252  static void
12253  set_table_entry(struct ctl_table *entry,
12254                 const char *procname, void *data, int maxlen,
12255 -               mode_t mode, proc_handler_t *proc_handler)
12256 +               mode_t mode, proc_handler *proc_handler)
12257  {
12258         entry->procname = procname;
12259         entry->data = data;
12260 diff -Nurb linux-2.6.27-720/net/core/dev.c linux-2.6.27-710/net/core/dev.c
12261 --- linux-2.6.27-720/net/core/dev.c     2009-05-04 12:19:35.000000000 -0400
12262 +++ linux-2.6.27-710/net/core/dev.c     2009-05-04 12:16:04.000000000 -0400
12263 @@ -252,9 +252,6 @@
12264         write_unlock_bh(&dev_base_lock);
12265  }
12266  
12267 -/* Click: input packet handlers, might steal packets from net_rx_action. */
12268 -static RAW_NOTIFIER_HEAD(net_in_chain);
12269 -
12270  /*
12271   *     Our notifier list
12272   */
12273 @@ -2024,31 +2021,6 @@
12274         return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
12275  }
12276  
12277 -
12278 -/*
12279 - * Click: Allow Click to ask to intercept input packets.
12280 - */
12281 -int
12282 -register_net_in(struct notifier_block *nb)
12283 -{
12284 -       int err;
12285 -       rtnl_lock();
12286 -       err = raw_notifier_chain_register(&net_in_chain, nb);
12287 -       rtnl_unlock();
12288 -       return err;
12289 -}
12290 -
12291 -int
12292 -unregister_net_in(struct notifier_block *nb)
12293 -{
12294 -       int err;
12295 -       rtnl_lock();
12296 -       err = raw_notifier_chain_unregister(&net_in_chain, nb);
12297 -       rtnl_unlock();
12298 -       return err;
12299 -}
12300 -
12301 -
12302  #if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE)
12303  /* These hooks defined here for ATM */
12304  struct net_bridge;
12305 @@ -2219,14 +2191,14 @@
12306   *     NET_RX_SUCCESS: no congestion
12307   *     NET_RX_DROP: packet was dropped
12308   */
12309 -int __netif_receive_skb(struct sk_buff *skb)
12310 +int netif_receive_skb(struct sk_buff *skb)
12311  {
12312         struct packet_type *ptype, *pt_prev;
12313         struct net_device *orig_dev;
12314         struct net_device *null_or_orig;
12315         int ret = NET_RX_DROP;
12316         int *cur_elevator = &__get_cpu_var(sknid_elevator);
12317 -       //__be16 type;
12318 +       __be16 type;
12319  
12320         *cur_elevator = 0;
12321  
12322 @@ -2255,14 +2227,6 @@
12323         skb_reset_transport_header(skb);
12324         skb->mac_len = skb->network_header - skb->mac_header;
12325  
12326 -       /* Click: may want to steal the packet */
12327 -       if (notifier_data >= 0
12328 -           && raw_notifier_call_chain(&net_in_chain,
12329 -                                  notifier_data,
12330 -                                  skb) & NOTIFY_STOP_MASK) {
12331 -               return ret;
12332 -       }
12333
12334         pt_prev = NULL;
12335  
12336         rcu_read_lock();
12337 @@ -2381,8 +2345,7 @@
12338                 }
12339                 local_irq_enable();
12340  
12341 -               __netif_receive_skb(skb, skb->protocol, skb_queue_len(&queue->input_pkt_queue));
12342 -//XXX          netif_receive_skb(skb);
12343 +               netif_receive_skb(skb);
12344         } while (++work < quota && jiffies == start_time);
12345  
12346         return work;
12347 @@ -4935,7 +4898,6 @@
12348  EXPORT_SYMBOL(dev_get_by_index);
12349  EXPORT_SYMBOL(dev_get_by_name);
12350  EXPORT_SYMBOL(dev_open);
12351 -EXPORT_SYMBOL(dev_ioctl);
12352  EXPORT_SYMBOL(dev_queue_xmit);
12353  EXPORT_SYMBOL(dev_remove_pack);
12354  EXPORT_SYMBOL(dev_set_allmulti);
12355 @@ -4948,16 +4910,10 @@
12356  EXPORT_SYMBOL(netdev_set_master);
12357  EXPORT_SYMBOL(netdev_state_change);
12358  EXPORT_SYMBOL(netif_receive_skb);
12359 -EXPORT_SYMBOL(__netif_receive_skb);
12360  EXPORT_SYMBOL(netif_rx);
12361  EXPORT_SYMBOL(register_gifconf);
12362  EXPORT_SYMBOL(register_netdevice);
12363  EXPORT_SYMBOL(register_netdevice_notifier);
12364 -
12365 -/* Click */
12366 -EXPORT_SYMBOL(register_net_in);
12367 -EXPORT_SYMBOL(unregister_net_in);
12368 -
12369  EXPORT_SYMBOL(skb_checksum_help);
12370  EXPORT_SYMBOL(synchronize_net);
12371  EXPORT_SYMBOL(unregister_netdevice);
12372 diff -Nurb linux-2.6.27-720/net/core/dev.c.orig linux-2.6.27-710/net/core/dev.c.orig
12373 --- linux-2.6.27-720/net/core/dev.c.orig        2009-05-04 12:16:04.000000000 -0400
12374 +++ linux-2.6.27-710/net/core/dev.c.orig        1969-12-31 19:00:00.000000000 -0500
12375 @@ -1,4936 +0,0 @@
12376 -/*
12377 - *     NET3    Protocol independent device support routines.
12378 - *
12379 - *             This program is free software; you can redistribute it and/or
12380 - *             modify it under the terms of the GNU General Public License
12381 - *             as published by the Free Software Foundation; either version
12382 - *             2 of the License, or (at your option) any later version.
12383 - *
12384 - *     Derived from the non IP parts of dev.c 1.0.19
12385 - *             Authors:        Ross Biro
12386 - *                             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12387 - *                             Mark Evans, <evansmp@uhura.aston.ac.uk>
12388 - *
12389 - *     Additional Authors:
12390 - *             Florian la Roche <rzsfl@rz.uni-sb.de>
12391 - *             Alan Cox <gw4pts@gw4pts.ampr.org>
12392 - *             David Hinds <dahinds@users.sourceforge.net>
12393 - *             Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
12394 - *             Adam Sulmicki <adam@cfar.umd.edu>
12395 - *              Pekka Riikonen <priikone@poesidon.pspt.fi>
12396 - *
12397 - *     Changes:
12398 - *              D.J. Barrow     :       Fixed bug where dev->refcnt gets set
12399 - *                                     to 2 if register_netdev gets called
12400 - *                                     before net_dev_init & also removed a
12401 - *                                     few lines of code in the process.
12402 - *             Alan Cox        :       device private ioctl copies fields back.
12403 - *             Alan Cox        :       Transmit queue code does relevant
12404 - *                                     stunts to keep the queue safe.
12405 - *             Alan Cox        :       Fixed double lock.
12406 - *             Alan Cox        :       Fixed promisc NULL pointer trap
12407 - *             ????????        :       Support the full private ioctl range
12408 - *             Alan Cox        :       Moved ioctl permission check into
12409 - *                                     drivers
12410 - *             Tim Kordas      :       SIOCADDMULTI/SIOCDELMULTI
12411 - *             Alan Cox        :       100 backlog just doesn't cut it when
12412 - *                                     you start doing multicast video 8)
12413 - *             Alan Cox        :       Rewrote net_bh and list manager.
12414 - *             Alan Cox        :       Fix ETH_P_ALL echoback lengths.
12415 - *             Alan Cox        :       Took out transmit every packet pass
12416 - *                                     Saved a few bytes in the ioctl handler
12417 - *             Alan Cox        :       Network driver sets packet type before
12418 - *                                     calling netif_rx. Saves a function
12419 - *                                     call a packet.
12420 - *             Alan Cox        :       Hashed net_bh()
12421 - *             Richard Kooijman:       Timestamp fixes.
12422 - *             Alan Cox        :       Wrong field in SIOCGIFDSTADDR
12423 - *             Alan Cox        :       Device lock protection.
12424 - *             Alan Cox        :       Fixed nasty side effect of device close
12425 - *                                     changes.
12426 - *             Rudi Cilibrasi  :       Pass the right thing to
12427 - *                                     set_mac_address()
12428 - *             Dave Miller     :       32bit quantity for the device lock to
12429 - *                                     make it work out on a Sparc.
12430 - *             Bjorn Ekwall    :       Added KERNELD hack.
12431 - *             Alan Cox        :       Cleaned up the backlog initialise.
12432 - *             Craig Metz      :       SIOCGIFCONF fix if space for under
12433 - *                                     1 device.
12434 - *         Thomas Bogendoerfer :       Return ENODEV for dev_open, if there
12435 - *                                     is no device open function.
12436 - *             Andi Kleen      :       Fix error reporting for SIOCGIFCONF
12437 - *         Michael Chastain    :       Fix signed/unsigned for SIOCGIFCONF
12438 - *             Cyrus Durgin    :       Cleaned for KMOD
12439 - *             Adam Sulmicki   :       Bug Fix : Network Device Unload
12440 - *                                     A network device unload needs to purge
12441 - *                                     the backlog queue.
12442 - *     Paul Rusty Russell      :       SIOCSIFNAME
12443 - *              Pekka Riikonen  :      Netdev boot-time settings code
12444 - *              Andrew Morton   :       Make unregister_netdevice wait
12445 - *                                     indefinitely on dev->refcnt
12446 - *             J Hadi Salim    :       - Backlog queue sampling
12447 - *                                     - netif_rx() feedback
12448 - */
12449 -
12450 -#include <asm/uaccess.h>
12451 -#include <asm/system.h>
12452 -#include <linux/bitops.h>
12453 -#include <linux/capability.h>
12454 -#include <linux/cpu.h>
12455 -#include <linux/types.h>
12456 -#include <linux/kernel.h>
12457 -#include <linux/sched.h>
12458 -#include <linux/mutex.h>
12459 -#include <linux/string.h>
12460 -#include <linux/mm.h>
12461 -#include <linux/socket.h>
12462 -#include <linux/sockios.h>
12463 -#include <linux/errno.h>
12464 -#include <linux/interrupt.h>
12465 -#include <linux/if_ether.h>
12466 -#include <linux/netdevice.h>
12467 -#include <linux/etherdevice.h>
12468 -#include <linux/ethtool.h>
12469 -#include <linux/notifier.h>
12470 -#include <linux/skbuff.h>
12471 -#include <net/net_namespace.h>
12472 -#include <net/sock.h>
12473 -#include <linux/rtnetlink.h>
12474 -#include <linux/proc_fs.h>
12475 -#include <linux/seq_file.h>
12476 -#include <linux/stat.h>
12477 -#include <linux/ip.h>
12478 -#include <linux/tcp.h>
12479 -#include <linux/if_bridge.h>
12480 -#include <linux/if_macvlan.h>
12481 -#include <net/dst.h>
12482 -#include <net/pkt_sched.h>
12483 -#include <net/checksum.h>
12484 -#include <linux/highmem.h>
12485 -#include <linux/init.h>
12486 -#include <linux/kmod.h>
12487 -#include <linux/module.h>
12488 -#include <linux/kallsyms.h>
12489 -#include <linux/netpoll.h>
12490 -#include <linux/rcupdate.h>
12491 -#include <linux/delay.h>
12492 -#include <net/wext.h>
12493 -#include <net/iw_handler.h>
12494 -#include <asm/current.h>
12495 -#include <linux/audit.h>
12496 -#include <linux/dmaengine.h>
12497 -#include <linux/err.h>
12498 -#include <linux/ctype.h>
12499 -#include <linux/if_arp.h>
12500 -#include <linux/if_vlan.h>
12501 -#include <linux/ip.h>
12502 -#include <net/ip.h>
12503 -#include <linux/ipv6.h>
12504 -#include <linux/in.h>
12505 -#include <linux/jhash.h>
12506 -#include <linux/random.h>
12507 -#include <linux/vs_inet.h>
12508 -
12509 -#include "net-sysfs.h"
12510 -
12511 -/*
12512 - *     The list of packet types we will receive (as opposed to discard)
12513 - *     and the routines to invoke.
12514 - *
12515 - *     Why 16. Because with 16 the only overlap we get on a hash of the
12516 - *     low nibble of the protocol value is RARP/SNAP/X.25.
12517 - *
12518 - *      NOTE:  That is no longer true with the addition of VLAN tags.  Not
12519 - *             sure which should go first, but I bet it won't make much
12520 - *             difference if we are running VLANs.  The good news is that
12521 - *             this protocol won't be in the list unless compiled in, so
12522 - *             the average user (w/out VLANs) will not be adversely affected.
12523 - *             --BLG
12524 - *
12525 - *             0800    IP
12526 - *             8100    802.1Q VLAN
12527 - *             0001    802.3
12528 - *             0002    AX.25
12529 - *             0004    802.2
12530 - *             8035    RARP
12531 - *             0005    SNAP
12532 - *             0805    X.25
12533 - *             0806    ARP
12534 - *             8137    IPX
12535 - *             0009    Localtalk
12536 - *             86DD    IPv6
12537 - */
12538 -
12539 -#define PTYPE_HASH_SIZE        (16)
12540 -#define PTYPE_HASH_MASK        (PTYPE_HASH_SIZE - 1)
12541 -
12542 -static DEFINE_SPINLOCK(ptype_lock);
12543 -static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
12544 -static struct list_head ptype_all __read_mostly;       /* Taps */
12545 -
12546 -#ifdef CONFIG_NET_DMA
12547 -struct net_dma {
12548 -       struct dma_client client;
12549 -       spinlock_t lock;
12550 -       cpumask_t channel_mask;
12551 -       struct dma_chan **channels;
12552 -};
12553 -
12554 -static enum dma_state_client
12555 -netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
12556 -       enum dma_state state);
12557 -
12558 -static struct net_dma net_dma = {
12559 -       .client = {
12560 -               .event_callback = netdev_dma_event,
12561 -       },
12562 -};
12563 -#endif
12564 -
12565 -/*
12566 - * The @dev_base_head list is protected by @dev_base_lock and the rtnl
12567 - * semaphore.
12568 - *
12569 - * Pure readers hold dev_base_lock for reading.
12570 - *
12571 - * Writers must hold the rtnl semaphore while they loop through the
12572 - * dev_base_head list, and hold dev_base_lock for writing when they do the
12573 - * actual updates.  This allows pure readers to access the list even
12574 - * while a writer is preparing to update it.
12575 - *
12576 - * To put it another way, dev_base_lock is held for writing only to
12577 - * protect against pure readers; the rtnl semaphore provides the
12578 - * protection against other writers.
12579 - *
12580 - * See, for example usages, register_netdevice() and
12581 - * unregister_netdevice(), which must be called with the rtnl
12582 - * semaphore held.
12583 - */
12584 -DEFINE_RWLOCK(dev_base_lock);
12585 -
12586 -EXPORT_SYMBOL(dev_base_lock);
12587 -
12588 -#define NETDEV_HASHBITS        8
12589 -#define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS)
12590 -
12591 -static inline struct hlist_head *dev_name_hash(struct net *net, const char *name)
12592 -{
12593 -       unsigned hash = full_name_hash(name, strnlen(name, IFNAMSIZ));
12594 -       return &net->dev_name_head[hash & ((1 << NETDEV_HASHBITS) - 1)];
12595 -}
12596 -
12597 -static inline struct hlist_head *dev_index_hash(struct net *net, int ifindex)
12598 -{
12599 -       return &net->dev_index_head[ifindex & ((1 << NETDEV_HASHBITS) - 1)];
12600 -}
12601 -
12602 -/* Device list insertion */
12603 -static int list_netdevice(struct net_device *dev)
12604 -{
12605 -       struct net *net = dev_net(dev);
12606 -
12607 -       ASSERT_RTNL();
12608 -
12609 -       write_lock_bh(&dev_base_lock);
12610 -       list_add_tail(&dev->dev_list, &net->dev_base_head);
12611 -       hlist_add_head(&dev->name_hlist, dev_name_hash(net, dev->name));
12612 -       hlist_add_head(&dev->index_hlist, dev_index_hash(net, dev->ifindex));
12613 -       write_unlock_bh(&dev_base_lock);
12614 -       return 0;
12615 -}
12616 -
12617 -/* Device list removal */
12618 -static void unlist_netdevice(struct net_device *dev)
12619 -{
12620 -       ASSERT_RTNL();
12621 -
12622 -       /* Unlink dev from the device chain */
12623 -       write_lock_bh(&dev_base_lock);
12624 -       list_del(&dev->dev_list);
12625 -       hlist_del(&dev->name_hlist);
12626 -       hlist_del(&dev->index_hlist);
12627 -       write_unlock_bh(&dev_base_lock);
12628 -}
12629 -
12630 -/*
12631 - *     Our notifier list
12632 - */
12633 -
12634 -static RAW_NOTIFIER_HEAD(netdev_chain);
12635 -
12636 -/*
12637 - *     Device drivers call our routines to queue packets here. We empty the
12638 - *     queue in the local softnet handler.
12639 - */
12640 -
12641 -DEFINE_PER_CPU(struct softnet_data, softnet_data);
12642 -
12643 -#ifdef CONFIG_LOCKDEP
12644 -/*
12645 - * register_netdevice() inits txq->_xmit_lock and sets lockdep class
12646 - * according to dev->type
12647 - */
12648 -static const unsigned short netdev_lock_type[] =
12649 -       {ARPHRD_NETROM, ARPHRD_ETHER, ARPHRD_EETHER, ARPHRD_AX25,
12650 -        ARPHRD_PRONET, ARPHRD_CHAOS, ARPHRD_IEEE802, ARPHRD_ARCNET,
12651 -        ARPHRD_APPLETLK, ARPHRD_DLCI, ARPHRD_ATM, ARPHRD_METRICOM,
12652 -        ARPHRD_IEEE1394, ARPHRD_EUI64, ARPHRD_INFINIBAND, ARPHRD_SLIP,
12653 -        ARPHRD_CSLIP, ARPHRD_SLIP6, ARPHRD_CSLIP6, ARPHRD_RSRVD,
12654 -        ARPHRD_ADAPT, ARPHRD_ROSE, ARPHRD_X25, ARPHRD_HWX25,
12655 -        ARPHRD_PPP, ARPHRD_CISCO, ARPHRD_LAPB, ARPHRD_DDCMP,
12656 -        ARPHRD_RAWHDLC, ARPHRD_TUNNEL, ARPHRD_TUNNEL6, ARPHRD_FRAD,
12657 -        ARPHRD_SKIP, ARPHRD_LOOPBACK, ARPHRD_LOCALTLK, ARPHRD_FDDI,
12658 -        ARPHRD_BIF, ARPHRD_SIT, ARPHRD_IPDDP, ARPHRD_IPGRE,
12659 -        ARPHRD_PIMREG, ARPHRD_HIPPI, ARPHRD_ASH, ARPHRD_ECONET,
12660 -        ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL,
12661 -        ARPHRD_FCFABRIC, ARPHRD_IEEE802_TR, ARPHRD_IEEE80211,
12662 -        ARPHRD_IEEE80211_PRISM, ARPHRD_IEEE80211_RADIOTAP, ARPHRD_VOID,
12663 -        ARPHRD_NONE};
12664 -
12665 -static const char *netdev_lock_name[] =
12666 -       {"_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25",
12667 -        "_xmit_PRONET", "_xmit_CHAOS", "_xmit_IEEE802", "_xmit_ARCNET",
12668 -        "_xmit_APPLETLK", "_xmit_DLCI", "_xmit_ATM", "_xmit_METRICOM",
12669 -        "_xmit_IEEE1394", "_xmit_EUI64", "_xmit_INFINIBAND", "_xmit_SLIP",
12670 -        "_xmit_CSLIP", "_xmit_SLIP6", "_xmit_CSLIP6", "_xmit_RSRVD",
12671 -        "_xmit_ADAPT", "_xmit_ROSE", "_xmit_X25", "_xmit_HWX25",
12672 -        "_xmit_PPP", "_xmit_CISCO", "_xmit_LAPB", "_xmit_DDCMP",
12673 -        "_xmit_RAWHDLC", "_xmit_TUNNEL", "_xmit_TUNNEL6", "_xmit_FRAD",
12674 -        "_xmit_SKIP", "_xmit_LOOPBACK", "_xmit_LOCALTLK", "_xmit_FDDI",
12675 -        "_xmit_BIF", "_xmit_SIT", "_xmit_IPDDP", "_xmit_IPGRE",
12676 -        "_xmit_PIMREG", "_xmit_HIPPI", "_xmit_ASH", "_xmit_ECONET",
12677 -        "_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL",
12678 -        "_xmit_FCFABRIC", "_xmit_IEEE802_TR", "_xmit_IEEE80211",
12679 -        "_xmit_IEEE80211_PRISM", "_xmit_IEEE80211_RADIOTAP", "_xmit_VOID",
12680 -        "_xmit_NONE"};
12681 -
12682 -static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)];
12683 -static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE(netdev_lock_type)];
12684 -
12685 -static inline unsigned short netdev_lock_pos(unsigned short dev_type)
12686 -{
12687 -       int i;
12688 -
12689 -       for (i = 0; i < ARRAY_SIZE(netdev_lock_type); i++)
12690 -               if (netdev_lock_type[i] == dev_type)
12691 -                       return i;
12692 -       /* the last key is used by default */
12693 -       return ARRAY_SIZE(netdev_lock_type) - 1;
12694 -}
12695 -
12696 -static inline void netdev_set_xmit_lockdep_class(spinlock_t *lock,
12697 -                                                unsigned short dev_type)
12698 -{
12699 -       int i;
12700 -
12701 -       i = netdev_lock_pos(dev_type);
12702 -       lockdep_set_class_and_name(lock, &netdev_xmit_lock_key[i],
12703 -                                  netdev_lock_name[i]);
12704 -}
12705 -
12706 -static inline void netdev_set_addr_lockdep_class(struct net_device *dev)
12707 -{
12708 -       int i;
12709 -
12710 -       i = netdev_lock_pos(dev->type);
12711 -       lockdep_set_class_and_name(&dev->addr_list_lock,
12712 -                                  &netdev_addr_lock_key[i],
12713 -                                  netdev_lock_name[i]);
12714 -}
12715 -#else
12716 -static inline void netdev_set_xmit_lockdep_class(spinlock_t *lock,
12717 -                                                unsigned short dev_type)
12718 -{
12719 -}
12720 -static inline void netdev_set_addr_lockdep_class(struct net_device *dev)
12721 -{
12722 -}
12723 -#endif
12724 -
12725 -/*******************************************************************************
12726 -
12727 -               Protocol management and registration routines
12728 -
12729 -*******************************************************************************/
12730 -
12731 -/*
12732 - *     Add a protocol ID to the list. Now that the input handler is
12733 - *     smarter we can dispense with all the messy stuff that used to be
12734 - *     here.
12735 - *
12736 - *     BEWARE!!! Protocol handlers, mangling input packets,
12737 - *     MUST BE last in hash buckets and checking protocol handlers
12738 - *     MUST start from promiscuous ptype_all chain in net_bh.
12739 - *     It is true now, do not change it.
12740 - *     Explanation follows: if protocol handler, mangling packet, will
12741 - *     be the first on list, it is not able to sense, that packet
12742 - *     is cloned and should be copied-on-write, so that it will
12743 - *     change it and subsequent readers will get broken packet.
12744 - *                                                     --ANK (980803)
12745 - */
12746 -
12747 -/**
12748 - *     dev_add_pack - add packet handler
12749 - *     @pt: packet type declaration
12750 - *
12751 - *     Add a protocol handler to the networking stack. The passed &packet_type
12752 - *     is linked into kernel lists and may not be freed until it has been
12753 - *     removed from the kernel lists.
12754 - *
12755 - *     This call does not sleep therefore it can not
12756 - *     guarantee all CPU's that are in middle of receiving packets
12757 - *     will see the new packet type (until the next received packet).
12758 - */
12759 -
12760 -void dev_add_pack(struct packet_type *pt)
12761 -{
12762 -       int hash;
12763 -
12764 -       spin_lock_bh(&ptype_lock);
12765 -       if (pt->type == htons(ETH_P_ALL))
12766 -               list_add_rcu(&pt->list, &ptype_all);
12767 -       else {
12768 -               hash = ntohs(pt->type) & PTYPE_HASH_MASK;
12769 -               list_add_rcu(&pt->list, &ptype_base[hash]);
12770 -       }
12771 -       spin_unlock_bh(&ptype_lock);
12772 -}
12773 -
12774 -/**
12775 - *     __dev_remove_pack        - remove packet handler
12776 - *     @pt: packet type declaration
12777 - *
12778 - *     Remove a protocol handler that was previously added to the kernel
12779 - *     protocol handlers by dev_add_pack(). The passed &packet_type is removed
12780 - *     from the kernel lists and can be freed or reused once this function
12781 - *     returns.
12782 - *
12783 - *      The packet type might still be in use by receivers
12784 - *     and must not be freed until after all the CPU's have gone
12785 - *     through a quiescent state.
12786 - */
12787 -void __dev_remove_pack(struct packet_type *pt)
12788 -{
12789 -       struct list_head *head;
12790 -       struct packet_type *pt1;
12791 -
12792 -       spin_lock_bh(&ptype_lock);
12793 -
12794 -       if (pt->type == htons(ETH_P_ALL))
12795 -               head = &ptype_all;
12796 -       else
12797 -               head = &ptype_base[ntohs(pt->type) & PTYPE_HASH_MASK];
12798 -
12799 -       list_for_each_entry(pt1, head, list) {
12800 -               if (pt == pt1) {
12801 -                       list_del_rcu(&pt->list);
12802 -                       goto out;
12803 -               }
12804 -       }
12805 -
12806 -       printk(KERN_WARNING "dev_remove_pack: %p not found.\n", pt);
12807 -out:
12808 -       spin_unlock_bh(&ptype_lock);
12809 -}
12810 -/**
12811 - *     dev_remove_pack  - remove packet handler
12812 - *     @pt: packet type declaration
12813 - *
12814 - *     Remove a protocol handler that was previously added to the kernel
12815 - *     protocol handlers by dev_add_pack(). The passed &packet_type is removed
12816 - *     from the kernel lists and can be freed or reused once this function
12817 - *     returns.
12818 - *
12819 - *     This call sleeps to guarantee that no CPU is looking at the packet
12820 - *     type after return.
12821 - */
12822 -void dev_remove_pack(struct packet_type *pt)
12823 -{
12824 -       __dev_remove_pack(pt);
12825 -
12826 -       synchronize_net();
12827 -}
12828 -
12829 -/******************************************************************************
12830 -
12831 -                     Device Boot-time Settings Routines
12832 -
12833 -*******************************************************************************/
12834 -
12835 -/* Boot time configuration table */
12836 -static struct netdev_boot_setup dev_boot_setup[NETDEV_BOOT_SETUP_MAX];
12837 -
12838 -/**
12839 - *     netdev_boot_setup_add   - add new setup entry
12840 - *     @name: name of the device
12841 - *     @map: configured settings for the device
12842 - *
12843 - *     Adds new setup entry to the dev_boot_setup list.  The function
12844 - *     returns 0 on error and 1 on success.  This is a generic routine to
12845 - *     all netdevices.
12846 - */
12847 -static int netdev_boot_setup_add(char *name, struct ifmap *map)
12848 -{
12849 -       struct netdev_boot_setup *s;
12850 -       int i;
12851 -
12852 -       s = dev_boot_setup;
12853 -       for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
12854 -               if (s[i].name[0] == '\0' || s[i].name[0] == ' ') {
12855 -                       memset(s[i].name, 0, sizeof(s[i].name));
12856 -                       strlcpy(s[i].name, name, IFNAMSIZ);
12857 -                       memcpy(&s[i].map, map, sizeof(s[i].map));
12858 -                       break;
12859 -               }
12860 -       }
12861 -
12862 -       return i >= NETDEV_BOOT_SETUP_MAX ? 0 : 1;
12863 -}
12864 -
12865 -/**
12866 - *     netdev_boot_setup_check - check boot time settings
12867 - *     @dev: the netdevice
12868 - *
12869 - *     Check boot time settings for the device.
12870 - *     The found settings are set for the device to be used
12871 - *     later in the device probing.
12872 - *     Returns 0 if no settings found, 1 if they are.
12873 - */
12874 -int netdev_boot_setup_check(struct net_device *dev)
12875 -{
12876 -       struct netdev_boot_setup *s = dev_boot_setup;
12877 -       int i;
12878 -
12879 -       for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
12880 -               if (s[i].name[0] != '\0' && s[i].name[0] != ' ' &&
12881 -                   !strcmp(dev->name, s[i].name)) {
12882 -                       dev->irq        = s[i].map.irq;
12883 -                       dev->base_addr  = s[i].map.base_addr;
12884 -                       dev->mem_start  = s[i].map.mem_start;
12885 -                       dev->mem_end    = s[i].map.mem_end;
12886 -                       return 1;
12887 -               }
12888 -       }
12889 -       return 0;
12890 -}
12891 -
12892 -
12893 -/**
12894 - *     netdev_boot_base        - get address from boot time settings
12895 - *     @prefix: prefix for network device
12896 - *     @unit: id for network device
12897 - *
12898 - *     Check boot time settings for the base address of device.
12899 - *     The found settings are set for the device to be used
12900 - *     later in the device probing.
12901 - *     Returns 0 if no settings found.
12902 - */
12903 -unsigned long netdev_boot_base(const char *prefix, int unit)
12904 -{
12905 -       const struct netdev_boot_setup *s = dev_boot_setup;
12906 -       char name[IFNAMSIZ];
12907 -       int i;
12908 -
12909 -       sprintf(name, "%s%d", prefix, unit);
12910 -
12911 -       /*
12912 -        * If device already registered then return base of 1
12913 -        * to indicate not to probe for this interface
12914 -        */
12915 -       if (__dev_get_by_name(&init_net, name))
12916 -               return 1;
12917 -
12918 -       for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++)
12919 -               if (!strcmp(name, s[i].name))
12920 -                       return s[i].map.base_addr;
12921 -       return 0;
12922 -}
12923 -
12924 -/*
12925 - * Saves at boot time configured settings for any netdevice.
12926 - */
12927 -int __init netdev_boot_setup(char *str)
12928 -{
12929 -       int ints[5];
12930 -       struct ifmap map;
12931 -
12932 -       str = get_options(str, ARRAY_SIZE(ints), ints);
12933 -       if (!str || !*str)
12934 -               return 0;
12935 -
12936 -       /* Save settings */
12937 -       memset(&map, 0, sizeof(map));
12938 -       if (ints[0] > 0)
12939 -               map.irq = ints[1];
12940 -       if (ints[0] > 1)
12941 -               map.base_addr = ints[2];
12942 -       if (ints[0] > 2)
12943 -               map.mem_start = ints[3];
12944 -       if (ints[0] > 3)
12945 -               map.mem_end = ints[4];
12946 -
12947 -       /* Add new entry to the list */
12948 -       return netdev_boot_setup_add(str, &map);
12949 -}
12950 -
12951 -__setup("netdev=", netdev_boot_setup);
12952 -
12953 -/*******************************************************************************
12954 -
12955 -                           Device Interface Subroutines
12956 -
12957 -*******************************************************************************/
12958 -
12959 -/**
12960 - *     __dev_get_by_name       - find a device by its name
12961 - *     @net: the applicable net namespace
12962 - *     @name: name to find
12963 - *
12964 - *     Find an interface by name. Must be called under RTNL semaphore
12965 - *     or @dev_base_lock. If the name is found a pointer to the device
12966 - *     is returned. If the name is not found then %NULL is returned. The
12967 - *     reference counters are not incremented so the caller must be
12968 - *     careful with locks.
12969 - */
12970 -
12971 -struct net_device *__dev_get_by_name(struct net *net, const char *name)
12972 -{
12973 -       struct hlist_node *p;
12974 -
12975 -       hlist_for_each(p, dev_name_hash(net, name)) {
12976 -               struct net_device *dev
12977 -                       = hlist_entry(p, struct net_device, name_hlist);
12978 -               if (!strncmp(dev->name, name, IFNAMSIZ))
12979 -                       return dev;
12980 -       }
12981 -       return NULL;
12982 -}
12983 -
12984 -/**
12985 - *     dev_get_by_name         - find a device by its name
12986 - *     @net: the applicable net namespace
12987 - *     @name: name to find
12988 - *
12989 - *     Find an interface by name. This can be called from any
12990 - *     context and does its own locking. The returned handle has
12991 - *     the usage count incremented and the caller must use dev_put() to
12992 - *     release it when it is no longer needed. %NULL is returned if no
12993 - *     matching device is found.
12994 - */
12995 -
12996 -struct net_device *dev_get_by_name(struct net *net, const char *name)
12997 -{
12998 -       struct net_device *dev;
12999 -
13000 -       read_lock(&dev_base_lock);
13001 -       dev = __dev_get_by_name(net, name);
13002 -       if (dev)
13003 -               dev_hold(dev);
13004 -       read_unlock(&dev_base_lock);
13005 -       return dev;
13006 -}
13007 -
13008 -/**
13009 - *     __dev_get_by_index - find a device by its ifindex
13010 - *     @net: the applicable net namespace
13011 - *     @ifindex: index of device
13012 - *
13013 - *     Search for an interface by index. Returns %NULL if the device
13014 - *     is not found or a pointer to the device. The device has not
13015 - *     had its reference counter increased so the caller must be careful
13016 - *     about locking. The caller must hold either the RTNL semaphore
13017 - *     or @dev_base_lock.
13018 - */
13019 -
13020 -struct net_device *__dev_get_by_index(struct net *net, int ifindex)
13021 -{
13022 -       struct hlist_node *p;
13023 -
13024 -       hlist_for_each(p, dev_index_hash(net, ifindex)) {
13025 -               struct net_device *dev
13026 -                       = hlist_entry(p, struct net_device, index_hlist);
13027 -               if (dev->ifindex == ifindex)
13028 -                       return dev;
13029 -       }
13030 -       return NULL;
13031 -}
13032 -
13033 -
13034 -/**
13035 - *     dev_get_by_index - find a device by its ifindex
13036 - *     @net: the applicable net namespace
13037 - *     @ifindex: index of device
13038 - *
13039 - *     Search for an interface by index. Returns NULL if the device
13040 - *     is not found or a pointer to the device. The device returned has
13041 - *     had a reference added and the pointer is safe until the user calls
13042 - *     dev_put to indicate they have finished with it.
13043 - */
13044 -
13045 -struct net_device *dev_get_by_index(struct net *net, int ifindex)
13046 -{
13047 -       struct net_device *dev;
13048 -
13049 -       read_lock(&dev_base_lock);
13050 -       dev = __dev_get_by_index(net, ifindex);
13051 -       if (dev)
13052 -               dev_hold(dev);
13053 -       read_unlock(&dev_base_lock);
13054 -       return dev;
13055 -}
13056 -
13057 -/**
13058 - *     dev_getbyhwaddr - find a device by its hardware address
13059 - *     @net: the applicable net namespace
13060 - *     @type: media type of device
13061 - *     @ha: hardware address
13062 - *
13063 - *     Search for an interface by MAC address. Returns NULL if the device
13064 - *     is not found or a pointer to the device. The caller must hold the
13065 - *     rtnl semaphore. The returned device has not had its ref count increased
13066 - *     and the caller must therefore be careful about locking
13067 - *
13068 - *     BUGS:
13069 - *     If the API was consistent this would be __dev_get_by_hwaddr
13070 - */
13071 -
13072 -struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type, char *ha)
13073 -{
13074 -       struct net_device *dev;
13075 -
13076 -       ASSERT_RTNL();
13077 -
13078 -       for_each_netdev(net, dev)
13079 -               if (dev->type == type &&
13080 -                   !memcmp(dev->dev_addr, ha, dev->addr_len))
13081 -                       return dev;
13082 -
13083 -       return NULL;
13084 -}
13085 -
13086 -EXPORT_SYMBOL(dev_getbyhwaddr);
13087 -
13088 -struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type)
13089 -{
13090 -       struct net_device *dev;
13091 -
13092 -       ASSERT_RTNL();
13093 -       for_each_netdev(net, dev)
13094 -               if (dev->type == type)
13095 -                       return dev;
13096 -
13097 -       return NULL;
13098 -}
13099 -
13100 -EXPORT_SYMBOL(__dev_getfirstbyhwtype);
13101 -
13102 -struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type)
13103 -{
13104 -       struct net_device *dev;
13105 -
13106 -       rtnl_lock();
13107 -       dev = __dev_getfirstbyhwtype(net, type);
13108 -       if (dev)
13109 -               dev_hold(dev);
13110 -       rtnl_unlock();
13111 -       return dev;
13112 -}
13113 -
13114 -EXPORT_SYMBOL(dev_getfirstbyhwtype);
13115 -
13116 -/**
13117 - *     dev_get_by_flags - find any device with given flags
13118 - *     @net: the applicable net namespace
13119 - *     @if_flags: IFF_* values
13120 - *     @mask: bitmask of bits in if_flags to check
13121 - *
13122 - *     Search for any interface with the given flags. Returns NULL if a device
13123 - *     is not found or a pointer to the device. The device returned has
13124 - *     had a reference added and the pointer is safe until the user calls
13125 - *     dev_put to indicate they have finished with it.
13126 - */
13127 -
13128 -struct net_device * dev_get_by_flags(struct net *net, unsigned short if_flags, unsigned short mask)
13129 -{
13130 -       struct net_device *dev, *ret;
13131 -
13132 -       ret = NULL;
13133 -       read_lock(&dev_base_lock);
13134 -       for_each_netdev(net, dev) {
13135 -               if (((dev->flags ^ if_flags) & mask) == 0) {
13136 -                       dev_hold(dev);
13137 -                       ret = dev;
13138 -                       break;
13139 -               }
13140 -       }
13141 -       read_unlock(&dev_base_lock);
13142 -       return ret;
13143 -}
13144 -
13145 -/**
13146 - *     dev_valid_name - check if name is okay for network device
13147 - *     @name: name string
13148 - *
13149 - *     Network device names need to be valid file names to
13150 - *     to allow sysfs to work.  We also disallow any kind of
13151 - *     whitespace.
13152 - */
13153 -int dev_valid_name(const char *name)
13154 -{
13155 -       if (*name == '\0')
13156 -               return 0;
13157 -       if (strlen(name) >= IFNAMSIZ)
13158 -               return 0;
13159 -       if (!strcmp(name, ".") || !strcmp(name, ".."))
13160 -               return 0;
13161 -
13162 -       while (*name) {
13163 -               if (*name == '/' || isspace(*name))
13164 -                       return 0;
13165 -               name++;
13166 -       }
13167 -       return 1;
13168 -}
13169 -
13170 -/**
13171 - *     __dev_alloc_name - allocate a name for a device
13172 - *     @net: network namespace to allocate the device name in
13173 - *     @name: name format string
13174 - *     @buf:  scratch buffer and result name string
13175 - *
13176 - *     Passed a format string - eg "lt%d" it will try and find a suitable
13177 - *     id. It scans list of devices to build up a free map, then chooses
13178 - *     the first empty slot. The caller must hold the dev_base or rtnl lock
13179 - *     while allocating the name and adding the device in order to avoid
13180 - *     duplicates.
13181 - *     Limited to bits_per_byte * page size devices (ie 32K on most platforms).
13182 - *     Returns the number of the unit assigned or a negative errno code.
13183 - */
13184 -
13185 -static int __dev_alloc_name(struct net *net, const char *name, char *buf)
13186 -{
13187 -       int i = 0;
13188 -       const char *p;
13189 -       const int max_netdevices = 8*PAGE_SIZE;
13190 -       unsigned long *inuse;
13191 -       struct net_device *d;
13192 -
13193 -       p = strnchr(name, IFNAMSIZ-1, '%');
13194 -       if (p) {
13195 -               /*
13196 -                * Verify the string as this thing may have come from
13197 -                * the user.  There must be either one "%d" and no other "%"
13198 -                * characters.
13199 -                */
13200 -               if (p[1] != 'd' || strchr(p + 2, '%'))
13201 -                       return -EINVAL;
13202 -
13203 -               /* Use one page as a bit array of possible slots */
13204 -               inuse = (unsigned long *) get_zeroed_page(GFP_ATOMIC);
13205 -               if (!inuse)
13206 -                       return -ENOMEM;
13207 -
13208 -               for_each_netdev(net, d) {
13209 -                       if (!sscanf(d->name, name, &i))
13210 -                               continue;
13211 -                       if (i < 0 || i >= max_netdevices)
13212 -                               continue;
13213 -
13214 -                       /*  avoid cases where sscanf is not exact inverse of printf */
13215 -                       snprintf(buf, IFNAMSIZ, name, i);
13216 -                       if (!strncmp(buf, d->name, IFNAMSIZ))
13217 -                               set_bit(i, inuse);
13218 -               }
13219 -
13220 -               i = find_first_zero_bit(inuse, max_netdevices);
13221 -               free_page((unsigned long) inuse);
13222 -       }
13223 -
13224 -       snprintf(buf, IFNAMSIZ, name, i);
13225 -       if (!__dev_get_by_name(net, buf))
13226 -               return i;
13227 -
13228 -       /* It is possible to run out of possible slots
13229 -        * when the name is long and there isn't enough space left
13230 -        * for the digits, or if all bits are used.
13231 -        */
13232 -       return -ENFILE;
13233 -}
13234 -
13235 -/**
13236 - *     dev_alloc_name - allocate a name for a device
13237 - *     @dev: device
13238 - *     @name: name format string
13239 - *
13240 - *     Passed a format string - eg "lt%d" it will try and find a suitable
13241 - *     id. It scans list of devices to build up a free map, then chooses
13242 - *     the first empty slot. The caller must hold the dev_base or rtnl lock
13243 - *     while allocating the name and adding the device in order to avoid
13244 - *     duplicates.
13245 - *     Limited to bits_per_byte * page size devices (ie 32K on most platforms).
13246 - *     Returns the number of the unit assigned or a negative errno code.
13247 - */
13248 -
13249 -int dev_alloc_name(struct net_device *dev, const char *name)
13250 -{
13251 -       char buf[IFNAMSIZ];
13252 -       struct net *net;
13253 -       int ret;
13254 -
13255 -       BUG_ON(!dev_net(dev));
13256 -       net = dev_net(dev);
13257 -       ret = __dev_alloc_name(net, name, buf);
13258 -       if (ret >= 0)
13259 -               strlcpy(dev->name, buf, IFNAMSIZ);
13260 -       return ret;
13261 -}
13262 -
13263 -
13264 -/**
13265 - *     dev_change_name - change name of a device
13266 - *     @dev: device
13267 - *     @newname: name (or format string) must be at least IFNAMSIZ
13268 - *
13269 - *     Change name of a device, can pass format strings "eth%d".
13270 - *     for wildcarding.
13271 - */
13272 -int dev_change_name(struct net_device *dev, char *newname)
13273 -{
13274 -       char oldname[IFNAMSIZ];
13275 -       int err = 0;
13276 -       int ret;
13277 -       struct net *net;
13278 -
13279 -       ASSERT_RTNL();
13280 -       BUG_ON(!dev_net(dev));
13281 -
13282 -       net = dev_net(dev);
13283 -       if (dev->flags & IFF_UP)
13284 -               return -EBUSY;
13285 -
13286 -       if (!dev_valid_name(newname))
13287 -               return -EINVAL;
13288 -
13289 -       if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
13290 -               return 0;
13291 -
13292 -       memcpy(oldname, dev->name, IFNAMSIZ);
13293 -
13294 -       if (strchr(newname, '%')) {
13295 -               err = dev_alloc_name(dev, newname);
13296 -               if (err < 0)
13297 -                       return err;
13298 -               strcpy(newname, dev->name);
13299 -       }
13300 -       else if (__dev_get_by_name(net, newname))
13301 -               return -EEXIST;
13302 -       else
13303 -               strlcpy(dev->name, newname, IFNAMSIZ);
13304 -
13305 -rollback:
13306 -       /* For now only devices in the initial network namespace
13307 -        * are in sysfs.
13308 -        */
13309 -       if (net == &init_net) {
13310 -               ret = device_rename(&dev->dev, dev->name);
13311 -               if (ret) {
13312 -                       memcpy(dev->name, oldname, IFNAMSIZ);
13313 -                       return ret;
13314 -               }
13315 -       }
13316 -
13317 -       write_lock_bh(&dev_base_lock);
13318 -       hlist_del(&dev->name_hlist);
13319 -       hlist_add_head(&dev->name_hlist, dev_name_hash(net, dev->name));
13320 -       write_unlock_bh(&dev_base_lock);
13321 -
13322 -       ret = call_netdevice_notifiers(NETDEV_CHANGENAME, dev);
13323 -       ret = notifier_to_errno(ret);
13324 -
13325 -       if (ret) {
13326 -               if (err) {
13327 -                       printk(KERN_ERR
13328 -                              "%s: name change rollback failed: %d.\n",
13329 -                              dev->name, ret);
13330 -               } else {
13331 -                       err = ret;
13332 -                       memcpy(dev->name, oldname, IFNAMSIZ);
13333 -                       goto rollback;
13334 -               }
13335 -       }
13336 -
13337 -       return err;
13338 -}
13339 -
13340 -/**
13341 - *     netdev_features_change - device changes features
13342 - *     @dev: device to cause notification
13343 - *
13344 - *     Called to indicate a device has changed features.
13345 - */
13346 -void netdev_features_change(struct net_device *dev)
13347 -{
13348 -       call_netdevice_notifiers(NETDEV_FEAT_CHANGE, dev);
13349 -}
13350 -EXPORT_SYMBOL(netdev_features_change);
13351 -
13352 -/**
13353 - *     netdev_state_change - device changes state
13354 - *     @dev: device to cause notification
13355 - *
13356 - *     Called to indicate a device has changed state. This function calls
13357 - *     the notifier chains for netdev_chain and sends a NEWLINK message
13358 - *     to the routing socket.
13359 - */
13360 -void netdev_state_change(struct net_device *dev)
13361 -{
13362 -       if (dev->flags & IFF_UP) {
13363 -               call_netdevice_notifiers(NETDEV_CHANGE, dev);
13364 -               rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
13365 -       }
13366 -}
13367 -
13368 -void netdev_bonding_change(struct net_device *dev)
13369 -{
13370 -       call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, dev);
13371 -}
13372 -EXPORT_SYMBOL(netdev_bonding_change);
13373 -
13374 -/**
13375 - *     dev_load        - load a network module
13376 - *     @net: the applicable net namespace
13377 - *     @name: name of interface
13378 - *
13379 - *     If a network interface is not present and the process has suitable
13380 - *     privileges this function loads the module. If module loading is not
13381 - *     available in this kernel then it becomes a nop.
13382 - */
13383 -
13384 -void dev_load(struct net *net, const char *name)
13385 -{
13386 -       struct net_device *dev;
13387 -
13388 -       read_lock(&dev_base_lock);
13389 -       dev = __dev_get_by_name(net, name);
13390 -       read_unlock(&dev_base_lock);
13391 -
13392 -       if (!dev && capable(CAP_SYS_MODULE))
13393 -               request_module("%s", name);
13394 -}
13395 -
13396 -/**
13397 - *     dev_open        - prepare an interface for use.
13398 - *     @dev:   device to open
13399 - *
13400 - *     Takes a device from down to up state. The device's private open
13401 - *     function is invoked and then the multicast lists are loaded. Finally
13402 - *     the device is moved into the up state and a %NETDEV_UP message is
13403 - *     sent to the netdev notifier chain.
13404 - *
13405 - *     Calling this function on an active interface is a nop. On a failure
13406 - *     a negative errno code is returned.
13407 - */
13408 -int dev_open(struct net_device *dev)
13409 -{
13410 -       int ret = 0;
13411 -
13412 -       ASSERT_RTNL();
13413 -
13414 -       /*
13415 -        *      Is it already up?
13416 -        */
13417 -
13418 -       if (dev->flags & IFF_UP)
13419 -               return 0;
13420 -
13421 -       /*
13422 -        *      Is it even present?
13423 -        */
13424 -       if (!netif_device_present(dev))
13425 -               return -ENODEV;
13426 -
13427 -       /*
13428 -        *      Call device private open method
13429 -        */
13430 -       set_bit(__LINK_STATE_START, &dev->state);
13431 -
13432 -       if (dev->validate_addr)
13433 -               ret = dev->validate_addr(dev);
13434 -
13435 -       if (!ret && dev->open)
13436 -               ret = dev->open(dev);
13437 -
13438 -       /*
13439 -        *      If it went open OK then:
13440 -        */
13441 -
13442 -       if (ret)
13443 -               clear_bit(__LINK_STATE_START, &dev->state);
13444 -       else {
13445 -               /*
13446 -                *      Set the flags.
13447 -                */
13448 -               dev->flags |= IFF_UP;
13449 -
13450 -               /*
13451 -                *      Initialize multicasting status
13452 -                */
13453 -               dev_set_rx_mode(dev);
13454 -
13455 -               /*
13456 -                *      Wakeup transmit queue engine
13457 -                */
13458 -               dev_activate(dev);
13459 -
13460 -               /*
13461 -                *      ... and announce new interface.
13462 -                */
13463 -               call_netdevice_notifiers(NETDEV_UP, dev);
13464 -       }
13465 -
13466 -       return ret;
13467 -}
13468 -
13469 -/**
13470 - *     dev_close - shutdown an interface.
13471 - *     @dev: device to shutdown
13472 - *
13473 - *     This function moves an active device into down state. A
13474 - *     %NETDEV_GOING_DOWN is sent to the netdev notifier chain. The device
13475 - *     is then deactivated and finally a %NETDEV_DOWN is sent to the notifier
13476 - *     chain.
13477 - */
13478 -int dev_close(struct net_device *dev)
13479 -{
13480 -       ASSERT_RTNL();
13481 -
13482 -       might_sleep();
13483 -
13484 -       if (!(dev->flags & IFF_UP))
13485 -               return 0;
13486 -
13487 -       /*
13488 -        *      Tell people we are going down, so that they can
13489 -        *      prepare to death, when device is still operating.
13490 -        */
13491 -       call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
13492 -
13493 -       clear_bit(__LINK_STATE_START, &dev->state);
13494 -
13495 -       /* Synchronize to scheduled poll. We cannot touch poll list,
13496 -        * it can be even on different cpu. So just clear netif_running().
13497 -        *
13498 -        * dev->stop() will invoke napi_disable() on all of it's
13499 -        * napi_struct instances on this device.
13500 -        */
13501 -       smp_mb__after_clear_bit(); /* Commit netif_running(). */
13502 -
13503 -       dev_deactivate(dev);
13504 -
13505 -       /*
13506 -        *      Call the device specific close. This cannot fail.
13507 -        *      Only if device is UP
13508 -        *
13509 -        *      We allow it to be called even after a DETACH hot-plug
13510 -        *      event.
13511 -        */
13512 -       if (dev->stop)
13513 -               dev->stop(dev);
13514 -
13515 -       /*
13516 -        *      Device is now down.
13517 -        */
13518 -
13519 -       dev->flags &= ~IFF_UP;
13520 -
13521 -       /*
13522 -        * Tell people we are down
13523 -        */
13524 -       call_netdevice_notifiers(NETDEV_DOWN, dev);
13525 -
13526 -       return 0;
13527 -}
13528 -
13529 -
13530 -/**
13531 - *     dev_disable_lro - disable Large Receive Offload on a device
13532 - *     @dev: device
13533 - *
13534 - *     Disable Large Receive Offload (LRO) on a net device.  Must be
13535 - *     called under RTNL.  This is needed if received packets may be
13536 - *     forwarded to another interface.
13537 - */
13538 -void dev_disable_lro(struct net_device *dev)
13539 -{
13540 -       if (dev->ethtool_ops && dev->ethtool_ops->get_flags &&
13541 -           dev->ethtool_ops->set_flags) {
13542 -               u32 flags = dev->ethtool_ops->get_flags(dev);
13543 -               if (flags & ETH_FLAG_LRO) {
13544 -                       flags &= ~ETH_FLAG_LRO;
13545 -                       dev->ethtool_ops->set_flags(dev, flags);
13546 -               }
13547 -       }
13548 -       WARN_ON(dev->features & NETIF_F_LRO);
13549 -}
13550 -EXPORT_SYMBOL(dev_disable_lro);
13551 -
13552 -
13553 -static int dev_boot_phase = 1;
13554 -
13555 -/*
13556 - *     Device change register/unregister. These are not inline or static
13557 - *     as we export them to the world.
13558 - */
13559 -
13560 -/**
13561 - *     register_netdevice_notifier - register a network notifier block
13562 - *     @nb: notifier
13563 - *
13564 - *     Register a notifier to be called when network device events occur.
13565 - *     The notifier passed is linked into the kernel structures and must
13566 - *     not be reused until it has been unregistered. A negative errno code
13567 - *     is returned on a failure.
13568 - *
13569 - *     When registered all registration and up events are replayed
13570 - *     to the new notifier to allow device to have a race free
13571 - *     view of the network device list.
13572 - */
13573 -
13574 -int register_netdevice_notifier(struct notifier_block *nb)
13575 -{
13576 -       struct net_device *dev;
13577 -       struct net_device *last;
13578 -       struct net *net;
13579 -       int err;
13580 -
13581 -       rtnl_lock();
13582 -       err = raw_notifier_chain_register(&netdev_chain, nb);
13583 -       if (err)
13584 -               goto unlock;
13585 -       if (dev_boot_phase)
13586 -               goto unlock;
13587 -       for_each_net(net) {
13588 -               for_each_netdev(net, dev) {
13589 -                       err = nb->notifier_call(nb, NETDEV_REGISTER, dev);
13590 -                       err = notifier_to_errno(err);
13591 -                       if (err)
13592 -                               goto rollback;
13593 -
13594 -                       if (!(dev->flags & IFF_UP))
13595 -                               continue;
13596 -
13597 -                       nb->notifier_call(nb, NETDEV_UP, dev);
13598 -               }
13599 -       }
13600 -
13601 -unlock:
13602 -       rtnl_unlock();
13603 -       return err;
13604 -
13605 -rollback:
13606 -       last = dev;
13607 -       for_each_net(net) {
13608 -               for_each_netdev(net, dev) {
13609 -                       if (dev == last)
13610 -                               break;
13611 -
13612 -                       if (dev->flags & IFF_UP) {
13613 -                               nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
13614 -                               nb->notifier_call(nb, NETDEV_DOWN, dev);
13615 -                       }
13616 -                       nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
13617 -               }
13618 -       }
13619 -
13620 -       raw_notifier_chain_unregister(&netdev_chain, nb);
13621 -       goto unlock;
13622 -}
13623 -
13624 -/**
13625 - *     unregister_netdevice_notifier - unregister a network notifier block
13626 - *     @nb: notifier
13627 - *
13628 - *     Unregister a notifier previously registered by
13629 - *     register_netdevice_notifier(). The notifier is unlinked into the
13630 - *     kernel structures and may then be reused. A negative errno code
13631 - *     is returned on a failure.
13632 - */
13633 -
13634 -int unregister_netdevice_notifier(struct notifier_block *nb)
13635 -{
13636 -       int err;
13637 -
13638 -       rtnl_lock();
13639 -       err = raw_notifier_chain_unregister(&netdev_chain, nb);
13640 -       rtnl_unlock();
13641 -       return err;
13642 -}
13643 -
13644 -/**
13645 - *     call_netdevice_notifiers - call all network notifier blocks
13646 - *      @val: value passed unmodified to notifier function
13647 - *      @dev: net_device pointer passed unmodified to notifier function
13648 - *
13649 - *     Call all network notifier blocks.  Parameters and return value
13650 - *     are as for raw_notifier_call_chain().
13651 - */
13652 -
13653 -int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
13654 -{
13655 -       return raw_notifier_call_chain(&netdev_chain, val, dev);
13656 -}
13657 -
13658 -/* When > 0 there are consumers of rx skb time stamps */
13659 -static atomic_t netstamp_needed = ATOMIC_INIT(0);
13660 -
13661 -void net_enable_timestamp(void)
13662 -{
13663 -       atomic_inc(&netstamp_needed);
13664 -}
13665 -
13666 -void net_disable_timestamp(void)
13667 -{
13668 -       atomic_dec(&netstamp_needed);
13669 -}
13670 -
13671 -static inline void net_timestamp(struct sk_buff *skb)
13672 -{
13673 -       if (atomic_read(&netstamp_needed))
13674 -               __net_timestamp(skb);
13675 -       else
13676 -               skb->tstamp.tv64 = 0;
13677 -}
13678 -
13679 -/*
13680 - *     Support routine. Sends outgoing frames to any network
13681 - *     taps currently in use.
13682 - */
13683 -
13684 -static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
13685 -{
13686 -       struct packet_type *ptype;
13687 -
13688 -       net_timestamp(skb);
13689 -
13690 -       rcu_read_lock();
13691 -       list_for_each_entry_rcu(ptype, &ptype_all, list) {
13692 -               /* Never send packets back to the socket
13693 -                * they originated from - MvS (miquels@drinkel.ow.org)
13694 -                */
13695 -               if ((ptype->dev == dev || !ptype->dev) &&
13696 -                   (ptype->af_packet_priv == NULL ||
13697 -                    (struct sock *)ptype->af_packet_priv != skb->sk)) {
13698 -                       struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
13699 -                       if (!skb2)
13700 -                               break;
13701 -
13702 -                       /* skb->nh should be correctly
13703 -                          set by sender, so that the second statement is
13704 -                          just protection against buggy protocols.
13705 -                        */
13706 -                       skb_reset_mac_header(skb2);
13707 -
13708 -                       if (skb_network_header(skb2) < skb2->data ||
13709 -                           skb2->network_header > skb2->tail) {
13710 -                               if (net_ratelimit())
13711 -                                       printk(KERN_CRIT "protocol %04x is "
13712 -                                              "buggy, dev %s\n",
13713 -                                              skb2->protocol, dev->name);
13714 -                               skb_reset_network_header(skb2);
13715 -                       }
13716 -
13717 -                       skb2->transport_header = skb2->network_header;
13718 -                       skb2->pkt_type = PACKET_OUTGOING;
13719 -                       ptype->func(skb2, skb->dev, ptype, skb->dev);
13720 -               }
13721 -       }
13722 -       rcu_read_unlock();
13723 -}
13724 -
13725 -
13726 -static inline void __netif_reschedule(struct Qdisc *q)
13727 -{
13728 -       struct softnet_data *sd;
13729 -       unsigned long flags;
13730 -
13731 -       local_irq_save(flags);
13732 -       sd = &__get_cpu_var(softnet_data);
13733 -       q->next_sched = sd->output_queue;
13734 -       sd->output_queue = q;
13735 -       raise_softirq_irqoff(NET_TX_SOFTIRQ);
13736 -       local_irq_restore(flags);
13737 -}
13738 -
13739 -void __netif_schedule(struct Qdisc *q)
13740 -{
13741 -       if (!test_and_set_bit(__QDISC_STATE_SCHED, &q->state))
13742 -               __netif_reschedule(q);
13743 -}
13744 -EXPORT_SYMBOL(__netif_schedule);
13745 -
13746 -void dev_kfree_skb_irq(struct sk_buff *skb)
13747 -{
13748 -       if (atomic_dec_and_test(&skb->users)) {
13749 -               struct softnet_data *sd;
13750 -               unsigned long flags;
13751 -
13752 -               local_irq_save(flags);
13753 -               sd = &__get_cpu_var(softnet_data);
13754 -               skb->next = sd->completion_queue;
13755 -               sd->completion_queue = skb;
13756 -               raise_softirq_irqoff(NET_TX_SOFTIRQ);
13757 -               local_irq_restore(flags);
13758 -       }
13759 -}
13760 -EXPORT_SYMBOL(dev_kfree_skb_irq);
13761 -
13762 -void dev_kfree_skb_any(struct sk_buff *skb)
13763 -{
13764 -       if (in_irq() || irqs_disabled())
13765 -               dev_kfree_skb_irq(skb);
13766 -       else
13767 -               dev_kfree_skb(skb);
13768 -}
13769 -EXPORT_SYMBOL(dev_kfree_skb_any);
13770 -
13771 -
13772 -/**
13773 - * netif_device_detach - mark device as removed
13774 - * @dev: network device
13775 - *
13776 - * Mark device as removed from system and therefore no longer available.
13777 - */
13778 -void netif_device_detach(struct net_device *dev)
13779 -{
13780 -       if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) &&
13781 -           netif_running(dev)) {
13782 -               netif_stop_queue(dev);
13783 -       }
13784 -}
13785 -EXPORT_SYMBOL(netif_device_detach);
13786 -
13787 -/**
13788 - * netif_device_attach - mark device as attached
13789 - * @dev: network device
13790 - *
13791 - * Mark device as attached from system and restart if needed.
13792 - */
13793 -void netif_device_attach(struct net_device *dev)
13794 -{
13795 -       if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
13796 -           netif_running(dev)) {
13797 -               netif_wake_queue(dev);
13798 -               __netdev_watchdog_up(dev);
13799 -       }
13800 -}
13801 -EXPORT_SYMBOL(netif_device_attach);
13802 -
13803 -static bool can_checksum_protocol(unsigned long features, __be16 protocol)
13804 -{
13805 -       return ((features & NETIF_F_GEN_CSUM) ||
13806 -               ((features & NETIF_F_IP_CSUM) &&
13807 -                protocol == htons(ETH_P_IP)) ||
13808 -               ((features & NETIF_F_IPV6_CSUM) &&
13809 -                protocol == htons(ETH_P_IPV6)));
13810 -}
13811 -
13812 -static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb)
13813 -{
13814 -       if (can_checksum_protocol(dev->features, skb->protocol))
13815 -               return true;
13816 -
13817 -       if (skb->protocol == htons(ETH_P_8021Q)) {
13818 -               struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
13819 -               if (can_checksum_protocol(dev->features & dev->vlan_features,
13820 -                                         veh->h_vlan_encapsulated_proto))
13821 -                       return true;
13822 -       }
13823 -
13824 -       return false;
13825 -}
13826 -
13827 -/*
13828 - * Invalidate hardware checksum when packet is to be mangled, and
13829 - * complete checksum manually on outgoing path.
13830 - */
13831 -int skb_checksum_help(struct sk_buff *skb)
13832 -{
13833 -       __wsum csum;
13834 -       int ret = 0, offset;
13835 -
13836 -       if (skb->ip_summed == CHECKSUM_COMPLETE)
13837 -               goto out_set_summed;
13838 -
13839 -       if (unlikely(skb_shinfo(skb)->gso_size)) {
13840 -               /* Let GSO fix up the checksum. */
13841 -               goto out_set_summed;
13842 -       }
13843 -
13844 -       offset = skb->csum_start - skb_headroom(skb);
13845 -       BUG_ON(offset >= skb_headlen(skb));
13846 -       csum = skb_checksum(skb, offset, skb->len - offset, 0);
13847 -
13848 -       offset += skb->csum_offset;
13849 -       BUG_ON(offset + sizeof(__sum16) > skb_headlen(skb));
13850 -
13851 -       if (skb_cloned(skb) &&
13852 -           !skb_clone_writable(skb, offset + sizeof(__sum16))) {
13853 -               ret = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
13854 -               if (ret)
13855 -                       goto out;
13856 -       }
13857 -
13858 -       *(__sum16 *)(skb->data + offset) = csum_fold(csum);
13859 -out_set_summed:
13860 -       skb->ip_summed = CHECKSUM_NONE;
13861 -out:
13862 -       return ret;
13863 -}
13864 -
13865 -/**
13866 - *     skb_gso_segment - Perform segmentation on skb.
13867 - *     @skb: buffer to segment
13868 - *     @features: features for the output path (see dev->features)
13869 - *
13870 - *     This function segments the given skb and returns a list of segments.
13871 - *
13872 - *     It may return NULL if the skb requires no segmentation.  This is
13873 - *     only possible when GSO is used for verifying header integrity.
13874 - */
13875 -struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
13876 -{
13877 -       struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
13878 -       struct packet_type *ptype;
13879 -       __be16 type = skb->protocol;
13880 -       int err;
13881 -
13882 -       BUG_ON(skb_shinfo(skb)->frag_list);
13883 -
13884 -       skb_reset_mac_header(skb);
13885 -       skb->mac_len = skb->network_header - skb->mac_header;
13886 -       __skb_pull(skb, skb->mac_len);
13887 -
13888 -       if (WARN_ON(skb->ip_summed != CHECKSUM_PARTIAL)) {
13889 -               if (skb_header_cloned(skb) &&
13890 -                   (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
13891 -                       return ERR_PTR(err);
13892 -       }
13893 -
13894 -       rcu_read_lock();
13895 -       list_for_each_entry_rcu(ptype,
13896 -                       &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) {
13897 -               if (ptype->type == type && !ptype->dev && ptype->gso_segment) {
13898 -                       if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
13899 -                               err = ptype->gso_send_check(skb);
13900 -                               segs = ERR_PTR(err);
13901 -                               if (err || skb_gso_ok(skb, features))
13902 -                                       break;
13903 -                               __skb_push(skb, (skb->data -
13904 -                                                skb_network_header(skb)));
13905 -                       }
13906 -                       segs = ptype->gso_segment(skb, features);
13907 -                       break;
13908 -               }
13909 -       }
13910 -       rcu_read_unlock();
13911 -
13912 -       __skb_push(skb, skb->data - skb_mac_header(skb));
13913 -
13914 -       return segs;
13915 -}
13916 -
13917 -EXPORT_SYMBOL(skb_gso_segment);
13918 -
13919 -/* Take action when hardware reception checksum errors are detected. */
13920 -#ifdef CONFIG_BUG
13921 -void netdev_rx_csum_fault(struct net_device *dev)
13922 -{
13923 -       if (net_ratelimit()) {
13924 -               printk(KERN_ERR "%s: hw csum failure.\n",
13925 -                       dev ? dev->name : "<unknown>");
13926 -               dump_stack();
13927 -       }
13928 -}
13929 -EXPORT_SYMBOL(netdev_rx_csum_fault);
13930 -#endif
13931 -
13932 -/* Actually, we should eliminate this check as soon as we know, that:
13933 - * 1. IOMMU is present and allows to map all the memory.
13934 - * 2. No high memory really exists on this machine.
13935 - */
13936 -
13937 -static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
13938 -{
13939 -#ifdef CONFIG_HIGHMEM
13940 -       int i;
13941 -
13942 -       if (dev->features & NETIF_F_HIGHDMA)
13943 -               return 0;
13944 -
13945 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
13946 -               if (PageHighMem(skb_shinfo(skb)->frags[i].page))
13947 -                       return 1;
13948 -
13949 -#endif
13950 -       return 0;
13951 -}
13952 -
13953 -struct dev_gso_cb {
13954 -       void (*destructor)(struct sk_buff *skb);
13955 -};
13956 -
13957 -#define DEV_GSO_CB(skb) ((struct dev_gso_cb *)(skb)->cb)
13958 -
13959 -static void dev_gso_skb_destructor(struct sk_buff *skb)
13960 -{
13961 -       struct dev_gso_cb *cb;
13962 -
13963 -       do {
13964 -               struct sk_buff *nskb = skb->next;
13965 -
13966 -               skb->next = nskb->next;
13967 -               nskb->next = NULL;
13968 -               kfree_skb(nskb);
13969 -       } while (skb->next);
13970 -
13971 -       cb = DEV_GSO_CB(skb);
13972 -       if (cb->destructor)
13973 -               cb->destructor(skb);
13974 -}
13975 -
13976 -/**
13977 - *     dev_gso_segment - Perform emulated hardware segmentation on skb.
13978 - *     @skb: buffer to segment
13979 - *
13980 - *     This function segments the given skb and stores the list of segments
13981 - *     in skb->next.
13982 - */
13983 -static int dev_gso_segment(struct sk_buff *skb)
13984 -{
13985 -       struct net_device *dev = skb->dev;
13986 -       struct sk_buff *segs;
13987 -       int features = dev->features & ~(illegal_highdma(dev, skb) ?
13988 -                                        NETIF_F_SG : 0);
13989 -
13990 -       segs = skb_gso_segment(skb, features);
13991 -
13992 -       /* Verifying header integrity only. */
13993 -       if (!segs)
13994 -               return 0;
13995 -
13996 -       if (IS_ERR(segs))
13997 -               return PTR_ERR(segs);
13998 -
13999 -       skb->next = segs;
14000 -       DEV_GSO_CB(skb)->destructor = skb->destructor;
14001 -       skb->destructor = dev_gso_skb_destructor;
14002 -
14003 -       return 0;
14004 -}
14005 -
14006 -int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
14007 -                       struct netdev_queue *txq)
14008 -{
14009 -       if (likely(!skb->next)) {
14010 -               if (!list_empty(&ptype_all))
14011 -                       dev_queue_xmit_nit(skb, dev);
14012 -
14013 -               if (netif_needs_gso(dev, skb)) {
14014 -                       if (unlikely(dev_gso_segment(skb)))
14015 -                               goto out_kfree_skb;
14016 -                       if (skb->next)
14017 -                               goto gso;
14018 -               }
14019 -
14020 -               return dev->hard_start_xmit(skb, dev);
14021 -       }
14022 -
14023 -gso:
14024 -       do {
14025 -               struct sk_buff *nskb = skb->next;
14026 -               int rc;
14027 -
14028 -               skb->next = nskb->next;
14029 -               nskb->next = NULL;
14030 -               rc = dev->hard_start_xmit(nskb, dev);
14031 -               if (unlikely(rc)) {
14032 -                       nskb->next = skb->next;
14033 -                       skb->next = nskb;
14034 -                       return rc;
14035 -               }
14036 -               if (unlikely(netif_tx_queue_stopped(txq) && skb->next))
14037 -                       return NETDEV_TX_BUSY;
14038 -       } while (skb->next);
14039 -
14040 -       skb->destructor = DEV_GSO_CB(skb)->destructor;
14041 -
14042 -out_kfree_skb:
14043 -       kfree_skb(skb);
14044 -       return 0;
14045 -}
14046 -
14047 -static u32 simple_tx_hashrnd;
14048 -static int simple_tx_hashrnd_initialized = 0;
14049 -
14050 -static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
14051 -{
14052 -       u32 addr1, addr2, ports;
14053 -       u32 hash, ihl;
14054 -       u8 ip_proto = 0;
14055 -
14056 -       if (unlikely(!simple_tx_hashrnd_initialized)) {
14057 -               get_random_bytes(&simple_tx_hashrnd, 4);
14058 -               simple_tx_hashrnd_initialized = 1;
14059 -       }
14060 -
14061 -       switch (skb->protocol) {
14062 -       case __constant_htons(ETH_P_IP):
14063 -               if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)))
14064 -                       ip_proto = ip_hdr(skb)->protocol;
14065 -               addr1 = ip_hdr(skb)->saddr;
14066 -               addr2 = ip_hdr(skb)->daddr;
14067 -               ihl = ip_hdr(skb)->ihl;
14068 -               break;
14069 -       case __constant_htons(ETH_P_IPV6):
14070 -               ip_proto = ipv6_hdr(skb)->nexthdr;
14071 -               addr1 = ipv6_hdr(skb)->saddr.s6_addr32[3];
14072 -               addr2 = ipv6_hdr(skb)->daddr.s6_addr32[3];
14073 -               ihl = (40 >> 2);
14074 -               break;
14075 -       default:
14076 -               return 0;
14077 -       }
14078 -
14079 -
14080 -       switch (ip_proto) {
14081 -       case IPPROTO_TCP:
14082 -       case IPPROTO_UDP:
14083 -       case IPPROTO_DCCP:
14084 -       case IPPROTO_ESP:
14085 -       case IPPROTO_AH:
14086 -       case IPPROTO_SCTP:
14087 -       case IPPROTO_UDPLITE:
14088 -               ports = *((u32 *) (skb_network_header(skb) + (ihl * 4)));
14089 -               break;
14090 -
14091 -       default:
14092 -               ports = 0;
14093 -               break;
14094 -       }
14095 -
14096 -       hash = jhash_3words(addr1, addr2, ports, simple_tx_hashrnd);
14097 -
14098 -       return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32);
14099 -}
14100 -
14101 -static struct netdev_queue *dev_pick_tx(struct net_device *dev,
14102 -                                       struct sk_buff *skb)
14103 -{
14104 -       u16 queue_index = 0;
14105 -
14106 -       if (dev->select_queue)
14107 -               queue_index = dev->select_queue(dev, skb);
14108 -       else if (dev->real_num_tx_queues > 1)
14109 -               queue_index = simple_tx_hash(dev, skb);
14110 -
14111 -       skb_set_queue_mapping(skb, queue_index);
14112 -       return netdev_get_tx_queue(dev, queue_index);
14113 -}
14114 -
14115 -/**
14116 - *     dev_queue_xmit - transmit a buffer
14117 - *     @skb: buffer to transmit
14118 - *
14119 - *     Queue a buffer for transmission to a network device. The caller must
14120 - *     have set the device and priority and built the buffer before calling
14121 - *     this function. The function can be called from an interrupt.
14122 - *
14123 - *     A negative errno code is returned on a failure. A success does not
14124 - *     guarantee the frame will be transmitted as it may be dropped due
14125 - *     to congestion or traffic shaping.
14126 - *
14127 - * -----------------------------------------------------------------------------------
14128 - *      I notice this method can also return errors from the queue disciplines,
14129 - *      including NET_XMIT_DROP, which is a positive value.  So, errors can also
14130 - *      be positive.
14131 - *
14132 - *      Regardless of the return value, the skb is consumed, so it is currently
14133 - *      difficult to retry a send to this method.  (You can bump the ref count
14134 - *      before sending to hold a reference for retry if you are careful.)
14135 - *
14136 - *      When calling this method, interrupts MUST be enabled.  This is because
14137 - *      the BH enable code must have IRQs enabled so that it will not deadlock.
14138 - *          --BLG
14139 - */
14140 -int dev_queue_xmit(struct sk_buff *skb)
14141 -{
14142 -       struct net_device *dev = skb->dev;
14143 -       struct netdev_queue *txq;
14144 -       struct Qdisc *q;
14145 -       int rc = -ENOMEM;
14146 -
14147 -       /* GSO will handle the following emulations directly. */
14148 -       if (netif_needs_gso(dev, skb))
14149 -               goto gso;
14150 -
14151 -       if (skb_shinfo(skb)->frag_list &&
14152 -           !(dev->features & NETIF_F_FRAGLIST) &&
14153 -           __skb_linearize(skb))
14154 -               goto out_kfree_skb;
14155 -
14156 -       /* Fragmented skb is linearized if device does not support SG,
14157 -        * or if at least one of fragments is in highmem and device
14158 -        * does not support DMA from it.
14159 -        */
14160 -       if (skb_shinfo(skb)->nr_frags &&
14161 -           (!(dev->features & NETIF_F_SG) || illegal_highdma(dev, skb)) &&
14162 -           __skb_linearize(skb))
14163 -               goto out_kfree_skb;
14164 -
14165 -       /* If packet is not checksummed and device does not support
14166 -        * checksumming for this protocol, complete checksumming here.
14167 -        */
14168 -       if (skb->ip_summed == CHECKSUM_PARTIAL) {
14169 -               skb_set_transport_header(skb, skb->csum_start -
14170 -                                             skb_headroom(skb));
14171 -               if (!dev_can_checksum(dev, skb) && skb_checksum_help(skb))
14172 -                       goto out_kfree_skb;
14173 -       }
14174 -
14175 -gso:
14176 -       /* Disable soft irqs for various locks below. Also
14177 -        * stops preemption for RCU.
14178 -        */
14179 -       rcu_read_lock_bh();
14180 -
14181 -       txq = dev_pick_tx(dev, skb);
14182 -       q = rcu_dereference(txq->qdisc);
14183 -
14184 -#ifdef CONFIG_NET_CLS_ACT
14185 -       skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS);
14186 -#endif
14187 -       if (q->enqueue) {
14188 -               spinlock_t *root_lock = qdisc_lock(q);
14189 -
14190 -               spin_lock(root_lock);
14191 -
14192 -               if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) {
14193 -                       kfree_skb(skb);
14194 -                       rc = NET_XMIT_DROP;
14195 -               } else {
14196 -                       rc = qdisc_enqueue_root(skb, q);
14197 -                       qdisc_run(q);
14198 -               }
14199 -               spin_unlock(root_lock);
14200 -
14201 -               goto out;
14202 -       }
14203 -
14204 -       /* The device has no queue. Common case for software devices:
14205 -          loopback, all the sorts of tunnels...
14206 -
14207 -          Really, it is unlikely that netif_tx_lock protection is necessary
14208 -          here.  (f.e. loopback and IP tunnels are clean ignoring statistics
14209 -          counters.)
14210 -          However, it is possible, that they rely on protection
14211 -          made by us here.
14212 -
14213 -          Check this and shot the lock. It is not prone from deadlocks.
14214 -          Either shot noqueue qdisc, it is even simpler 8)
14215 -        */
14216 -       if (dev->flags & IFF_UP) {
14217 -               int cpu = smp_processor_id(); /* ok because BHs are off */
14218 -
14219 -               if (txq->xmit_lock_owner != cpu) {
14220 -
14221 -                       HARD_TX_LOCK(dev, txq, cpu);
14222 -
14223 -                       if (!netif_tx_queue_stopped(txq)) {
14224 -                               rc = 0;
14225 -                               if (!dev_hard_start_xmit(skb, dev, txq)) {
14226 -                                       HARD_TX_UNLOCK(dev, txq);
14227 -                                       goto out;
14228 -                               }
14229 -                       }
14230 -                       HARD_TX_UNLOCK(dev, txq);
14231 -                       if (net_ratelimit())
14232 -                               printk(KERN_CRIT "Virtual device %s asks to "
14233 -                                      "queue packet!\n", dev->name);
14234 -               } else {
14235 -                       /* Recursion is detected! It is possible,
14236 -                        * unfortunately */
14237 -                       if (net_ratelimit())
14238 -                               printk(KERN_CRIT "Dead loop on virtual device "
14239 -                                      "%s, fix it urgently!\n", dev->name);
14240 -               }
14241 -       }
14242 -
14243 -       rc = -ENETDOWN;
14244 -       rcu_read_unlock_bh();
14245 -
14246 -out_kfree_skb:
14247 -       kfree_skb(skb);
14248 -       return rc;
14249 -out:
14250 -       rcu_read_unlock_bh();
14251 -       return rc;
14252 -}
14253 -
14254 -
14255 -/*=======================================================================
14256 -                       Receiver routines
14257 -  =======================================================================*/
14258 -
14259 -int netdev_max_backlog __read_mostly = 1000;
14260 -int netdev_budget __read_mostly = 300;
14261 -int weight_p __read_mostly = 64;            /* old backlog weight */
14262 -
14263 -DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, };
14264 -
14265 -
14266 -/**
14267 - *     netif_rx        -       post buffer to the network code
14268 - *     @skb: buffer to post
14269 - *
14270 - *     This function receives a packet from a device driver and queues it for
14271 - *     the upper (protocol) levels to process.  It always succeeds. The buffer
14272 - *     may be dropped during processing for congestion control or by the
14273 - *     protocol layers.
14274 - *
14275 - *     return values:
14276 - *     NET_RX_SUCCESS  (no congestion)
14277 - *     NET_RX_DROP     (packet was dropped)
14278 - *
14279 - */
14280 -
14281 -int netif_rx(struct sk_buff *skb)
14282 -{
14283 -       struct softnet_data *queue;
14284 -       unsigned long flags;
14285 -
14286 -       /* if netpoll wants it, pretend we never saw it */
14287 -       if (netpoll_rx(skb))
14288 -               return NET_RX_DROP;
14289 -
14290 -       if (!skb->tstamp.tv64)
14291 -               net_timestamp(skb);
14292 -
14293 -       /*
14294 -        * The code is rearranged so that the path is the most
14295 -        * short when CPU is congested, but is still operating.
14296 -        */
14297 -       local_irq_save(flags);
14298 -       queue = &__get_cpu_var(softnet_data);
14299 -
14300 -       __get_cpu_var(netdev_rx_stat).total++;
14301 -       if (queue->input_pkt_queue.qlen <= netdev_max_backlog) {
14302 -               if (queue->input_pkt_queue.qlen) {
14303 -enqueue:
14304 -                       __skb_queue_tail(&queue->input_pkt_queue, skb);
14305 -                       local_irq_restore(flags);
14306 -                       return NET_RX_SUCCESS;
14307 -               }
14308 -
14309 -               napi_schedule(&queue->backlog);
14310 -               goto enqueue;
14311 -       }
14312 -
14313 -       __get_cpu_var(netdev_rx_stat).dropped++;
14314 -       local_irq_restore(flags);
14315 -
14316 -       kfree_skb(skb);
14317 -       return NET_RX_DROP;
14318 -}
14319 -
14320 -int netif_rx_ni(struct sk_buff *skb)
14321 -{
14322 -       int err;
14323 -
14324 -       preempt_disable();
14325 -       err = netif_rx(skb);
14326 -       if (local_softirq_pending())
14327 -               do_softirq();
14328 -       preempt_enable();
14329 -
14330 -       return err;
14331 -}
14332 -
14333 -EXPORT_SYMBOL(netif_rx_ni);
14334 -
14335 -static void net_tx_action(struct softirq_action *h)
14336 -{
14337 -       struct softnet_data *sd = &__get_cpu_var(softnet_data);
14338 -
14339 -       if (sd->completion_queue) {
14340 -               struct sk_buff *clist;
14341 -
14342 -               local_irq_disable();
14343 -               clist = sd->completion_queue;
14344 -               sd->completion_queue = NULL;
14345 -               local_irq_enable();
14346 -
14347 -               while (clist) {
14348 -                       struct sk_buff *skb = clist;
14349 -                       clist = clist->next;
14350 -
14351 -                       WARN_ON(atomic_read(&skb->users));
14352 -                       __kfree_skb(skb);
14353 -               }
14354 -       }
14355 -
14356 -       if (sd->output_queue) {
14357 -               struct Qdisc *head;
14358 -
14359 -               local_irq_disable();
14360 -               head = sd->output_queue;
14361 -               sd->output_queue = NULL;
14362 -               local_irq_enable();
14363 -
14364 -               while (head) {
14365 -                       struct Qdisc *q = head;
14366 -                       spinlock_t *root_lock;
14367 -
14368 -                       head = head->next_sched;
14369 -
14370 -                       root_lock = qdisc_lock(q);
14371 -                       if (spin_trylock(root_lock)) {
14372 -                               smp_mb__before_clear_bit();
14373 -                               clear_bit(__QDISC_STATE_SCHED,
14374 -                                         &q->state);
14375 -                               qdisc_run(q);
14376 -                               spin_unlock(root_lock);
14377 -                       } else {
14378 -                               if (!test_bit(__QDISC_STATE_DEACTIVATED,
14379 -                                             &q->state)) {
14380 -                                       __netif_reschedule(q);
14381 -                               } else {
14382 -                                       smp_mb__before_clear_bit();
14383 -                                       clear_bit(__QDISC_STATE_SCHED,
14384 -                                                 &q->state);
14385 -                               }
14386 -                       }
14387 -               }
14388 -       }
14389 -}
14390 -
14391 -static inline int deliver_skb(struct sk_buff *skb,
14392 -                             struct packet_type *pt_prev,
14393 -                             struct net_device *orig_dev)
14394 -{
14395 -       atomic_inc(&skb->users);
14396 -       return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
14397 -}
14398 -
14399 -#if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE)
14400 -/* These hooks defined here for ATM */
14401 -struct net_bridge;
14402 -struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
14403 -                                               unsigned char *addr);
14404 -void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent) __read_mostly;
14405 -
14406 -/*
14407 - * If bridge module is loaded call bridging hook.
14408 - *  returns NULL if packet was consumed.
14409 - */
14410 -struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
14411 -                                       struct sk_buff *skb) __read_mostly;
14412 -static inline struct sk_buff *handle_bridge(struct sk_buff *skb,
14413 -                                           struct packet_type **pt_prev, int *ret,
14414 -                                           struct net_device *orig_dev)
14415 -{
14416 -       struct net_bridge_port *port;
14417 -
14418 -       if (skb->pkt_type == PACKET_LOOPBACK ||
14419 -           (port = rcu_dereference(skb->dev->br_port)) == NULL)
14420 -               return skb;
14421 -
14422 -       if (*pt_prev) {
14423 -               *ret = deliver_skb(skb, *pt_prev, orig_dev);
14424 -               *pt_prev = NULL;
14425 -       }
14426 -
14427 -       return br_handle_frame_hook(port, skb);
14428 -}
14429 -#else
14430 -#define handle_bridge(skb, pt_prev, ret, orig_dev)     (skb)
14431 -#endif
14432 -
14433 -#if defined(CONFIG_MACVLAN) || defined(CONFIG_MACVLAN_MODULE)
14434 -struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *skb) __read_mostly;
14435 -EXPORT_SYMBOL_GPL(macvlan_handle_frame_hook);
14436 -
14437 -static inline struct sk_buff *handle_macvlan(struct sk_buff *skb,
14438 -                                            struct packet_type **pt_prev,
14439 -                                            int *ret,
14440 -                                            struct net_device *orig_dev)
14441 -{
14442 -       if (skb->dev->macvlan_port == NULL)
14443 -               return skb;
14444 -
14445 -       if (*pt_prev) {
14446 -               *ret = deliver_skb(skb, *pt_prev, orig_dev);
14447 -               *pt_prev = NULL;
14448 -       }
14449 -       return macvlan_handle_frame_hook(skb);
14450 -}
14451 -#else
14452 -#define handle_macvlan(skb, pt_prev, ret, orig_dev)    (skb)
14453 -#endif
14454 -
14455 -#ifdef CONFIG_NET_CLS_ACT
14456 -/* TODO: Maybe we should just force sch_ingress to be compiled in
14457 - * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions
14458 - * a compare and 2 stores extra right now if we dont have it on
14459 - * but have CONFIG_NET_CLS_ACT
14460 - * NOTE: This doesnt stop any functionality; if you dont have
14461 - * the ingress scheduler, you just cant add policies on ingress.
14462 - *
14463 - */
14464 -static int ing_filter(struct sk_buff *skb)
14465 -{
14466 -       struct net_device *dev = skb->dev;
14467 -       u32 ttl = G_TC_RTTL(skb->tc_verd);
14468 -       struct netdev_queue *rxq;
14469 -       int result = TC_ACT_OK;
14470 -       struct Qdisc *q;
14471 -
14472 -       if (MAX_RED_LOOP < ttl++) {
14473 -               printk(KERN_WARNING
14474 -                      "Redir loop detected Dropping packet (%d->%d)\n",
14475 -                      skb->iif, dev->ifindex);
14476 -               return TC_ACT_SHOT;
14477 -       }
14478 -
14479 -       skb->tc_verd = SET_TC_RTTL(skb->tc_verd, ttl);
14480 -       skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_INGRESS);
14481 -
14482 -       rxq = &dev->rx_queue;
14483 -
14484 -       q = rxq->qdisc;
14485 -       if (q != &noop_qdisc) {
14486 -               spin_lock(qdisc_lock(q));
14487 -               if (likely(!test_bit(__QDISC_STATE_DEACTIVATED, &q->state)))
14488 -                       result = qdisc_enqueue_root(skb, q);
14489 -               spin_unlock(qdisc_lock(q));
14490 -       }
14491 -
14492 -       return result;
14493 -}
14494 -
14495 -static inline struct sk_buff *handle_ing(struct sk_buff *skb,
14496 -                                        struct packet_type **pt_prev,
14497 -                                        int *ret, struct net_device *orig_dev)
14498 -{
14499 -       if (skb->dev->rx_queue.qdisc == &noop_qdisc)
14500 -               goto out;
14501 -
14502 -       if (*pt_prev) {
14503 -               *ret = deliver_skb(skb, *pt_prev, orig_dev);
14504 -               *pt_prev = NULL;
14505 -       } else {
14506 -               /* Huh? Why does turning on AF_PACKET affect this? */
14507 -               skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd);
14508 -       }
14509 -
14510 -       switch (ing_filter(skb)) {
14511 -       case TC_ACT_SHOT:
14512 -       case TC_ACT_STOLEN:
14513 -               kfree_skb(skb);
14514 -               return NULL;
14515 -       }
14516 -
14517 -out:
14518 -       skb->tc_verd = 0;
14519 -       return skb;
14520 -}
14521 -#endif
14522 -
14523 -/*
14524 - *     netif_nit_deliver - deliver received packets to network taps
14525 - *     @skb: buffer
14526 - *
14527 - *     This function is used to deliver incoming packets to network
14528 - *     taps. It should be used when the normal netif_receive_skb path
14529 - *     is bypassed, for example because of VLAN acceleration.
14530 - */
14531 -void netif_nit_deliver(struct sk_buff *skb)
14532 -{
14533 -       struct packet_type *ptype;
14534 -
14535 -       if (list_empty(&ptype_all))
14536 -               return;
14537 -
14538 -       skb_reset_network_header(skb);
14539 -       skb_reset_transport_header(skb);
14540 -       skb->mac_len = skb->network_header - skb->mac_header;
14541 -
14542 -       rcu_read_lock();
14543 -       list_for_each_entry_rcu(ptype, &ptype_all, list) {
14544 -               if (!ptype->dev || ptype->dev == skb->dev)
14545 -                       deliver_skb(skb, ptype, skb->dev);
14546 -       }
14547 -       rcu_read_unlock();
14548 -}
14549 -
14550 -/* The code already makes the assumption that packet handlers run
14551 - * sequentially on the same CPU. -Sapan */
14552 -DEFINE_PER_CPU(int, sknid_elevator) = 0;
14553 -
14554 -/**
14555 - *     netif_receive_skb - process receive buffer from network
14556 - *     @skb: buffer to process
14557 - *
14558 - *     netif_receive_skb() is the main receive data processing function.
14559 - *     It always succeeds. The buffer may be dropped during processing
14560 - *     for congestion control or by the protocol layers.
14561 - *
14562 - *     This function may only be called from softirq context and interrupts
14563 - *     should be enabled.
14564 - *
14565 - *     Return values (usually ignored):
14566 - *     NET_RX_SUCCESS: no congestion
14567 - *     NET_RX_DROP: packet was dropped
14568 - */
14569 -int netif_receive_skb(struct sk_buff *skb)
14570 -{
14571 -       struct packet_type *ptype, *pt_prev;
14572 -       struct net_device *orig_dev;
14573 -       struct net_device *null_or_orig;
14574 -       int ret = NET_RX_DROP;
14575 -       int *cur_elevator = &__get_cpu_var(sknid_elevator);
14576 -       __be16 type;
14577 -
14578 -       *cur_elevator = 0;
14579 -
14580 -       /* if we've gotten here through NAPI, check netpoll */
14581 -       if (netpoll_receive_skb(skb))
14582 -               return NET_RX_DROP;
14583 -
14584 -       if (!skb->tstamp.tv64)
14585 -               net_timestamp(skb);
14586 -
14587 -       if (!skb->iif)
14588 -               skb->iif = skb->dev->ifindex;
14589 -
14590 -       null_or_orig = NULL;
14591 -       orig_dev = skb->dev;
14592 -       if (orig_dev->master) {
14593 -               if (skb_bond_should_drop(skb))
14594 -                       null_or_orig = orig_dev; /* deliver only exact match */
14595 -               else
14596 -                       skb->dev = orig_dev->master;
14597 -       }
14598 -
14599 -       __get_cpu_var(netdev_rx_stat).total++;
14600 -
14601 -       skb_reset_network_header(skb);
14602 -       skb_reset_transport_header(skb);
14603 -       skb->mac_len = skb->network_header - skb->mac_header;
14604 -
14605 -       pt_prev = NULL;
14606 -
14607 -       rcu_read_lock();
14608 -
14609 -       /* Don't receive packets in an exiting network namespace */
14610 -       if (!net_alive(dev_net(skb->dev)))
14611 -               goto out;
14612 -
14613 -#ifdef CONFIG_NET_CLS_ACT
14614 -       if (skb->tc_verd & TC_NCLS) {
14615 -               skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
14616 -               goto ncls;
14617 -       }
14618 -#endif
14619 -
14620 -       list_for_each_entry_rcu(ptype, &ptype_all, list) {
14621 -               if (ptype->dev == null_or_orig || ptype->dev == skb->dev ||
14622 -                   ptype->dev == orig_dev) {
14623 -                       if (pt_prev)
14624 -                               ret = deliver_skb(skb, pt_prev, orig_dev);
14625 -                       pt_prev = ptype;
14626 -               }
14627 -       }
14628 -
14629 -#ifdef CONFIG_NET_CLS_ACT
14630 -       skb = handle_ing(skb, &pt_prev, &ret, orig_dev);
14631 -       if (!skb)
14632 -               goto out;
14633 -ncls:
14634 -#endif
14635 -
14636 -       skb = handle_bridge(skb, &pt_prev, &ret, orig_dev);
14637 -       if (!skb)
14638 -               goto out;
14639 -       skb = handle_macvlan(skb, &pt_prev, &ret, orig_dev);
14640 -       if (!skb)
14641 -               goto out;
14642 -
14643 -       type = skb->protocol;
14644 -       list_for_each_entry_rcu(ptype,
14645 -                       &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) {
14646 -               if (ptype->type == type &&
14647 -                   (ptype->dev == null_or_orig || ptype->dev == skb->dev ||
14648 -                    ptype->dev == orig_dev)) {
14649 -                       if (pt_prev)
14650 -                               ret = deliver_skb(skb, pt_prev, orig_dev);
14651 -                       pt_prev = ptype;
14652 -               }
14653 -       }
14654 -
14655 -       if (pt_prev) {
14656 -               /* At this point, cur_elevator may be -2 or a positive value, in
14657 -                * case a previous protocol handler marked it */
14658 -               if (*cur_elevator) {
14659 -                       atomic_inc(&skb->users);
14660 -               }
14661 -               
14662 -               ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
14663 -
14664 -               if ((*cur_elevator)>0) {
14665 -                       skb->skb_tag = *cur_elevator;
14666 -                       list_for_each_entry_rcu(ptype, &ptype_all, list) {
14667 -                               if ((!ptype->dev || ptype->dev == skb->dev) && (ptype->sknid_elevator)) {
14668 -                                       ret = deliver_skb(skb, ptype, orig_dev);
14669 -                               }
14670 -                       }
14671 -               }
14672 -
14673 -               if (*cur_elevator) {
14674 -                       /* We have a packet */
14675 -                       kfree_skb(skb);
14676 -               }
14677 -       } else {
14678 -               kfree_skb(skb);
14679 -               /* Jamal, now you will not able to escape explaining
14680 -                * me how you were going to use this. :-)
14681 -                */
14682 -               ret = NET_RX_DROP;
14683 -       }
14684 -
14685 -out:
14686 -       rcu_read_unlock();
14687 -       return ret;
14688 -}
14689 -
14690 -/* Network device is going away, flush any packets still pending  */
14691 -static void flush_backlog(void *arg)
14692 -{
14693 -       struct net_device *dev = arg;
14694 -       struct softnet_data *queue = &__get_cpu_var(softnet_data);
14695 -       struct sk_buff *skb, *tmp;
14696 -
14697 -       skb_queue_walk_safe(&queue->input_pkt_queue, skb, tmp)
14698 -               if (skb->dev == dev) {
14699 -                       __skb_unlink(skb, &queue->input_pkt_queue);
14700 -                       kfree_skb(skb);
14701 -               }
14702 -}
14703 -
14704 -static int process_backlog(struct napi_struct *napi, int quota)
14705 -{
14706 -       int work = 0;
14707 -       struct softnet_data *queue = &__get_cpu_var(softnet_data);
14708 -       unsigned long start_time = jiffies;
14709 -
14710 -       napi->weight = weight_p;
14711 -       do {
14712 -               struct sk_buff *skb;
14713 -
14714 -               local_irq_disable();
14715 -               skb = __skb_dequeue(&queue->input_pkt_queue);
14716 -               if (!skb) {
14717 -                       __napi_complete(napi);
14718 -                       local_irq_enable();
14719 -                       break;
14720 -               }
14721 -               local_irq_enable();
14722 -
14723 -               netif_receive_skb(skb);
14724 -       } while (++work < quota && jiffies == start_time);
14725 -
14726 -       return work;
14727 -}
14728 -
14729 -/**
14730 - * __napi_schedule - schedule for receive
14731 - * @n: entry to schedule
14732 - *
14733 - * The entry's receive function will be scheduled to run
14734 - */
14735 -void __napi_schedule(struct napi_struct *n)
14736 -{
14737 -       unsigned long flags;
14738 -
14739 -       local_irq_save(flags);
14740 -       list_add_tail(&n->poll_list, &__get_cpu_var(softnet_data).poll_list);
14741 -       __raise_softirq_irqoff(NET_RX_SOFTIRQ);
14742 -       local_irq_restore(flags);
14743 -}
14744 -EXPORT_SYMBOL(__napi_schedule);
14745 -
14746 -
14747 -static void net_rx_action(struct softirq_action *h)
14748 -{
14749 -       struct list_head *list = &__get_cpu_var(softnet_data).poll_list;
14750 -       unsigned long start_time = jiffies;
14751 -       int budget = netdev_budget;
14752 -       void *have;
14753 -
14754 -       local_irq_disable();
14755 -
14756 -       while (!list_empty(list)) {
14757 -               struct napi_struct *n;
14758 -               int work, weight;
14759 -
14760 -               /* If softirq window is exhuasted then punt.
14761 -                *
14762 -                * Note that this is a slight policy change from the
14763 -                * previous NAPI code, which would allow up to 2
14764 -                * jiffies to pass before breaking out.  The test
14765 -                * used to be "jiffies - start_time > 1".
14766 -                */
14767 -               if (unlikely(budget <= 0 || jiffies != start_time))
14768 -                       goto softnet_break;
14769 -
14770 -               local_irq_enable();
14771 -
14772 -               /* Even though interrupts have been re-enabled, this
14773 -                * access is safe because interrupts can only add new
14774 -                * entries to the tail of this list, and only ->poll()
14775 -                * calls can remove this head entry from the list.
14776 -                */
14777 -               n = list_entry(list->next, struct napi_struct, poll_list);
14778 -
14779 -               have = netpoll_poll_lock(n);
14780 -
14781 -               weight = n->weight;
14782 -
14783 -               /* This NAPI_STATE_SCHED test is for avoiding a race
14784 -                * with netpoll's poll_napi().  Only the entity which
14785 -                * obtains the lock and sees NAPI_STATE_SCHED set will
14786 -                * actually make the ->poll() call.  Therefore we avoid
14787 -                * accidently calling ->poll() when NAPI is not scheduled.
14788 -                */
14789 -               work = 0;
14790 -               if (test_bit(NAPI_STATE_SCHED, &n->state))
14791 -                       work = n->poll(n, weight);
14792 -
14793 -               WARN_ON_ONCE(work > weight);
14794 -
14795 -               budget -= work;
14796 -
14797 -               local_irq_disable();
14798 -
14799 -               /* Drivers must not modify the NAPI state if they
14800 -                * consume the entire weight.  In such cases this code
14801 -                * still "owns" the NAPI instance and therefore can
14802 -                * move the instance around on the list at-will.
14803 -                */
14804 -               if (unlikely(work == weight)) {
14805 -                       if (unlikely(napi_disable_pending(n)))
14806 -                               __napi_complete(n);
14807 -                       else
14808 -                               list_move_tail(&n->poll_list, list);
14809 -               }
14810 -
14811 -               netpoll_poll_unlock(have);
14812 -       }
14813 -out:
14814 -       local_irq_enable();
14815 -
14816 -#ifdef CONFIG_NET_DMA
14817 -       /*
14818 -        * There may not be any more sk_buffs coming right now, so push
14819 -        * any pending DMA copies to hardware
14820 -        */
14821 -       if (!cpus_empty(net_dma.channel_mask)) {
14822 -               int chan_idx;
14823 -               for_each_cpu_mask_nr(chan_idx, net_dma.channel_mask) {
14824 -                       struct dma_chan *chan = net_dma.channels[chan_idx];
14825 -                       if (chan)
14826 -                               dma_async_memcpy_issue_pending(chan);
14827 -               }
14828 -       }
14829 -#endif
14830 -
14831 -       return;
14832 -
14833 -softnet_break:
14834 -       __get_cpu_var(netdev_rx_stat).time_squeeze++;
14835 -       __raise_softirq_irqoff(NET_RX_SOFTIRQ);
14836 -       goto out;
14837 -}
14838 -
14839 -static gifconf_func_t * gifconf_list [NPROTO];
14840 -
14841 -/**
14842 - *     register_gifconf        -       register a SIOCGIF handler
14843 - *     @family: Address family
14844 - *     @gifconf: Function handler
14845 - *
14846 - *     Register protocol dependent address dumping routines. The handler
14847 - *     that is passed must not be freed or reused until it has been replaced
14848 - *     by another handler.
14849 - */
14850 -int register_gifconf(unsigned int family, gifconf_func_t * gifconf)
14851 -{
14852 -       if (family >= NPROTO)
14853 -               return -EINVAL;
14854 -       gifconf_list[family] = gifconf;
14855 -       return 0;
14856 -}
14857 -
14858 -
14859 -/*
14860 - *     Map an interface index to its name (SIOCGIFNAME)
14861 - */
14862 -
14863 -/*
14864 - *     We need this ioctl for efficient implementation of the
14865 - *     if_indextoname() function required by the IPv6 API.  Without
14866 - *     it, we would have to search all the interfaces to find a
14867 - *     match.  --pb
14868 - */
14869 -
14870 -static int dev_ifname(struct net *net, struct ifreq __user *arg)
14871 -{
14872 -       struct net_device *dev;
14873 -       struct ifreq ifr;
14874 -
14875 -       /*
14876 -        *      Fetch the caller's info block.
14877 -        */
14878 -
14879 -       if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
14880 -               return -EFAULT;
14881 -
14882 -       read_lock(&dev_base_lock);
14883 -       dev = __dev_get_by_index(net, ifr.ifr_ifindex);
14884 -       if (!dev) {
14885 -               read_unlock(&dev_base_lock);
14886 -               return -ENODEV;
14887 -       }
14888 -
14889 -       strcpy(ifr.ifr_name, dev->name);
14890 -       read_unlock(&dev_base_lock);
14891 -
14892 -       if (copy_to_user(arg, &ifr, sizeof(struct ifreq)))
14893 -               return -EFAULT;
14894 -       return 0;
14895 -}
14896 -
14897 -/*
14898 - *     Perform a SIOCGIFCONF call. This structure will change
14899 - *     size eventually, and there is nothing I can do about it.
14900 - *     Thus we will need a 'compatibility mode'.
14901 - */
14902 -
14903 -static int dev_ifconf(struct net *net, char __user *arg)
14904 -{
14905 -       struct ifconf ifc;
14906 -       struct net_device *dev;
14907 -       char __user *pos;
14908 -       int len;
14909 -       int total;
14910 -       int i;
14911 -
14912 -       /*
14913 -        *      Fetch the caller's info block.
14914 -        */
14915 -
14916 -       if (copy_from_user(&ifc, arg, sizeof(struct ifconf)))
14917 -               return -EFAULT;
14918 -
14919 -       pos = ifc.ifc_buf;
14920 -       len = ifc.ifc_len;
14921 -
14922 -       /*
14923 -        *      Loop over the interfaces, and write an info block for each.
14924 -        */
14925 -
14926 -       total = 0;
14927 -       for_each_netdev(net, dev) {
14928 -               if (!nx_dev_visible(current->nx_info, dev))
14929 -                       continue;
14930 -               for (i = 0; i < NPROTO; i++) {
14931 -                       if (gifconf_list[i]) {
14932 -                               int done;
14933 -                               if (!pos)
14934 -                                       done = gifconf_list[i](dev, NULL, 0);
14935 -                               else
14936 -                                       done = gifconf_list[i](dev, pos + total,
14937 -                                                              len - total);
14938 -                               if (done < 0)
14939 -                                       return -EFAULT;
14940 -                               total += done;
14941 -                       }
14942 -               }
14943 -       }
14944 -
14945 -       /*
14946 -        *      All done.  Write the updated control block back to the caller.
14947 -        */
14948 -       ifc.ifc_len = total;
14949 -
14950 -       /*
14951 -        *      Both BSD and Solaris return 0 here, so we do too.
14952 -        */
14953 -       return copy_to_user(arg, &ifc, sizeof(struct ifconf)) ? -EFAULT : 0;
14954 -}
14955 -
14956 -#ifdef CONFIG_PROC_FS
14957 -/*
14958 - *     This is invoked by the /proc filesystem handler to display a device
14959 - *     in detail.
14960 - */
14961 -void *dev_seq_start(struct seq_file *seq, loff_t *pos)
14962 -       __acquires(dev_base_lock)
14963 -{
14964 -       struct net *net = seq_file_net(seq);
14965 -       loff_t off;
14966 -       struct net_device *dev;
14967 -
14968 -       read_lock(&dev_base_lock);
14969 -       if (!*pos)
14970 -               return SEQ_START_TOKEN;
14971 -
14972 -       off = 1;
14973 -       for_each_netdev(net, dev)
14974 -               if (off++ == *pos)
14975 -                       return dev;
14976 -
14977 -       return NULL;
14978 -}
14979 -
14980 -void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
14981 -{
14982 -       struct net *net = seq_file_net(seq);
14983 -       ++*pos;
14984 -       return v == SEQ_START_TOKEN ?
14985 -               first_net_device(net) : next_net_device((struct net_device *)v);
14986 -}
14987 -
14988 -void dev_seq_stop(struct seq_file *seq, void *v)
14989 -       __releases(dev_base_lock)
14990 -{
14991 -       read_unlock(&dev_base_lock);
14992 -}
14993 -
14994 -static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
14995 -{
14996 -       struct net_device_stats *stats = dev->get_stats(dev);
14997 -
14998 -       if (!nx_dev_visible(current->nx_info, dev))
14999 -               return;
15000 -
15001 -       seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
15002 -                  "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
15003 -                  dev->name, stats->rx_bytes, stats->rx_packets,
15004 -                  stats->rx_errors,
15005 -                  stats->rx_dropped + stats->rx_missed_errors,
15006 -                  stats->rx_fifo_errors,
15007 -                  stats->rx_length_errors + stats->rx_over_errors +
15008 -                   stats->rx_crc_errors + stats->rx_frame_errors,
15009 -                  stats->rx_compressed, stats->multicast,
15010 -                  stats->tx_bytes, stats->tx_packets,
15011 -                  stats->tx_errors, stats->tx_dropped,
15012 -                  stats->tx_fifo_errors, stats->collisions,
15013 -                  stats->tx_carrier_errors +
15014 -                   stats->tx_aborted_errors +
15015 -                   stats->tx_window_errors +
15016 -                   stats->tx_heartbeat_errors,
15017 -                  stats->tx_compressed);
15018 -}
15019 -
15020 -/*
15021 - *     Called from the PROCfs module. This now uses the new arbitrary sized
15022 - *     /proc/net interface to create /proc/net/dev
15023 - */
15024 -static int dev_seq_show(struct seq_file *seq, void *v)
15025 -{
15026 -       if (v == SEQ_START_TOKEN)
15027 -               seq_puts(seq, "Inter-|   Receive                            "
15028 -                             "                    |  Transmit\n"
15029 -                             " face |bytes    packets errs drop fifo frame "
15030 -                             "compressed multicast|bytes    packets errs "
15031 -                             "drop fifo colls carrier compressed\n");
15032 -       else
15033 -               dev_seq_printf_stats(seq, v);
15034 -       return 0;
15035 -}
15036 -
15037 -static struct netif_rx_stats *softnet_get_online(loff_t *pos)
15038 -{
15039 -       struct netif_rx_stats *rc = NULL;
15040 -
15041 -       while (*pos < nr_cpu_ids)
15042 -               if (cpu_online(*pos)) {
15043 -                       rc = &per_cpu(netdev_rx_stat, *pos);
15044 -                       break;
15045 -               } else
15046 -                       ++*pos;
15047 -       return rc;
15048 -}
15049 -
15050 -static void *softnet_seq_start(struct seq_file *seq, loff_t *pos)
15051 -{
15052 -       return softnet_get_online(pos);
15053 -}
15054 -
15055 -static void *softnet_seq_next(struct seq_file *seq, void *v, loff_t *pos)
15056 -{
15057 -       ++*pos;
15058 -       return softnet_get_online(pos);
15059 -}
15060 -
15061 -static void softnet_seq_stop(struct seq_file *seq, void *v)
15062 -{
15063 -}
15064 -
15065 -static int softnet_seq_show(struct seq_file *seq, void *v)
15066 -{
15067 -       struct netif_rx_stats *s = v;
15068 -
15069 -       seq_printf(seq, "%08x %08x %08x %08x %08x %08x %08x %08x %08x\n",
15070 -                  s->total, s->dropped, s->time_squeeze, 0,
15071 -                  0, 0, 0, 0, /* was fastroute */
15072 -                  s->cpu_collision );
15073 -       return 0;
15074 -}
15075 -
15076 -static const struct seq_operations dev_seq_ops = {
15077 -       .start = dev_seq_start,
15078 -       .next  = dev_seq_next,
15079 -       .stop  = dev_seq_stop,
15080 -       .show  = dev_seq_show,
15081 -};
15082 -
15083 -static int dev_seq_open(struct inode *inode, struct file *file)
15084 -{
15085 -       return seq_open_net(inode, file, &dev_seq_ops,
15086 -                           sizeof(struct seq_net_private));
15087 -}
15088 -
15089 -static const struct file_operations dev_seq_fops = {
15090 -       .owner   = THIS_MODULE,
15091 -       .open    = dev_seq_open,
15092 -       .read    = seq_read,
15093 -       .llseek  = seq_lseek,
15094 -       .release = seq_release_net,
15095 -};
15096 -
15097 -static const struct seq_operations softnet_seq_ops = {
15098 -       .start = softnet_seq_start,
15099 -       .next  = softnet_seq_next,
15100 -       .stop  = softnet_seq_stop,
15101 -       .show  = softnet_seq_show,
15102 -};
15103 -
15104 -static int softnet_seq_open(struct inode *inode, struct file *file)
15105 -{
15106 -       return seq_open(file, &softnet_seq_ops);
15107 -}
15108 -
15109 -static const struct file_operations softnet_seq_fops = {
15110 -       .owner   = THIS_MODULE,
15111 -       .open    = softnet_seq_open,
15112 -       .read    = seq_read,
15113 -       .llseek  = seq_lseek,
15114 -       .release = seq_release,
15115 -};
15116 -
15117 -static void *ptype_get_idx(loff_t pos)
15118 -{
15119 -       struct packet_type *pt = NULL;
15120 -       loff_t i = 0;
15121 -       int t;
15122 -
15123 -       list_for_each_entry_rcu(pt, &ptype_all, list) {
15124 -               if (i == pos)
15125 -                       return pt;
15126 -               ++i;
15127 -       }
15128 -
15129 -       for (t = 0; t < PTYPE_HASH_SIZE; t++) {
15130 -               list_for_each_entry_rcu(pt, &ptype_base[t], list) {
15131 -                       if (i == pos)
15132 -                               return pt;
15133 -                       ++i;
15134 -               }
15135 -       }
15136 -       return NULL;
15137 -}
15138 -
15139 -static void *ptype_seq_start(struct seq_file *seq, loff_t *pos)
15140 -       __acquires(RCU)
15141 -{
15142 -       rcu_read_lock();
15143 -       return *pos ? ptype_get_idx(*pos - 1) : SEQ_START_TOKEN;
15144 -}
15145 -
15146 -static void *ptype_seq_next(struct seq_file *seq, void *v, loff_t *pos)
15147 -{
15148 -       struct packet_type *pt;
15149 -       struct list_head *nxt;
15150 -       int hash;
15151 -
15152 -       ++*pos;
15153 -       if (v == SEQ_START_TOKEN)
15154 -               return ptype_get_idx(0);
15155 -
15156 -       pt = v;
15157 -       nxt = pt->list.next;
15158 -       if (pt->type == htons(ETH_P_ALL)) {
15159 -               if (nxt != &ptype_all)
15160 -                       goto found;
15161 -               hash = 0;
15162 -               nxt = ptype_base[0].next;
15163 -       } else
15164 -               hash = ntohs(pt->type) & PTYPE_HASH_MASK;
15165 -
15166 -       while (nxt == &ptype_base[hash]) {
15167 -               if (++hash >= PTYPE_HASH_SIZE)
15168 -                       return NULL;
15169 -               nxt = ptype_base[hash].next;
15170 -       }
15171 -found:
15172 -       return list_entry(nxt, struct packet_type, list);
15173 -}
15174 -
15175 -static void ptype_seq_stop(struct seq_file *seq, void *v)
15176 -       __releases(RCU)
15177 -{
15178 -       rcu_read_unlock();
15179 -}
15180 -
15181 -static void ptype_seq_decode(struct seq_file *seq, void *sym)
15182 -{
15183 -#ifdef CONFIG_KALLSYMS
15184 -       unsigned long offset = 0, symsize;
15185 -       const char *symname;
15186 -       char *modname;
15187 -       char namebuf[128];
15188 -
15189 -       symname = kallsyms_lookup((unsigned long)sym, &symsize, &offset,
15190 -                                 &modname, namebuf);
15191 -
15192 -       if (symname) {
15193 -               char *delim = ":";
15194 -
15195 -               if (!modname)
15196 -                       modname = delim = "";
15197 -               seq_printf(seq, "%s%s%s%s+0x%lx", delim, modname, delim,
15198 -                          symname, offset);
15199 -               return;
15200 -       }
15201 -#endif
15202 -
15203 -       seq_printf(seq, "[%p]", sym);
15204 -}
15205 -
15206 -static int ptype_seq_show(struct seq_file *seq, void *v)
15207 -{
15208 -       struct packet_type *pt = v;
15209 -
15210 -       if (v == SEQ_START_TOKEN)
15211 -               seq_puts(seq, "Type Device      Function\n");
15212 -       else if (pt->dev == NULL || dev_net(pt->dev) == seq_file_net(seq)) {
15213 -               if (pt->type == htons(ETH_P_ALL))
15214 -                       seq_puts(seq, "ALL ");
15215 -               else
15216 -                       seq_printf(seq, "%04x", ntohs(pt->type));
15217 -
15218 -               seq_printf(seq, " %-8s ",
15219 -                          pt->dev ? pt->dev->name : "");
15220 -               ptype_seq_decode(seq,  pt->func);
15221 -               seq_putc(seq, '\n');
15222 -       }
15223 -
15224 -       return 0;
15225 -}
15226 -
15227 -static const struct seq_operations ptype_seq_ops = {
15228 -       .start = ptype_seq_start,
15229 -       .next  = ptype_seq_next,
15230 -       .stop  = ptype_seq_stop,
15231 -       .show  = ptype_seq_show,
15232 -};
15233 -
15234 -static int ptype_seq_open(struct inode *inode, struct file *file)
15235 -{
15236 -       return seq_open_net(inode, file, &ptype_seq_ops,
15237 -                       sizeof(struct seq_net_private));
15238 -}
15239 -
15240 -static const struct file_operations ptype_seq_fops = {
15241 -       .owner   = THIS_MODULE,
15242 -       .open    = ptype_seq_open,
15243 -       .read    = seq_read,
15244 -       .llseek  = seq_lseek,
15245 -       .release = seq_release_net,
15246 -};
15247 -
15248 -
15249 -static int __net_init dev_proc_net_init(struct net *net)
15250 -{
15251 -       int rc = -ENOMEM;
15252 -
15253 -       if (!proc_net_fops_create(net, "dev", S_IRUGO, &dev_seq_fops))
15254 -               goto out;
15255 -       if (!proc_net_fops_create(net, "softnet_stat", S_IRUGO, &softnet_seq_fops))
15256 -               goto out_dev;
15257 -       if (!proc_net_fops_create(net, "ptype", S_IRUGO, &ptype_seq_fops))
15258 -               goto out_softnet;
15259 -
15260 -       if (wext_proc_init(net))
15261 -               goto out_ptype;
15262 -       rc = 0;
15263 -out:
15264 -       return rc;
15265 -out_ptype:
15266 -       proc_net_remove(net, "ptype");
15267 -out_softnet:
15268 -       proc_net_remove(net, "softnet_stat");
15269 -out_dev:
15270 -       proc_net_remove(net, "dev");
15271 -       goto out;
15272 -}
15273 -
15274 -static void __net_exit dev_proc_net_exit(struct net *net)
15275 -{
15276 -       wext_proc_exit(net);
15277 -
15278 -       proc_net_remove(net, "ptype");
15279 -       proc_net_remove(net, "softnet_stat");
15280 -       proc_net_remove(net, "dev");
15281 -}
15282 -
15283 -static struct pernet_operations __net_initdata dev_proc_ops = {
15284 -       .init = dev_proc_net_init,
15285 -       .exit = dev_proc_net_exit,
15286 -};
15287 -
15288 -static int __init dev_proc_init(void)
15289 -{
15290 -       return register_pernet_subsys(&dev_proc_ops);
15291 -}
15292 -#else
15293 -#define dev_proc_init() 0
15294 -#endif /* CONFIG_PROC_FS */
15295 -
15296 -
15297 -/**
15298 - *     netdev_set_master       -       set up master/slave pair
15299 - *     @slave: slave device
15300 - *     @master: new master device
15301 - *
15302 - *     Changes the master device of the slave. Pass %NULL to break the
15303 - *     bonding. The caller must hold the RTNL semaphore. On a failure
15304 - *     a negative errno code is returned. On success the reference counts
15305 - *     are adjusted, %RTM_NEWLINK is sent to the routing socket and the
15306 - *     function returns zero.
15307 - */
15308 -int netdev_set_master(struct net_device *slave, struct net_device *master)
15309 -{
15310 -       struct net_device *old = slave->master;
15311 -
15312 -       ASSERT_RTNL();
15313 -
15314 -       if (master) {
15315 -               if (old)
15316 -                       return -EBUSY;
15317 -               dev_hold(master);
15318 -       }
15319 -
15320 -       slave->master = master;
15321 -
15322 -       synchronize_net();
15323 -
15324 -       if (old)
15325 -               dev_put(old);
15326 -
15327 -       if (master)
15328 -               slave->flags |= IFF_SLAVE;
15329 -       else
15330 -               slave->flags &= ~IFF_SLAVE;
15331 -
15332 -       rtmsg_ifinfo(RTM_NEWLINK, slave, IFF_SLAVE);
15333 -       return 0;
15334 -}
15335 -
15336 -static void dev_change_rx_flags(struct net_device *dev, int flags)
15337 -{
15338 -       if (dev->flags & IFF_UP && dev->change_rx_flags)
15339 -               dev->change_rx_flags(dev, flags);
15340 -}
15341 -
15342 -static int __dev_set_promiscuity(struct net_device *dev, int inc)
15343 -{
15344 -       unsigned short old_flags = dev->flags;
15345 -
15346 -       ASSERT_RTNL();
15347 -
15348 -       dev->flags |= IFF_PROMISC;
15349 -       dev->promiscuity += inc;
15350 -       if (dev->promiscuity == 0) {
15351 -               /*
15352 -                * Avoid overflow.
15353 -                * If inc causes overflow, untouch promisc and return error.
15354 -                */
15355 -               if (inc < 0)
15356 -                       dev->flags &= ~IFF_PROMISC;
15357 -               else {
15358 -                       dev->promiscuity -= inc;
15359 -                       printk(KERN_WARNING "%s: promiscuity touches roof, "
15360 -                               "set promiscuity failed, promiscuity feature "
15361 -                               "of device might be broken.\n", dev->name);
15362 -                       return -EOVERFLOW;
15363 -               }
15364 -       }
15365 -       if (dev->flags != old_flags) {
15366 -               printk(KERN_INFO "device %s %s promiscuous mode\n",
15367 -                      dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
15368 -                                                              "left");
15369 -               if (audit_enabled)
15370 -                       audit_log(current->audit_context, GFP_ATOMIC,
15371 -                               AUDIT_ANOM_PROMISCUOUS,
15372 -                               "dev=%s prom=%d old_prom=%d auid=%u uid=%u gid=%u ses=%u",
15373 -                               dev->name, (dev->flags & IFF_PROMISC),
15374 -                               (old_flags & IFF_PROMISC),
15375 -                               audit_get_loginuid(current),
15376 -                               current->uid, current->gid,
15377 -                               audit_get_sessionid(current));
15378 -
15379 -               dev_change_rx_flags(dev, IFF_PROMISC);
15380 -       }
15381 -       return 0;
15382 -}
15383 -
15384 -/**
15385 - *     dev_set_promiscuity     - update promiscuity count on a device
15386 - *     @dev: device
15387 - *     @inc: modifier
15388 - *
15389 - *     Add or remove promiscuity from a device. While the count in the device
15390 - *     remains above zero the interface remains promiscuous. Once it hits zero
15391 - *     the device reverts back to normal filtering operation. A negative inc
15392 - *     value is used to drop promiscuity on the device.
15393 - *     Return 0 if successful or a negative errno code on error.
15394 - */
15395 -int dev_set_promiscuity(struct net_device *dev, int inc)
15396 -{
15397 -       unsigned short old_flags = dev->flags;
15398 -       int err;
15399 -
15400 -       err = __dev_set_promiscuity(dev, inc);
15401 -       if (err < 0)
15402 -               return err;
15403 -       if (dev->flags != old_flags)
15404 -               dev_set_rx_mode(dev);
15405 -       return err;
15406 -}
15407 -
15408 -/**
15409 - *     dev_set_allmulti        - update allmulti count on a device
15410 - *     @dev: device
15411 - *     @inc: modifier
15412 - *
15413 - *     Add or remove reception of all multicast frames to a device. While the
15414 - *     count in the device remains above zero the interface remains listening
15415 - *     to all interfaces. Once it hits zero the device reverts back to normal
15416 - *     filtering operation. A negative @inc value is used to drop the counter
15417 - *     when releasing a resource needing all multicasts.
15418 - *     Return 0 if successful or a negative errno code on error.
15419 - */
15420 -
15421 -int dev_set_allmulti(struct net_device *dev, int inc)
15422 -{
15423 -       unsigned short old_flags = dev->flags;
15424 -
15425 -       ASSERT_RTNL();
15426 -
15427 -       dev->flags |= IFF_ALLMULTI;
15428 -       dev->allmulti += inc;
15429 -       if (dev->allmulti == 0) {
15430 -               /*
15431 -                * Avoid overflow.
15432 -                * If inc causes overflow, untouch allmulti and return error.
15433 -                */
15434 -               if (inc < 0)
15435 -                       dev->flags &= ~IFF_ALLMULTI;
15436 -               else {
15437 -                       dev->allmulti -= inc;
15438 -                       printk(KERN_WARNING "%s: allmulti touches roof, "
15439 -                               "set allmulti failed, allmulti feature of "
15440 -                               "device might be broken.\n", dev->name);
15441 -                       return -EOVERFLOW;
15442 -               }
15443 -       }
15444 -       if (dev->flags ^ old_flags) {
15445 -               dev_change_rx_flags(dev, IFF_ALLMULTI);
15446 -               dev_set_rx_mode(dev);
15447 -       }
15448 -       return 0;
15449 -}
15450 -
15451 -/*
15452 - *     Upload unicast and multicast address lists to device and
15453 - *     configure RX filtering. When the device doesn't support unicast
15454 - *     filtering it is put in promiscuous mode while unicast addresses
15455 - *     are present.
15456 - */
15457 -void __dev_set_rx_mode(struct net_device *dev)
15458 -{
15459 -       /* dev_open will call this function so the list will stay sane. */
15460 -       if (!(dev->flags&IFF_UP))
15461 -               return;
15462 -
15463 -       if (!netif_device_present(dev))
15464 -               return;
15465 -
15466 -       if (dev->set_rx_mode)
15467 -               dev->set_rx_mode(dev);
15468 -       else {
15469 -               /* Unicast addresses changes may only happen under the rtnl,
15470 -                * therefore calling __dev_set_promiscuity here is safe.
15471 -                */
15472 -               if (dev->uc_count > 0 && !dev->uc_promisc) {
15473 -                       __dev_set_promiscuity(dev, 1);
15474 -                       dev->uc_promisc = 1;
15475 -               } else if (dev->uc_count == 0 && dev->uc_promisc) {
15476 -                       __dev_set_promiscuity(dev, -1);
15477 -                       dev->uc_promisc = 0;
15478 -               }
15479 -
15480 -               if (dev->set_multicast_list)
15481 -                       dev->set_multicast_list(dev);
15482 -       }
15483 -}
15484 -
15485 -void dev_set_rx_mode(struct net_device *dev)
15486 -{
15487 -       netif_addr_lock_bh(dev);
15488 -       __dev_set_rx_mode(dev);
15489 -       netif_addr_unlock_bh(dev);
15490 -}
15491 -
15492 -int __dev_addr_delete(struct dev_addr_list **list, int *count,
15493 -                     void *addr, int alen, int glbl)
15494 -{
15495 -       struct dev_addr_list *da;
15496 -
15497 -       for (; (da = *list) != NULL; list = &da->next) {
15498 -               if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 &&
15499 -                   alen == da->da_addrlen) {
15500 -                       if (glbl) {
15501 -                               int old_glbl = da->da_gusers;
15502 -                               da->da_gusers = 0;
15503 -                               if (old_glbl == 0)
15504 -                                       break;
15505 -                       }
15506 -                       if (--da->da_users)
15507 -                               return 0;
15508 -
15509 -                       *list = da->next;
15510 -                       kfree(da);
15511 -                       (*count)--;
15512 -                       return 0;
15513 -               }
15514 -       }
15515 -       return -ENOENT;
15516 -}
15517 -
15518 -int __dev_addr_add(struct dev_addr_list **list, int *count,
15519 -                  void *addr, int alen, int glbl)
15520 -{
15521 -       struct dev_addr_list *da;
15522 -
15523 -       for (da = *list; da != NULL; da = da->next) {
15524 -               if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 &&
15525 -                   da->da_addrlen == alen) {
15526 -                       if (glbl) {
15527 -                               int old_glbl = da->da_gusers;
15528 -                               da->da_gusers = 1;
15529 -                               if (old_glbl)
15530 -                                       return 0;
15531 -                       }
15532 -                       da->da_users++;
15533 -                       return 0;
15534 -               }
15535 -       }
15536 -
15537 -       da = kzalloc(sizeof(*da), GFP_ATOMIC);
15538 -       if (da == NULL)
15539 -               return -ENOMEM;
15540 -       memcpy(da->da_addr, addr, alen);
15541 -       da->da_addrlen = alen;
15542 -       da->da_users = 1;
15543 -       da->da_gusers = glbl ? 1 : 0;
15544 -       da->next = *list;
15545 -       *list = da;
15546 -       (*count)++;
15547 -       return 0;
15548 -}
15549 -
15550 -/**
15551 - *     dev_unicast_delete      - Release secondary unicast address.
15552 - *     @dev: device
15553 - *     @addr: address to delete
15554 - *     @alen: length of @addr
15555 - *
15556 - *     Release reference to a secondary unicast address and remove it
15557 - *     from the device if the reference count drops to zero.
15558 - *
15559 - *     The caller must hold the rtnl_mutex.
15560 - */
15561 -int dev_unicast_delete(struct net_device *dev, void *addr, int alen)
15562 -{
15563 -       int err;
15564 -
15565 -       ASSERT_RTNL();
15566 -
15567 -       netif_addr_lock_bh(dev);
15568 -       err = __dev_addr_delete(&dev->uc_list, &dev->uc_count, addr, alen, 0);
15569 -       if (!err)
15570 -               __dev_set_rx_mode(dev);
15571 -       netif_addr_unlock_bh(dev);
15572 -       return err;
15573 -}
15574 -EXPORT_SYMBOL(dev_unicast_delete);
15575 -
15576 -/**
15577 - *     dev_unicast_add         - add a secondary unicast address
15578 - *     @dev: device
15579 - *     @addr: address to add
15580 - *     @alen: length of @addr
15581 - *
15582 - *     Add a secondary unicast address to the device or increase
15583 - *     the reference count if it already exists.
15584 - *
15585 - *     The caller must hold the rtnl_mutex.
15586 - */
15587 -int dev_unicast_add(struct net_device *dev, void *addr, int alen)
15588 -{
15589 -       int err;
15590 -
15591 -       ASSERT_RTNL();
15592 -
15593 -       netif_addr_lock_bh(dev);
15594 -       err = __dev_addr_add(&dev->uc_list, &dev->uc_count, addr, alen, 0);
15595 -       if (!err)
15596 -               __dev_set_rx_mode(dev);
15597 -       netif_addr_unlock_bh(dev);
15598 -       return err;
15599 -}
15600 -EXPORT_SYMBOL(dev_unicast_add);
15601 -
15602 -int __dev_addr_sync(struct dev_addr_list **to, int *to_count,
15603 -                   struct dev_addr_list **from, int *from_count)
15604 -{
15605 -       struct dev_addr_list *da, *next;
15606 -       int err = 0;
15607 -
15608 -       da = *from;
15609 -       while (da != NULL) {
15610 -               next = da->next;
15611 -               if (!da->da_synced) {
15612 -                       err = __dev_addr_add(to, to_count,
15613 -                                            da->da_addr, da->da_addrlen, 0);
15614 -                       if (err < 0)
15615 -                               break;
15616 -                       da->da_synced = 1;
15617 -                       da->da_users++;
15618 -               } else if (da->da_users == 1) {
15619 -                       __dev_addr_delete(to, to_count,
15620 -                                         da->da_addr, da->da_addrlen, 0);
15621 -                       __dev_addr_delete(from, from_count,
15622 -                                         da->da_addr, da->da_addrlen, 0);
15623 -               }
15624 -               da = next;
15625 -       }
15626 -       return err;
15627 -}
15628 -
15629 -void __dev_addr_unsync(struct dev_addr_list **to, int *to_count,
15630 -                      struct dev_addr_list **from, int *from_count)
15631 -{
15632 -       struct dev_addr_list *da, *next;
15633 -
15634 -       da = *from;
15635 -       while (da != NULL) {
15636 -               next = da->next;
15637 -               if (da->da_synced) {
15638 -                       __dev_addr_delete(to, to_count,
15639 -                                         da->da_addr, da->da_addrlen, 0);
15640 -                       da->da_synced = 0;
15641 -                       __dev_addr_delete(from, from_count,
15642 -                                         da->da_addr, da->da_addrlen, 0);
15643 -               }
15644 -               da = next;
15645 -       }
15646 -}
15647 -
15648 -/**
15649 - *     dev_unicast_sync - Synchronize device's unicast list to another device
15650 - *     @to: destination device
15651 - *     @from: source device
15652 - *
15653 - *     Add newly added addresses to the destination device and release
15654 - *     addresses that have no users left. The source device must be
15655 - *     locked by netif_tx_lock_bh.
15656 - *
15657 - *     This function is intended to be called from the dev->set_rx_mode
15658 - *     function of layered software devices.
15659 - */
15660 -int dev_unicast_sync(struct net_device *to, struct net_device *from)
15661 -{
15662 -       int err = 0;
15663 -
15664 -       netif_addr_lock_bh(to);
15665 -       err = __dev_addr_sync(&to->uc_list, &to->uc_count,
15666 -                             &from->uc_list, &from->uc_count);
15667 -       if (!err)
15668 -               __dev_set_rx_mode(to);
15669 -       netif_addr_unlock_bh(to);
15670 -       return err;
15671 -}
15672 -EXPORT_SYMBOL(dev_unicast_sync);
15673 -
15674 -/**
15675 - *     dev_unicast_unsync - Remove synchronized addresses from the destination device
15676 - *     @to: destination device
15677 - *     @from: source device
15678 - *
15679 - *     Remove all addresses that were added to the destination device by
15680 - *     dev_unicast_sync(). This function is intended to be called from the
15681 - *     dev->stop function of layered software devices.
15682 - */
15683 -void dev_unicast_unsync(struct net_device *to, struct net_device *from)
15684 -{
15685 -       netif_addr_lock_bh(from);
15686 -       netif_addr_lock(to);
15687 -
15688 -       __dev_addr_unsync(&to->uc_list, &to->uc_count,
15689 -                         &from->uc_list, &from->uc_count);
15690 -       __dev_set_rx_mode(to);
15691 -
15692 -       netif_addr_unlock(to);
15693 -       netif_addr_unlock_bh(from);
15694 -}
15695 -EXPORT_SYMBOL(dev_unicast_unsync);
15696 -
15697 -static void __dev_addr_discard(struct dev_addr_list **list)
15698 -{
15699 -       struct dev_addr_list *tmp;
15700 -
15701 -       while (*list != NULL) {
15702 -               tmp = *list;
15703 -               *list = tmp->next;
15704 -               if (tmp->da_users > tmp->da_gusers)
15705 -                       printk("__dev_addr_discard: address leakage! "
15706 -                              "da_users=%d\n", tmp->da_users);
15707 -               kfree(tmp);
15708 -       }
15709 -}
15710 -
15711 -static void dev_addr_discard(struct net_device *dev)
15712 -{
15713 -       netif_addr_lock_bh(dev);
15714 -
15715 -       __dev_addr_discard(&dev->uc_list);
15716 -       dev->uc_count = 0;
15717 -
15718 -       __dev_addr_discard(&dev->mc_list);
15719 -       dev->mc_count = 0;
15720 -
15721 -       netif_addr_unlock_bh(dev);
15722 -}
15723 -
15724 -unsigned dev_get_flags(const struct net_device *dev)
15725 -{
15726 -       unsigned flags;
15727 -
15728 -       flags = (dev->flags & ~(IFF_PROMISC |
15729 -                               IFF_ALLMULTI |
15730 -                               IFF_RUNNING |
15731 -                               IFF_LOWER_UP |
15732 -                               IFF_DORMANT)) |
15733 -               (dev->gflags & (IFF_PROMISC |
15734 -                               IFF_ALLMULTI));
15735 -
15736 -       if (netif_running(dev)) {
15737 -               if (netif_oper_up(dev))
15738 -                       flags |= IFF_RUNNING;
15739 -               if (netif_carrier_ok(dev))
15740 -                       flags |= IFF_LOWER_UP;
15741 -               if (netif_dormant(dev))
15742 -                       flags |= IFF_DORMANT;
15743 -       }
15744 -
15745 -       return flags;
15746 -}
15747 -
15748 -int dev_change_flags(struct net_device *dev, unsigned flags)
15749 -{
15750 -       int ret, changes;
15751 -       int old_flags = dev->flags;
15752 -
15753 -       ASSERT_RTNL();
15754 -
15755 -       /*
15756 -        *      Set the flags on our device.
15757 -        */
15758 -
15759 -       dev->flags = (flags & (IFF_DEBUG | IFF_NOTRAILERS | IFF_NOARP |
15760 -                              IFF_DYNAMIC | IFF_MULTICAST | IFF_PORTSEL |
15761 -                              IFF_AUTOMEDIA)) |
15762 -                    (dev->flags & (IFF_UP | IFF_VOLATILE | IFF_PROMISC |
15763 -                                   IFF_ALLMULTI));
15764 -
15765 -       /*
15766 -        *      Load in the correct multicast list now the flags have changed.
15767 -        */
15768 -
15769 -       if ((old_flags ^ flags) & IFF_MULTICAST)
15770 -               dev_change_rx_flags(dev, IFF_MULTICAST);
15771 -
15772 -       dev_set_rx_mode(dev);
15773 -
15774 -       /*
15775 -        *      Have we downed the interface. We handle IFF_UP ourselves
15776 -        *      according to user attempts to set it, rather than blindly
15777 -        *      setting it.
15778 -        */
15779 -
15780 -       ret = 0;
15781 -       if ((old_flags ^ flags) & IFF_UP) {     /* Bit is different  ? */
15782 -               ret = ((old_flags & IFF_UP) ? dev_close : dev_open)(dev);
15783 -
15784 -               if (!ret)
15785 -                       dev_set_rx_mode(dev);
15786 -       }
15787 -
15788 -       if (dev->flags & IFF_UP &&
15789 -           ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI |
15790 -                                         IFF_VOLATILE)))
15791 -               call_netdevice_notifiers(NETDEV_CHANGE, dev);
15792 -
15793 -       if ((flags ^ dev->gflags) & IFF_PROMISC) {
15794 -               int inc = (flags & IFF_PROMISC) ? +1 : -1;
15795 -               dev->gflags ^= IFF_PROMISC;
15796 -               dev_set_promiscuity(dev, inc);
15797 -       }
15798 -
15799 -       /* NOTE: order of synchronization of IFF_PROMISC and IFF_ALLMULTI
15800 -          is important. Some (broken) drivers set IFF_PROMISC, when
15801 -          IFF_ALLMULTI is requested not asking us and not reporting.
15802 -        */
15803 -       if ((flags ^ dev->gflags) & IFF_ALLMULTI) {
15804 -               int inc = (flags & IFF_ALLMULTI) ? +1 : -1;
15805 -               dev->gflags ^= IFF_ALLMULTI;
15806 -               dev_set_allmulti(dev, inc);
15807 -       }
15808 -
15809 -       /* Exclude state transition flags, already notified */
15810 -       changes = (old_flags ^ dev->flags) & ~(IFF_UP | IFF_RUNNING);
15811 -       if (changes)
15812 -               rtmsg_ifinfo(RTM_NEWLINK, dev, changes);
15813 -
15814 -       return ret;
15815 -}
15816 -
15817 -int dev_set_mtu(struct net_device *dev, int new_mtu)
15818 -{
15819 -       int err;
15820 -
15821 -       if (new_mtu == dev->mtu)
15822 -               return 0;
15823 -
15824 -       /*      MTU must be positive.    */
15825 -       if (new_mtu < 0)
15826 -               return -EINVAL;
15827 -
15828 -       if (!netif_device_present(dev))
15829 -               return -ENODEV;
15830 -
15831 -       err = 0;
15832 -       if (dev->change_mtu)
15833 -               err = dev->change_mtu(dev, new_mtu);
15834 -       else
15835 -               dev->mtu = new_mtu;
15836 -       if (!err && dev->flags & IFF_UP)
15837 -               call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
15838 -       return err;
15839 -}
15840 -
15841 -int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
15842 -{
15843 -       int err;
15844 -
15845 -       if (!dev->set_mac_address)
15846 -               return -EOPNOTSUPP;
15847 -       if (sa->sa_family != dev->type)
15848 -               return -EINVAL;
15849 -       if (!netif_device_present(dev))
15850 -               return -ENODEV;
15851 -       err = dev->set_mac_address(dev, sa);
15852 -       if (!err)
15853 -               call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
15854 -       return err;
15855 -}
15856 -
15857 -/*
15858 - *     Perform the SIOCxIFxxx calls, inside read_lock(dev_base_lock)
15859 - */
15860 -static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cmd)
15861 -{
15862 -       int err;
15863 -       struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name);
15864 -
15865 -       if (!dev)
15866 -               return -ENODEV;
15867 -
15868 -       switch (cmd) {
15869 -               case SIOCGIFFLAGS:      /* Get interface flags */
15870 -                       ifr->ifr_flags = dev_get_flags(dev);
15871 -                       return 0;
15872 -
15873 -               case SIOCGIFMETRIC:     /* Get the metric on the interface
15874 -                                          (currently unused) */
15875 -                       ifr->ifr_metric = 0;
15876 -                       return 0;
15877 -
15878 -               case SIOCGIFMTU:        /* Get the MTU of a device */
15879 -                       ifr->ifr_mtu = dev->mtu;
15880 -                       return 0;
15881 -
15882 -               case SIOCGIFHWADDR:
15883 -                       if (!dev->addr_len)
15884 -                               memset(ifr->ifr_hwaddr.sa_data, 0, sizeof ifr->ifr_hwaddr.sa_data);
15885 -                       else
15886 -                               memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr,
15887 -                                      min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len));
15888 -                       ifr->ifr_hwaddr.sa_family = dev->type;
15889 -                       return 0;
15890 -
15891 -               case SIOCGIFSLAVE:
15892 -                       err = -EINVAL;
15893 -                       break;
15894 -
15895 -               case SIOCGIFMAP:
15896 -                       ifr->ifr_map.mem_start = dev->mem_start;
15897 -                       ifr->ifr_map.mem_end   = dev->mem_end;
15898 -                       ifr->ifr_map.base_addr = dev->base_addr;
15899 -                       ifr->ifr_map.irq       = dev->irq;
15900 -                       ifr->ifr_map.dma       = dev->dma;
15901 -                       ifr->ifr_map.port      = dev->if_port;
15902 -                       return 0;
15903 -
15904 -               case SIOCGIFINDEX:
15905 -                       ifr->ifr_ifindex = dev->ifindex;
15906 -                       return 0;
15907 -
15908 -               case SIOCGIFTXQLEN:
15909 -                       ifr->ifr_qlen = dev->tx_queue_len;
15910 -                       return 0;
15911 -
15912 -               default:
15913 -                       /* dev_ioctl() should ensure this case
15914 -                        * is never reached
15915 -                        */
15916 -                       WARN_ON(1);
15917 -                       err = -EINVAL;
15918 -                       break;
15919 -
15920 -       }
15921 -       return err;
15922 -}
15923 -
15924 -/*
15925 - *     Perform the SIOCxIFxxx calls, inside rtnl_lock()
15926 - */
15927 -static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
15928 -{
15929 -       int err;
15930 -       struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name);
15931 -
15932 -       if (!dev)
15933 -               return -ENODEV;
15934 -
15935 -       switch (cmd) {
15936 -               case SIOCSIFFLAGS:      /* Set interface flags */
15937 -                       return dev_change_flags(dev, ifr->ifr_flags);
15938 -
15939 -               case SIOCSIFMETRIC:     /* Set the metric on the interface
15940 -                                          (currently unused) */
15941 -                       return -EOPNOTSUPP;
15942 -
15943 -               case SIOCSIFMTU:        /* Set the MTU of a device */
15944 -                       return dev_set_mtu(dev, ifr->ifr_mtu);
15945 -
15946 -               case SIOCSIFHWADDR:
15947 -                       return dev_set_mac_address(dev, &ifr->ifr_hwaddr);
15948 -
15949 -               case SIOCSIFHWBROADCAST:
15950 -                       if (ifr->ifr_hwaddr.sa_family != dev->type)
15951 -                               return -EINVAL;
15952 -                       memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data,
15953 -                              min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len));
15954 -                       call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
15955 -                       return 0;
15956 -
15957 -               case SIOCSIFMAP:
15958 -                       if (dev->set_config) {
15959 -                               if (!netif_device_present(dev))
15960 -                                       return -ENODEV;
15961 -                               return dev->set_config(dev, &ifr->ifr_map);
15962 -                       }
15963 -                       return -EOPNOTSUPP;
15964 -
15965 -               case SIOCADDMULTI:
15966 -                       if ((!dev->set_multicast_list && !dev->set_rx_mode) ||
15967 -                           ifr->ifr_hwaddr.sa_family != AF_UNSPEC)
15968 -                               return -EINVAL;
15969 -                       if (!netif_device_present(dev))
15970 -                               return -ENODEV;
15971 -                       return dev_mc_add(dev, ifr->ifr_hwaddr.sa_data,
15972 -                                         dev->addr_len, 1);
15973 -
15974 -               case SIOCDELMULTI:
15975 -                       if ((!dev->set_multicast_list && !dev->set_rx_mode) ||
15976 -                           ifr->ifr_hwaddr.sa_family != AF_UNSPEC)
15977 -                               return -EINVAL;
15978 -                       if (!netif_device_present(dev))
15979 -                               return -ENODEV;
15980 -                       return dev_mc_delete(dev, ifr->ifr_hwaddr.sa_data,
15981 -                                            dev->addr_len, 1);
15982 -
15983 -               case SIOCSIFTXQLEN:
15984 -                       if (ifr->ifr_qlen < 0)
15985 -                               return -EINVAL;
15986 -                       dev->tx_queue_len = ifr->ifr_qlen;
15987 -                       return 0;
15988 -
15989 -               case SIOCSIFNAME:
15990 -                       ifr->ifr_newname[IFNAMSIZ-1] = '\0';
15991 -                       return dev_change_name(dev, ifr->ifr_newname);
15992 -
15993 -               /*
15994 -                *      Unknown or private ioctl
15995 -                */
15996 -
15997 -               default:
15998 -                       if ((cmd >= SIOCDEVPRIVATE &&
15999 -                           cmd <= SIOCDEVPRIVATE + 15) ||
16000 -                           cmd == SIOCBONDENSLAVE ||
16001 -                           cmd == SIOCBONDRELEASE ||
16002 -                           cmd == SIOCBONDSETHWADDR ||
16003 -                           cmd == SIOCBONDSLAVEINFOQUERY ||
16004 -                           cmd == SIOCBONDINFOQUERY ||
16005 -                           cmd == SIOCBONDCHANGEACTIVE ||
16006 -                           cmd == SIOCGMIIPHY ||
16007 -                           cmd == SIOCGMIIREG ||
16008 -                           cmd == SIOCSMIIREG ||
16009 -                           cmd == SIOCBRADDIF ||
16010 -                           cmd == SIOCBRDELIF ||
16011 -                           cmd == SIOCWANDEV) {
16012 -                               err = -EOPNOTSUPP;
16013 -                               if (dev->do_ioctl) {
16014 -                                       if (netif_device_present(dev))
16015 -                                               err = dev->do_ioctl(dev, ifr,
16016 -                                                                   cmd);
16017 -                                       else
16018 -                                               err = -ENODEV;
16019 -                               }
16020 -                       } else
16021 -                               err = -EINVAL;
16022 -
16023 -       }
16024 -       return err;
16025 -}
16026 -
16027 -/*
16028 - *     This function handles all "interface"-type I/O control requests. The actual
16029 - *     'doing' part of this is dev_ifsioc above.
16030 - */
16031 -
16032 -/**
16033 - *     dev_ioctl       -       network device ioctl
16034 - *     @net: the applicable net namespace
16035 - *     @cmd: command to issue
16036 - *     @arg: pointer to a struct ifreq in user space
16037 - *
16038 - *     Issue ioctl functions to devices. This is normally called by the
16039 - *     user space syscall interfaces but can sometimes be useful for
16040 - *     other purposes. The return value is the return from the syscall if
16041 - *     positive or a negative errno code on error.
16042 - */
16043 -
16044 -int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
16045 -{
16046 -       struct ifreq ifr;
16047 -       int ret;
16048 -       char *colon;
16049 -
16050 -       /* One special case: SIOCGIFCONF takes ifconf argument
16051 -          and requires shared lock, because it sleeps writing
16052 -          to user space.
16053 -        */
16054 -
16055 -       if (cmd == SIOCGIFCONF) {
16056 -               rtnl_lock();
16057 -               ret = dev_ifconf(net, (char __user *) arg);
16058 -               rtnl_unlock();
16059 -               return ret;
16060 -       }
16061 -       if (cmd == SIOCGIFNAME)
16062 -               return dev_ifname(net, (struct ifreq __user *)arg);
16063 -
16064 -       if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
16065 -               return -EFAULT;
16066 -
16067 -       ifr.ifr_name[IFNAMSIZ-1] = 0;
16068 -
16069 -       colon = strchr(ifr.ifr_name, ':');
16070 -       if (colon)
16071 -               *colon = 0;
16072 -
16073 -       /*
16074 -        *      See which interface the caller is talking about.
16075 -        */
16076 -
16077 -       switch (cmd) {
16078 -               /*
16079 -                *      These ioctl calls:
16080 -                *      - can be done by all.
16081 -                *      - atomic and do not require locking.
16082 -                *      - return a value
16083 -                */
16084 -               case SIOCGIFFLAGS:
16085 -               case SIOCGIFMETRIC:
16086 -               case SIOCGIFMTU:
16087 -               case SIOCGIFHWADDR:
16088 -               case SIOCGIFSLAVE:
16089 -               case SIOCGIFMAP:
16090 -               case SIOCGIFINDEX:
16091 -               case SIOCGIFTXQLEN:
16092 -                       dev_load(net, ifr.ifr_name);
16093 -                       read_lock(&dev_base_lock);
16094 -                       ret = dev_ifsioc_locked(net, &ifr, cmd);
16095 -                       read_unlock(&dev_base_lock);
16096 -                       if (!ret) {
16097 -                               if (colon)
16098 -                                       *colon = ':';
16099 -                               if (copy_to_user(arg, &ifr,
16100 -                                                sizeof(struct ifreq)))
16101 -                                       ret = -EFAULT;
16102 -                       }
16103 -                       return ret;
16104 -
16105 -               case SIOCETHTOOL:
16106 -                       dev_load(net, ifr.ifr_name);
16107 -                       rtnl_lock();
16108 -                       ret = dev_ethtool(net, &ifr);
16109 -                       rtnl_unlock();
16110 -                       if (!ret) {
16111 -                               if (colon)
16112 -                                       *colon = ':';
16113 -                               if (copy_to_user(arg, &ifr,
16114 -                                                sizeof(struct ifreq)))
16115 -                                       ret = -EFAULT;
16116 -                       }
16117 -                       return ret;
16118 -
16119 -               /*
16120 -                *      These ioctl calls:
16121 -                *      - require superuser power.
16122 -                *      - require strict serialization.
16123 -                *      - return a value
16124 -                */
16125 -               case SIOCGMIIPHY:
16126 -               case SIOCGMIIREG:
16127 -               case SIOCSIFNAME:
16128 -                       if (!capable(CAP_NET_ADMIN))
16129 -                               return -EPERM;
16130 -                       dev_load(net, ifr.ifr_name);
16131 -                       rtnl_lock();
16132 -                       ret = dev_ifsioc(net, &ifr, cmd);
16133 -                       rtnl_unlock();
16134 -                       if (!ret) {
16135 -                               if (colon)
16136 -                                       *colon = ':';
16137 -                               if (copy_to_user(arg, &ifr,
16138 -                                                sizeof(struct ifreq)))
16139 -                                       ret = -EFAULT;
16140 -                       }
16141 -                       return ret;
16142 -
16143 -               /*
16144 -                *      These ioctl calls:
16145 -                *      - require superuser power.
16146 -                *      - require strict serialization.
16147 -                *      - do not return a value
16148 -                */
16149 -               case SIOCSIFFLAGS:
16150 -               case SIOCSIFMETRIC:
16151 -               case SIOCSIFMTU:
16152 -               case SIOCSIFMAP:
16153 -               case SIOCSIFHWADDR:
16154 -               case SIOCSIFSLAVE:
16155 -               case SIOCADDMULTI:
16156 -               case SIOCDELMULTI:
16157 -               case SIOCSIFHWBROADCAST:
16158 -               case SIOCSIFTXQLEN:
16159 -               case SIOCSMIIREG:
16160 -               case SIOCBONDENSLAVE:
16161 -               case SIOCBONDRELEASE:
16162 -               case SIOCBONDSETHWADDR:
16163 -               case SIOCBONDCHANGEACTIVE:
16164 -               case SIOCBRADDIF:
16165 -               case SIOCBRDELIF:
16166 -                       if (!capable(CAP_NET_ADMIN))
16167 -                               return -EPERM;
16168 -                       /* fall through */
16169 -               case SIOCBONDSLAVEINFOQUERY:
16170 -               case SIOCBONDINFOQUERY:
16171 -                       dev_load(net, ifr.ifr_name);
16172 -                       rtnl_lock();
16173 -                       ret = dev_ifsioc(net, &ifr, cmd);
16174 -                       rtnl_unlock();
16175 -                       return ret;
16176 -
16177 -               case SIOCGIFMEM:
16178 -                       /* Get the per device memory space. We can add this but
16179 -                        * currently do not support it */
16180 -               case SIOCSIFMEM:
16181 -                       /* Set the per device memory buffer space.
16182 -                        * Not applicable in our case */
16183 -               case SIOCSIFLINK:
16184 -                       return -EINVAL;
16185 -
16186 -               /*
16187 -                *      Unknown or private ioctl.
16188 -                */
16189 -               default:
16190 -                       if (cmd == SIOCWANDEV ||
16191 -                           (cmd >= SIOCDEVPRIVATE &&
16192 -                            cmd <= SIOCDEVPRIVATE + 15)) {
16193 -                               dev_load(net, ifr.ifr_name);
16194 -                               rtnl_lock();
16195 -                               ret = dev_ifsioc(net, &ifr, cmd);
16196 -                               rtnl_unlock();
16197 -                               if (!ret && copy_to_user(arg, &ifr,
16198 -                                                        sizeof(struct ifreq)))
16199 -                                       ret = -EFAULT;
16200 -                               return ret;
16201 -                       }
16202 -                       /* Take care of Wireless Extensions */
16203 -                       if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST)
16204 -                               return wext_handle_ioctl(net, &ifr, cmd, arg);
16205 -                       return -EINVAL;
16206 -       }
16207 -}
16208 -
16209 -
16210 -/**
16211 - *     dev_new_index   -       allocate an ifindex
16212 - *     @net: the applicable net namespace
16213 - *
16214 - *     Returns a suitable unique value for a new device interface
16215 - *     number.  The caller must hold the rtnl semaphore or the
16216 - *     dev_base_lock to be sure it remains unique.
16217 - */
16218 -static int dev_new_index(struct net *net)
16219 -{
16220 -       static int ifindex;
16221 -       for (;;) {
16222 -               if (++ifindex <= 0)
16223 -                       ifindex = 1;
16224 -               if (!__dev_get_by_index(net, ifindex))
16225 -                       return ifindex;
16226 -       }
16227 -}
16228 -
16229 -/* Delayed registration/unregisteration */
16230 -static LIST_HEAD(net_todo_list);
16231 -
16232 -static void net_set_todo(struct net_device *dev)
16233 -{
16234 -       list_add_tail(&dev->todo_list, &net_todo_list);
16235 -}
16236 -
16237 -static void rollback_registered(struct net_device *dev)
16238 -{
16239 -       BUG_ON(dev_boot_phase);
16240 -       ASSERT_RTNL();
16241 -
16242 -       /* Some devices call without registering for initialization unwind. */
16243 -       if (dev->reg_state == NETREG_UNINITIALIZED) {
16244 -               printk(KERN_DEBUG "unregister_netdevice: device %s/%p never "
16245 -                                 "was registered\n", dev->name, dev);
16246 -
16247 -               WARN_ON(1);
16248 -               return;
16249 -       }
16250 -
16251 -       BUG_ON(dev->reg_state != NETREG_REGISTERED);
16252 -
16253 -       /* If device is running, close it first. */
16254 -       dev_close(dev);
16255 -
16256 -       /* And unlink it from device chain. */
16257 -       unlist_netdevice(dev);
16258 -
16259 -       dev->reg_state = NETREG_UNREGISTERING;
16260 -
16261 -       synchronize_net();
16262 -
16263 -       /* Shutdown queueing discipline. */
16264 -       dev_shutdown(dev);
16265 -
16266 -
16267 -       /* Notify protocols, that we are about to destroy
16268 -          this device. They should clean all the things.
16269 -       */
16270 -       call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
16271 -
16272 -       /*
16273 -        *      Flush the unicast and multicast chains
16274 -        */
16275 -       dev_addr_discard(dev);
16276 -
16277 -       if (dev->uninit)
16278 -               dev->uninit(dev);
16279 -
16280 -       /* Notifier chain MUST detach us from master device. */
16281 -       WARN_ON(dev->master);
16282 -
16283 -       /* Remove entries from kobject tree */
16284 -       netdev_unregister_kobject(dev);
16285 -
16286 -       synchronize_net();
16287 -
16288 -       dev_put(dev);
16289 -}
16290 -
16291 -static void __netdev_init_queue_locks_one(struct net_device *dev,
16292 -                                         struct netdev_queue *dev_queue,
16293 -                                         void *_unused)
16294 -{
16295 -       spin_lock_init(&dev_queue->_xmit_lock);
16296 -       netdev_set_xmit_lockdep_class(&dev_queue->_xmit_lock, dev->type);
16297 -       dev_queue->xmit_lock_owner = -1;
16298 -}
16299 -
16300 -static void netdev_init_queue_locks(struct net_device *dev)
16301 -{
16302 -       netdev_for_each_tx_queue(dev, __netdev_init_queue_locks_one, NULL);
16303 -       __netdev_init_queue_locks_one(dev, &dev->rx_queue, NULL);
16304 -}
16305 -
16306 -/**
16307 - *     register_netdevice      - register a network device
16308 - *     @dev: device to register
16309 - *
16310 - *     Take a completed network device structure and add it to the kernel
16311 - *     interfaces. A %NETDEV_REGISTER message is sent to the netdev notifier
16312 - *     chain. 0 is returned on success. A negative errno code is returned
16313 - *     on a failure to set up the device, or if the name is a duplicate.
16314 - *
16315 - *     Callers must hold the rtnl semaphore. You may want
16316 - *     register_netdev() instead of this.
16317 - *
16318 - *     BUGS:
16319 - *     The locking appears insufficient to guarantee two parallel registers
16320 - *     will not get the same name.
16321 - */
16322 -
16323 -int register_netdevice(struct net_device *dev)
16324 -{
16325 -       struct hlist_head *head;
16326 -       struct hlist_node *p;
16327 -       int ret;
16328 -       struct net *net;
16329 -
16330 -       BUG_ON(dev_boot_phase);
16331 -       ASSERT_RTNL();
16332 -
16333 -       might_sleep();
16334 -
16335 -       /* When net_device's are persistent, this will be fatal. */
16336 -       BUG_ON(dev->reg_state != NETREG_UNINITIALIZED);
16337 -       BUG_ON(!dev_net(dev));
16338 -       net = dev_net(dev);
16339 -
16340 -       spin_lock_init(&dev->addr_list_lock);
16341 -       netdev_set_addr_lockdep_class(dev);
16342 -       netdev_init_queue_locks(dev);
16343 -
16344 -       dev->iflink = -1;
16345 -
16346 -       /* Init, if this function is available */
16347 -       if (dev->init) {
16348 -               ret = dev->init(dev);
16349 -               if (ret) {
16350 -                       if (ret > 0)
16351 -                               ret = -EIO;
16352 -                       goto out;
16353 -               }
16354 -       }
16355 -
16356 -       if (!dev_valid_name(dev->name)) {
16357 -               ret = -EINVAL;
16358 -               goto err_uninit;
16359 -       }
16360 -
16361 -       dev->ifindex = dev_new_index(net);
16362 -       if (dev->iflink == -1)
16363 -               dev->iflink = dev->ifindex;
16364 -
16365 -       /* Check for existence of name */
16366 -       head = dev_name_hash(net, dev->name);
16367 -       hlist_for_each(p, head) {
16368 -               struct net_device *d
16369 -                       = hlist_entry(p, struct net_device, name_hlist);
16370 -               if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
16371 -                       ret = -EEXIST;
16372 -                       goto err_uninit;
16373 -               }
16374 -       }
16375 -
16376 -       /* Fix illegal checksum combinations */
16377 -       if ((dev->features & NETIF_F_HW_CSUM) &&
16378 -           (dev->features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
16379 -               printk(KERN_NOTICE "%s: mixed HW and IP checksum settings.\n",
16380 -                      dev->name);
16381 -               dev->features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
16382 -       }
16383 -
16384 -       if ((dev->features & NETIF_F_NO_CSUM) &&
16385 -           (dev->features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
16386 -               printk(KERN_NOTICE "%s: mixed no checksumming and other settings.\n",
16387 -                      dev->name);
16388 -               dev->features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM);
16389 -       }
16390 -
16391 -
16392 -       /* Fix illegal SG+CSUM combinations. */
16393 -       if ((dev->features & NETIF_F_SG) &&
16394 -           !(dev->features & NETIF_F_ALL_CSUM)) {
16395 -               printk(KERN_NOTICE "%s: Dropping NETIF_F_SG since no checksum feature.\n",
16396 -                      dev->name);
16397 -               dev->features &= ~NETIF_F_SG;
16398 -       }
16399 -
16400 -       /* TSO requires that SG is present as well. */
16401 -       if ((dev->features & NETIF_F_TSO) &&
16402 -           !(dev->features & NETIF_F_SG)) {
16403 -               printk(KERN_NOTICE "%s: Dropping NETIF_F_TSO since no SG feature.\n",
16404 -                      dev->name);
16405 -               dev->features &= ~NETIF_F_TSO;
16406 -       }
16407 -       if (dev->features & NETIF_F_UFO) {
16408 -               if (!(dev->features & NETIF_F_GEN_CSUM)) {
16409 -                       printk(KERN_ERR "%s: Dropping NETIF_F_UFO since no "
16410 -                                       "NETIF_F_HW_CSUM feature.\n",
16411 -                                                       dev->name);
16412 -                       dev->features &= ~NETIF_F_UFO;
16413 -               }
16414 -               if (!(dev->features & NETIF_F_SG)) {
16415 -                       printk(KERN_ERR "%s: Dropping NETIF_F_UFO since no "
16416 -                                       "NETIF_F_SG feature.\n",
16417 -                                       dev->name);
16418 -                       dev->features &= ~NETIF_F_UFO;
16419 -               }
16420 -       }
16421 -
16422 -       /* Enable software GSO if SG is supported. */
16423 -       if (dev->features & NETIF_F_SG)
16424 -               dev->features |= NETIF_F_GSO;
16425 -
16426 -       netdev_initialize_kobject(dev);
16427 -       ret = netdev_register_kobject(dev);
16428 -       if (ret)
16429 -               goto err_uninit;
16430 -       dev->reg_state = NETREG_REGISTERED;
16431 -
16432 -       /*
16433 -        *      Default initial state at registry is that the
16434 -        *      device is present.
16435 -        */
16436 -
16437 -       set_bit(__LINK_STATE_PRESENT, &dev->state);
16438 -
16439 -       dev_init_scheduler(dev);
16440 -       dev_hold(dev);
16441 -       list_netdevice(dev);
16442 -
16443 -       /* Notify protocols, that a new device appeared. */
16444 -       ret = call_netdevice_notifiers(NETDEV_REGISTER, dev);
16445 -       ret = notifier_to_errno(ret);
16446 -       if (ret) {
16447 -               rollback_registered(dev);
16448 -               dev->reg_state = NETREG_UNREGISTERED;
16449 -       }
16450 -
16451 -out:
16452 -       return ret;
16453 -
16454 -err_uninit:
16455 -       if (dev->uninit)
16456 -               dev->uninit(dev);
16457 -       goto out;
16458 -}
16459 -
16460 -/**
16461 - *     register_netdev - register a network device
16462 - *     @dev: device to register
16463 - *
16464 - *     Take a completed network device structure and add it to the kernel
16465 - *     interfaces. A %NETDEV_REGISTER message is sent to the netdev notifier
16466 - *     chain. 0 is returned on success. A negative errno code is returned
16467 - *     on a failure to set up the device, or if the name is a duplicate.
16468 - *
16469 - *     This is a wrapper around register_netdevice that takes the rtnl semaphore
16470 - *     and expands the device name if you passed a format string to
16471 - *     alloc_netdev.
16472 - */
16473 -int register_netdev(struct net_device *dev)
16474 -{
16475 -       int err;
16476 -
16477 -       rtnl_lock();
16478 -
16479 -       /*
16480 -        * If the name is a format string the caller wants us to do a
16481 -        * name allocation.
16482 -        */
16483 -       if (strchr(dev->name, '%')) {
16484 -               err = dev_alloc_name(dev, dev->name);
16485 -               if (err < 0)
16486 -                       goto out;
16487 -       }
16488 -
16489 -       err = register_netdevice(dev);
16490 -out:
16491 -       rtnl_unlock();
16492 -       return err;
16493 -}
16494 -EXPORT_SYMBOL(register_netdev);
16495 -
16496 -/*
16497 - * netdev_wait_allrefs - wait until all references are gone.
16498 - *
16499 - * This is called when unregistering network devices.
16500 - *
16501 - * Any protocol or device that holds a reference should register
16502 - * for netdevice notification, and cleanup and put back the
16503 - * reference if they receive an UNREGISTER event.
16504 - * We can get stuck here if buggy protocols don't correctly
16505 - * call dev_put.
16506 - */
16507 -static void netdev_wait_allrefs(struct net_device *dev)
16508 -{
16509 -       unsigned long rebroadcast_time, warning_time;
16510 -
16511 -       rebroadcast_time = warning_time = jiffies;
16512 -       while (atomic_read(&dev->refcnt) != 0) {
16513 -               if (time_after(jiffies, rebroadcast_time + 1 * HZ)) {
16514 -                       rtnl_lock();
16515 -
16516 -                       /* Rebroadcast unregister notification */
16517 -                       call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
16518 -
16519 -                       if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
16520 -                                    &dev->state)) {
16521 -                               /* We must not have linkwatch events
16522 -                                * pending on unregister. If this
16523 -                                * happens, we simply run the queue
16524 -                                * unscheduled, resulting in a noop
16525 -                                * for this device.
16526 -                                */
16527 -                               linkwatch_run_queue();
16528 -                       }
16529 -
16530 -                       __rtnl_unlock();
16531 -
16532 -                       rebroadcast_time = jiffies;
16533 -               }
16534 -
16535 -               msleep(250);
16536 -
16537 -               if (time_after(jiffies, warning_time + 10 * HZ)) {
16538 -                       printk(KERN_EMERG "unregister_netdevice: "
16539 -                              "waiting for %s to become free. Usage "
16540 -                              "count = %d\n",
16541 -                              dev->name, atomic_read(&dev->refcnt));
16542 -                       warning_time = jiffies;
16543 -               }
16544 -       }
16545 -}
16546 -
16547 -/* The sequence is:
16548 - *
16549 - *     rtnl_lock();
16550 - *     ...
16551 - *     register_netdevice(x1);
16552 - *     register_netdevice(x2);
16553 - *     ...
16554 - *     unregister_netdevice(y1);
16555 - *     unregister_netdevice(y2);
16556 - *      ...
16557 - *     rtnl_unlock();
16558 - *     free_netdev(y1);
16559 - *     free_netdev(y2);
16560 - *
16561 - * We are invoked by rtnl_unlock().
16562 - * This allows us to deal with problems:
16563 - * 1) We can delete sysfs objects which invoke hotplug
16564 - *    without deadlocking with linkwatch via keventd.
16565 - * 2) Since we run with the RTNL semaphore not held, we can sleep
16566 - *    safely in order to wait for the netdev refcnt to drop to zero.
16567 - *
16568 - * We must not return until all unregister events added during
16569 - * the interval the lock was held have been completed.
16570 - */
16571 -void netdev_run_todo(void)
16572 -{
16573 -       struct list_head list;
16574 -
16575 -       /* Snapshot list, allow later requests */
16576 -       list_replace_init(&net_todo_list, &list);
16577 -
16578 -       __rtnl_unlock();
16579 -
16580 -       while (!list_empty(&list)) {
16581 -               struct net_device *dev
16582 -                       = list_entry(list.next, struct net_device, todo_list);
16583 -               list_del(&dev->todo_list);
16584 -
16585 -               if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) {
16586 -                       printk(KERN_ERR "network todo '%s' but state %d\n",
16587 -                              dev->name, dev->reg_state);
16588 -                       dump_stack();
16589 -                       continue;
16590 -               }
16591 -
16592 -               dev->reg_state = NETREG_UNREGISTERED;
16593 -
16594 -               on_each_cpu(flush_backlog, dev, 1);
16595 -
16596 -               netdev_wait_allrefs(dev);
16597 -
16598 -               /* paranoia */
16599 -               BUG_ON(atomic_read(&dev->refcnt));
16600 -               WARN_ON(dev->ip_ptr);
16601 -               WARN_ON(dev->ip6_ptr);
16602 -               WARN_ON(dev->dn_ptr);
16603 -
16604 -               if (dev->destructor)
16605 -                       dev->destructor(dev);
16606 -
16607 -               /* Free network device */
16608 -               kobject_put(&dev->dev.kobj);
16609 -       }
16610 -}
16611 -
16612 -static struct net_device_stats *internal_stats(struct net_device *dev)
16613 -{
16614 -       return &dev->stats;
16615 -}
16616 -
16617 -static void netdev_init_one_queue(struct net_device *dev,
16618 -                                 struct netdev_queue *queue,
16619 -                                 void *_unused)
16620 -{
16621 -       queue->dev = dev;
16622 -}
16623 -
16624 -static void netdev_init_queues(struct net_device *dev)
16625 -{
16626 -       netdev_init_one_queue(dev, &dev->rx_queue, NULL);
16627 -       netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL);
16628 -       spin_lock_init(&dev->tx_global_lock);
16629 -}
16630 -
16631 -/**
16632 - *     alloc_netdev_mq - allocate network device
16633 - *     @sizeof_priv:   size of private data to allocate space for
16634 - *     @name:          device name format string
16635 - *     @setup:         callback to initialize device
16636 - *     @queue_count:   the number of subqueues to allocate
16637 - *
16638 - *     Allocates a struct net_device with private data area for driver use
16639 - *     and performs basic initialization.  Also allocates subquue structs
16640 - *     for each queue on the device at the end of the netdevice.
16641 - */
16642 -struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
16643 -               void (*setup)(struct net_device *), unsigned int queue_count)
16644 -{
16645 -       struct netdev_queue *tx;
16646 -       struct net_device *dev;
16647 -       size_t alloc_size;
16648 -       void *p;
16649 -
16650 -       BUG_ON(strlen(name) >= sizeof(dev->name));
16651 -
16652 -       alloc_size = sizeof(struct net_device);
16653 -       if (sizeof_priv) {
16654 -               /* ensure 32-byte alignment of private area */
16655 -               alloc_size = (alloc_size + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST;
16656 -               alloc_size += sizeof_priv;
16657 -       }
16658 -       /* ensure 32-byte alignment of whole construct */
16659 -       alloc_size += NETDEV_ALIGN_CONST;
16660 -
16661 -       p = kzalloc(alloc_size, GFP_KERNEL);
16662 -       if (!p) {
16663 -               printk(KERN_ERR "alloc_netdev: Unable to allocate device.\n");
16664 -               return NULL;
16665 -       }
16666 -
16667 -       tx = kcalloc(queue_count, sizeof(struct netdev_queue), GFP_KERNEL);
16668 -       if (!tx) {
16669 -               printk(KERN_ERR "alloc_netdev: Unable to allocate "
16670 -                      "tx qdiscs.\n");
16671 -               kfree(p);
16672 -               return NULL;
16673 -       }
16674 -
16675 -       dev = (struct net_device *)
16676 -               (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
16677 -       dev->padded = (char *)dev - (char *)p;
16678 -       dev_net_set(dev, &init_net);
16679 -
16680 -       dev->_tx = tx;
16681 -       dev->num_tx_queues = queue_count;
16682 -       dev->real_num_tx_queues = queue_count;
16683 -
16684 -       if (sizeof_priv) {
16685 -               dev->priv = ((char *)dev +
16686 -                            ((sizeof(struct net_device) + NETDEV_ALIGN_CONST)
16687 -                             & ~NETDEV_ALIGN_CONST));
16688 -       }
16689 -
16690 -       dev->gso_max_size = GSO_MAX_SIZE;
16691 -
16692 -       netdev_init_queues(dev);
16693 -
16694 -       dev->get_stats = internal_stats;
16695 -       netpoll_netdev_init(dev);
16696 -       setup(dev);
16697 -       strcpy(dev->name, name);
16698 -       return dev;
16699 -}
16700 -EXPORT_SYMBOL(alloc_netdev_mq);
16701 -
16702 -/**
16703 - *     free_netdev - free network device
16704 - *     @dev: device
16705 - *
16706 - *     This function does the last stage of destroying an allocated device
16707 - *     interface. The reference to the device object is released.
16708 - *     If this is the last reference then it will be freed.
16709 - */
16710 -void free_netdev(struct net_device *dev)
16711 -{
16712 -       release_net(dev_net(dev));
16713 -
16714 -       kfree(dev->_tx);
16715 -
16716 -       /*  Compatibility with error handling in drivers */
16717 -       if (dev->reg_state == NETREG_UNINITIALIZED) {
16718 -               kfree((char *)dev - dev->padded);
16719 -               return;
16720 -       }
16721 -
16722 -       BUG_ON(dev->reg_state != NETREG_UNREGISTERED);
16723 -       dev->reg_state = NETREG_RELEASED;
16724 -
16725 -       /* will free via device release */
16726 -       put_device(&dev->dev);
16727 -}
16728 -
16729 -/* Synchronize with packet receive processing. */
16730 -void synchronize_net(void)
16731 -{
16732 -       might_sleep();
16733 -       synchronize_rcu();
16734 -}
16735 -
16736 -/**
16737 - *     unregister_netdevice - remove device from the kernel
16738 - *     @dev: device
16739 - *
16740 - *     This function shuts down a device interface and removes it
16741 - *     from the kernel tables.
16742 - *
16743 - *     Callers must hold the rtnl semaphore.  You may want
16744 - *     unregister_netdev() instead of this.
16745 - */
16746 -
16747 -void unregister_netdevice(struct net_device *dev)
16748 -{
16749 -       ASSERT_RTNL();
16750 -
16751 -       rollback_registered(dev);
16752 -       /* Finish processing unregister after unlock */
16753 -       net_set_todo(dev);
16754 -}
16755 -
16756 -/**
16757 - *     unregister_netdev - remove device from the kernel
16758 - *     @dev: device
16759 - *
16760 - *     This function shuts down a device interface and removes it
16761 - *     from the kernel tables.
16762 - *
16763 - *     This is just a wrapper for unregister_netdevice that takes
16764 - *     the rtnl semaphore.  In general you want to use this and not
16765 - *     unregister_netdevice.
16766 - */
16767 -void unregister_netdev(struct net_device *dev)
16768 -{
16769 -       rtnl_lock();
16770 -       unregister_netdevice(dev);
16771 -       rtnl_unlock();
16772 -}
16773 -
16774 -EXPORT_SYMBOL(unregister_netdev);
16775 -
16776 -/**
16777 - *     dev_change_net_namespace - move device to different nethost namespace
16778 - *     @dev: device
16779 - *     @net: network namespace
16780 - *     @pat: If not NULL name pattern to try if the current device name
16781 - *           is already taken in the destination network namespace.
16782 - *
16783 - *     This function shuts down a device interface and moves it
16784 - *     to a new network namespace. On success 0 is returned, on
16785 - *     a failure a netagive errno code is returned.
16786 - *
16787 - *     Callers must hold the rtnl semaphore.
16788 - */
16789 -
16790 -int dev_change_net_namespace(struct net_device *dev, struct net *net, const char *pat)
16791 -{
16792 -       char buf[IFNAMSIZ];
16793 -       const char *destname;
16794 -       int err;
16795 -
16796 -       ASSERT_RTNL();
16797 -
16798 -       /* Don't allow namespace local devices to be moved. */
16799 -       err = -EINVAL;
16800 -       if (dev->features & NETIF_F_NETNS_LOCAL)
16801 -               goto out;
16802 -
16803 -#ifdef CONFIG_SYSFS
16804 -       /* Don't allow real devices to be moved when sysfs
16805 -        * is enabled.
16806 -        */
16807 -       err = -EINVAL;
16808 -       if (dev->dev.parent)
16809 -               goto out;
16810 -#endif
16811 -
16812 -       /* Ensure the device has been registrered */
16813 -       err = -EINVAL;
16814 -       if (dev->reg_state != NETREG_REGISTERED)
16815 -               goto out;
16816 -
16817 -       /* Get out if there is nothing todo */
16818 -       err = 0;
16819 -       if (net_eq(dev_net(dev), net))
16820 -               goto out;
16821 -
16822 -       /* Pick the destination device name, and ensure
16823 -        * we can use it in the destination network namespace.
16824 -        */
16825 -       err = -EEXIST;
16826 -       destname = dev->name;
16827 -       if (__dev_get_by_name(net, destname)) {
16828 -               /* We get here if we can't use the current device name */
16829 -               if (!pat)
16830 -                       goto out;
16831 -               if (!dev_valid_name(pat))
16832 -                       goto out;
16833 -               if (strchr(pat, '%')) {
16834 -                       if (__dev_alloc_name(net, pat, buf) < 0)
16835 -                               goto out;
16836 -                       destname = buf;
16837 -               } else
16838 -                       destname = pat;
16839 -               if (__dev_get_by_name(net, destname))
16840 -                       goto out;
16841 -       }
16842 -
16843 -       /*
16844 -        * And now a mini version of register_netdevice unregister_netdevice.
16845 -        */
16846 -
16847 -       /* If device is running close it first. */
16848 -       dev_close(dev);
16849 -
16850 -       /* And unlink it from device chain */
16851 -       err = -ENODEV;
16852 -       unlist_netdevice(dev);
16853 -
16854 -       synchronize_net();
16855 -
16856 -       /* Shutdown queueing discipline. */
16857 -       dev_shutdown(dev);
16858 -
16859 -       /* Notify protocols, that we are about to destroy
16860 -          this device. They should clean all the things.
16861 -       */
16862 -       call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
16863 -
16864 -       /*
16865 -        *      Flush the unicast and multicast chains
16866 -        */
16867 -       dev_addr_discard(dev);
16868 -
16869 -       netdev_unregister_kobject(dev);
16870 -
16871 -       /* Actually switch the network namespace */
16872 -       dev_net_set(dev, net);
16873 -
16874 -       /* Assign the new device name */
16875 -       if (destname != dev->name)
16876 -               strcpy(dev->name, destname);
16877 -
16878 -       /* If there is an ifindex conflict assign a new one */
16879 -       if (__dev_get_by_index(net, dev->ifindex)) {
16880 -               int iflink = (dev->iflink == dev->ifindex);
16881 -               dev->ifindex = dev_new_index(net);
16882 -               if (iflink)
16883 -                       dev->iflink = dev->ifindex;
16884 -       }
16885 -
16886 -       /* Fixup kobjects */
16887 -       err = netdev_register_kobject(dev);
16888 -       WARN_ON(err);
16889 -
16890 -       /* Add the device back in the hashes */
16891 -       list_netdevice(dev);
16892 -
16893 -       /* Notify protocols, that a new device appeared. */
16894 -       call_netdevice_notifiers(NETDEV_REGISTER, dev);
16895 -
16896 -       synchronize_net();
16897 -       err = 0;
16898 -out:
16899 -       return err;
16900 -}
16901 -
16902 -static int dev_cpu_callback(struct notifier_block *nfb,
16903 -                           unsigned long action,
16904 -                           void *ocpu)
16905 -{
16906 -       struct sk_buff **list_skb;
16907 -       struct Qdisc **list_net;
16908 -       struct sk_buff *skb;
16909 -       unsigned int cpu, oldcpu = (unsigned long)ocpu;
16910 -       struct softnet_data *sd, *oldsd;
16911 -
16912 -       if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
16913 -               return NOTIFY_OK;
16914 -
16915 -       local_irq_disable();
16916 -       cpu = smp_processor_id();
16917 -       sd = &per_cpu(softnet_data, cpu);
16918 -       oldsd = &per_cpu(softnet_data, oldcpu);
16919 -
16920 -       /* Find end of our completion_queue. */
16921 -       list_skb = &sd->completion_queue;
16922 -       while (*list_skb)
16923 -               list_skb = &(*list_skb)->next;
16924 -       /* Append completion queue from offline CPU. */
16925 -       *list_skb = oldsd->completion_queue;
16926 -       oldsd->completion_queue = NULL;
16927 -
16928 -       /* Find end of our output_queue. */
16929 -       list_net = &sd->output_queue;
16930 -       while (*list_net)
16931 -               list_net = &(*list_net)->next_sched;
16932 -       /* Append output queue from offline CPU. */
16933 -       *list_net = oldsd->output_queue;
16934 -       oldsd->output_queue = NULL;
16935 -
16936 -       raise_softirq_irqoff(NET_TX_SOFTIRQ);
16937 -       local_irq_enable();
16938 -
16939 -       /* Process offline CPU's input_pkt_queue */
16940 -       while ((skb = __skb_dequeue(&oldsd->input_pkt_queue)))
16941 -               netif_rx(skb);
16942 -
16943 -       return NOTIFY_OK;
16944 -}
16945 -
16946 -#ifdef CONFIG_NET_DMA
16947 -/**
16948 - * net_dma_rebalance - try to maintain one DMA channel per CPU
16949 - * @net_dma: DMA client and associated data (lock, channels, channel_mask)
16950 - *
16951 - * This is called when the number of channels allocated to the net_dma client
16952 - * changes.  The net_dma client tries to have one DMA channel per CPU.
16953 - */
16954 -
16955 -static void net_dma_rebalance(struct net_dma *net_dma)
16956 -{
16957 -       unsigned int cpu, i, n, chan_idx;
16958 -       struct dma_chan *chan;
16959 -
16960 -       if (cpus_empty(net_dma->channel_mask)) {
16961 -               for_each_online_cpu(cpu)
16962 -                       rcu_assign_pointer(per_cpu(softnet_data, cpu).net_dma, NULL);
16963 -               return;
16964 -       }
16965 -
16966 -       i = 0;
16967 -       cpu = first_cpu(cpu_online_map);
16968 -
16969 -       for_each_cpu_mask_nr(chan_idx, net_dma->channel_mask) {
16970 -               chan = net_dma->channels[chan_idx];
16971 -
16972 -               n = ((num_online_cpus() / cpus_weight(net_dma->channel_mask))
16973 -                  + (i < (num_online_cpus() %
16974 -                       cpus_weight(net_dma->channel_mask)) ? 1 : 0));
16975 -
16976 -               while(n) {
16977 -                       per_cpu(softnet_data, cpu).net_dma = chan;
16978 -                       cpu = next_cpu(cpu, cpu_online_map);
16979 -                       n--;
16980 -               }
16981 -               i++;
16982 -       }
16983 -}
16984 -
16985 -/**
16986 - * netdev_dma_event - event callback for the net_dma_client
16987 - * @client: should always be net_dma_client
16988 - * @chan: DMA channel for the event
16989 - * @state: DMA state to be handled
16990 - */
16991 -static enum dma_state_client
16992 -netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
16993 -       enum dma_state state)
16994 -{
16995 -       int i, found = 0, pos = -1;
16996 -       struct net_dma *net_dma =
16997 -               container_of(client, struct net_dma, client);
16998 -       enum dma_state_client ack = DMA_DUP; /* default: take no action */
16999 -
17000 -       spin_lock(&net_dma->lock);
17001 -       switch (state) {
17002 -       case DMA_RESOURCE_AVAILABLE:
17003 -               for (i = 0; i < nr_cpu_ids; i++)
17004 -                       if (net_dma->channels[i] == chan) {
17005 -                               found = 1;
17006 -                               break;
17007 -                       } else if (net_dma->channels[i] == NULL && pos < 0)
17008 -                               pos = i;
17009 -
17010 -               if (!found && pos >= 0) {
17011 -                       ack = DMA_ACK;
17012 -                       net_dma->channels[pos] = chan;
17013 -                       cpu_set(pos, net_dma->channel_mask);
17014 -                       net_dma_rebalance(net_dma);
17015 -               }
17016 -               break;
17017 -       case DMA_RESOURCE_REMOVED:
17018 -               for (i = 0; i < nr_cpu_ids; i++)
17019 -                       if (net_dma->channels[i] == chan) {
17020 -                               found = 1;
17021 -                               pos = i;
17022 -                               break;
17023 -                       }
17024 -
17025 -               if (found) {
17026 -                       ack = DMA_ACK;
17027 -                       cpu_clear(pos, net_dma->channel_mask);
17028 -                       net_dma->channels[i] = NULL;
17029 -                       net_dma_rebalance(net_dma);
17030 -               }
17031 -               break;
17032 -       default:
17033 -               break;
17034 -       }
17035 -       spin_unlock(&net_dma->lock);
17036 -
17037 -       return ack;
17038 -}
17039 -
17040 -/**
17041 - * netdev_dma_regiser - register the networking subsystem as a DMA client
17042 - */
17043 -static int __init netdev_dma_register(void)
17044 -{
17045 -       net_dma.channels = kzalloc(nr_cpu_ids * sizeof(struct net_dma),
17046 -                                                               GFP_KERNEL);
17047 -       if (unlikely(!net_dma.channels)) {
17048 -               printk(KERN_NOTICE
17049 -                               "netdev_dma: no memory for net_dma.channels\n");
17050 -               return -ENOMEM;
17051 -       }
17052 -       spin_lock_init(&net_dma.lock);
17053 -       dma_cap_set(DMA_MEMCPY, net_dma.client.cap_mask);
17054 -       dma_async_client_register(&net_dma.client);
17055 -       dma_async_client_chan_request(&net_dma.client);
17056 -       return 0;
17057 -}
17058 -
17059 -#else
17060 -static int __init netdev_dma_register(void) { return -ENODEV; }
17061 -#endif /* CONFIG_NET_DMA */
17062 -
17063 -/**
17064 - *     netdev_compute_feature - compute conjunction of two feature sets
17065 - *     @all: first feature set
17066 - *     @one: second feature set
17067 - *
17068 - *     Computes a new feature set after adding a device with feature set
17069 - *     @one to the master device with current feature set @all.  Returns
17070 - *     the new feature set.
17071 - */
17072 -int netdev_compute_features(unsigned long all, unsigned long one)
17073 -{
17074 -       /* if device needs checksumming, downgrade to hw checksumming */
17075 -       if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM))
17076 -               all ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
17077 -
17078 -       /* if device can't do all checksum, downgrade to ipv4/ipv6 */
17079 -       if (all & NETIF_F_HW_CSUM && !(one & NETIF_F_HW_CSUM))
17080 -               all ^= NETIF_F_HW_CSUM
17081 -                       | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
17082 -
17083 -       if (one & NETIF_F_GSO)
17084 -               one |= NETIF_F_GSO_SOFTWARE;
17085 -       one |= NETIF_F_GSO;
17086 -
17087 -       /* If even one device supports robust GSO, enable it for all. */
17088 -       if (one & NETIF_F_GSO_ROBUST)
17089 -               all |= NETIF_F_GSO_ROBUST;
17090 -
17091 -       all &= one | NETIF_F_LLTX;
17092 -
17093 -       if (!(all & NETIF_F_ALL_CSUM))
17094 -               all &= ~NETIF_F_SG;
17095 -       if (!(all & NETIF_F_SG))
17096 -               all &= ~NETIF_F_GSO_MASK;
17097 -
17098 -       return all;
17099 -}
17100 -EXPORT_SYMBOL(netdev_compute_features);
17101 -
17102 -static struct hlist_head *netdev_create_hash(void)
17103 -{
17104 -       int i;
17105 -       struct hlist_head *hash;
17106 -
17107 -       hash = kmalloc(sizeof(*hash) * NETDEV_HASHENTRIES, GFP_KERNEL);
17108 -       if (hash != NULL)
17109 -               for (i = 0; i < NETDEV_HASHENTRIES; i++)
17110 -                       INIT_HLIST_HEAD(&hash[i]);
17111 -
17112 -       return hash;
17113 -}
17114 -
17115 -/* Initialize per network namespace state */
17116 -static int __net_init netdev_init(struct net *net)
17117 -{
17118 -       INIT_LIST_HEAD(&net->dev_base_head);
17119 -
17120 -       net->dev_name_head = netdev_create_hash();
17121 -       if (net->dev_name_head == NULL)
17122 -               goto err_name;
17123 -
17124 -       net->dev_index_head = netdev_create_hash();
17125 -       if (net->dev_index_head == NULL)
17126 -               goto err_idx;
17127 -
17128 -       return 0;
17129 -
17130 -err_idx:
17131 -       kfree(net->dev_name_head);
17132 -err_name:
17133 -       return -ENOMEM;
17134 -}
17135 -
17136 -char *netdev_drivername(struct net_device *dev, char *buffer, int len)
17137 -{
17138 -       struct device_driver *driver;
17139 -       struct device *parent;
17140 -
17141 -       if (len <= 0 || !buffer)
17142 -               return buffer;
17143 -       buffer[0] = 0;
17144 -
17145 -       parent = dev->dev.parent;
17146 -
17147 -       if (!parent)
17148 -               return buffer;
17149 -
17150 -       driver = parent->driver;
17151 -       if (driver && driver->name)
17152 -               strlcpy(buffer, driver->name, len);
17153 -       return buffer;
17154 -}
17155 -
17156 -static void __net_exit netdev_exit(struct net *net)
17157 -{
17158 -       kfree(net->dev_name_head);
17159 -       kfree(net->dev_index_head);
17160 -}
17161 -
17162 -static struct pernet_operations __net_initdata netdev_net_ops = {
17163 -       .init = netdev_init,
17164 -       .exit = netdev_exit,
17165 -};
17166 -
17167 -static void __net_exit default_device_exit(struct net *net)
17168 -{
17169 -       struct net_device *dev, *next;
17170 -       /*
17171 -        * Push all migratable of the network devices back to the
17172 -        * initial network namespace
17173 -        */
17174 -       rtnl_lock();
17175 -       for_each_netdev_safe(net, dev, next) {
17176 -               int err;
17177 -               char fb_name[IFNAMSIZ];
17178 -
17179 -               /* Ignore unmoveable devices (i.e. loopback) */
17180 -               if (dev->features & NETIF_F_NETNS_LOCAL)
17181 -                       continue;
17182 -
17183 -               /* Push remaing network devices to init_net */
17184 -               snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex);
17185 -               err = dev_change_net_namespace(dev, &init_net, fb_name);
17186 -               if (err) {
17187 -                       printk(KERN_EMERG "%s: failed to move %s to init_net: %d\n",
17188 -                               __func__, dev->name, err);
17189 -                       BUG();
17190 -               }
17191 -       }
17192 -       rtnl_unlock();
17193 -}
17194 -
17195 -static struct pernet_operations __net_initdata default_device_ops = {
17196 -       .exit = default_device_exit,
17197 -};
17198 -
17199 -/*
17200 - *     Initialize the DEV module. At boot time this walks the device list and
17201 - *     unhooks any devices that fail to initialise (normally hardware not
17202 - *     present) and leaves us with a valid list of present and active devices.
17203 - *
17204 - */
17205 -
17206 -/*
17207 - *       This is called single threaded during boot, so no need
17208 - *       to take the rtnl semaphore.
17209 - */
17210 -static int __init net_dev_init(void)
17211 -{
17212 -       int i, rc = -ENOMEM;
17213 -
17214 -       BUG_ON(!dev_boot_phase);
17215 -
17216 -       if (dev_proc_init())
17217 -               goto out;
17218 -
17219 -       if (netdev_kobject_init())
17220 -               goto out;
17221 -
17222 -       INIT_LIST_HEAD(&ptype_all);
17223 -       for (i = 0; i < PTYPE_HASH_SIZE; i++)
17224 -               INIT_LIST_HEAD(&ptype_base[i]);
17225 -
17226 -       if (register_pernet_subsys(&netdev_net_ops))
17227 -               goto out;
17228 -
17229 -       if (register_pernet_device(&default_device_ops))
17230 -               goto out;
17231 -
17232 -       /*
17233 -        *      Initialise the packet receive queues.
17234 -        */
17235 -
17236 -       for_each_possible_cpu(i) {
17237 -               struct softnet_data *queue;
17238 -
17239 -               queue = &per_cpu(softnet_data, i);
17240 -               skb_queue_head_init(&queue->input_pkt_queue);
17241 -               queue->completion_queue = NULL;
17242 -               INIT_LIST_HEAD(&queue->poll_list);
17243 -
17244 -               queue->backlog.poll = process_backlog;
17245 -               queue->backlog.weight = weight_p;
17246 -       }
17247 -
17248 -       netdev_dma_register();
17249 -
17250 -       dev_boot_phase = 0;
17251 -
17252 -       open_softirq(NET_TX_SOFTIRQ, net_tx_action);
17253 -       open_softirq(NET_RX_SOFTIRQ, net_rx_action);
17254 -
17255 -       hotcpu_notifier(dev_cpu_callback, 0);
17256 -       dst_init();
17257 -       dev_mcast_init();
17258 -       rc = 0;
17259 -out:
17260 -       return rc;
17261 -}
17262 -
17263 -subsys_initcall(net_dev_init);
17264 -
17265 -EXPORT_SYMBOL(__dev_get_by_index);
17266 -EXPORT_SYMBOL(__dev_get_by_name);
17267 -EXPORT_SYMBOL(__dev_remove_pack);
17268 -EXPORT_SYMBOL(dev_valid_name);
17269 -EXPORT_SYMBOL(dev_add_pack);
17270 -EXPORT_SYMBOL(dev_alloc_name);
17271 -EXPORT_SYMBOL(dev_close);
17272 -EXPORT_SYMBOL(dev_get_by_flags);
17273 -EXPORT_SYMBOL(dev_get_by_index);
17274 -EXPORT_SYMBOL(dev_get_by_name);
17275 -EXPORT_SYMBOL(dev_open);
17276 -EXPORT_SYMBOL(dev_queue_xmit);
17277 -EXPORT_SYMBOL(dev_remove_pack);
17278 -EXPORT_SYMBOL(dev_set_allmulti);
17279 -EXPORT_SYMBOL(dev_set_promiscuity);
17280 -EXPORT_SYMBOL(dev_change_flags);
17281 -EXPORT_SYMBOL(dev_set_mtu);
17282 -EXPORT_SYMBOL(dev_set_mac_address);
17283 -EXPORT_SYMBOL(free_netdev);
17284 -EXPORT_SYMBOL(netdev_boot_setup_check);
17285 -EXPORT_SYMBOL(netdev_set_master);
17286 -EXPORT_SYMBOL(netdev_state_change);
17287 -EXPORT_SYMBOL(netif_receive_skb);
17288 -EXPORT_SYMBOL(netif_rx);
17289 -EXPORT_SYMBOL(register_gifconf);
17290 -EXPORT_SYMBOL(register_netdevice);
17291 -EXPORT_SYMBOL(register_netdevice_notifier);
17292 -EXPORT_SYMBOL(skb_checksum_help);
17293 -EXPORT_SYMBOL(synchronize_net);
17294 -EXPORT_SYMBOL(unregister_netdevice);
17295 -EXPORT_SYMBOL(unregister_netdevice_notifier);
17296 -EXPORT_SYMBOL(net_enable_timestamp);
17297 -EXPORT_SYMBOL(net_disable_timestamp);
17298 -EXPORT_SYMBOL(dev_get_flags);
17299 -EXPORT_PER_CPU_SYMBOL(sknid_elevator);
17300 -
17301 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
17302 -EXPORT_SYMBOL(br_handle_frame_hook);
17303 -EXPORT_SYMBOL(br_fdb_get_hook);
17304 -EXPORT_SYMBOL(br_fdb_put_hook);
17305 -#endif
17306 -
17307 -#ifdef CONFIG_KMOD
17308 -EXPORT_SYMBOL(dev_load);
17309 -#endif
17310 -
17311 -EXPORT_PER_CPU_SYMBOL(softnet_data);
17312 diff -Nurb linux-2.6.27-720/net/core/dev.c.rej linux-2.6.27-710/net/core/dev.c.rej
17313 --- linux-2.6.27-720/net/core/dev.c.rej 2009-05-04 12:18:34.000000000 -0400
17314 +++ linux-2.6.27-710/net/core/dev.c.rej 1969-12-31 19:00:00.000000000 -0500
17315 @@ -1,30 +0,0 @@
17316 -***************
17317 -*** 2187,2199 ****
17318 -   *   NET_RX_SUCCESS: no congestion
17319 -   *   NET_RX_DROP: packet was dropped
17320 -   */
17321 -- int netif_receive_skb(struct sk_buff *skb)
17322 -  {
17323 -       struct packet_type *ptype, *pt_prev;
17324 -       struct net_device *orig_dev;
17325 -       struct net_device *null_or_orig;
17326 -       int ret = NET_RX_DROP;
17327 --      __be16 type;
17328 -  
17329 -       /* if we've gotten here through NAPI, check netpoll */
17330 -       if (netpoll_receive_skb(skb))
17331 ---- 2215,2228 ----
17332 -   *   NET_RX_SUCCESS: no congestion
17333 -   *   NET_RX_DROP: packet was dropped
17334 -   */
17335 -+ //int netif_receive_skb(struct sk_buff *skb)
17336 -+ int __netif_receive_skb(struct sk_buff *skb, unsigned short type, int notifier_data)
17337 -  {
17338 -       struct packet_type *ptype, *pt_prev;
17339 -       struct net_device *orig_dev;
17340 -       struct net_device *null_or_orig;
17341 -       int ret = NET_RX_DROP;
17342 -+ //   __be16 type;
17343 -  
17344 -       /* if we've gotten here through NAPI, check netpoll */
17345 -       if (netpoll_receive_skb(skb))
17346 diff -Nurb linux-2.6.27-720/net/core/neighbour.c linux-2.6.27-710/net/core/neighbour.c
17347 --- linux-2.6.27-720/net/core/neighbour.c       2009-05-04 12:18:34.000000000 -0400
17348 +++ linux-2.6.27-710/net/core/neighbour.c       2008-10-09 18:13:53.000000000 -0400
17349 @@ -2702,7 +2702,7 @@
17350  
17351  int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
17352                           int p_id, int pdev_id, char *p_name,
17353 -                         proc_handler_t *handler, ctl_handler *strategy)
17354 +                         proc_handler *handler, ctl_handler *strategy)
17355  {
17356         struct neigh_sysctl_table *t;
17357         const char *dev_name_source = NULL;
17358 diff -Nurb linux-2.6.27-720/net/core/skbuff.c linux-2.6.27-710/net/core/skbuff.c
17359 --- linux-2.6.27-720/net/core/skbuff.c  2009-05-04 12:18:34.000000000 -0400
17360 +++ linux-2.6.27-710/net/core/skbuff.c  2009-05-04 12:15:31.000000000 -0400
17361 @@ -575,112 +575,6 @@
17362         skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type;
17363  }
17364  
17365 -
17366 -/* Click: clear skb header state */
17367 -static inline void skb_headerinit(void *p, struct kmem_cache *cache,
17368 -                                 unsigned long flags)
17369 -{
17370 -       struct sk_buff *skb = p;
17371 -
17372 -       skb->next = NULL;
17373 -       skb->prev = NULL;
17374 -       skb->sk = NULL;
17375 -       skb->tstamp.tv64 = 0;     /* No idea about time */
17376 -       skb->dev = NULL;
17377 -       skb->iif = 0;
17378 -       skb->dst = NULL;
17379 -       skb->sp = NULL;
17380 -       memset(skb->cb, 0, sizeof(skb->cb));
17381 -       skb->priority = 0;
17382 -       skb->pkt_type = PACKET_HOST;   /* Default type */
17383 -       skb->ip_summed = 0;
17384 -       skb->destructor = NULL;
17385 -
17386 -#ifdef CONFIG_NETFILTER
17387 -       skb->mark = 0;
17388 -       skb->nfct = NULL;
17389 -# if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
17390 -       skb->nfct_reasm = NULL;
17391 -# endif
17392 -# ifdef CONFIG_BRIDGE_NETFILTER
17393 -       skb->nf_bridge = NULL;
17394 -# endif
17395 -#endif
17396 -#ifdef CONFIG_NET_SCHED
17397 -       skb->tc_index = 0;
17398 -# ifdef CONFIG_NET_CLS_ACT
17399 -       skb->tc_verd = 0;
17400 -# endif
17401 -#endif
17402 -}
17403 -
17404 -/* Click: attempts to recycle a sk_buff. if it can be recycled, return it */
17405 -struct sk_buff *skb_recycle(struct sk_buff *skb)
17406 -{
17407 -       if (atomic_dec_and_test(&skb->users)) { 
17408 -               dst_release(skb->dst);
17409 -#ifdef CONFIG_XFRM
17410 -               secpath_put(skb->sp);
17411 -#endif
17412 -               if(skb->destructor) {
17413 -                       WARN_ON(in_irq());
17414 -                       skb->destructor(skb);
17415 -               }
17416 -#ifdef CONFIG_NETFILTER
17417 -               nf_conntrack_put(skb->nfct);
17418 -# if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
17419 -               nf_conntrack_put_reasm(skb->nfct_reasm);
17420 -# endif
17421 -# ifdef CONFIG_BRIDGE_NETFILTER
17422 -               nf_bridge_put(skb->nf_bridge);
17423 -# endif
17424 -#endif
17425 -               skb_headerinit(skb, NULL, 0);
17426 -
17427 -               if (skb->fclone == SKB_FCLONE_UNAVAILABLE
17428 -                   && (!skb->cloned ||
17429 -                       atomic_read(&skb_shinfo(skb)->dataref) == (skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1))) {
17430 -                       /* Don't need to atomic_sub skb_shinfo(skb)->dataref,
17431 -                          as we set that to 1 below. */
17432 -                       
17433 -                       if (skb_shinfo(skb)->nr_frags) {
17434 -                               int i;
17435 -                               for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
17436 -                                       put_page(skb_shinfo(skb)->frags[i].page);
17437 -                               /* Jason Park patch */
17438 -                               skb_shinfo(skb)->nr_frags = 0;
17439 -                       }
17440 -
17441 -                       if (skb_shinfo(skb)->frag_list)
17442 -                               skb_drop_fraglist(skb);
17443 -
17444 -                       /* Load the data pointers. */
17445 -                       skb->data = skb->head;
17446 -                       skb->tail = skb->data;
17447 -                       /* end and truesize should have never changed */
17448 -                       /* skb->end = skb->data + skb->truesize; */
17449 -
17450 -                       /* set up other state */
17451 -                       skb->len = 0;
17452 -                       skb->cloned = 0;
17453 -
17454 -                       atomic_set(&skb->users, 1);
17455 -                       atomic_set(&(skb_shinfo(skb)->dataref), 1);
17456 -                       /* Jason Park patch */
17457 -                       skb_shinfo(skb)->gso_size = 0;
17458 -                       skb_shinfo(skb)->gso_segs = 0;
17459 -                       skb_shinfo(skb)->gso_type = 0;
17460 -                       skb_shinfo(skb)->ip6_frag_id = 0;
17461 -
17462 -                       return skb;
17463 -               }
17464 -
17465 -               kfree_skbmem(skb);
17466 -       }
17467 -
17468 -       return 0;
17469 -}
17470 -
17471  /**
17472   *     skb_copy        -       create private copy of an sk_buff
17473   *     @skb: buffer to copy
17474 @@ -2710,7 +2604,6 @@
17475  EXPORT_SYMBOL(skb_append_datato_frags);
17476  EXPORT_SYMBOL(__skb_warn_lro_forwarding);
17477  
17478 -EXPORT_SYMBOL(skb_recycle);
17479  EXPORT_SYMBOL_GPL(skb_to_sgvec);
17480  EXPORT_SYMBOL_GPL(skb_cow_data);
17481  EXPORT_SYMBOL_GPL(skb_partial_csum_set);
17482 diff -Nurb linux-2.6.27-720/net/core/skbuff.c.orig linux-2.6.27-710/net/core/skbuff.c.orig
17483 --- linux-2.6.27-720/net/core/skbuff.c.orig     2009-05-04 12:15:31.000000000 -0400
17484 +++ linux-2.6.27-710/net/core/skbuff.c.orig     1969-12-31 19:00:00.000000000 -0500
17485 @@ -1,2609 +0,0 @@
17486 -/*
17487 - *     Routines having to do with the 'struct sk_buff' memory handlers.
17488 - *
17489 - *     Authors:        Alan Cox <iiitac@pyr.swan.ac.uk>
17490 - *                     Florian La Roche <rzsfl@rz.uni-sb.de>
17491 - *
17492 - *     Fixes:
17493 - *             Alan Cox        :       Fixed the worst of the load
17494 - *                                     balancer bugs.
17495 - *             Dave Platt      :       Interrupt stacking fix.
17496 - *     Richard Kooijman        :       Timestamp fixes.
17497 - *             Alan Cox        :       Changed buffer format.
17498 - *             Alan Cox        :       destructor hook for AF_UNIX etc.
17499 - *             Linus Torvalds  :       Better skb_clone.
17500 - *             Alan Cox        :       Added skb_copy.
17501 - *             Alan Cox        :       Added all the changed routines Linus
17502 - *                                     only put in the headers
17503 - *             Ray VanTassle   :       Fixed --skb->lock in free
17504 - *             Alan Cox        :       skb_copy copy arp field
17505 - *             Andi Kleen      :       slabified it.
17506 - *             Robert Olsson   :       Removed skb_head_pool
17507 - *
17508 - *     NOTE:
17509 - *             The __skb_ routines should be called with interrupts
17510 - *     disabled, or you better be *real* sure that the operation is atomic
17511 - *     with respect to whatever list is being frobbed (e.g. via lock_sock()
17512 - *     or via disabling bottom half handlers, etc).
17513 - *
17514 - *     This program is free software; you can redistribute it and/or
17515 - *     modify it under the terms of the GNU General Public License
17516 - *     as published by the Free Software Foundation; either version
17517 - *     2 of the License, or (at your option) any later version.
17518 - */
17519 -
17520 -/*
17521 - *     The functions in this file will not compile correctly with gcc 2.4.x
17522 - */
17523 -
17524 -#include <linux/module.h>
17525 -#include <linux/types.h>
17526 -#include <linux/kernel.h>
17527 -#include <linux/mm.h>
17528 -#include <linux/interrupt.h>
17529 -#include <linux/in.h>
17530 -#include <linux/inet.h>
17531 -#include <linux/slab.h>
17532 -#include <linux/netdevice.h>
17533 -#ifdef CONFIG_NET_CLS_ACT
17534 -#include <net/pkt_sched.h>
17535 -#endif
17536 -#include <linux/string.h>
17537 -#include <linux/skbuff.h>
17538 -#include <linux/splice.h>
17539 -#include <linux/cache.h>
17540 -#include <linux/rtnetlink.h>
17541 -#include <linux/init.h>
17542 -#include <linux/scatterlist.h>
17543 -#include <linux/vs_network.h>
17544 -
17545 -#include <net/protocol.h>
17546 -#include <net/dst.h>
17547 -#include <net/sock.h>
17548 -#include <net/checksum.h>
17549 -#include <net/xfrm.h>
17550 -
17551 -#include <asm/uaccess.h>
17552 -#include <asm/system.h>
17553 -
17554 -#include "kmap_skb.h"
17555 -
17556 -static struct kmem_cache *skbuff_head_cache __read_mostly;
17557 -static struct kmem_cache *skbuff_fclone_cache __read_mostly;
17558 -
17559 -static void sock_pipe_buf_release(struct pipe_inode_info *pipe,
17560 -                                 struct pipe_buffer *buf)
17561 -{
17562 -       struct sk_buff *skb = (struct sk_buff *) buf->private;
17563 -
17564 -       kfree_skb(skb);
17565 -}
17566 -
17567 -static void sock_pipe_buf_get(struct pipe_inode_info *pipe,
17568 -                               struct pipe_buffer *buf)
17569 -{
17570 -       struct sk_buff *skb = (struct sk_buff *) buf->private;
17571 -
17572 -       skb_get(skb);
17573 -}
17574 -
17575 -static int sock_pipe_buf_steal(struct pipe_inode_info *pipe,
17576 -                              struct pipe_buffer *buf)
17577 -{
17578 -       return 1;
17579 -}
17580 -
17581 -
17582 -/* Pipe buffer operations for a socket. */
17583 -static struct pipe_buf_operations sock_pipe_buf_ops = {
17584 -       .can_merge = 0,
17585 -       .map = generic_pipe_buf_map,
17586 -       .unmap = generic_pipe_buf_unmap,
17587 -       .confirm = generic_pipe_buf_confirm,
17588 -       .release = sock_pipe_buf_release,
17589 -       .steal = sock_pipe_buf_steal,
17590 -       .get = sock_pipe_buf_get,
17591 -};
17592 -
17593 -/*
17594 - *     Keep out-of-line to prevent kernel bloat.
17595 - *     __builtin_return_address is not used because it is not always
17596 - *     reliable.
17597 - */
17598 -
17599 -/**
17600 - *     skb_over_panic  -       private function
17601 - *     @skb: buffer
17602 - *     @sz: size
17603 - *     @here: address
17604 - *
17605 - *     Out of line support code for skb_put(). Not user callable.
17606 - */
17607 -void skb_over_panic(struct sk_buff *skb, int sz, void *here)
17608 -{
17609 -       printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p "
17610 -                         "data:%p tail:%#lx end:%#lx dev:%s\n",
17611 -              here, skb->len, sz, skb->head, skb->data,
17612 -              (unsigned long)skb->tail, (unsigned long)skb->end,
17613 -              skb->dev ? skb->dev->name : "<NULL>");
17614 -       BUG();
17615 -}
17616 -
17617 -/**
17618 - *     skb_under_panic -       private function
17619 - *     @skb: buffer
17620 - *     @sz: size
17621 - *     @here: address
17622 - *
17623 - *     Out of line support code for skb_push(). Not user callable.
17624 - */
17625 -
17626 -void skb_under_panic(struct sk_buff *skb, int sz, void *here)
17627 -{
17628 -       printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p "
17629 -                         "data:%p tail:%#lx end:%#lx dev:%s\n",
17630 -              here, skb->len, sz, skb->head, skb->data,
17631 -              (unsigned long)skb->tail, (unsigned long)skb->end,
17632 -              skb->dev ? skb->dev->name : "<NULL>");
17633 -       BUG();
17634 -}
17635 -
17636 -void skb_truesize_bug(struct sk_buff *skb)
17637 -{
17638 -       printk(KERN_ERR "SKB BUG: Invalid truesize (%u) "
17639 -              "len=%u, sizeof(sk_buff)=%Zd\n",
17640 -              skb->truesize, skb->len, sizeof(struct sk_buff));
17641 -}
17642 -EXPORT_SYMBOL(skb_truesize_bug);
17643 -
17644 -/*     Allocate a new skbuff. We do this ourselves so we can fill in a few
17645 - *     'private' fields and also do memory statistics to find all the
17646 - *     [BEEP] leaks.
17647 - *
17648 - */
17649 -
17650 -/**
17651 - *     __alloc_skb     -       allocate a network buffer
17652 - *     @size: size to allocate
17653 - *     @gfp_mask: allocation mask
17654 - *     @fclone: allocate from fclone cache instead of head cache
17655 - *             and allocate a cloned (child) skb
17656 - *     @node: numa node to allocate memory on
17657 - *
17658 - *     Allocate a new &sk_buff. The returned buffer has no headroom and a
17659 - *     tail room of size bytes. The object has a reference count of one.
17660 - *     The return is the buffer. On a failure the return is %NULL.
17661 - *
17662 - *     Buffers may only be allocated from interrupts using a @gfp_mask of
17663 - *     %GFP_ATOMIC.
17664 - */
17665 -struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
17666 -                           int fclone, int node)
17667 -{
17668 -       struct kmem_cache *cache;
17669 -       struct skb_shared_info *shinfo;
17670 -       struct sk_buff *skb;
17671 -       u8 *data;
17672 -
17673 -       cache = fclone ? skbuff_fclone_cache : skbuff_head_cache;
17674 -
17675 -       /* Get the HEAD */
17676 -       skb = kmem_cache_alloc_node(cache, gfp_mask & ~__GFP_DMA, node);
17677 -       if (!skb)
17678 -               goto out;
17679 -
17680 -       size = SKB_DATA_ALIGN(size);
17681 -       data = kmalloc_node_track_caller(size + sizeof(struct skb_shared_info),
17682 -                       gfp_mask, node);
17683 -       if (!data)
17684 -               goto nodata;
17685 -
17686 -       /*
17687 -        * Only clear those fields we need to clear, not those that we will
17688 -        * actually initialise below. Hence, don't put any more fields after
17689 -        * the tail pointer in struct sk_buff!
17690 -        */
17691 -       memset(skb, 0, offsetof(struct sk_buff, tail));
17692 -       skb->truesize = size + sizeof(struct sk_buff);
17693 -       atomic_set(&skb->users, 1);
17694 -       skb->head = data;
17695 -       skb->data = data;
17696 -       skb_reset_tail_pointer(skb);
17697 -       skb->end = skb->tail + size;
17698 -       if (!in_interrupt()) skb->skb_tag = nx_current_nid(); else skb->skb_tag = 0;
17699 -       /* make sure we initialize shinfo sequentially */
17700 -       shinfo = skb_shinfo(skb);
17701 -       atomic_set(&shinfo->dataref, 1);
17702 -       shinfo->nr_frags  = 0;
17703 -       shinfo->gso_size = 0;
17704 -       shinfo->gso_segs = 0;
17705 -       shinfo->gso_type = 0;
17706 -       shinfo->ip6_frag_id = 0;
17707 -       shinfo->frag_list = NULL;
17708 -
17709 -       if (fclone) {
17710 -               struct sk_buff *child = skb + 1;
17711 -               atomic_t *fclone_ref = (atomic_t *) (child + 1);
17712 -
17713 -               skb->fclone = SKB_FCLONE_ORIG;
17714 -               atomic_set(fclone_ref, 1);
17715 -
17716 -               child->fclone = SKB_FCLONE_UNAVAILABLE;
17717 -       }
17718 -out:
17719 -       return skb;
17720 -nodata:
17721 -       kmem_cache_free(cache, skb);
17722 -       skb = NULL;
17723 -       goto out;
17724 -}
17725 -
17726 -/**
17727 - *     __netdev_alloc_skb - allocate an skbuff for rx on a specific device
17728 - *     @dev: network device to receive on
17729 - *     @length: length to allocate
17730 - *     @gfp_mask: get_free_pages mask, passed to alloc_skb
17731 - *
17732 - *     Allocate a new &sk_buff and assign it a usage count of one. The
17733 - *     buffer has unspecified headroom built in. Users should allocate
17734 - *     the headroom they think they need without accounting for the
17735 - *     built in space. The built in space is used for optimisations.
17736 - *
17737 - *     %NULL is returned if there is no free memory.
17738 - */
17739 -struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
17740 -               unsigned int length, gfp_t gfp_mask)
17741 -{
17742 -       int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1;
17743 -       struct sk_buff *skb;
17744 -
17745 -       skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node);
17746 -       if (likely(skb)) {
17747 -               skb_reserve(skb, NET_SKB_PAD);
17748 -               skb->dev = dev;
17749 -       }
17750 -       return skb;
17751 -}
17752 -
17753 -/**
17754 - *     dev_alloc_skb - allocate an skbuff for receiving
17755 - *     @length: length to allocate
17756 - *
17757 - *     Allocate a new &sk_buff and assign it a usage count of one. The
17758 - *     buffer has unspecified headroom built in. Users should allocate
17759 - *     the headroom they think they need without accounting for the
17760 - *     built in space. The built in space is used for optimisations.
17761 - *
17762 - *     %NULL is returned if there is no free memory. Although this function
17763 - *     allocates memory it can be called from an interrupt.
17764 - */
17765 -struct sk_buff *dev_alloc_skb(unsigned int length)
17766 -{
17767 -       /*
17768 -        * There is more code here than it seems:
17769 -        * __dev_alloc_skb is an inline
17770 -        */
17771 -       return __dev_alloc_skb(length, GFP_ATOMIC);
17772 -}
17773 -EXPORT_SYMBOL(dev_alloc_skb);
17774 -
17775 -static void skb_drop_list(struct sk_buff **listp)
17776 -{
17777 -       struct sk_buff *list = *listp;
17778 -
17779 -       *listp = NULL;
17780 -
17781 -       do {
17782 -               struct sk_buff *this = list;
17783 -               list = list->next;
17784 -               kfree_skb(this);
17785 -       } while (list);
17786 -}
17787 -
17788 -static inline void skb_drop_fraglist(struct sk_buff *skb)
17789 -{
17790 -       skb_drop_list(&skb_shinfo(skb)->frag_list);
17791 -}
17792 -
17793 -static void skb_clone_fraglist(struct sk_buff *skb)
17794 -{
17795 -       struct sk_buff *list;
17796 -
17797 -       for (list = skb_shinfo(skb)->frag_list; list; list = list->next)
17798 -               skb_get(list);
17799 -}
17800 -
17801 -static void skb_release_data(struct sk_buff *skb)
17802 -{
17803 -       if (!skb->cloned ||
17804 -           !atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1,
17805 -                              &skb_shinfo(skb)->dataref)) {
17806 -               if (skb_shinfo(skb)->nr_frags) {
17807 -                       int i;
17808 -                       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
17809 -                               put_page(skb_shinfo(skb)->frags[i].page);
17810 -               }
17811 -
17812 -               if (skb_shinfo(skb)->frag_list)
17813 -                       skb_drop_fraglist(skb);
17814 -
17815 -               kfree(skb->head);
17816 -       }
17817 -}
17818 -
17819 -/*
17820 - *     Free an skbuff by memory without cleaning the state.
17821 - */
17822 -static void kfree_skbmem(struct sk_buff *skb)
17823 -{
17824 -       struct sk_buff *other;
17825 -       atomic_t *fclone_ref;
17826 -
17827 -       switch (skb->fclone) {
17828 -       case SKB_FCLONE_UNAVAILABLE:
17829 -               kmem_cache_free(skbuff_head_cache, skb);
17830 -               break;
17831 -
17832 -       case SKB_FCLONE_ORIG:
17833 -               fclone_ref = (atomic_t *) (skb + 2);
17834 -               if (atomic_dec_and_test(fclone_ref))
17835 -                       kmem_cache_free(skbuff_fclone_cache, skb);
17836 -               break;
17837 -
17838 -       case SKB_FCLONE_CLONE:
17839 -               fclone_ref = (atomic_t *) (skb + 1);
17840 -               other = skb - 1;
17841 -
17842 -               /* The clone portion is available for
17843 -                * fast-cloning again.
17844 -                */
17845 -               skb->fclone = SKB_FCLONE_UNAVAILABLE;
17846 -
17847 -               if (atomic_dec_and_test(fclone_ref))
17848 -                       kmem_cache_free(skbuff_fclone_cache, other);
17849 -               break;
17850 -       }
17851 -}
17852 -
17853 -/* Free everything but the sk_buff shell. */
17854 -static void skb_release_all(struct sk_buff *skb)
17855 -{
17856 -       dst_release(skb->dst);
17857 -#ifdef CONFIG_XFRM
17858 -       secpath_put(skb->sp);
17859 -#endif
17860 -       if (skb->destructor) {
17861 -               WARN_ON(in_irq());
17862 -               skb->destructor(skb);
17863 -       }
17864 -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
17865 -       nf_conntrack_put(skb->nfct);
17866 -       nf_conntrack_put_reasm(skb->nfct_reasm);
17867 -#endif
17868 -#ifdef CONFIG_BRIDGE_NETFILTER
17869 -       nf_bridge_put(skb->nf_bridge);
17870 -#endif
17871 -/* XXX: IS this still necessary? - JHS */
17872 -#ifdef CONFIG_NET_SCHED
17873 -       skb->tc_index = 0;
17874 -#ifdef CONFIG_NET_CLS_ACT
17875 -       skb->tc_verd = 0;
17876 -#endif
17877 -#endif
17878 -       skb_release_data(skb);
17879 -}
17880 -
17881 -/**
17882 - *     __kfree_skb - private function
17883 - *     @skb: buffer
17884 - *
17885 - *     Free an sk_buff. Release anything attached to the buffer.
17886 - *     Clean the state. This is an internal helper function. Users should
17887 - *     always call kfree_skb
17888 - */
17889 -
17890 -void __kfree_skb(struct sk_buff *skb)
17891 -{
17892 -       skb_release_all(skb);
17893 -       kfree_skbmem(skb);
17894 -}
17895 -
17896 -/**
17897 - *     kfree_skb - free an sk_buff
17898 - *     @skb: buffer to free
17899 - *
17900 - *     Drop a reference to the buffer and free it if the usage count has
17901 - *     hit zero.
17902 - */
17903 -void kfree_skb(struct sk_buff *skb)
17904 -{
17905 -       if (unlikely(!skb))
17906 -               return;
17907 -       if (likely(atomic_read(&skb->users) == 1))
17908 -               smp_rmb();
17909 -       else if (likely(!atomic_dec_and_test(&skb->users)))
17910 -               return;
17911 -       __kfree_skb(skb);
17912 -}
17913 -
17914 -static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
17915 -{
17916 -       new->tstamp             = old->tstamp;
17917 -       new->dev                = old->dev;
17918 -       new->transport_header   = old->transport_header;
17919 -       new->network_header     = old->network_header;
17920 -       new->mac_header         = old->mac_header;
17921 -       new->dst                = dst_clone(old->dst);
17922 -#ifdef CONFIG_INET
17923 -       new->sp                 = secpath_get(old->sp);
17924 -#endif
17925 -       memcpy(new->cb, old->cb, sizeof(old->cb));
17926 -       new->csum_start         = old->csum_start;
17927 -       new->csum_offset        = old->csum_offset;
17928 -       new->local_df           = old->local_df;
17929 -       new->pkt_type           = old->pkt_type;
17930 -       new->ip_summed          = old->ip_summed;
17931 -       skb_copy_queue_mapping(new, old);
17932 -       new->priority           = old->priority;
17933 -#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
17934 -       new->ipvs_property      = old->ipvs_property;
17935 -#endif
17936 -       new->protocol           = old->protocol;
17937 -       new->mark               = old->mark;
17938 -       __nf_copy(new, old);
17939 -#if defined(CONFIG_NETFILTER_XT_TARGET_TRACE) || \
17940 -    defined(CONFIG_NETFILTER_XT_TARGET_TRACE_MODULE)
17941 -       new->nf_trace           = old->nf_trace;
17942 -#endif
17943 -#ifdef CONFIG_NET_SCHED
17944 -       new->tc_index           = old->tc_index;
17945 -#ifdef CONFIG_NET_CLS_ACT
17946 -       new->tc_verd            = old->tc_verd;
17947 -#endif
17948 -#endif
17949 -       new->vlan_tci           = old->vlan_tci;
17950 -       new->skb_tag            = old->skb_tag;
17951 -
17952 -       skb_copy_secmark(new, old);
17953 -}
17954 -
17955 -static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
17956 -{
17957 -#define C(x) n->x = skb->x
17958 -
17959 -       n->next = n->prev = NULL;
17960 -       n->sk = NULL;
17961 -       __copy_skb_header(n, skb);
17962 -
17963 -       C(len);
17964 -       C(data_len);
17965 -       C(mac_len);
17966 -       n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len;
17967 -       n->cloned = 1;
17968 -       n->nohdr = 0;
17969 -       n->destructor = NULL;
17970 -       C(iif);
17971 -       C(tail);
17972 -       C(end);
17973 -       C(head);
17974 -       C(data);
17975 -       C(truesize);
17976 -#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
17977 -       C(do_not_encrypt);
17978 -#endif
17979 -       atomic_set(&n->users, 1);
17980 -
17981 -       /* Sapan: Cloned skbs aren't owned by anyone. Let the cloner decide who it belongs to. */
17982 -
17983 -       atomic_inc(&(skb_shinfo(skb)->dataref));
17984 -       skb->cloned = 1;
17985 -
17986 -       return n;
17987 -#undef C
17988 -}
17989 -
17990 -/**
17991 - *     skb_morph       -       morph one skb into another
17992 - *     @dst: the skb to receive the contents
17993 - *     @src: the skb to supply the contents
17994 - *
17995 - *     This is identical to skb_clone except that the target skb is
17996 - *     supplied by the user.
17997 - *
17998 - *     The target skb is returned upon exit.
17999 - */
18000 -struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src)
18001 -{
18002 -       skb_release_all(dst);
18003 -       return __skb_clone(dst, src);
18004 -}
18005 -EXPORT_SYMBOL_GPL(skb_morph);
18006 -
18007 -/**
18008 - *     skb_clone       -       duplicate an sk_buff
18009 - *     @skb: buffer to clone
18010 - *     @gfp_mask: allocation priority
18011 - *
18012 - *     Duplicate an &sk_buff. The new one is not owned by a socket. Both
18013 - *     copies share the same packet data but not structure. The new
18014 - *     buffer has a reference count of 1. If the allocation fails the
18015 - *     function returns %NULL otherwise the new buffer is returned.
18016 - *
18017 - *     If this function is called from an interrupt gfp_mask() must be
18018 - *     %GFP_ATOMIC.
18019 - */
18020 -
18021 -struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
18022 -{
18023 -       struct sk_buff *n;
18024 -
18025 -       n = skb + 1;
18026 -       if (skb->fclone == SKB_FCLONE_ORIG &&
18027 -           n->fclone == SKB_FCLONE_UNAVAILABLE) {
18028 -               atomic_t *fclone_ref = (atomic_t *) (n + 1);
18029 -               n->fclone = SKB_FCLONE_CLONE;
18030 -               atomic_inc(fclone_ref);
18031 -       } else {
18032 -               n = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
18033 -               if (!n)
18034 -                       return NULL;
18035 -               n->fclone = SKB_FCLONE_UNAVAILABLE;
18036 -       }
18037 -
18038 -       return __skb_clone(n, skb);
18039 -}
18040 -
18041 -static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
18042 -{
18043 -#ifndef NET_SKBUFF_DATA_USES_OFFSET
18044 -       /*
18045 -        *      Shift between the two data areas in bytes
18046 -        */
18047 -       unsigned long offset = new->data - old->data;
18048 -#endif
18049 -
18050 -       __copy_skb_header(new, old);
18051 -
18052 -#ifndef NET_SKBUFF_DATA_USES_OFFSET
18053 -       /* {transport,network,mac}_header are relative to skb->head */
18054 -       new->transport_header += offset;
18055 -       new->network_header   += offset;
18056 -       new->mac_header       += offset;
18057 -#endif
18058 -       skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
18059 -       skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
18060 -       skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type;
18061 -}
18062 -
18063 -/**
18064 - *     skb_copy        -       create private copy of an sk_buff
18065 - *     @skb: buffer to copy
18066 - *     @gfp_mask: allocation priority
18067 - *
18068 - *     Make a copy of both an &sk_buff and its data. This is used when the
18069 - *     caller wishes to modify the data and needs a private copy of the
18070 - *     data to alter. Returns %NULL on failure or the pointer to the buffer
18071 - *     on success. The returned buffer has a reference count of 1.
18072 - *
18073 - *     As by-product this function converts non-linear &sk_buff to linear
18074 - *     one, so that &sk_buff becomes completely private and caller is allowed
18075 - *     to modify all the data of returned buffer. This means that this
18076 - *     function is not recommended for use in circumstances when only
18077 - *     header is going to be modified. Use pskb_copy() instead.
18078 - */
18079 -
18080 -struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
18081 -{
18082 -       int headerlen = skb->data - skb->head;
18083 -       /*
18084 -        *      Allocate the copy buffer
18085 -        */
18086 -       struct sk_buff *n;
18087 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18088 -       n = alloc_skb(skb->end + skb->data_len, gfp_mask);
18089 -#else
18090 -       n = alloc_skb(skb->end - skb->head + skb->data_len, gfp_mask);
18091 -#endif
18092 -       if (!n)
18093 -               return NULL;
18094 -
18095 -       /* Set the data pointer */
18096 -       skb_reserve(n, headerlen);
18097 -       /* Set the tail pointer and length */
18098 -       skb_put(n, skb->len);
18099 -
18100 -       if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))
18101 -               BUG();
18102 -
18103 -       copy_skb_header(n, skb);
18104 -       return n;
18105 -}
18106 -
18107 -
18108 -/**
18109 - *     pskb_copy       -       create copy of an sk_buff with private head.
18110 - *     @skb: buffer to copy
18111 - *     @gfp_mask: allocation priority
18112 - *
18113 - *     Make a copy of both an &sk_buff and part of its data, located
18114 - *     in header. Fragmented data remain shared. This is used when
18115 - *     the caller wishes to modify only header of &sk_buff and needs
18116 - *     private copy of the header to alter. Returns %NULL on failure
18117 - *     or the pointer to the buffer on success.
18118 - *     The returned buffer has a reference count of 1.
18119 - */
18120 -
18121 -struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask)
18122 -{
18123 -       /*
18124 -        *      Allocate the copy buffer
18125 -        */
18126 -       struct sk_buff *n;
18127 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18128 -       n = alloc_skb(skb->end, gfp_mask);
18129 -#else
18130 -       n = alloc_skb(skb->end - skb->head, gfp_mask);
18131 -#endif
18132 -       if (!n)
18133 -               goto out;
18134 -
18135 -       /* Set the data pointer */
18136 -       skb_reserve(n, skb->data - skb->head);
18137 -       /* Set the tail pointer and length */
18138 -       skb_put(n, skb_headlen(skb));
18139 -       /* Copy the bytes */
18140 -       skb_copy_from_linear_data(skb, n->data, n->len);
18141 -
18142 -       n->truesize += skb->data_len;
18143 -       n->data_len  = skb->data_len;
18144 -       n->len       = skb->len;
18145 -
18146 -       if (skb_shinfo(skb)->nr_frags) {
18147 -               int i;
18148 -
18149 -               for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
18150 -                       skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i];
18151 -                       get_page(skb_shinfo(n)->frags[i].page);
18152 -               }
18153 -               skb_shinfo(n)->nr_frags = i;
18154 -       }
18155 -
18156 -       if (skb_shinfo(skb)->frag_list) {
18157 -               skb_shinfo(n)->frag_list = skb_shinfo(skb)->frag_list;
18158 -               skb_clone_fraglist(n);
18159 -       }
18160 -
18161 -       copy_skb_header(n, skb);
18162 -out:
18163 -       return n;
18164 -}
18165 -
18166 -/**
18167 - *     pskb_expand_head - reallocate header of &sk_buff
18168 - *     @skb: buffer to reallocate
18169 - *     @nhead: room to add at head
18170 - *     @ntail: room to add at tail
18171 - *     @gfp_mask: allocation priority
18172 - *
18173 - *     Expands (or creates identical copy, if &nhead and &ntail are zero)
18174 - *     header of skb. &sk_buff itself is not changed. &sk_buff MUST have
18175 - *     reference count of 1. Returns zero in the case of success or error,
18176 - *     if expansion failed. In the last case, &sk_buff is not changed.
18177 - *
18178 - *     All the pointers pointing into skb header may change and must be
18179 - *     reloaded after call to this function.
18180 - */
18181 -
18182 -int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
18183 -                    gfp_t gfp_mask)
18184 -{
18185 -       int i;
18186 -       u8 *data;
18187 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18188 -       int size = nhead + skb->end + ntail;
18189 -#else
18190 -       int size = nhead + (skb->end - skb->head) + ntail;
18191 -#endif
18192 -       long off;
18193 -
18194 -       if (skb_shared(skb))
18195 -               BUG();
18196 -
18197 -       size = SKB_DATA_ALIGN(size);
18198 -
18199 -       data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
18200 -       if (!data)
18201 -               goto nodata;
18202 -
18203 -       /* Copy only real data... and, alas, header. This should be
18204 -        * optimized for the cases when header is void. */
18205 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18206 -       memcpy(data + nhead, skb->head, skb->tail);
18207 -#else
18208 -       memcpy(data + nhead, skb->head, skb->tail - skb->head);
18209 -#endif
18210 -       memcpy(data + size, skb_end_pointer(skb),
18211 -              sizeof(struct skb_shared_info));
18212 -
18213 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
18214 -               get_page(skb_shinfo(skb)->frags[i].page);
18215 -
18216 -       if (skb_shinfo(skb)->frag_list)
18217 -               skb_clone_fraglist(skb);
18218 -
18219 -       skb_release_data(skb);
18220 -
18221 -       off = (data + nhead) - skb->head;
18222 -
18223 -       skb->head     = data;
18224 -       skb->data    += off;
18225 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18226 -       skb->end      = size;
18227 -       off           = nhead;
18228 -#else
18229 -       skb->end      = skb->head + size;
18230 -#endif
18231 -       /* {transport,network,mac}_header and tail are relative to skb->head */
18232 -       skb->tail             += off;
18233 -       skb->transport_header += off;
18234 -       skb->network_header   += off;
18235 -       skb->mac_header       += off;
18236 -       skb->csum_start       += nhead;
18237 -       skb->cloned   = 0;
18238 -       skb->hdr_len  = 0;
18239 -       skb->nohdr    = 0;
18240 -       atomic_set(&skb_shinfo(skb)->dataref, 1);
18241 -       return 0;
18242 -
18243 -nodata:
18244 -       return -ENOMEM;
18245 -}
18246 -
18247 -/* Make private copy of skb with writable head and some headroom */
18248 -
18249 -struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom)
18250 -{
18251 -       struct sk_buff *skb2;
18252 -       int delta = headroom - skb_headroom(skb);
18253 -
18254 -       if (delta <= 0)
18255 -               skb2 = pskb_copy(skb, GFP_ATOMIC);
18256 -       else {
18257 -               skb2 = skb_clone(skb, GFP_ATOMIC);
18258 -               if (skb2 && pskb_expand_head(skb2, SKB_DATA_ALIGN(delta), 0,
18259 -                                            GFP_ATOMIC)) {
18260 -                       kfree_skb(skb2);
18261 -                       skb2 = NULL;
18262 -               }
18263 -       }
18264 -       return skb2;
18265 -}
18266 -
18267 -
18268 -/**
18269 - *     skb_copy_expand -       copy and expand sk_buff
18270 - *     @skb: buffer to copy
18271 - *     @newheadroom: new free bytes at head
18272 - *     @newtailroom: new free bytes at tail
18273 - *     @gfp_mask: allocation priority
18274 - *
18275 - *     Make a copy of both an &sk_buff and its data and while doing so
18276 - *     allocate additional space.
18277 - *
18278 - *     This is used when the caller wishes to modify the data and needs a
18279 - *     private copy of the data to alter as well as more space for new fields.
18280 - *     Returns %NULL on failure or the pointer to the buffer
18281 - *     on success. The returned buffer has a reference count of 1.
18282 - *
18283 - *     You must pass %GFP_ATOMIC as the allocation priority if this function
18284 - *     is called from an interrupt.
18285 - */
18286 -struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
18287 -                               int newheadroom, int newtailroom,
18288 -                               gfp_t gfp_mask)
18289 -{
18290 -       /*
18291 -        *      Allocate the copy buffer
18292 -        */
18293 -       struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom,
18294 -                                     gfp_mask);
18295 -       int oldheadroom = skb_headroom(skb);
18296 -       int head_copy_len, head_copy_off;
18297 -       int off;
18298 -
18299 -       if (!n)
18300 -               return NULL;
18301 -
18302 -       skb_reserve(n, newheadroom);
18303 -
18304 -       /* Set the tail pointer and length */
18305 -       skb_put(n, skb->len);
18306 -
18307 -       head_copy_len = oldheadroom;
18308 -       head_copy_off = 0;
18309 -       if (newheadroom <= head_copy_len)
18310 -               head_copy_len = newheadroom;
18311 -       else
18312 -               head_copy_off = newheadroom - head_copy_len;
18313 -
18314 -       /* Copy the linear header and data. */
18315 -       if (skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
18316 -                         skb->len + head_copy_len))
18317 -               BUG();
18318 -
18319 -       copy_skb_header(n, skb);
18320 -
18321 -       off                  = newheadroom - oldheadroom;
18322 -       n->csum_start       += off;
18323 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18324 -       n->transport_header += off;
18325 -       n->network_header   += off;
18326 -       n->mac_header       += off;
18327 -#endif
18328 -
18329 -       return n;
18330 -}
18331 -
18332 -/**
18333 - *     skb_pad                 -       zero pad the tail of an skb
18334 - *     @skb: buffer to pad
18335 - *     @pad: space to pad
18336 - *
18337 - *     Ensure that a buffer is followed by a padding area that is zero
18338 - *     filled. Used by network drivers which may DMA or transfer data
18339 - *     beyond the buffer end onto the wire.
18340 - *
18341 - *     May return error in out of memory cases. The skb is freed on error.
18342 - */
18343 -
18344 -int skb_pad(struct sk_buff *skb, int pad)
18345 -{
18346 -       int err;
18347 -       int ntail;
18348 -
18349 -       /* If the skbuff is non linear tailroom is always zero.. */
18350 -       if (!skb_cloned(skb) && skb_tailroom(skb) >= pad) {
18351 -               memset(skb->data+skb->len, 0, pad);
18352 -               return 0;
18353 -       }
18354 -
18355 -       ntail = skb->data_len + pad - (skb->end - skb->tail);
18356 -       if (likely(skb_cloned(skb) || ntail > 0)) {
18357 -               err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC);
18358 -               if (unlikely(err))
18359 -                       goto free_skb;
18360 -       }
18361 -
18362 -       /* FIXME: The use of this function with non-linear skb's really needs
18363 -        * to be audited.
18364 -        */
18365 -       err = skb_linearize(skb);
18366 -       if (unlikely(err))
18367 -               goto free_skb;
18368 -
18369 -       memset(skb->data + skb->len, 0, pad);
18370 -       return 0;
18371 -
18372 -free_skb:
18373 -       kfree_skb(skb);
18374 -       return err;
18375 -}
18376 -
18377 -/**
18378 - *     skb_put - add data to a buffer
18379 - *     @skb: buffer to use
18380 - *     @len: amount of data to add
18381 - *
18382 - *     This function extends the used data area of the buffer. If this would
18383 - *     exceed the total buffer size the kernel will panic. A pointer to the
18384 - *     first byte of the extra data is returned.
18385 - */
18386 -unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
18387 -{
18388 -       unsigned char *tmp = skb_tail_pointer(skb);
18389 -       SKB_LINEAR_ASSERT(skb);
18390 -       skb->tail += len;
18391 -       skb->len  += len;
18392 -       if (unlikely(skb->tail > skb->end))
18393 -               skb_over_panic(skb, len, __builtin_return_address(0));
18394 -       return tmp;
18395 -}
18396 -EXPORT_SYMBOL(skb_put);
18397 -
18398 -/**
18399 - *     skb_push - add data to the start of a buffer
18400 - *     @skb: buffer to use
18401 - *     @len: amount of data to add
18402 - *
18403 - *     This function extends the used data area of the buffer at the buffer
18404 - *     start. If this would exceed the total buffer headroom the kernel will
18405 - *     panic. A pointer to the first byte of the extra data is returned.
18406 - */
18407 -unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
18408 -{
18409 -       skb->data -= len;
18410 -       skb->len  += len;
18411 -       if (unlikely(skb->data<skb->head))
18412 -               skb_under_panic(skb, len, __builtin_return_address(0));
18413 -       return skb->data;
18414 -}
18415 -EXPORT_SYMBOL(skb_push);
18416 -
18417 -/**
18418 - *     skb_pull - remove data from the start of a buffer
18419 - *     @skb: buffer to use
18420 - *     @len: amount of data to remove
18421 - *
18422 - *     This function removes data from the start of a buffer, returning
18423 - *     the memory to the headroom. A pointer to the next data in the buffer
18424 - *     is returned. Once the data has been pulled future pushes will overwrite
18425 - *     the old data.
18426 - */
18427 -unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
18428 -{
18429 -       return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
18430 -}
18431 -EXPORT_SYMBOL(skb_pull);
18432 -
18433 -/**
18434 - *     skb_trim - remove end from a buffer
18435 - *     @skb: buffer to alter
18436 - *     @len: new length
18437 - *
18438 - *     Cut the length of a buffer down by removing data from the tail. If
18439 - *     the buffer is already under the length specified it is not modified.
18440 - *     The skb must be linear.
18441 - */
18442 -void skb_trim(struct sk_buff *skb, unsigned int len)
18443 -{
18444 -       if (skb->len > len)
18445 -               __skb_trim(skb, len);
18446 -}
18447 -EXPORT_SYMBOL(skb_trim);
18448 -
18449 -/* Trims skb to length len. It can change skb pointers.
18450 - */
18451 -
18452 -int ___pskb_trim(struct sk_buff *skb, unsigned int len)
18453 -{
18454 -       struct sk_buff **fragp;
18455 -       struct sk_buff *frag;
18456 -       int offset = skb_headlen(skb);
18457 -       int nfrags = skb_shinfo(skb)->nr_frags;
18458 -       int i;
18459 -       int err;
18460 -
18461 -       if (skb_cloned(skb) &&
18462 -           unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))))
18463 -               return err;
18464 -
18465 -       i = 0;
18466 -       if (offset >= len)
18467 -               goto drop_pages;
18468 -
18469 -       for (; i < nfrags; i++) {
18470 -               int end = offset + skb_shinfo(skb)->frags[i].size;
18471 -
18472 -               if (end < len) {
18473 -                       offset = end;
18474 -                       continue;
18475 -               }
18476 -
18477 -               skb_shinfo(skb)->frags[i++].size = len - offset;
18478 -
18479 -drop_pages:
18480 -               skb_shinfo(skb)->nr_frags = i;
18481 -
18482 -               for (; i < nfrags; i++)
18483 -                       put_page(skb_shinfo(skb)->frags[i].page);
18484 -
18485 -               if (skb_shinfo(skb)->frag_list)
18486 -                       skb_drop_fraglist(skb);
18487 -               goto done;
18488 -       }
18489 -
18490 -       for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp);
18491 -            fragp = &frag->next) {
18492 -               int end = offset + frag->len;
18493 -
18494 -               if (skb_shared(frag)) {
18495 -                       struct sk_buff *nfrag;
18496 -
18497 -                       nfrag = skb_clone(frag, GFP_ATOMIC);
18498 -                       if (unlikely(!nfrag))
18499 -                               return -ENOMEM;
18500 -
18501 -                       nfrag->next = frag->next;
18502 -                       kfree_skb(frag);
18503 -                       frag = nfrag;
18504 -                       *fragp = frag;
18505 -               }
18506 -
18507 -               if (end < len) {
18508 -                       offset = end;
18509 -                       continue;
18510 -               }
18511 -
18512 -               if (end > len &&
18513 -                   unlikely((err = pskb_trim(frag, len - offset))))
18514 -                       return err;
18515 -
18516 -               if (frag->next)
18517 -                       skb_drop_list(&frag->next);
18518 -               break;
18519 -       }
18520 -
18521 -done:
18522 -       if (len > skb_headlen(skb)) {
18523 -               skb->data_len -= skb->len - len;
18524 -               skb->len       = len;
18525 -       } else {
18526 -               skb->len       = len;
18527 -               skb->data_len  = 0;
18528 -               skb_set_tail_pointer(skb, len);
18529 -       }
18530 -
18531 -       return 0;
18532 -}
18533 -
18534 -/**
18535 - *     __pskb_pull_tail - advance tail of skb header
18536 - *     @skb: buffer to reallocate
18537 - *     @delta: number of bytes to advance tail
18538 - *
18539 - *     The function makes a sense only on a fragmented &sk_buff,
18540 - *     it expands header moving its tail forward and copying necessary
18541 - *     data from fragmented part.
18542 - *
18543 - *     &sk_buff MUST have reference count of 1.
18544 - *
18545 - *     Returns %NULL (and &sk_buff does not change) if pull failed
18546 - *     or value of new tail of skb in the case of success.
18547 - *
18548 - *     All the pointers pointing into skb header may change and must be
18549 - *     reloaded after call to this function.
18550 - */
18551 -
18552 -/* Moves tail of skb head forward, copying data from fragmented part,
18553 - * when it is necessary.
18554 - * 1. It may fail due to malloc failure.
18555 - * 2. It may change skb pointers.
18556 - *
18557 - * It is pretty complicated. Luckily, it is called only in exceptional cases.
18558 - */
18559 -unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
18560 -{
18561 -       /* If skb has not enough free space at tail, get new one
18562 -        * plus 128 bytes for future expansions. If we have enough
18563 -        * room at tail, reallocate without expansion only if skb is cloned.
18564 -        */
18565 -       int i, k, eat = (skb->tail + delta) - skb->end;
18566 -
18567 -       if (eat > 0 || skb_cloned(skb)) {
18568 -               if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0,
18569 -                                    GFP_ATOMIC))
18570 -                       return NULL;
18571 -       }
18572 -
18573 -       if (skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb), delta))
18574 -               BUG();
18575 -
18576 -       /* Optimization: no fragments, no reasons to preestimate
18577 -        * size of pulled pages. Superb.
18578 -        */
18579 -       if (!skb_shinfo(skb)->frag_list)
18580 -               goto pull_pages;
18581 -
18582 -       /* Estimate size of pulled pages. */
18583 -       eat = delta;
18584 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
18585 -               if (skb_shinfo(skb)->frags[i].size >= eat)
18586 -                       goto pull_pages;
18587 -               eat -= skb_shinfo(skb)->frags[i].size;
18588 -       }
18589 -
18590 -       /* If we need update frag list, we are in troubles.
18591 -        * Certainly, it possible to add an offset to skb data,
18592 -        * but taking into account that pulling is expected to
18593 -        * be very rare operation, it is worth to fight against
18594 -        * further bloating skb head and crucify ourselves here instead.
18595 -        * Pure masohism, indeed. 8)8)
18596 -        */
18597 -       if (eat) {
18598 -               struct sk_buff *list = skb_shinfo(skb)->frag_list;
18599 -               struct sk_buff *clone = NULL;
18600 -               struct sk_buff *insp = NULL;
18601 -
18602 -               do {
18603 -                       BUG_ON(!list);
18604 -
18605 -                       if (list->len <= eat) {
18606 -                               /* Eaten as whole. */
18607 -                               eat -= list->len;
18608 -                               list = list->next;
18609 -                               insp = list;
18610 -                       } else {
18611 -                               /* Eaten partially. */
18612 -
18613 -                               if (skb_shared(list)) {
18614 -                                       /* Sucks! We need to fork list. :-( */
18615 -                                       clone = skb_clone(list, GFP_ATOMIC);
18616 -                                       if (!clone)
18617 -                                               return NULL;
18618 -                                       insp = list->next;
18619 -                                       list = clone;
18620 -                               } else {
18621 -                                       /* This may be pulled without
18622 -                                        * problems. */
18623 -                                       insp = list;
18624 -                               }
18625 -                               if (!pskb_pull(list, eat)) {
18626 -                                       if (clone)
18627 -                                               kfree_skb(clone);
18628 -                                       return NULL;
18629 -                               }
18630 -                               break;
18631 -                       }
18632 -               } while (eat);
18633 -
18634 -               /* Free pulled out fragments. */
18635 -               while ((list = skb_shinfo(skb)->frag_list) != insp) {
18636 -                       skb_shinfo(skb)->frag_list = list->next;
18637 -                       kfree_skb(list);
18638 -               }
18639 -               /* And insert new clone at head. */
18640 -               if (clone) {
18641 -                       clone->next = list;
18642 -                       skb_shinfo(skb)->frag_list = clone;
18643 -               }
18644 -       }
18645 -       /* Success! Now we may commit changes to skb data. */
18646 -
18647 -pull_pages:
18648 -       eat = delta;
18649 -       k = 0;
18650 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
18651 -               if (skb_shinfo(skb)->frags[i].size <= eat) {
18652 -                       put_page(skb_shinfo(skb)->frags[i].page);
18653 -                       eat -= skb_shinfo(skb)->frags[i].size;
18654 -               } else {
18655 -                       skb_shinfo(skb)->frags[k] = skb_shinfo(skb)->frags[i];
18656 -                       if (eat) {
18657 -                               skb_shinfo(skb)->frags[k].page_offset += eat;
18658 -                               skb_shinfo(skb)->frags[k].size -= eat;
18659 -                               eat = 0;
18660 -                       }
18661 -                       k++;
18662 -               }
18663 -       }
18664 -       skb_shinfo(skb)->nr_frags = k;
18665 -
18666 -       skb->tail     += delta;
18667 -       skb->data_len -= delta;
18668 -
18669 -       return skb_tail_pointer(skb);
18670 -}
18671 -
18672 -/* Copy some data bits from skb to kernel buffer. */
18673 -
18674 -int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len)
18675 -{
18676 -       int i, copy;
18677 -       int start = skb_headlen(skb);
18678 -
18679 -       if (offset > (int)skb->len - len)
18680 -               goto fault;
18681 -
18682 -       /* Copy header. */
18683 -       if ((copy = start - offset) > 0) {
18684 -               if (copy > len)
18685 -                       copy = len;
18686 -               skb_copy_from_linear_data_offset(skb, offset, to, copy);
18687 -               if ((len -= copy) == 0)
18688 -                       return 0;
18689 -               offset += copy;
18690 -               to     += copy;
18691 -       }
18692 -
18693 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
18694 -               int end;
18695 -
18696 -               WARN_ON(start > offset + len);
18697 -
18698 -               end = start + skb_shinfo(skb)->frags[i].size;
18699 -               if ((copy = end - offset) > 0) {
18700 -                       u8 *vaddr;
18701 -
18702 -                       if (copy > len)
18703 -                               copy = len;
18704 -
18705 -                       vaddr = kmap_skb_frag(&skb_shinfo(skb)->frags[i]);
18706 -                       memcpy(to,
18707 -                              vaddr + skb_shinfo(skb)->frags[i].page_offset+
18708 -                              offset - start, copy);
18709 -                       kunmap_skb_frag(vaddr);
18710 -
18711 -                       if ((len -= copy) == 0)
18712 -                               return 0;
18713 -                       offset += copy;
18714 -                       to     += copy;
18715 -               }
18716 -               start = end;
18717 -       }
18718 -
18719 -       if (skb_shinfo(skb)->frag_list) {
18720 -               struct sk_buff *list = skb_shinfo(skb)->frag_list;
18721 -
18722 -               for (; list; list = list->next) {
18723 -                       int end;
18724 -
18725 -                       WARN_ON(start > offset + len);
18726 -
18727 -                       end = start + list->len;
18728 -                       if ((copy = end - offset) > 0) {
18729 -                               if (copy > len)
18730 -                                       copy = len;
18731 -                               if (skb_copy_bits(list, offset - start,
18732 -                                                 to, copy))
18733 -                                       goto fault;
18734 -                               if ((len -= copy) == 0)
18735 -                                       return 0;
18736 -                               offset += copy;
18737 -                               to     += copy;
18738 -                       }
18739 -                       start = end;
18740 -               }
18741 -       }
18742 -       if (!len)
18743 -               return 0;
18744 -
18745 -fault:
18746 -       return -EFAULT;
18747 -}
18748 -
18749 -/*
18750 - * Callback from splice_to_pipe(), if we need to release some pages
18751 - * at the end of the spd in case we error'ed out in filling the pipe.
18752 - */
18753 -static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
18754 -{
18755 -       struct sk_buff *skb = (struct sk_buff *) spd->partial[i].private;
18756 -
18757 -       kfree_skb(skb);
18758 -}
18759 -
18760 -/*
18761 - * Fill page/offset/length into spd, if it can hold more pages.
18762 - */
18763 -static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page,
18764 -                               unsigned int len, unsigned int offset,
18765 -                               struct sk_buff *skb)
18766 -{
18767 -       if (unlikely(spd->nr_pages == PIPE_BUFFERS))
18768 -               return 1;
18769 -
18770 -       spd->pages[spd->nr_pages] = page;
18771 -       spd->partial[spd->nr_pages].len = len;
18772 -       spd->partial[spd->nr_pages].offset = offset;
18773 -       spd->partial[spd->nr_pages].private = (unsigned long) skb_get(skb);
18774 -       spd->nr_pages++;
18775 -       return 0;
18776 -}
18777 -
18778 -static inline void __segment_seek(struct page **page, unsigned int *poff,
18779 -                                 unsigned int *plen, unsigned int off)
18780 -{
18781 -       *poff += off;
18782 -       *page += *poff / PAGE_SIZE;
18783 -       *poff = *poff % PAGE_SIZE;
18784 -       *plen -= off;
18785 -}
18786 -
18787 -static inline int __splice_segment(struct page *page, unsigned int poff,
18788 -                                  unsigned int plen, unsigned int *off,
18789 -                                  unsigned int *len, struct sk_buff *skb,
18790 -                                  struct splice_pipe_desc *spd)
18791 -{
18792 -       if (!*len)
18793 -               return 1;
18794 -
18795 -       /* skip this segment if already processed */
18796 -       if (*off >= plen) {
18797 -               *off -= plen;
18798 -               return 0;
18799 -       }
18800 -
18801 -       /* ignore any bits we already processed */
18802 -       if (*off) {
18803 -               __segment_seek(&page, &poff, &plen, *off);
18804 -               *off = 0;
18805 -       }
18806 -
18807 -       do {
18808 -               unsigned int flen = min(*len, plen);
18809 -
18810 -               /* the linear region may spread across several pages  */
18811 -               flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
18812 -
18813 -               if (spd_fill_page(spd, page, flen, poff, skb))
18814 -                       return 1;
18815 -
18816 -               __segment_seek(&page, &poff, &plen, flen);
18817 -               *len -= flen;
18818 -
18819 -       } while (*len && plen);
18820 -
18821 -       return 0;
18822 -}
18823 -
18824 -/*
18825 - * Map linear and fragment data from the skb to spd. It reports failure if the
18826 - * pipe is full or if we already spliced the requested length.
18827 - */
18828 -static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
18829 -                     unsigned int *len,
18830 -                     struct splice_pipe_desc *spd)
18831 -{
18832 -       int seg;
18833 -
18834 -       /*
18835 -        * map the linear part
18836 -        */
18837 -       if (__splice_segment(virt_to_page(skb->data),
18838 -                            (unsigned long) skb->data & (PAGE_SIZE - 1),
18839 -                            skb_headlen(skb),
18840 -                            offset, len, skb, spd))
18841 -               return 1;
18842 -
18843 -       /*
18844 -        * then map the fragments
18845 -        */
18846 -       for (seg = 0; seg < skb_shinfo(skb)->nr_frags; seg++) {
18847 -               const skb_frag_t *f = &skb_shinfo(skb)->frags[seg];
18848 -
18849 -               if (__splice_segment(f->page, f->page_offset, f->size,
18850 -                                    offset, len, skb, spd))
18851 -                       return 1;
18852 -       }
18853 -
18854 -       return 0;
18855 -}
18856 -
18857 -/*
18858 - * Map data from the skb to a pipe. Should handle both the linear part,
18859 - * the fragments, and the frag list. It does NOT handle frag lists within
18860 - * the frag list, if such a thing exists. We'd probably need to recurse to
18861 - * handle that cleanly.
18862 - */
18863 -int skb_splice_bits(struct sk_buff *__skb, unsigned int offset,
18864 -                   struct pipe_inode_info *pipe, unsigned int tlen,
18865 -                   unsigned int flags)
18866 -{
18867 -       struct partial_page partial[PIPE_BUFFERS];
18868 -       struct page *pages[PIPE_BUFFERS];
18869 -       struct splice_pipe_desc spd = {
18870 -               .pages = pages,
18871 -               .partial = partial,
18872 -               .flags = flags,
18873 -               .ops = &sock_pipe_buf_ops,
18874 -               .spd_release = sock_spd_release,
18875 -       };
18876 -       struct sk_buff *skb;
18877 -
18878 -       /*
18879 -        * I'd love to avoid the clone here, but tcp_read_sock()
18880 -        * ignores reference counts and unconditonally kills the sk_buff
18881 -        * on return from the actor.
18882 -        */
18883 -       skb = skb_clone(__skb, GFP_KERNEL);
18884 -       if (unlikely(!skb))
18885 -               return -ENOMEM;
18886 -
18887 -       /*
18888 -        * __skb_splice_bits() only fails if the output has no room left,
18889 -        * so no point in going over the frag_list for the error case.
18890 -        */
18891 -       if (__skb_splice_bits(skb, &offset, &tlen, &spd))
18892 -               goto done;
18893 -       else if (!tlen)
18894 -               goto done;
18895 -
18896 -       /*
18897 -        * now see if we have a frag_list to map
18898 -        */
18899 -       if (skb_shinfo(skb)->frag_list) {
18900 -               struct sk_buff *list = skb_shinfo(skb)->frag_list;
18901 -
18902 -               for (; list && tlen; list = list->next) {
18903 -                       if (__skb_splice_bits(list, &offset, &tlen, &spd))
18904 -                               break;
18905 -               }
18906 -       }
18907 -
18908 -done:
18909 -       /*
18910 -        * drop our reference to the clone, the pipe consumption will
18911 -        * drop the rest.
18912 -        */
18913 -       kfree_skb(skb);
18914 -
18915 -       if (spd.nr_pages) {
18916 -               int ret;
18917 -               struct sock *sk = __skb->sk;
18918 -
18919 -               /*
18920 -                * Drop the socket lock, otherwise we have reverse
18921 -                * locking dependencies between sk_lock and i_mutex
18922 -                * here as compared to sendfile(). We enter here
18923 -                * with the socket lock held, and splice_to_pipe() will
18924 -                * grab the pipe inode lock. For sendfile() emulation,
18925 -                * we call into ->sendpage() with the i_mutex lock held
18926 -                * and networking will grab the socket lock.
18927 -                */
18928 -               release_sock(sk);
18929 -               ret = splice_to_pipe(pipe, &spd);
18930 -               lock_sock(sk);
18931 -               return ret;
18932 -       }
18933 -
18934 -       return 0;
18935 -}
18936 -
18937 -/**
18938 - *     skb_store_bits - store bits from kernel buffer to skb
18939 - *     @skb: destination buffer
18940 - *     @offset: offset in destination
18941 - *     @from: source buffer
18942 - *     @len: number of bytes to copy
18943 - *
18944 - *     Copy the specified number of bytes from the source buffer to the
18945 - *     destination skb.  This function handles all the messy bits of
18946 - *     traversing fragment lists and such.
18947 - */
18948 -
18949 -int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len)
18950 -{
18951 -       int i, copy;
18952 -       int start = skb_headlen(skb);
18953 -
18954 -       if (offset > (int)skb->len - len)
18955 -               goto fault;
18956 -
18957 -       if ((copy = start - offset) > 0) {
18958 -               if (copy > len)
18959 -                       copy = len;
18960 -               skb_copy_to_linear_data_offset(skb, offset, from, copy);
18961 -               if ((len -= copy) == 0)
18962 -                       return 0;
18963 -               offset += copy;
18964 -               from += copy;
18965 -       }
18966 -
18967 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
18968 -               skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
18969 -               int end;
18970 -
18971 -               WARN_ON(start > offset + len);
18972 -
18973 -               end = start + frag->size;
18974 -               if ((copy = end - offset) > 0) {
18975 -                       u8 *vaddr;
18976 -
18977 -                       if (copy > len)
18978 -                               copy = len;
18979 -
18980 -                       vaddr = kmap_skb_frag(frag);
18981 -                       memcpy(vaddr + frag->page_offset + offset - start,
18982 -                              from, copy);
18983 -                       kunmap_skb_frag(vaddr);
18984 -
18985 -                       if ((len -= copy) == 0)
18986 -                               return 0;
18987 -                       offset += copy;
18988 -                       from += copy;
18989 -               }
18990 -               start = end;
18991 -       }
18992 -
18993 -       if (skb_shinfo(skb)->frag_list) {
18994 -               struct sk_buff *list = skb_shinfo(skb)->frag_list;
18995 -
18996 -               for (; list; list = list->next) {
18997 -                       int end;
18998 -
18999 -                       WARN_ON(start > offset + len);
19000 -
19001 -                       end = start + list->len;
19002 -                       if ((copy = end - offset) > 0) {
19003 -                               if (copy > len)
19004 -                                       copy = len;
19005 -                               if (skb_store_bits(list, offset - start,
19006 -                                                  from, copy))
19007 -                                       goto fault;
19008 -                               if ((len -= copy) == 0)
19009 -                                       return 0;
19010 -                               offset += copy;
19011 -                               from += copy;
19012 -                       }
19013 -                       start = end;
19014 -               }
19015 -       }
19016 -       if (!len)
19017 -               return 0;
19018 -
19019 -fault:
19020 -       return -EFAULT;
19021 -}
19022 -
19023 -EXPORT_SYMBOL(skb_store_bits);
19024 -
19025 -/* Checksum skb data. */
19026 -
19027 -__wsum skb_checksum(const struct sk_buff *skb, int offset,
19028 -                         int len, __wsum csum)
19029 -{
19030 -       int start = skb_headlen(skb);
19031 -       int i, copy = start - offset;
19032 -       int pos = 0;
19033 -
19034 -       /* Checksum header. */
19035 -       if (copy > 0) {
19036 -               if (copy > len)
19037 -                       copy = len;
19038 -               csum = csum_partial(skb->data + offset, copy, csum);
19039 -               if ((len -= copy) == 0)
19040 -                       return csum;
19041 -               offset += copy;
19042 -               pos     = copy;
19043 -       }
19044 -
19045 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
19046 -               int end;
19047 -
19048 -               WARN_ON(start > offset + len);
19049 -
19050 -               end = start + skb_shinfo(skb)->frags[i].size;
19051 -               if ((copy = end - offset) > 0) {
19052 -                       __wsum csum2;
19053 -                       u8 *vaddr;
19054 -                       skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
19055 -
19056 -                       if (copy > len)
19057 -                               copy = len;
19058 -                       vaddr = kmap_skb_frag(frag);
19059 -                       csum2 = csum_partial(vaddr + frag->page_offset +
19060 -                                            offset - start, copy, 0);
19061 -                       kunmap_skb_frag(vaddr);
19062 -                       csum = csum_block_add(csum, csum2, pos);
19063 -                       if (!(len -= copy))
19064 -                               return csum;
19065 -                       offset += copy;
19066 -                       pos    += copy;
19067 -               }
19068 -               start = end;
19069 -       }
19070 -
19071 -       if (skb_shinfo(skb)->frag_list) {
19072 -               struct sk_buff *list = skb_shinfo(skb)->frag_list;
19073 -
19074 -               for (; list; list = list->next) {
19075 -                       int end;
19076 -
19077 -                       WARN_ON(start > offset + len);
19078 -
19079 -                       end = start + list->len;
19080 -                       if ((copy = end - offset) > 0) {
19081 -                               __wsum csum2;
19082 -                               if (copy > len)
19083 -                                       copy = len;
19084 -                               csum2 = skb_checksum(list, offset - start,
19085 -                                                    copy, 0);
19086 -                               csum = csum_block_add(csum, csum2, pos);
19087 -                               if ((len -= copy) == 0)
19088 -                                       return csum;
19089 -                               offset += copy;
19090 -                               pos    += copy;
19091 -                       }
19092 -                       start = end;
19093 -               }
19094 -       }
19095 -       BUG_ON(len);
19096 -
19097 -       return csum;
19098 -}
19099 -
19100 -/* Both of above in one bottle. */
19101 -
19102 -__wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
19103 -                                   u8 *to, int len, __wsum csum)
19104 -{
19105 -       int start = skb_headlen(skb);
19106 -       int i, copy = start - offset;
19107 -       int pos = 0;
19108 -
19109 -       /* Copy header. */
19110 -       if (copy > 0) {
19111 -               if (copy > len)
19112 -                       copy = len;
19113 -               csum = csum_partial_copy_nocheck(skb->data + offset, to,
19114 -                                                copy, csum);
19115 -               if ((len -= copy) == 0)
19116 -                       return csum;
19117 -               offset += copy;
19118 -               to     += copy;
19119 -               pos     = copy;
19120 -       }
19121 -
19122 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
19123 -               int end;
19124 -
19125 -               WARN_ON(start > offset + len);
19126 -
19127 -               end = start + skb_shinfo(skb)->frags[i].size;
19128 -               if ((copy = end - offset) > 0) {
19129 -                       __wsum csum2;
19130 -                       u8 *vaddr;
19131 -                       skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
19132 -
19133 -                       if (copy > len)
19134 -                               copy = len;
19135 -                       vaddr = kmap_skb_frag(frag);
19136 -                       csum2 = csum_partial_copy_nocheck(vaddr +
19137 -                                                         frag->page_offset +
19138 -                                                         offset - start, to,
19139 -                                                         copy, 0);
19140 -                       kunmap_skb_frag(vaddr);
19141 -                       csum = csum_block_add(csum, csum2, pos);
19142 -                       if (!(len -= copy))
19143 -                               return csum;
19144 -                       offset += copy;
19145 -                       to     += copy;
19146 -                       pos    += copy;
19147 -               }
19148 -               start = end;
19149 -       }
19150 -
19151 -       if (skb_shinfo(skb)->frag_list) {
19152 -               struct sk_buff *list = skb_shinfo(skb)->frag_list;
19153 -
19154 -               for (; list; list = list->next) {
19155 -                       __wsum csum2;
19156 -                       int end;
19157 -
19158 -                       WARN_ON(start > offset + len);
19159 -
19160 -                       end = start + list->len;
19161 -                       if ((copy = end - offset) > 0) {
19162 -                               if (copy > len)
19163 -                                       copy = len;
19164 -                               csum2 = skb_copy_and_csum_bits(list,
19165 -                                                              offset - start,
19166 -                                                              to, copy, 0);
19167 -                               csum = csum_block_add(csum, csum2, pos);
19168 -                               if ((len -= copy) == 0)
19169 -                                       return csum;
19170 -                               offset += copy;
19171 -                               to     += copy;
19172 -                               pos    += copy;
19173 -                       }
19174 -                       start = end;
19175 -               }
19176 -       }
19177 -       BUG_ON(len);
19178 -       return csum;
19179 -}
19180 -
19181 -void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
19182 -{
19183 -       __wsum csum;
19184 -       long csstart;
19185 -
19186 -       if (skb->ip_summed == CHECKSUM_PARTIAL)
19187 -               csstart = skb->csum_start - skb_headroom(skb);
19188 -       else
19189 -               csstart = skb_headlen(skb);
19190 -
19191 -       BUG_ON(csstart > skb_headlen(skb));
19192 -
19193 -       skb_copy_from_linear_data(skb, to, csstart);
19194 -
19195 -       csum = 0;
19196 -       if (csstart != skb->len)
19197 -               csum = skb_copy_and_csum_bits(skb, csstart, to + csstart,
19198 -                                             skb->len - csstart, 0);
19199 -
19200 -       if (skb->ip_summed == CHECKSUM_PARTIAL) {
19201 -               long csstuff = csstart + skb->csum_offset;
19202 -
19203 -               *((__sum16 *)(to + csstuff)) = csum_fold(csum);
19204 -       }
19205 -}
19206 -
19207 -/**
19208 - *     skb_dequeue - remove from the head of the queue
19209 - *     @list: list to dequeue from
19210 - *
19211 - *     Remove the head of the list. The list lock is taken so the function
19212 - *     may be used safely with other locking list functions. The head item is
19213 - *     returned or %NULL if the list is empty.
19214 - */
19215 -
19216 -struct sk_buff *skb_dequeue(struct sk_buff_head *list)
19217 -{
19218 -       unsigned long flags;
19219 -       struct sk_buff *result;
19220 -
19221 -       spin_lock_irqsave(&list->lock, flags);
19222 -       result = __skb_dequeue(list);
19223 -       spin_unlock_irqrestore(&list->lock, flags);
19224 -       return result;
19225 -}
19226 -
19227 -/**
19228 - *     skb_dequeue_tail - remove from the tail of the queue
19229 - *     @list: list to dequeue from
19230 - *
19231 - *     Remove the tail of the list. The list lock is taken so the function
19232 - *     may be used safely with other locking list functions. The tail item is
19233 - *     returned or %NULL if the list is empty.
19234 - */
19235 -struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list)
19236 -{
19237 -       unsigned long flags;
19238 -       struct sk_buff *result;
19239 -
19240 -       spin_lock_irqsave(&list->lock, flags);
19241 -       result = __skb_dequeue_tail(list);
19242 -       spin_unlock_irqrestore(&list->lock, flags);
19243 -       return result;
19244 -}
19245 -
19246 -/**
19247 - *     skb_queue_purge - empty a list
19248 - *     @list: list to empty
19249 - *
19250 - *     Delete all buffers on an &sk_buff list. Each buffer is removed from
19251 - *     the list and one reference dropped. This function takes the list
19252 - *     lock and is atomic with respect to other list locking functions.
19253 - */
19254 -void skb_queue_purge(struct sk_buff_head *list)
19255 -{
19256 -       struct sk_buff *skb;
19257 -       while ((skb = skb_dequeue(list)) != NULL)
19258 -               kfree_skb(skb);
19259 -}
19260 -
19261 -/**
19262 - *     skb_queue_head - queue a buffer at the list head
19263 - *     @list: list to use
19264 - *     @newsk: buffer to queue
19265 - *
19266 - *     Queue a buffer at the start of the list. This function takes the
19267 - *     list lock and can be used safely with other locking &sk_buff functions
19268 - *     safely.
19269 - *
19270 - *     A buffer cannot be placed on two lists at the same time.
19271 - */
19272 -void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk)
19273 -{
19274 -       unsigned long flags;
19275 -
19276 -       spin_lock_irqsave(&list->lock, flags);
19277 -       __skb_queue_head(list, newsk);
19278 -       spin_unlock_irqrestore(&list->lock, flags);
19279 -}
19280 -
19281 -/**
19282 - *     skb_queue_tail - queue a buffer at the list tail
19283 - *     @list: list to use
19284 - *     @newsk: buffer to queue
19285 - *
19286 - *     Queue a buffer at the tail of the list. This function takes the
19287 - *     list lock and can be used safely with other locking &sk_buff functions
19288 - *     safely.
19289 - *
19290 - *     A buffer cannot be placed on two lists at the same time.
19291 - */
19292 -void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk)
19293 -{
19294 -       unsigned long flags;
19295 -
19296 -       spin_lock_irqsave(&list->lock, flags);
19297 -       __skb_queue_tail(list, newsk);
19298 -       spin_unlock_irqrestore(&list->lock, flags);
19299 -}
19300 -
19301 -/**
19302 - *     skb_unlink      -       remove a buffer from a list
19303 - *     @skb: buffer to remove
19304 - *     @list: list to use
19305 - *
19306 - *     Remove a packet from a list. The list locks are taken and this
19307 - *     function is atomic with respect to other list locked calls
19308 - *
19309 - *     You must know what list the SKB is on.
19310 - */
19311 -void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
19312 -{
19313 -       unsigned long flags;
19314 -
19315 -       spin_lock_irqsave(&list->lock, flags);
19316 -       __skb_unlink(skb, list);
19317 -       spin_unlock_irqrestore(&list->lock, flags);
19318 -}
19319 -
19320 -/**
19321 - *     skb_append      -       append a buffer
19322 - *     @old: buffer to insert after
19323 - *     @newsk: buffer to insert
19324 - *     @list: list to use
19325 - *
19326 - *     Place a packet after a given packet in a list. The list locks are taken
19327 - *     and this function is atomic with respect to other list locked calls.
19328 - *     A buffer cannot be placed on two lists at the same time.
19329 - */
19330 -void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
19331 -{
19332 -       unsigned long flags;
19333 -
19334 -       spin_lock_irqsave(&list->lock, flags);
19335 -       __skb_queue_after(list, old, newsk);
19336 -       spin_unlock_irqrestore(&list->lock, flags);
19337 -}
19338 -
19339 -
19340 -/**
19341 - *     skb_insert      -       insert a buffer
19342 - *     @old: buffer to insert before
19343 - *     @newsk: buffer to insert
19344 - *     @list: list to use
19345 - *
19346 - *     Place a packet before a given packet in a list. The list locks are
19347 - *     taken and this function is atomic with respect to other list locked
19348 - *     calls.
19349 - *
19350 - *     A buffer cannot be placed on two lists at the same time.
19351 - */
19352 -void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
19353 -{
19354 -       unsigned long flags;
19355 -
19356 -       spin_lock_irqsave(&list->lock, flags);
19357 -       __skb_insert(newsk, old->prev, old, list);
19358 -       spin_unlock_irqrestore(&list->lock, flags);
19359 -}
19360 -
19361 -static inline void skb_split_inside_header(struct sk_buff *skb,
19362 -                                          struct sk_buff* skb1,
19363 -                                          const u32 len, const int pos)
19364 -{
19365 -       int i;
19366 -
19367 -       skb_copy_from_linear_data_offset(skb, len, skb_put(skb1, pos - len),
19368 -                                        pos - len);
19369 -       /* And move data appendix as is. */
19370 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
19371 -               skb_shinfo(skb1)->frags[i] = skb_shinfo(skb)->frags[i];
19372 -
19373 -       skb_shinfo(skb1)->nr_frags = skb_shinfo(skb)->nr_frags;
19374 -       skb_shinfo(skb)->nr_frags  = 0;
19375 -       skb1->data_len             = skb->data_len;
19376 -       skb1->len                  += skb1->data_len;
19377 -       skb->data_len              = 0;
19378 -       skb->len                   = len;
19379 -       skb_set_tail_pointer(skb, len);
19380 -}
19381 -
19382 -static inline void skb_split_no_header(struct sk_buff *skb,
19383 -                                      struct sk_buff* skb1,
19384 -                                      const u32 len, int pos)
19385 -{
19386 -       int i, k = 0;
19387 -       const int nfrags = skb_shinfo(skb)->nr_frags;
19388 -
19389 -       skb_shinfo(skb)->nr_frags = 0;
19390 -       skb1->len                 = skb1->data_len = skb->len - len;
19391 -       skb->len                  = len;
19392 -       skb->data_len             = len - pos;
19393 -
19394 -       for (i = 0; i < nfrags; i++) {
19395 -               int size = skb_shinfo(skb)->frags[i].size;
19396 -
19397 -               if (pos + size > len) {
19398 -                       skb_shinfo(skb1)->frags[k] = skb_shinfo(skb)->frags[i];
19399 -
19400 -                       if (pos < len) {
19401 -                               /* Split frag.
19402 -                                * We have two variants in this case:
19403 -                                * 1. Move all the frag to the second
19404 -                                *    part, if it is possible. F.e.
19405 -                                *    this approach is mandatory for TUX,
19406 -                                *    where splitting is expensive.
19407 -                                * 2. Split is accurately. We make this.
19408 -                                */
19409 -                               get_page(skb_shinfo(skb)->frags[i].page);
19410 -                               skb_shinfo(skb1)->frags[0].page_offset += len - pos;
19411 -                               skb_shinfo(skb1)->frags[0].size -= len - pos;
19412 -                               skb_shinfo(skb)->frags[i].size  = len - pos;
19413 -                               skb_shinfo(skb)->nr_frags++;
19414 -                       }
19415 -                       k++;
19416 -               } else
19417 -                       skb_shinfo(skb)->nr_frags++;
19418 -               pos += size;
19419 -       }
19420 -       skb_shinfo(skb1)->nr_frags = k;
19421 -}
19422 -
19423 -/**
19424 - * skb_split - Split fragmented skb to two parts at length len.
19425 - * @skb: the buffer to split
19426 - * @skb1: the buffer to receive the second part
19427 - * @len: new length for skb
19428 - */
19429 -void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len)
19430 -{
19431 -       int pos = skb_headlen(skb);
19432 -
19433 -       if (len < pos)  /* Split line is inside header. */
19434 -               skb_split_inside_header(skb, skb1, len, pos);
19435 -       else            /* Second chunk has no header, nothing to copy. */
19436 -               skb_split_no_header(skb, skb1, len, pos);
19437 -}
19438 -
19439 -/**
19440 - * skb_prepare_seq_read - Prepare a sequential read of skb data
19441 - * @skb: the buffer to read
19442 - * @from: lower offset of data to be read
19443 - * @to: upper offset of data to be read
19444 - * @st: state variable
19445 - *
19446 - * Initializes the specified state variable. Must be called before
19447 - * invoking skb_seq_read() for the first time.
19448 - */
19449 -void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
19450 -                         unsigned int to, struct skb_seq_state *st)
19451 -{
19452 -       st->lower_offset = from;
19453 -       st->upper_offset = to;
19454 -       st->root_skb = st->cur_skb = skb;
19455 -       st->frag_idx = st->stepped_offset = 0;
19456 -       st->frag_data = NULL;
19457 -}
19458 -
19459 -/**
19460 - * skb_seq_read - Sequentially read skb data
19461 - * @consumed: number of bytes consumed by the caller so far
19462 - * @data: destination pointer for data to be returned
19463 - * @st: state variable
19464 - *
19465 - * Reads a block of skb data at &consumed relative to the
19466 - * lower offset specified to skb_prepare_seq_read(). Assigns
19467 - * the head of the data block to &data and returns the length
19468 - * of the block or 0 if the end of the skb data or the upper
19469 - * offset has been reached.
19470 - *
19471 - * The caller is not required to consume all of the data
19472 - * returned, i.e. &consumed is typically set to the number
19473 - * of bytes already consumed and the next call to
19474 - * skb_seq_read() will return the remaining part of the block.
19475 - *
19476 - * Note 1: The size of each block of data returned can be arbitary,
19477 - *       this limitation is the cost for zerocopy seqeuental
19478 - *       reads of potentially non linear data.
19479 - *
19480 - * Note 2: Fragment lists within fragments are not implemented
19481 - *       at the moment, state->root_skb could be replaced with
19482 - *       a stack for this purpose.
19483 - */
19484 -unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
19485 -                         struct skb_seq_state *st)
19486 -{
19487 -       unsigned int block_limit, abs_offset = consumed + st->lower_offset;
19488 -       skb_frag_t *frag;
19489 -
19490 -       if (unlikely(abs_offset >= st->upper_offset))
19491 -               return 0;
19492 -
19493 -next_skb:
19494 -       block_limit = skb_headlen(st->cur_skb);
19495 -
19496 -       if (abs_offset < block_limit) {
19497 -               *data = st->cur_skb->data + abs_offset;
19498 -               return block_limit - abs_offset;
19499 -       }
19500 -
19501 -       if (st->frag_idx == 0 && !st->frag_data)
19502 -               st->stepped_offset += skb_headlen(st->cur_skb);
19503 -
19504 -       while (st->frag_idx < skb_shinfo(st->cur_skb)->nr_frags) {
19505 -               frag = &skb_shinfo(st->cur_skb)->frags[st->frag_idx];
19506 -               block_limit = frag->size + st->stepped_offset;
19507 -
19508 -               if (abs_offset < block_limit) {
19509 -                       if (!st->frag_data)
19510 -                               st->frag_data = kmap_skb_frag(frag);
19511 -
19512 -                       *data = (u8 *) st->frag_data + frag->page_offset +
19513 -                               (abs_offset - st->stepped_offset);
19514 -
19515 -                       return block_limit - abs_offset;
19516 -               }
19517 -
19518 -               if (st->frag_data) {
19519 -                       kunmap_skb_frag(st->frag_data);
19520 -                       st->frag_data = NULL;
19521 -               }
19522 -
19523 -               st->frag_idx++;
19524 -               st->stepped_offset += frag->size;
19525 -       }
19526 -
19527 -       if (st->frag_data) {
19528 -               kunmap_skb_frag(st->frag_data);
19529 -               st->frag_data = NULL;
19530 -       }
19531 -
19532 -       if (st->cur_skb->next) {
19533 -               st->cur_skb = st->cur_skb->next;
19534 -               st->frag_idx = 0;
19535 -               goto next_skb;
19536 -       } else if (st->root_skb == st->cur_skb &&
19537 -                  skb_shinfo(st->root_skb)->frag_list) {
19538 -               st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
19539 -               goto next_skb;
19540 -       }
19541 -
19542 -       return 0;
19543 -}
19544 -
19545 -/**
19546 - * skb_abort_seq_read - Abort a sequential read of skb data
19547 - * @st: state variable
19548 - *
19549 - * Must be called if skb_seq_read() was not called until it
19550 - * returned 0.
19551 - */
19552 -void skb_abort_seq_read(struct skb_seq_state *st)
19553 -{
19554 -       if (st->frag_data)
19555 -               kunmap_skb_frag(st->frag_data);
19556 -}
19557 -
19558 -#define TS_SKB_CB(state)       ((struct skb_seq_state *) &((state)->cb))
19559 -
19560 -static unsigned int skb_ts_get_next_block(unsigned int offset, const u8 **text,
19561 -                                         struct ts_config *conf,
19562 -                                         struct ts_state *state)
19563 -{
19564 -       return skb_seq_read(offset, text, TS_SKB_CB(state));
19565 -}
19566 -
19567 -static void skb_ts_finish(struct ts_config *conf, struct ts_state *state)
19568 -{
19569 -       skb_abort_seq_read(TS_SKB_CB(state));
19570 -}
19571 -
19572 -/**
19573 - * skb_find_text - Find a text pattern in skb data
19574 - * @skb: the buffer to look in
19575 - * @from: search offset
19576 - * @to: search limit
19577 - * @config: textsearch configuration
19578 - * @state: uninitialized textsearch state variable
19579 - *
19580 - * Finds a pattern in the skb data according to the specified
19581 - * textsearch configuration. Use textsearch_next() to retrieve
19582 - * subsequent occurrences of the pattern. Returns the offset
19583 - * to the first occurrence or UINT_MAX if no match was found.
19584 - */
19585 -unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
19586 -                          unsigned int to, struct ts_config *config,
19587 -                          struct ts_state *state)
19588 -{
19589 -       unsigned int ret;
19590 -
19591 -       config->get_next_block = skb_ts_get_next_block;
19592 -       config->finish = skb_ts_finish;
19593 -
19594 -       skb_prepare_seq_read(skb, from, to, TS_SKB_CB(state));
19595 -
19596 -       ret = textsearch_find(config, state);
19597 -       return (ret <= to - from ? ret : UINT_MAX);
19598 -}
19599 -
19600 -/**
19601 - * skb_append_datato_frags: - append the user data to a skb
19602 - * @sk: sock  structure
19603 - * @skb: skb structure to be appened with user data.
19604 - * @getfrag: call back function to be used for getting the user data
19605 - * @from: pointer to user message iov
19606 - * @length: length of the iov message
19607 - *
19608 - * Description: This procedure append the user data in the fragment part
19609 - * of the skb if any page alloc fails user this procedure returns  -ENOMEM
19610 - */
19611 -int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
19612 -                       int (*getfrag)(void *from, char *to, int offset,
19613 -                                       int len, int odd, struct sk_buff *skb),
19614 -                       void *from, int length)
19615 -{
19616 -       int frg_cnt = 0;
19617 -       skb_frag_t *frag = NULL;
19618 -       struct page *page = NULL;
19619 -       int copy, left;
19620 -       int offset = 0;
19621 -       int ret;
19622 -
19623 -       do {
19624 -               /* Return error if we don't have space for new frag */
19625 -               frg_cnt = skb_shinfo(skb)->nr_frags;
19626 -               if (frg_cnt >= MAX_SKB_FRAGS)
19627 -                       return -EFAULT;
19628 -
19629 -               /* allocate a new page for next frag */
19630 -               page = alloc_pages(sk->sk_allocation, 0);
19631 -
19632 -               /* If alloc_page fails just return failure and caller will
19633 -                * free previous allocated pages by doing kfree_skb()
19634 -                */
19635 -               if (page == NULL)
19636 -                       return -ENOMEM;
19637 -
19638 -               /* initialize the next frag */
19639 -               sk->sk_sndmsg_page = page;
19640 -               sk->sk_sndmsg_off = 0;
19641 -               skb_fill_page_desc(skb, frg_cnt, page, 0, 0);
19642 -               skb->truesize += PAGE_SIZE;
19643 -               atomic_add(PAGE_SIZE, &sk->sk_wmem_alloc);
19644 -
19645 -               /* get the new initialized frag */
19646 -               frg_cnt = skb_shinfo(skb)->nr_frags;
19647 -               frag = &skb_shinfo(skb)->frags[frg_cnt - 1];
19648 -
19649 -               /* copy the user data to page */
19650 -               left = PAGE_SIZE - frag->page_offset;
19651 -               copy = (length > left)? left : length;
19652 -
19653 -               ret = getfrag(from, (page_address(frag->page) +
19654 -                           frag->page_offset + frag->size),
19655 -                           offset, copy, 0, skb);
19656 -               if (ret < 0)
19657 -                       return -EFAULT;
19658 -
19659 -               /* copy was successful so update the size parameters */
19660 -               sk->sk_sndmsg_off += copy;
19661 -               frag->size += copy;
19662 -               skb->len += copy;
19663 -               skb->data_len += copy;
19664 -               offset += copy;
19665 -               length -= copy;
19666 -
19667 -       } while (length > 0);
19668 -
19669 -       return 0;
19670 -}
19671 -
19672 -/**
19673 - *     skb_pull_rcsum - pull skb and update receive checksum
19674 - *     @skb: buffer to update
19675 - *     @len: length of data pulled
19676 - *
19677 - *     This function performs an skb_pull on the packet and updates
19678 - *     the CHECKSUM_COMPLETE checksum.  It should be used on
19679 - *     receive path processing instead of skb_pull unless you know
19680 - *     that the checksum difference is zero (e.g., a valid IP header)
19681 - *     or you are setting ip_summed to CHECKSUM_NONE.
19682 - */
19683 -unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len)
19684 -{
19685 -       BUG_ON(len > skb->len);
19686 -       skb->len -= len;
19687 -       BUG_ON(skb->len < skb->data_len);
19688 -       skb_postpull_rcsum(skb, skb->data, len);
19689 -       return skb->data += len;
19690 -}
19691 -
19692 -EXPORT_SYMBOL_GPL(skb_pull_rcsum);
19693 -
19694 -/**
19695 - *     skb_segment - Perform protocol segmentation on skb.
19696 - *     @skb: buffer to segment
19697 - *     @features: features for the output path (see dev->features)
19698 - *
19699 - *     This function performs segmentation on the given skb.  It returns
19700 - *     a pointer to the first in a list of new skbs for the segments.
19701 - *     In case of error it returns ERR_PTR(err).
19702 - */
19703 -struct sk_buff *skb_segment(struct sk_buff *skb, int features)
19704 -{
19705 -       struct sk_buff *segs = NULL;
19706 -       struct sk_buff *tail = NULL;
19707 -       unsigned int mss = skb_shinfo(skb)->gso_size;
19708 -       unsigned int doffset = skb->data - skb_mac_header(skb);
19709 -       unsigned int offset = doffset;
19710 -       unsigned int headroom;
19711 -       unsigned int len;
19712 -       int sg = features & NETIF_F_SG;
19713 -       int nfrags = skb_shinfo(skb)->nr_frags;
19714 -       int err = -ENOMEM;
19715 -       int i = 0;
19716 -       int pos;
19717 -
19718 -       __skb_push(skb, doffset);
19719 -       headroom = skb_headroom(skb);
19720 -       pos = skb_headlen(skb);
19721 -
19722 -       do {
19723 -               struct sk_buff *nskb;
19724 -               skb_frag_t *frag;
19725 -               int hsize;
19726 -               int k;
19727 -               int size;
19728 -
19729 -               len = skb->len - offset;
19730 -               if (len > mss)
19731 -                       len = mss;
19732 -
19733 -               hsize = skb_headlen(skb) - offset;
19734 -               if (hsize < 0)
19735 -                       hsize = 0;
19736 -               if (hsize > len || !sg)
19737 -                       hsize = len;
19738 -
19739 -               nskb = alloc_skb(hsize + doffset + headroom, GFP_ATOMIC);
19740 -               if (unlikely(!nskb))
19741 -                       goto err;
19742 -
19743 -               if (segs)
19744 -                       tail->next = nskb;
19745 -               else
19746 -                       segs = nskb;
19747 -               tail = nskb;
19748 -
19749 -               __copy_skb_header(nskb, skb);
19750 -               nskb->mac_len = skb->mac_len;
19751 -
19752 -               skb_reserve(nskb, headroom);
19753 -               skb_reset_mac_header(nskb);
19754 -               skb_set_network_header(nskb, skb->mac_len);
19755 -               nskb->transport_header = (nskb->network_header +
19756 -                                         skb_network_header_len(skb));
19757 -               skb_copy_from_linear_data(skb, skb_put(nskb, doffset),
19758 -                                         doffset);
19759 -               if (!sg) {
19760 -                       nskb->ip_summed = CHECKSUM_NONE;
19761 -                       nskb->csum = skb_copy_and_csum_bits(skb, offset,
19762 -                                                           skb_put(nskb, len),
19763 -                                                           len, 0);
19764 -                       continue;
19765 -               }
19766 -
19767 -               frag = skb_shinfo(nskb)->frags;
19768 -               k = 0;
19769 -
19770 -               skb_copy_from_linear_data_offset(skb, offset,
19771 -                                                skb_put(nskb, hsize), hsize);
19772 -
19773 -               while (pos < offset + len) {
19774 -                       BUG_ON(i >= nfrags);
19775 -
19776 -                       *frag = skb_shinfo(skb)->frags[i];
19777 -                       get_page(frag->page);
19778 -                       size = frag->size;
19779 -
19780 -                       if (pos < offset) {
19781 -                               frag->page_offset += offset - pos;
19782 -                               frag->size -= offset - pos;
19783 -                       }
19784 -
19785 -                       k++;
19786 -
19787 -                       if (pos + size <= offset + len) {
19788 -                               i++;
19789 -                               pos += size;
19790 -                       } else {
19791 -                               frag->size -= pos + size - (offset + len);
19792 -                               break;
19793 -                       }
19794 -
19795 -                       frag++;
19796 -               }
19797 -
19798 -               skb_shinfo(nskb)->nr_frags = k;
19799 -               nskb->data_len = len - hsize;
19800 -               nskb->len += nskb->data_len;
19801 -               nskb->truesize += nskb->data_len;
19802 -       } while ((offset += len) < skb->len);
19803 -
19804 -       return segs;
19805 -
19806 -err:
19807 -       while ((skb = segs)) {
19808 -               segs = skb->next;
19809 -               kfree_skb(skb);
19810 -       }
19811 -       return ERR_PTR(err);
19812 -}
19813 -
19814 -EXPORT_SYMBOL_GPL(skb_segment);
19815 -
19816 -void __init skb_init(void)
19817 -{
19818 -       skbuff_head_cache = kmem_cache_create("skbuff_head_cache",
19819 -                                             sizeof(struct sk_buff),
19820 -                                             0,
19821 -                                             SLAB_HWCACHE_ALIGN|SLAB_PANIC,
19822 -                                             NULL);
19823 -       skbuff_fclone_cache = kmem_cache_create("skbuff_fclone_cache",
19824 -                                               (2*sizeof(struct sk_buff)) +
19825 -                                               sizeof(atomic_t),
19826 -                                               0,
19827 -                                               SLAB_HWCACHE_ALIGN|SLAB_PANIC,
19828 -                                               NULL);
19829 -}
19830 -
19831 -/**
19832 - *     skb_to_sgvec - Fill a scatter-gather list from a socket buffer
19833 - *     @skb: Socket buffer containing the buffers to be mapped
19834 - *     @sg: The scatter-gather list to map into
19835 - *     @offset: The offset into the buffer's contents to start mapping
19836 - *     @len: Length of buffer space to be mapped
19837 - *
19838 - *     Fill the specified scatter-gather list with mappings/pointers into a
19839 - *     region of the buffer space attached to a socket buffer.
19840 - */
19841 -static int
19842 -__skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
19843 -{
19844 -       int start = skb_headlen(skb);
19845 -       int i, copy = start - offset;
19846 -       int elt = 0;
19847 -
19848 -       if (copy > 0) {
19849 -               if (copy > len)
19850 -                       copy = len;
19851 -               sg_set_buf(sg, skb->data + offset, copy);
19852 -               elt++;
19853 -               if ((len -= copy) == 0)
19854 -                       return elt;
19855 -               offset += copy;
19856 -       }
19857 -
19858 -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
19859 -               int end;
19860 -
19861 -               WARN_ON(start > offset + len);
19862 -
19863 -               end = start + skb_shinfo(skb)->frags[i].size;
19864 -               if ((copy = end - offset) > 0) {
19865 -                       skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
19866 -
19867 -                       if (copy > len)
19868 -                               copy = len;
19869 -                       sg_set_page(&sg[elt], frag->page, copy,
19870 -                                       frag->page_offset+offset-start);
19871 -                       elt++;
19872 -                       if (!(len -= copy))
19873 -                               return elt;
19874 -                       offset += copy;
19875 -               }
19876 -               start = end;
19877 -       }
19878 -
19879 -       if (skb_shinfo(skb)->frag_list) {
19880 -               struct sk_buff *list = skb_shinfo(skb)->frag_list;
19881 -
19882 -               for (; list; list = list->next) {
19883 -                       int end;
19884 -
19885 -                       WARN_ON(start > offset + len);
19886 -
19887 -                       end = start + list->len;
19888 -                       if ((copy = end - offset) > 0) {
19889 -                               if (copy > len)
19890 -                                       copy = len;
19891 -                               elt += __skb_to_sgvec(list, sg+elt, offset - start,
19892 -                                                     copy);
19893 -                               if ((len -= copy) == 0)
19894 -                                       return elt;
19895 -                               offset += copy;
19896 -                       }
19897 -                       start = end;
19898 -               }
19899 -       }
19900 -       BUG_ON(len);
19901 -       return elt;
19902 -}
19903 -
19904 -int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
19905 -{
19906 -       int nsg = __skb_to_sgvec(skb, sg, offset, len);
19907 -
19908 -       sg_mark_end(&sg[nsg - 1]);
19909 -
19910 -       return nsg;
19911 -}
19912 -
19913 -/**
19914 - *     skb_cow_data - Check that a socket buffer's data buffers are writable
19915 - *     @skb: The socket buffer to check.
19916 - *     @tailbits: Amount of trailing space to be added
19917 - *     @trailer: Returned pointer to the skb where the @tailbits space begins
19918 - *
19919 - *     Make sure that the data buffers attached to a socket buffer are
19920 - *     writable. If they are not, private copies are made of the data buffers
19921 - *     and the socket buffer is set to use these instead.
19922 - *
19923 - *     If @tailbits is given, make sure that there is space to write @tailbits
19924 - *     bytes of data beyond current end of socket buffer.  @trailer will be
19925 - *     set to point to the skb in which this space begins.
19926 - *
19927 - *     The number of scatterlist elements required to completely map the
19928 - *     COW'd and extended socket buffer will be returned.
19929 - */
19930 -int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
19931 -{
19932 -       int copyflag;
19933 -       int elt;
19934 -       struct sk_buff *skb1, **skb_p;
19935 -
19936 -       /* If skb is cloned or its head is paged, reallocate
19937 -        * head pulling out all the pages (pages are considered not writable
19938 -        * at the moment even if they are anonymous).
19939 -        */
19940 -       if ((skb_cloned(skb) || skb_shinfo(skb)->nr_frags) &&
19941 -           __pskb_pull_tail(skb, skb_pagelen(skb)-skb_headlen(skb)) == NULL)
19942 -               return -ENOMEM;
19943 -
19944 -       /* Easy case. Most of packets will go this way. */
19945 -       if (!skb_shinfo(skb)->frag_list) {
19946 -               /* A little of trouble, not enough of space for trailer.
19947 -                * This should not happen, when stack is tuned to generate
19948 -                * good frames. OK, on miss we reallocate and reserve even more
19949 -                * space, 128 bytes is fair. */
19950 -
19951 -               if (skb_tailroom(skb) < tailbits &&
19952 -                   pskb_expand_head(skb, 0, tailbits-skb_tailroom(skb)+128, GFP_ATOMIC))
19953 -                       return -ENOMEM;
19954 -
19955 -               /* Voila! */
19956 -               *trailer = skb;
19957 -               return 1;
19958 -       }
19959 -
19960 -       /* Misery. We are in troubles, going to mincer fragments... */
19961 -
19962 -       elt = 1;
19963 -       skb_p = &skb_shinfo(skb)->frag_list;
19964 -       copyflag = 0;
19965 -
19966 -       while ((skb1 = *skb_p) != NULL) {
19967 -               int ntail = 0;
19968 -
19969 -               /* The fragment is partially pulled by someone,
19970 -                * this can happen on input. Copy it and everything
19971 -                * after it. */
19972 -
19973 -               if (skb_shared(skb1))
19974 -                       copyflag = 1;
19975 -
19976 -               /* If the skb is the last, worry about trailer. */
19977 -
19978 -               if (skb1->next == NULL && tailbits) {
19979 -                       if (skb_shinfo(skb1)->nr_frags ||
19980 -                           skb_shinfo(skb1)->frag_list ||
19981 -                           skb_tailroom(skb1) < tailbits)
19982 -                               ntail = tailbits + 128;
19983 -               }
19984 -
19985 -               if (copyflag ||
19986 -                   skb_cloned(skb1) ||
19987 -                   ntail ||
19988 -                   skb_shinfo(skb1)->nr_frags ||
19989 -                   skb_shinfo(skb1)->frag_list) {
19990 -                       struct sk_buff *skb2;
19991 -
19992 -                       /* Fuck, we are miserable poor guys... */
19993 -                       if (ntail == 0)
19994 -                               skb2 = skb_copy(skb1, GFP_ATOMIC);
19995 -                       else
19996 -                               skb2 = skb_copy_expand(skb1,
19997 -                                                      skb_headroom(skb1),
19998 -                                                      ntail,
19999 -                                                      GFP_ATOMIC);
20000 -                       if (unlikely(skb2 == NULL))
20001 -                               return -ENOMEM;
20002 -
20003 -                       if (skb1->sk)
20004 -                               skb_set_owner_w(skb2, skb1->sk);
20005 -
20006 -                       /* Looking around. Are we still alive?
20007 -                        * OK, link new skb, drop old one */
20008 -
20009 -                       skb2->next = skb1->next;
20010 -                       *skb_p = skb2;
20011 -                       kfree_skb(skb1);
20012 -                       skb1 = skb2;
20013 -               }
20014 -               elt++;
20015 -               *trailer = skb1;
20016 -               skb_p = &skb1->next;
20017 -       }
20018 -
20019 -       return elt;
20020 -}
20021 -
20022 -/**
20023 - * skb_partial_csum_set - set up and verify partial csum values for packet
20024 - * @skb: the skb to set
20025 - * @start: the number of bytes after skb->data to start checksumming.
20026 - * @off: the offset from start to place the checksum.
20027 - *
20028 - * For untrusted partially-checksummed packets, we need to make sure the values
20029 - * for skb->csum_start and skb->csum_offset are valid so we don't oops.
20030 - *
20031 - * This function checks and sets those values and skb->ip_summed: if this
20032 - * returns false you should drop the packet.
20033 - */
20034 -bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)
20035 -{
20036 -       if (unlikely(start > skb->len - 2) ||
20037 -           unlikely((int)start + off > skb->len - 2)) {
20038 -               if (net_ratelimit())
20039 -                       printk(KERN_WARNING
20040 -                              "bad partial csum: csum=%u/%u len=%u\n",
20041 -                              start, off, skb->len);
20042 -               return false;
20043 -       }
20044 -       skb->ip_summed = CHECKSUM_PARTIAL;
20045 -       skb->csum_start = skb_headroom(skb) + start;
20046 -       skb->csum_offset = off;
20047 -       return true;
20048 -}
20049 -
20050 -void __skb_warn_lro_forwarding(const struct sk_buff *skb)
20051 -{
20052 -       if (net_ratelimit())
20053 -               pr_warning("%s: received packets cannot be forwarded"
20054 -                          " while LRO is enabled\n", skb->dev->name);
20055 -}
20056 -
20057 -EXPORT_SYMBOL(___pskb_trim);
20058 -EXPORT_SYMBOL(__kfree_skb);
20059 -EXPORT_SYMBOL(kfree_skb);
20060 -EXPORT_SYMBOL(__pskb_pull_tail);
20061 -EXPORT_SYMBOL(__alloc_skb);
20062 -EXPORT_SYMBOL(__netdev_alloc_skb);
20063 -EXPORT_SYMBOL(pskb_copy);
20064 -EXPORT_SYMBOL(pskb_expand_head);
20065 -EXPORT_SYMBOL(skb_checksum);
20066 -EXPORT_SYMBOL(skb_clone);
20067 -EXPORT_SYMBOL(skb_copy);
20068 -EXPORT_SYMBOL(skb_copy_and_csum_bits);
20069 -EXPORT_SYMBOL(skb_copy_and_csum_dev);
20070 -EXPORT_SYMBOL(skb_copy_bits);
20071 -EXPORT_SYMBOL(skb_copy_expand);
20072 -EXPORT_SYMBOL(skb_over_panic);
20073 -EXPORT_SYMBOL(skb_pad);
20074 -EXPORT_SYMBOL(skb_realloc_headroom);
20075 -EXPORT_SYMBOL(skb_under_panic);
20076 -EXPORT_SYMBOL(skb_dequeue);
20077 -EXPORT_SYMBOL(skb_dequeue_tail);
20078 -EXPORT_SYMBOL(skb_insert);
20079 -EXPORT_SYMBOL(skb_queue_purge);
20080 -EXPORT_SYMBOL(skb_queue_head);
20081 -EXPORT_SYMBOL(skb_queue_tail);
20082 -EXPORT_SYMBOL(skb_unlink);
20083 -EXPORT_SYMBOL(skb_append);
20084 -EXPORT_SYMBOL(skb_split);
20085 -EXPORT_SYMBOL(skb_prepare_seq_read);
20086 -EXPORT_SYMBOL(skb_seq_read);
20087 -EXPORT_SYMBOL(skb_abort_seq_read);
20088 -EXPORT_SYMBOL(skb_find_text);
20089 -EXPORT_SYMBOL(skb_append_datato_frags);
20090 -EXPORT_SYMBOL(__skb_warn_lro_forwarding);
20091 -
20092 -EXPORT_SYMBOL_GPL(skb_to_sgvec);
20093 -EXPORT_SYMBOL_GPL(skb_cow_data);
20094 -EXPORT_SYMBOL_GPL(skb_partial_csum_set);
20095 diff -Nurb linux-2.6.27-720/net/ipv4/arp.c linux-2.6.27-710/net/ipv4/arp.c
20096 --- linux-2.6.27-720/net/ipv4/arp.c     2009-05-04 12:18:34.000000000 -0400
20097 +++ linux-2.6.27-710/net/ipv4/arp.c     2008-10-09 18:13:53.000000000 -0400
20098 @@ -328,7 +328,6 @@
20099  {
20100         __be32 saddr = 0;
20101         u8  *dst_ha = NULL;
20102 -       u8  dst_ha_buf[MAX_ADDR_LEN+sizeof(unsigned long)];
20103         struct net_device *dev = neigh->dev;
20104         __be32 target = *(__be32*)neigh->primary_key;
20105         int probes = atomic_read(&neigh->probes);
20106 @@ -366,8 +365,8 @@
20107         if ((probes -= neigh->parms->ucast_probes) < 0) {
20108                 if (!(neigh->nud_state&NUD_VALID))
20109                         printk(KERN_DEBUG "trying to ucast probe in NUD_INVALID\n");
20110 -               memcpy(dst_ha_buf, neigh->ha, sizeof(neigh->ha));
20111 -               dst_ha = dst_ha_buf;
20112 +               dst_ha = neigh->ha;
20113 +               read_lock_bh(&neigh->lock);
20114         } else if ((probes -= neigh->parms->app_probes) < 0) {
20115  #ifdef CONFIG_ARPD
20116                 neigh_app_ns(neigh);
20117 @@ -377,6 +376,8 @@
20118  
20119         arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
20120                  dst_ha, dev->dev_addr, NULL);
20121 +       if (dst_ha)
20122 +               read_unlock_bh(&neigh->lock);
20123  }
20124  
20125  static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
20126 diff -Nurb linux-2.6.27-720/net/ipv4/devinet.c linux-2.6.27-710/net/ipv4/devinet.c
20127 --- linux-2.6.27-720/net/ipv4/devinet.c 2009-05-04 12:18:34.000000000 -0400
20128 +++ linux-2.6.27-710/net/ipv4/devinet.c 2009-05-04 12:15:14.000000000 -0400
20129 @@ -1687,4 +1687,3 @@
20130  EXPORT_SYMBOL(inetdev_by_index);
20131  EXPORT_SYMBOL(register_inetaddr_notifier);
20132  EXPORT_SYMBOL(unregister_inetaddr_notifier);
20133 -EXPORT_SYMBOL(devinet_ioctl);
20134 diff -Nurb linux-2.6.27-720/scr linux-2.6.27-710/scr
20135 --- linux-2.6.27-720/scr        2009-05-04 12:18:34.000000000 -0400
20136 +++ linux-2.6.27-710/scr        1969-12-31 19:00:00.000000000 -0500
20137 @@ -1,29 +0,0 @@
20138 -vi -o ./include/asm-um/elf-x86_64.h ./include/asm-um/elf-x86_64.h.rej
20139 -vi -o ./include/asm-frv/tlbflush.h ./include/asm-frv/tlbflush.h.rej
20140 -vi -o ./include/asm-frv/pgtable.h ./include/asm-frv/pgtable.h.rej
20141 -vi -o ./include/asm-xtensa/pgalloc.h ./include/asm-xtensa/pgalloc.h.rej
20142 -vi -o ./include/asm-xtensa/pgtable.h ./include/asm-xtensa/pgtable.h.rej
20143 -vi -o ./include/asm-xtensa/module.h ./include/asm-xtensa/module.h.rej
20144 -vi -o ./include/asm-xtensa/system.h ./include/asm-xtensa/system.h.rej
20145 -vi -o ./include/asm-xtensa/timex.h ./include/asm-xtensa/timex.h.rej
20146 -vi -o ./include/net/sock.h ./include/net/sock.h.rej
20147 -vi -o ./include/net/compat.h ./include/net/compat.h.rej
20148 -vi -o ./include/asm-mips/fpu.h ./include/asm-mips/fpu.h.rej
20149 -vi -o ./include/asm-mips/time.h ./include/asm-mips/time.h.rej
20150 -vi -o ./include/asm-mips/irq.h ./include/asm-mips/irq.h.rej
20151 -vi -o ./include/asm-mips/system.h ./include/asm-mips/system.h.rej
20152 -vi -o ./include/linux/lockdep.h ./include/linux/lockdep.h.rej
20153 -vi -o ./include/linux/ktime.h ./include/linux/ktime.h.rej
20154 -vi -o ./include/linux/textsearch.h ./include/linux/textsearch.h.rej
20155 -vi -o ./include/linux/backing-dev.h ./include/linux/backing-dev.h.rej
20156 -vi -o ./include/linux/kexec.h ./include/linux/kexec.h.rej
20157 -vi -o ./include/linux/sysctl.h ./include/linux/sysctl.h.rej
20158 -vi -o ./include/linux/netdevice.h ./include/linux/netdevice.h.rej
20159 -vi -o ./include/linux/spinlock_types_up.h ./include/linux/spinlock_types_up.h.rej
20160 -vi -o ./include/linux/list.h ./include/linux/list.h.rej
20161 -vi -o ./include/asm-m68k/module.h ./include/asm-m68k/module.h.rej
20162 -vi -o ./net/core/dev.c ./net/core/dev.c.rej
20163 -vi -o ./net/core/skbuff.c ./net/core/skbuff.c.rej
20164 -vi -o ./net/core/neighbour.c ./net/core/neighbour.c.rej
20165 -vi -o ./drivers/media/dvb/bt8xx/bt878.h ./drivers/media/dvb/bt8xx/bt878.h.rej
20166 -vi -o ./drivers/net/ibmveth.c ./drivers/net/ibmveth.c.rej