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
5 asm volatile("lis 7,0xff88 \n\
8 - : "=r" (kbd_data) : : "6", "7");
9 + : "=r" (kbd_data) :: "6", "7");
11 __raw_writel(0x00000000, 0xff50000c);
17 - : "=r" (kbd_status) : : "6", "7");
18 + : "=r" (kbd_status) :: "6", "7");
20 __raw_writel(0x00000000, 0xff50000c);
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
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 {
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
41 static inline void flush_cache(void)
43 - asm volatile ("wbinvd": : :"memory");
44 + asm volatile ("wbinvd":::"memory");
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
52 /* public. Not pretty! */
53 __cacheline_aligned_in_smp DEFINE_SPINLOCK(files_lock);
55 -EXPORT_SYMBOL(files_lock);
57 static struct percpu_counter nr_files __cacheline_aligned_in_smp;
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
64 LIST_HEAD(super_blocks);
65 DEFINE_SPINLOCK(sb_lock);
67 -EXPORT_SYMBOL(sb_lock);
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
76 ({ int _Foofoo; __asm__ volatile ("bmod [%0],%0" : "=r" (_Foofoo) : "0" \
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
90 #ifndef _ASM_CRIS_MODULE_H
91 #define _ASM_CRIS_MODULE_H
93 -EMPTY_STRUCT_DECL(mod_arch_specific);
94 +struct mod_arch_specific { };
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
103 * Tell the user there is some problem.
105 -asmlinkage void __debug_bug_trap(int signr);
106 +extern asmlinkage void __debug_bug_trap(int signr);
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
114 * MAX floating point unit state size (FSAVE/FRESTORE)
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)
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
125 extern void gdbstub_tx_flush(void);
126 extern void gdbstub_do_rx(void);
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);
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);
141 +extern asmlinkage void gdbstub_rx_handler(void);
142 +extern asmlinkage void gdbstub_rx_irq(void);
143 +extern asmlinkage void gdbstub_intercept(void);
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
151 dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \
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"); \
157 asm volatile("movgs %0,iampr"#ampr"\n" \
158 "movgs %0,dampr"#ampr"\n" \
159 - : : "r"(dampr) : "memory" \
160 + :: "r"(dampr) : "memory" \
163 asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \
166 #define __kunmap_atomic_primary(type, ampr) \
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"); \
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
180 #ifndef _ASM_MODULE_H
181 #define _ASM_MODULE_H
183 -EMPTY_STRUCT_DECL(mod_arch_specific);
184 +struct mod_arch_specific
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
194 #define set_pte(pteptr, pteval) \
196 *(pteptr) = (pteval); \
197 - asm volatile("dcf %M0" : : "U"(*pteptr)); \
198 + asm volatile("dcf %M0" :: "U"(*pteptr)); \
200 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
203 #define set_pgd(pgdptr, pgdval) \
205 memcpy((pgdptr), &(pgdval), sizeof(pgd_t)); \
206 - asm volatile("dcf %M0" : : "U"(*(pgdptr))); \
207 + asm volatile("dcf %M0" :: "U"(*(pgdptr))); \
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
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, ...);
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
232 #define restore_dampr(R, _dampr) \
234 - asm volatile("movgs %0,dampr"R : : "r"(_dampr)); \
235 + asm volatile("movgs %0,dampr"R :: "r"(_dampr)); \
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
243 * `prev' will never be the same as `next'.
244 * The `mb' is to tell GCC not to cache `current' across this call.
248 struct task_struct *__switch_to(struct thread_struct *prev_thread,
249 struct thread_struct *next_thread,
250 struct task_struct *prev);
253 * Force strict CPU ordering.
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
264 #ifndef _ASM_M32R_MODULE_H
265 #define _ASM_M32R_MODULE_H
267 -EMPTY_STRUCT_DECL(mod_arch_specific);
268 +struct mod_arch_specific { };
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
278 static inline unsigned long __cmpxchg(volatile void *p, unsigned long old,
279 - unsigned long n, int size)
280 + unsigned long new, int size)
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));
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));
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));
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
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);
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);
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
326 volatile type *__mem; \
329 - __mem = (type *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
330 + __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
332 __val = pfx##ioswab##bwlq(__mem, val); \
335 volatile type *__mem; \
338 - __mem = (type *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
339 + __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
341 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
344 volatile type *__addr; \
347 - __addr = (type *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
348 + __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
350 __val = pfx##ioswab##bwlq(__addr, val); \
353 volatile type *__addr; \
356 - __addr = (type *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
357 + __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
359 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
362 static inline void writes##bwlq(volatile void __iomem *mem, \
363 const void *addr, unsigned int count) \
365 - const volatile type *__addr = (const type *) addr; \
366 + const volatile type *__addr = addr; \
369 __mem_write##bwlq(*__addr, mem); \
371 static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
372 unsigned int count) \
374 - volatile type *__addr = (type *) addr; \
375 + volatile type *__addr = addr; \
378 *__addr = __mem_read##bwlq(mem); \
380 static inline void outs##bwlq(unsigned long port, const void *addr, \
381 unsigned int count) \
383 - const volatile type *__addr = (const type *) addr; \
384 + const volatile type *__addr = addr; \
387 __mem_out##bwlq(*__addr, port); \
389 static inline void ins##bwlq(unsigned long port, void *addr, \
390 unsigned int count) \
392 - volatile type *__addr = (type *) addr; \
393 + volatile type *__addr = addr; \
396 *__addr = __mem_in##bwlq(port); \
400 /* Depends on MIPS II instruction set */
401 -#define mmiowb() asm volatile ("sync" : : : "memory")
402 +#define mmiowb() asm volatile ("sync" ::: "memory")
404 static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
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
413 -EMPTY_STRUCT_DECL(mace_parallel);
414 +struct mace_parallel {
417 -EMPTY_STRUCT_DECL(mace_ecp1284); /* later... */
418 +struct mace_ecp1284 { /* later... */
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
428 __asm__ __volatile__( \
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;})
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))
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))
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))
463 @@ -1390,13 +1390,13 @@
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) \
472 res = read_c0_##name(); \
474 - res |= (newval & change); \
475 + res |= (new & change); \
476 write_c0_##name(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
483 #define __PA_ADDR ".dword"
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);
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
497 * overhead of a function call by forcing the compiler to save the return
498 * address register on the stack.
500 -#define return_address() ({__asm__ __volatile__("": : :"$31");__builtin_return_address(0);})
501 +#define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
503 #ifdef CONFIG_CPU_HAS_PREFETCH
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
509 #define instruction_pointer(regs) ((regs)->cp0_epc)
510 #define profile_pc(regs) instruction_pointer(regs)
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);
515 extern NORET_TYPE void die(const char *, const struct pt_regs *) ATTRIB_NORET;
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
521 mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
524 -asmlinkage void smp_call_function_interrupt(void);
525 +extern asmlinkage void smp_call_function_interrupt(void);
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
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.
536 -asmlinkage void *resume(void *last, void *next, void *next_ti);
537 +extern asmlinkage void *resume(void *last, void *next, void *next_ti);
545 - return __xchg_u32((volatile int *) ptr, x);
546 + return __xchg_u32(ptr, x);
548 - return __xchg_u64((volatile __u64 *) ptr, x);
549 + return __xchg_u64(ptr, x);
551 __xchg_called_with_bad_pointer();
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
557 ** The __asm__ op below simple prevents gcc/ld from reordering
558 ** instructions across the mb() "call".
560 -#define mb() __asm__ __volatile__("": : :"memory") /* barrier() */
561 +#define mb() __asm__ __volatile__("":::"memory") /* barrier() */
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
569 #define __UM_MODULE_I386_H
572 -EMPTY_STRUCT_DECL(mod_arch_specific);
573 +struct mod_arch_specific
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
583 #define __UM_MODULE_X86_64_H
586 -EMPTY_STRUCT_DECL(mod_arch_specific);
587 +struct mod_arch_specific
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
597 * a mask operation on a byte.
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))
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
610 static inline int desc_empty(const void *ptr)
612 - const u32 *desc = (const u32 *) ptr;
613 + const u32 *desc = ptr;
614 return !(desc[0] | desc[1]);
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
621 extern void eisa_set_level_irq(unsigned int irq);
623 /* Voyager functions */
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);
634 extern asmlinkage void vic_cpi_interrupt(void);
635 extern asmlinkage void vic_sys_interrupt(void);
636 extern asmlinkage void vic_cmn_interrupt(void);
638 extern asmlinkage void qic_enable_irq_interrupt(void);
639 extern asmlinkage void qic_call_function_interrupt(void);
644 extern void (*const interrupt[NR_IRQS])(void);
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
651 static inline pte_t native_make_pte(pteval_t val)
653 - return (pte_t) ({pte_t duh; duh.pte = val;duh;});
654 + return (pte_t) { .pte = val };
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 @@
665 - return (pte_t) ({pte_t duh; duh.pte = ret;duh;});
666 + return (pte_t) { .pte = ret };
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,
674 - return (pte_t) ({pte_t duh; duh.pte = ret;duh;});
675 + return (pte_t) { .pte = ret };
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));
684 static inline void pmd_clear(pmd_t *pmdp)
686 set_pmd(pmdp, __pmd(0));
689 #endif /* CONFIG_X86_PAE */
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
696 native_set_pte(ptep, pte);
700 static inline void native_pmd_clear(pmd_t *pmdp)
702 native_set_pmd(pmdp, __pmd(0));
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);
716 static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
718 return __pmd((((phys_addr_t)page_nr << PAGE_SHIFT) |
719 pgprot_val(pgprot)) & __supported_pte_mask);
723 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
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
733 #define __RAW_SPIN_LOCK_UNLOCKED { 0 }
735 -#define __RAW_SPIN_LOCK_UNLOCKED ({raw_spinlock_t duh; duh.slock=0;duh;})
743 #define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
745 -#define __RAW_RW_LOCK_UNLOCKED ({raw_rwlock_t duh;duh.lock=RW_LOCK_BIAS;duh;})
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
753 * These symbols are defined with the addresses in the vsyscall page.
754 * See vsyscall-sigreturn.S.
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;
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
767 #ifndef _XTENSA_MODULE_H
768 #define _XTENSA_MODULE_H
770 -EMPTY_STRUCT_DECL(mod_arch_specific);
771 +struct mod_arch_specific
773 + /* No special elements, yet. */
776 #define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " "
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
783 /* Special register access. */
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));
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
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);
804 static inline void local_irq_disable(void)
807 __asm__ __volatile__ ("rsil %0, "__stringify(LOCKLEVEL)
808 - : "=a" (flags) : : "memory");
809 + : "=a" (flags) :: "memory");
811 static inline void local_irq_enable(void)
814 - __asm__ __volatile__ ("rsil %0, 0" : "=a" (flags) : : "memory");
815 + __asm__ __volatile__ ("rsil %0, 0" : "=a" (flags) :: "memory");
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
823 BDI_unused, /* Available bits start here */
826 -typedef int (congested_fn_t)(void *, int);
827 +typedef int (congested_fn)(void *, int);
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
845 struct compat_siginfo;
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 *);
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
857 static inline void async_tx_ack(struct dma_async_tx_descriptor *tx)
859 - tx->flags = (enum dma_ctrl_flags) (tx->flags | DMA_CTRL_ACK);
860 + tx->flags |= DMA_CTRL_ACK;
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
868 #define V1_DEL_REWRITE 2
870 /* Special information about quotafile */
871 -EMPTY_STRUCT_DECL(v1_mem_dqinfo);
872 +struct v1_mem_dqinfo {
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 @@
881 static inline void simple_transaction_set(struct file *file, size_t n)
883 - struct simple_transaction_argresp *ar = (struct simple_transaction_argresp *) file->private_data;
884 + struct simple_transaction_argresp *ar = file->private_data;
886 BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
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
896 - * This file has definitions for some important file table
900 -#include <linux/limits.h>
901 -#include <linux/ioctl.h>
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.
909 - * Some programs (notably those using select()) may have to be
910 - * recompiled to take full advantage of the new limits..
913 -/* Fixed constants first: */
915 -extern int sysctl_nr_open;
916 -#define INR_OPEN 4096 /* Initial setting for nfile rlimits */
918 -#define BLOCK_SIZE_BITS 10
919 -#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
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
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 */
932 -extern struct files_stat_struct files_stat;
933 -extern int get_max_files(void);
935 -struct inodes_stat_t {
938 - int dummy[5]; /* padding for sysctl ABI compatibility */
940 -extern struct inodes_stat_t inodes_stat;
942 -extern int leases_enable, lease_break_time;
944 -#ifdef CONFIG_DNOTIFY
945 -extern int dir_notify_enable;
948 -#define NR_FILE 8192 /* this can well be larger on a larger system */
953 -#define MAY_APPEND 8
954 -#define MAY_ACCESS 16
957 -#define FMODE_READ 1
958 -#define FMODE_WRITE 2
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 */
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
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))
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.
996 - * These are the fs-independent mount-flags: up to 32 flags are supported
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)
1029 - * Superblock flags that can be altered by MS_REMOUNT
1031 -#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)
1034 - * Old magic mount flag and mask
1036 -#define MS_MGC_VAL 0xC0ED0000
1037 -#define MS_MGC_MSK 0xffff0000
1039 -/* Inode flags - they have nothing to superblock flags now */
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 */
1053 -/* Linux-VServer related Inode flags */
1057 -#define V_BARRIER 4 /* Barrier for chroot() */
1058 -#define V_COW 8 /* Copy on Write */
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.
1066 - * Exception: MS_RDONLY is always applied to the entire file system.
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
1073 -#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
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)
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)
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)
1097 -#define IS_BARRIER(inode) (S_ISDIR((inode)->i_mode) && ((inode)->i_vflags & V_BARRIER))
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))
1103 -# define IS_COW(inode) (0)
1104 -# define IS_COW_LINK(inode) (0)
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. */
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 */
1123 -#define BLKPG _IO(0x12,105)/* See blkpg.h */
1125 -/* Some people are morons. Do not use sizeof! */
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. */
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)
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 */
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)
1155 - * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
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 */
1183 -#define FS_BARRIER_FL 0x04000000 /* Barrier for chroot() */
1184 -#define FS_COW_FL 0x20000000 /* Copy on Write marker */
1186 -#define FS_FL_USER_VISIBLE 0x0103DFFF /* User visible flags */
1187 -#define FS_FL_USER_MODIFIABLE 0x010380FF /* User modifiable flags */
1189 -#define SYNC_FILE_RANGE_WAIT_BEFORE 1
1190 -#define SYNC_FILE_RANGE_WRITE 2
1191 -#define SYNC_FILE_RANGE_WAIT_AFTER 4
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>
1213 -#include <asm/atomic.h>
1214 -#include <asm/byteorder.h>
1216 -struct export_operations;
1217 -struct hd_geometry;
1221 -struct pipe_inode_info;
1222 -struct poll_table_struct;
1224 -struct vm_area_struct;
1227 -extern void __init inode_init(void);
1228 -extern void __init inode_init_early(void);
1229 -extern void __init files_init(unsigned long);
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);
1238 - * Attribute flags. These should be or-ed together to figure out what
1239 - * has been changed!
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)
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.
1267 - * Derek Atkins <warlord@MIT.EDU> 94-10-20
1270 - unsigned int ia_valid;
1276 - struct timespec ia_atime;
1277 - struct timespec ia_mtime;
1278 - struct timespec ia_ctime;
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).
1285 - struct file *ia_file;
1288 -#define ATTR_FLAG_BARRIER 512 /* Barrier for chroot() */
1289 -#define ATTR_FLAG_IXUNLINK 1024 /* Immutable invert on unlink */
1292 - * Includes for diskquotas.
1294 -#include <linux/quota.h>
1297 - * enum positive_aop_returns - aop return codes with specific semantics
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
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
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
1322 -enum positive_aop_returns {
1323 - AOP_WRITEPAGE_ACTIVATE = 0x80000,
1324 - AOP_TRUNCATED_PAGE = 0x80001,
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 */
1334 - * oh the beauties of C type declarations.
1337 -struct address_space;
1338 -struct writeback_control;
1341 - const struct iovec *iov;
1342 - unsigned long nr_segs;
1343 - size_t iov_offset;
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);
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)
1360 - i->nr_segs = nr_segs;
1361 - i->iov_offset = 0;
1362 - i->count = count + written;
1364 - iov_iter_advance(i, written);
1367 -static inline size_t iov_iter_count(struct iov_iter *i)
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.
1378 - * The simplest case just copies the data to user
1389 -} read_descriptor_t;
1391 -typedef int (*read_actor_t)(read_descriptor_t *, struct page *,
1392 - unsigned long, unsigned long);
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 *);
1399 - /* Write back some dirty pages from this mapping. */
1400 - int (*writepages)(struct address_space *, struct writeback_control *);
1402 - /* Set a page dirty. Return true if this dirtied it */
1403 - int (*set_page_dirty)(struct page *page);
1405 - int (*readpages)(struct file *filp, struct address_space *mapping,
1406 - struct list_head *pages, unsigned nr_pages);
1409 - * ext3 requires that a successful prepare_write() call be followed
1410 - * by a commit_write() call - they must be balanced
1412 - int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
1413 - int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
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);
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 *,
1439 - * pagecache_write_begin/pagecache_write_end must be used by general code
1440 - * to write into the pagecache.
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);
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);
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))));
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.
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 */
1479 - struct mutex bd_mutex; /* open/close mutex */
1480 - struct semaphore bd_mount_sem;
1481 - struct list_head bd_inodes;
1484 -#ifdef CONFIG_SYSFS
1485 - struct list_head bd_holder_list;
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;
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.
1502 - unsigned long bd_private;
1506 - * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
1509 -#define PAGECACHE_TAG_DIRTY 0
1510 -#define PAGECACHE_TAG_WRITEBACK 1
1512 -int mapping_tagged(struct address_space *mapping, int tag);
1515 - * Might pages of this file be mapped into userspace?
1517 -static inline int mapping_mapped(struct address_space *mapping)
1519 - return !prio_tree_empty(&mapping->i_mmap) ||
1520 - !list_empty(&mapping->i_mmap_nonlinear);
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.
1529 -static inline int mapping_writably_mapped(struct address_space *mapping)
1531 - return mapping->i_mmap_writable != 0;
1535 - * Use sequence counter to get consistent i_size on 32-bit processors.
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)
1542 -#define i_size_ordered_init(inode) do { } while (0)
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;
1552 - unsigned int i_nlink;
1560 -#ifdef __NEED_I_SIZE_ORDERED
1561 - seqcount_t i_size_seqcount;
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;
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];
1582 - struct list_head i_devices;
1584 - struct pipe_inode_info *i_pipe;
1585 - struct block_device *i_bdev;
1586 - struct cdev *i_cdev;
1590 - __u32 i_generation;
1592 -#ifdef CONFIG_DNOTIFY
1593 - unsigned long i_dnotify_mask; /* Directory notify events */
1594 - struct dnotify_struct *i_dnotify; /* for directory notifications */
1597 -#ifdef CONFIG_INOTIFY
1598 - struct list_head inotify_watches; /* watches on this inode */
1599 - struct mutex inotify_mutex; /* protects the watches list */
1602 - unsigned long i_state;
1603 - unsigned long dirtied_when; /* jiffies of first dirtying */
1605 - unsigned short i_flags;
1606 - unsigned short i_vflags;
1608 - atomic_t i_writecount;
1609 -#ifdef CONFIG_SECURITY
1612 - void *i_private; /* fs or device private pointer */
1616 - * inode->i_mutex nesting subclasses for the lock validator:
1618 - * 0: the object of the current VFS operation
1623 - * The locking order between these classes is
1624 - * parent -> child -> normal -> xattr -> quota
1626 -enum inode_i_mutex_lock_class
1635 -extern void inode_double_lock(struct inode *inode1, struct inode *inode2);
1636 -extern void inode_double_unlock(struct inode *inode1, struct inode *inode2);
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.
1648 -static inline loff_t i_size_read(const struct inode *inode)
1650 -#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
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));
1659 -#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
1662 - preempt_disable();
1663 - i_size = inode->i_size;
1667 - return inode->i_size;
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.
1676 -static inline void i_size_write(struct inode *inode, loff_t i_size)
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;
1687 - inode->i_size = i_size;
1691 -static inline unsigned iminor(const struct inode *inode)
1693 - return MINOR(inode->i_mdev);
1696 -static inline unsigned imajor(const struct inode *inode)
1698 - return MAJOR(inode->i_mdev);
1701 -extern struct block_device *I_BDEV(struct inode *inode);
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 */
1712 - * Track a single file's readahead state
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 */
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 */
1726 - * Check if @index falls in the readahead windows.
1728 -static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
1730 - return (index >= ra->start &&
1731 - index < ra->start + ra->size);
1734 -#define FILE_MNT_WRITE_TAKEN 1
1735 -#define FILE_MNT_WRITE_RELEASED 2
1739 - * fu_list becomes invalid after file_free is called and queued via
1740 - * fu_rcuhead for RCU freeing
1743 - struct list_head fu_list;
1744 - struct rcu_head fu_rcuhead;
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;
1754 - struct fown_struct f_owner;
1755 - unsigned int f_uid, f_gid;
1757 - struct file_ra_state f_ra;
1760 -#ifdef CONFIG_SECURITY
1763 - /* needed for tty driver, and maybe others */
1764 - void *private_data;
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;
1776 -extern spinlock_t files_lock;
1777 -#define file_list_lock() spin_lock(&files_lock);
1778 -#define file_list_unlock() spin_unlock(&files_lock);
1780 -#define get_file(x) atomic_long_inc(&(x)->f_count)
1781 -#define file_count(x) atomic_long_read(&(x)->f_count)
1783 -#ifdef CONFIG_DEBUG_WRITECOUNT
1784 -static inline void file_take_write(struct file *f)
1786 - WARN_ON(f->f_mnt_write_state != 0);
1787 - f->f_mnt_write_state = FILE_MNT_WRITE_TAKEN;
1789 -static inline void file_release_write(struct file *f)
1791 - f->f_mnt_write_state |= FILE_MNT_WRITE_RELEASED;
1793 -static inline void file_reset_write(struct file *f)
1795 - f->f_mnt_write_state = 0;
1797 -static inline void file_check_state(struct file *f)
1800 - * At this point, either both or neither of these bits
1803 - WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN);
1804 - WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_RELEASED);
1806 -static inline int file_check_writeable(struct file *f)
1808 - if (f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN)
1810 - printk(KERN_WARNING "writeable file with no "
1811 - "mnt_want_write()\n");
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)
1824 -#endif /* CONFIG_DEBUG_WRITECOUNT */
1826 -#define MAX_NON_LFS ((1UL<<31) - 1)
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
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 */
1845 - * Special return value from posix_lock_file() and vfs_lock_file() for
1846 - * asynchronous locking.
1848 -#define FILE_LOCK_DEFERRED 1
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).
1855 - * Lockd stuffs a "host" pointer into this.
1857 -typedef struct files_struct *fl_owner_t;
1859 -struct file_lock_operations {
1860 - void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
1861 - void (*fl_release_private)(struct file_lock *);
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);
1875 -/* that will die - we need it for nfs_lock_info */
1876 -#include <linux/nfs_fs_i.h>
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;
1893 - struct fasync_struct * fl_fasync; /* for lease break notifications */
1894 - unsigned long fl_break_time; /* for nonblocking lease breaks */
1896 - struct file_lock_operations *fl_ops; /* Callbacks for filesystems */
1897 - struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */
1899 - struct nfs_lock_info nfs_fl;
1900 - struct nfs4_lock_info nfs4_fl;
1902 - struct list_head link; /* link in AFS vnode's pending_locks list */
1903 - int state; /* state of grant or error if -ve */
1908 -/* The following constant reflects the upper bound of the file/locking space */
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)
1915 -#include <linux/fcntl.h>
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 *);
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 *);
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);
1932 -extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1933 - loff_t endbyte, unsigned int flags);
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;
1958 -struct fasync_struct {
1961 - struct fasync_struct *fa_next; /* singly linked list */
1962 - struct file *fa_file;
1965 -#define FASYNC_MAGIC 0x4601
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);
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);
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 */
1988 -extern struct list_head super_blocks;
1989 -extern spinlock_t sb_lock;
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;
2011 - int s_need_sync_fs;
2012 - atomic_t s_active;
2013 -#ifdef CONFIG_SECURITY
2016 - struct xattr_handler **s_xattr;
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 */
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 */
2034 - wait_queue_head_t s_wait_unfrozen;
2036 - char s_id[32]; /* Informational name */
2038 - void *s_fs_info; /* Filesystem private info */
2041 - * The next field is for VFS *only*. No filesystems have any business
2042 - * even looking at it. You had been warned.
2044 - struct mutex s_vfs_rename_mutex; /* Kludge */
2046 - /* Granularity of c/m/atime in ns.
2047 - Cannot be worse than a second */
2051 - * Filesystem subtype. If non-empty the filesystem type field
2052 - * in /proc/mounts will be "type.subtype"
2057 - * Saved mount options for lazy filesystems using
2058 - * generic_show_options()
2063 -extern struct timespec current_fs_time(struct super_block *sb);
2066 - * Snapshotting support.
2070 - SB_FREEZE_WRITE = 1,
2071 - SB_FREEZE_TRANS = 2,
2074 -#define vfs_check_frozen(sb, level) \
2075 - wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
2077 -#define get_fs_excl() atomic_inc(¤t->fs_excl)
2078 -#define put_fs_excl() atomic_dec(¤t->fs_excl)
2079 -#define has_fs_excl() atomic_read(¤t->fs_excl)
2081 -#define is_owner_or_cap(inode) \
2082 - ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER))
2084 -/* not quite ready to be deprecated, but... */
2085 -extern void lock_super(struct super_block *);
2086 -extern void unlock_super(struct super_block *);
2089 - * VFS helper functions..
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 *);
2102 - * VFS dentry helper functions.
2104 -extern void dentry_unhash(struct dentry *dentry);
2107 - * VFS file helper functions.
2109 -extern int file_permission(struct file *, int);
2114 - * NOTE! These match bits 12..15 of stat.st_mode
2115 - * (ie "(i_mode >> 12) & 15").
2117 -#define DT_UNKNOWN 0
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);
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.
2138 -typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
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;
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
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.
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 **);
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,
2220 - int (*sync_flags) (struct inode *);
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);
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);
2238 -struct super_operations {
2239 - struct inode *(*alloc_inode)(struct super_block *sb);
2240 - void (*destroy_inode)(struct inode *);
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 *);
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);
2265 - * Inode state bits. Protected by inode_lock.
2267 - * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
2268 - * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
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.
2274 - * Two bits are used for locking and completion notification, I_LOCK and I_SYNC.
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
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
2291 - * I_CLEAR Set by clear_inode(). In this state the inode is clean
2292 - * and can be destroyed.
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.
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.
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?
2317 -#define I_DIRTY_SYNC 1
2318 -#define I_DIRTY_DATASYNC 2
2319 -#define I_DIRTY_PAGES 4
2321 -#define I_WILL_FREE 16
2322 -#define I_FREEING 32
2325 -#define I_LOCK (1 << __I_LOCK)
2327 -#define I_SYNC (1 << __I_SYNC)
2329 -#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
2331 -extern void __mark_inode_dirty(struct inode *, int);
2332 -static inline void mark_inode_dirty(struct inode *inode)
2334 - __mark_inode_dirty(inode, I_DIRTY);
2337 -static inline void mark_inode_dirty_sync(struct inode *inode)
2339 - __mark_inode_dirty(inode, I_DIRTY_SYNC);
2343 - * inc_nlink - directly increment an inode's link count
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().
2350 -static inline void inc_nlink(struct inode *inode)
2355 -static inline void inode_inc_link_count(struct inode *inode)
2358 - mark_inode_dirty(inode);
2362 - * drop_nlink - directly drop an inode's link count
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.
2372 -static inline void drop_nlink(struct inode *inode)
2378 - * clear_nlink - directly zero an inode's link count
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.
2385 -static inline void clear_nlink(struct inode *inode)
2387 - inode->i_nlink = 0;
2390 -static inline void inode_dec_link_count(struct inode *inode)
2392 - drop_nlink(inode);
2393 - mark_inode_dirty(inode);
2397 - * inode_inc_iversion - increments i_version
2398 - * @inode: inode that need to be updated
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
2404 -static inline void inode_inc_iversion(struct inode *inode)
2406 - spin_lock(&inode->i_lock);
2407 - inode->i_version++;
2408 - spin_unlock(&inode->i_lock);
2411 -extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
2412 -static inline void file_accessed(struct file *file)
2414 - if (!(file->f_flags & O_NOATIME))
2415 - touch_atime(file->f_path.mnt, file->f_path.dentry);
2418 -int sync_inode(struct inode *inode, struct writeback_control *wbc);
2420 -struct file_system_type {
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;
2430 - struct lock_class_key s_lock_key;
2431 - struct lock_class_key s_umount_key;
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;
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 *),
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);
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)
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 *);
2484 -extern int vfs_statfs(struct dentry *, struct kstatfs *);
2487 -extern struct kobject *fs_kobj;
2489 -#define FLOCK_VERIFY_READ 1
2490 -#define FLOCK_VERIFY_WRITE 2
2492 -extern int locks_mandatory_locked(struct inode *);
2493 -extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
2496 - * Candidates for mandatory locking have the setgid bit set
2497 - * but no group execute bit - an otherwise meaningless combination.
2500 -static inline int __mandatory_lock(struct inode *ino)
2502 - return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
2506 - * ... and these candidates should be on MS_MANDLOCK mounted fs,
2507 - * otherwise these will be advisory locks
2510 -static inline int mandatory_lock(struct inode *ino)
2512 - return IS_MANDLOCK(ino) && __mandatory_lock(ino);
2515 -static inline int locks_verify_locked(struct inode *inode)
2517 - if (mandatory_lock(inode))
2518 - return locks_mandatory_locked(inode);
2522 -extern int rw_verify_area(int, struct file *, loff_t *, size_t);
2524 -static inline int locks_verify_truncate(struct inode *inode,
2525 - struct file *filp,
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)
2538 -static inline int break_lease(struct inode *inode, unsigned int mode)
2540 - if (inode->i_flock)
2541 - return __break_lease(inode, mode);
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,
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 *);
2557 -extern void __init vfs_caches_init_early(void);
2558 -extern void __init vfs_caches_init(unsigned long);
2560 -extern struct kmem_cache *names_cachep;
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)
2567 -extern void putname(const char *name);
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);
2579 -static inline void bd_forget(struct inode *inode) {}
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 *);
2600 -#define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder)
2601 -#define bd_release_from_disk(bdev, disk) bd_release(bdev)
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);
2615 -/* fs/block_dev.c */
2616 -#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
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);
2627 -#define BLKDEV_MAJOR_HASH_SIZE 0
2630 -extern void init_special_inode(struct inode *, umode_t, dev_t);
2632 -/* Invalid inode operations -- fs/bad_inode.c */
2633 -extern void make_bad_inode(struct inode *);
2634 -extern int is_bad_inode(struct inode *);
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;
2640 -extern int fs_may_remount_ro(struct super_block *);
2642 -#ifdef CONFIG_BLOCK
2644 - * return READ, READA, or WRITE
2646 -#define bio_rw(bio) ((bio)->bi_rw & (RW_MASK | RWA_MASK))
2649 - * return data direction, READ or WRITE
2651 -#define bio_data_dir(bio) ((bio)->bi_rw & 1)
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);
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,
2661 -unsigned long invalidate_mapping_pages(struct address_space *mapping,
2662 - pgoff_t start, pgoff_t end);
2664 -static inline unsigned long __deprecated
2665 -invalidate_inode_pages(struct address_space *mapping)
2667 - return invalidate_mapping_pages(mapping, 0, ~0UL);
2670 -static inline void invalidate_remote_inode(struct inode *inode)
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);
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);
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);
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));
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)
2715 - atomic_dec(&inode->i_writecount);
2717 -static inline void allow_write_access(struct file *file)
2720 - atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
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 *);
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);
2732 -extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
2733 -extern struct file * open_exec(const char *);
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 *);
2739 -#include <linux/err.h>
2741 -/* needed for stackable file system support */
2742 -extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
2744 -extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
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);
2754 -extern struct inode *ilookup5_nowait(struct super_block *sb,
2755 - unsigned long hashval, int (*test)(struct inode *, void *),
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);
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 *);
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 *);
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);
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
2784 -extern void submit_bio(int, struct bio *);
2785 -extern int bdev_read_only(struct block_device *);
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 *);
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);
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);
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,
2827 -extern int generic_file_open(struct inode * inode, struct file * filp);
2828 -extern int nonseekable_open(struct inode * inode, struct file * filp);
2830 -#ifdef CONFIG_FS_XIP
2831 -extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len,
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);
2838 -static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
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,
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 */
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)
2861 - return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2862 - nr_segs, get_block, end_io, DIO_LOCKING);
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)
2870 - return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2871 - nr_segs, get_block, end_io, DIO_NO_LOCKING);
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)
2879 - return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2880 - nr_segs, get_block, end_io, DIO_OWN_LOCKING);
2884 -extern const struct file_operations generic_ro_fops;
2886 -#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
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,
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);
2905 -extern int vfs_readdir(struct file *, filldir_t, void *);
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 *);
2913 -extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2914 - unsigned long arg);
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);
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);
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);
2956 -extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2957 - loff_t *ppos, const void *from, size_t available);
2959 -#ifdef CONFIG_MIGRATION
2960 -extern int buffer_migrate_page(struct address_space *,
2961 - struct page *, struct page *);
2963 -#define buffer_migrate_page NULL
2966 -extern int inode_change_ok(struct inode *, struct iattr *);
2967 -extern int __must_check inode_setattr(struct inode *, struct iattr *);
2969 -extern void file_update_time(struct file *file);
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);
2974 -static inline ino_t parent_ino(struct dentry *dentry)
2978 - spin_lock(&dentry->d_lock);
2979 - res = dentry->d_parent->d_inode->i_ino;
2980 - spin_unlock(&dentry->d_lock);
2984 -/* Transaction based IO helpers */
2987 - * An argresp is stored in an allocated page and holds the
2988 - * size of the argument or response, along with its content
2990 -struct simple_transaction_argresp {
2995 -#define SIMPLE_TRANSACTION_LIMIT (PAGE_SIZE - sizeof(struct simple_transaction_argresp))
2997 -char *simple_transaction_get(struct file *file, const char __user *buf,
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);
3003 -static inline void simple_transaction_set(struct file *file, size_t n)
3005 - struct simple_transaction_argresp *ar = file->private_data;
3007 - BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
3010 - * The barrier ensures that ar->size will really remain zero until
3011 - * ar->data is ready for reading.
3018 - * simple attribute files
3020 - * These attributes behave similar to those in sysfs:
3022 - * Writing to an attribute immediately sets a value, an open file can be
3023 - * written to multiple times.
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
3030 - * All attributes contain a text representation of a numeric value
3031 - * that are accessed with the get() and set() functions.
3033 -#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \
3034 -static int __fops ## _open(struct inode *inode, struct file *file) \
3036 - __simple_attr_check_format(__fmt, 0ull); \
3037 - return simple_attr_open(inode, file, __get, __set, __fmt); \
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, \
3047 -static inline void __attribute__((format(printf, 1, 2)))
3048 -__simple_attr_check_format(const char *fmt, ...)
3050 - /* don't do anything, just let the compiler check the arguments; */
3053 -int simple_attr_open(struct inode *inode, struct file *file,
3054 - int (*get)(void *, u64 *), int (*set)(void *, u64),
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);
3063 -#ifdef CONFIG_SECURITY
3064 -static inline char *alloc_secdata(void)
3066 - return (char *)get_zeroed_page(GFP_KERNEL);
3069 -static inline void free_secdata(void *secdata)
3071 - free_page((unsigned long)secdata);
3074 -static inline char *alloc_secdata(void)
3079 -static inline void free_secdata(void *secdata)
3081 -#endif /* CONFIG_SECURITY */
3084 -int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
3085 - void __user *buffer, size_t *lenp, loff_t *ppos);
3087 -int get_filesystem_list(char * buf);
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
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);
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
3120 static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
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);
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
3133 static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev)
3135 - struct in_device *in_dev = (struct in_device *) dev->ip_ptr;
3136 + struct in_device *in_dev = dev->ip_ptr;
3138 in_dev = rcu_dereference(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
3144 static inline u32 jhash(const void *key, u32 length, u32 initval)
3147 - const u8 *k = (const u8 *) key;
3148 + const u8 *k = key;
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
3159 -asmlinkage void __attribute__((format(printf, 1, 2)))
3160 +extern void asmlinkage __attribute__((format(printf, 1, 2)))
3161 early_printk(const char *fmt, ...);
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
3169 #if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)
3172 -# define KTIME_TV64(__s) ({ ktime_t __kt; __kt.tv64 = (__s); __kt; })
3174 -# define KTIME_TV64(__s) ((ktime_t) { .tv64 = (__s) })
3178 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
3179 * @secs: seconds to set
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 };
3187 - return KTIME_TV64((s64)secs * NSEC_PER_SEC + (s64)nsecs);
3188 + return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs };
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 }; })
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 }; })
3202 * Add a ktime_t variable and a scalar nanosecond value.
3205 #define ktime_add_ns(kt, nsval) \
3206 - KTIME_TV64((kt).tv64 + (nsval))
3207 + ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
3210 * Subtract a scalar nanosecod from a ktime_t variable
3214 -#define ktime_sub_ns(kt, nsval) \
3215 - ({ktime_t duh; duh.tv64 = (kt).tv64 - (nsval); duh; })
3217 #define ktime_sub_ns(kt, nsval) \
3218 ({ (ktime_t){ .tv64 = (kt).tv64 - (nsval) }; })
3221 /* convert a timespec to ktime_t format: */
3222 static inline ktime_t timespec_to_ktime(struct timespec ts)
3223 @@ -143,18 +132,6 @@
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; })
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) })
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
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)
3246 - return KTIME_SEC_NSEC(secs, nsecs);
3247 + return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
3253 static inline ktime_t timespec_to_ktime(const struct timespec ts)
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 } };
3263 static inline ktime_t timeval_to_ktime(const struct timeval tv)
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 } };
3273 static inline struct timespec ktime_to_timespec(const ktime_t kt)
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 };
3283 static inline struct timeval ktime_to_timeval(const ktime_t kt)
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) };
3295 static inline ktime_t ns_to_ktime(u64 ns)
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);
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
3307 #define CPP_ASMLINKAGE
3309 -#ifndef extern_asmlinkage
3310 -# ifdef __cplusplus
3311 -# define extern_asmlinkage asmlinkage
3313 -# define extern_asmlinkage extern 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
3323 struct list_head *next, *prev;
3327 -#define LIST_HEAD_INIT(name) ({struct list_head duh;duh.next=&(name);duh.prev=&(name);duh;})
3329 #define LIST_HEAD_INIT(name) { &(name), &(name) }
3332 #define LIST_HEAD(name) \
3333 struct list_head name = LIST_HEAD_INIT(name)
3335 static inline void list_del(struct list_head *entry)
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;
3344 extern void list_del(struct list_head *entry);
3346 static inline void hlist_del(struct hlist_node *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;
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
3363 -EMPTY_STRUCT_DECL(mempolicy);
3364 +struct mempolicy {};
3366 static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
3372 -EMPTY_STRUCT_DECL(shared_policy);
3373 +struct shared_policy {};
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
3381 static inline void set_compound_page_dtor(struct page *page,
3382 compound_page_dtor *dtor)
3384 - page[1].lru.next = (struct list_head *)dtor;
3385 + page[1].lru.next = (void *)dtor;
3388 static inline compound_page_dtor *get_compound_page_dtor(struct page *page)
3391 static inline void set_compound_order(struct page *page, unsigned long order)
3393 - page[1].lru.prev = (struct list_head *)order;
3394 + page[1].lru.prev = (void *)order;
3400 static inline enum zone_type page_zonenum(struct page *page)
3402 - return (enum zone_type) ((page->flags >> ZONES_PGSHIFT) & ZONES_MASK);
3403 + return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
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
3411 -#ifndef _LINUX_MM_H
3412 -#define _LINUX_MM_H
3414 -#include <linux/errno.h>
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>
3428 -struct file_ra_state;
3429 -struct user_struct;
3430 -struct writeback_control;
3432 -#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */
3433 -extern unsigned long max_mapnr;
3436 -extern unsigned long num_physpages;
3437 -extern void * high_memory;
3438 -extern int page_cluster;
3440 -#ifdef CONFIG_SYSCTL
3441 -extern int sysctl_legacy_va_layout;
3443 -#define sysctl_legacy_va_layout 0
3446 -extern unsigned long mmap_min_addr;
3448 -#include <asm/page.h>
3449 -#include <asm/pgtable.h>
3450 -#include <asm/processor.h>
3452 -#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
3454 -/* to align the pointer to the (next) page boundary */
3455 -#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
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).
3466 -extern struct kmem_cache *vm_area_cachep;
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
3473 -struct vm_list_struct {
3474 - struct vm_list_struct *next;
3475 - struct vm_area_struct *vma;
3479 -extern struct rb_root nommu_vma_tree;
3480 -extern struct rw_semaphore nommu_vma_sem;
3482 -extern unsigned int kobjsize(const void *objp);
3486 - * vm_flags in vm_area_struct, see mm_types.h.
3488 -#define VM_READ 0x00000001 /* currently active flags */
3489 -#define VM_WRITE 0x00000002
3490 -#define VM_EXEC 0x00000004
3491 -#define VM_SHARED 0x00000008
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
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.. */
3504 -#define VM_EXECUTABLE 0x00001000
3505 -#define VM_LOCKED 0x00002000
3506 -#define VM_IO 0x00004000 /* Memory mapped I/O or similar */
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 */
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 */
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) */
3527 -#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
3528 -#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
3531 -#ifdef CONFIG_STACK_GROWSUP
3532 -#define VM_STACK_FLAGS (VM_GROWSUP | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
3534 -#define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
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)
3544 - * mapping from the currently active vm_flags protection bits (the
3545 - * low four bits) to a page protection mask..
3547 -extern pgprot_t protection_map[16];
3549 -#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
3550 -#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
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.
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.
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 */
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).
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.
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);
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);
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
3591 - int (*access)(struct vm_area_struct *vma, unsigned long addr,
3592 - void *buf, int len, int write);
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
3601 - int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
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
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);
3623 -#define page_private(page) ((page)->private)
3624 -#define set_page_private(page, v) ((page)->private = (v))
3627 - * FIXME: take this include out, include page-flags.h in
3628 - * files which need it (119 of them)
3630 -#include <linux/page-flags.h>
3632 -#ifdef CONFIG_DEBUG_VM
3633 -#define VM_BUG_ON(cond) BUG_ON(cond)
3635 -#define VM_BUG_ON(condition) do { } while(0)
3639 - * Methods to modify the page usage count.
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
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.
3652 - * Drop a ref, return true if the refcount fell to zero (the page has no users)
3654 -static inline int put_page_testzero(struct page *page)
3656 - VM_BUG_ON(atomic_read(&page->_count) == 0);
3657 - return atomic_dec_and_test(&page->_count);
3661 - * Try to grab a ref unless the page has a refcount of zero, return false if
3662 - * that is the case.
3664 -static inline int get_page_unless_zero(struct page *page)
3666 - return atomic_inc_not_zero(&page->_count);
3669 -/* Support for virtually mapped pages */
3670 -struct page *vmalloc_to_page(const void *addr);
3671 -unsigned long vmalloc_to_pfn(const void *addr);
3674 - * Determine if an address is within the vmalloc range
3676 - * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
3677 - * is no special casing required.
3679 -static inline int is_vmalloc_addr(const void *x)
3682 - unsigned long addr = (unsigned long)x;
3684 - return addr >= VMALLOC_START && addr < VMALLOC_END;
3690 -static inline struct page *compound_head(struct page *page)
3692 - if (unlikely(PageTail(page)))
3693 - return page->first_page;
3697 -static inline int page_count(struct page *page)
3699 - return atomic_read(&compound_head(page)->_count);
3702 -static inline void get_page(struct page *page)
3704 - page = compound_head(page);
3705 - VM_BUG_ON(atomic_read(&page->_count) == 0);
3706 - atomic_inc(&page->_count);
3709 -static inline struct page *virt_to_head_page(const void *x)
3711 - struct page *page = virt_to_page(x);
3712 - return compound_head(page);
3716 - * Setup the page count before being freed into the page allocator for
3717 - * the first time (boot or memory hotplug)
3719 -static inline void init_page_count(struct page *page)
3721 - atomic_set(&page->_count, 1);
3724 -void put_page(struct page *page);
3725 -void put_pages_list(struct list_head *pages);
3727 -void split_page(struct page *page, unsigned int order);
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.
3734 -typedef void compound_page_dtor(struct page *);
3736 -static inline void set_compound_page_dtor(struct page *page,
3737 - compound_page_dtor *dtor)
3739 - page[1].lru.next = (void *)dtor;
3742 -static inline compound_page_dtor *get_compound_page_dtor(struct page *page)
3744 - return (compound_page_dtor *)page[1].lru.next;
3747 -static inline int compound_order(struct page *page)
3749 - if (!PageHead(page))
3751 - return (unsigned long)page[1].lru.prev;
3754 -static inline void set_compound_order(struct page *page, unsigned long order)
3756 - page[1].lru.prev = (void *)order;
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
3826 - * page->flags layout:
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.
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 |
3839 -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
3840 -#define SECTIONS_WIDTH SECTIONS_SHIFT
3842 -#define SECTIONS_WIDTH 0
3845 -#define ZONES_WIDTH ZONES_SHIFT
3847 -#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
3848 -#define NODES_WIDTH NODES_SHIFT
3850 -#ifdef CONFIG_SPARSEMEM_VMEMMAP
3851 -#error "Vmemmap: No space for nodes field in page flags"
3853 -#define NODES_WIDTH 0
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)
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.
3865 -#if !(NODES_WIDTH > 0 || NODES_SHIFT == 0)
3866 -#define NODE_NOT_IN_PAGE_FLAGS
3869 -#ifndef PFN_SECTION_SHIFT
3870 -#define PFN_SECTION_SHIFT 0
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.
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))
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)
3888 -#define ZONEID_SHIFT (NODES_SHIFT + ZONES_SHIFT)
3889 -#define ZONEID_PGOFF ((NODES_PGOFF < ZONES_PGOFF)? \
3890 - NODES_PGOFF : ZONES_PGOFF)
3893 -#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
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
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)
3904 -static inline enum zone_type page_zonenum(struct page *page)
3906 - return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
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.
3917 -static inline int page_zone_id(struct page *page)
3919 - return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
3922 -static inline int zone_to_nid(struct zone *zone)
3925 - return zone->node;
3931 -#ifdef NODE_NOT_IN_PAGE_FLAGS
3932 -extern int page_to_nid(struct page *page);
3934 -static inline int page_to_nid(struct page *page)
3936 - return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
3940 -static inline struct zone *page_zone(struct page *page)
3942 - return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
3945 -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
3946 -static inline unsigned long page_to_section(struct page *page)
3948 - return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
3952 -static inline void set_page_zone(struct page *page, enum zone_type zone)
3954 - page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
3955 - page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
3958 -static inline void set_page_node(struct page *page, unsigned long node)
3960 - page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
3961 - page->flags |= (node & NODES_MASK) << NODES_PGSHIFT;
3964 -static inline void set_page_section(struct page *page, unsigned long section)
3966 - page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
3967 - page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
3970 -static inline void set_page_links(struct page *page, enum zone_type zone,
3971 - unsigned long node, unsigned long pfn)
3973 - set_page_zone(page, zone);
3974 - set_page_node(page, node);
3975 - set_page_section(page, pfn_to_section_nr(pfn));
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
3982 -static inline unsigned long round_hint_to_min(unsigned long hint)
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);
3994 - * Some inline functions in vmstat.h depend on page_zone()
3996 -#include <linux/vmstat.h>
3998 -static __always_inline void *lowmem_page_address(struct page *page)
4000 - return __va(page_to_pfn(page) << PAGE_SHIFT);
4003 -#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
4004 -#define HASHED_PAGE_VIRTUAL
4007 -#if defined(WANT_PAGE_VIRTUAL)
4008 -#define page_address(page) ((page)->virtual)
4009 -#define set_page_address(page, address) \
4011 - (page)->virtual = (address); \
4013 -#define page_address_init() do { } while(0)
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);
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)
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.
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.
4037 -#define PAGE_MAPPING_ANON 1
4039 -extern struct address_space swapper_space;
4040 -static inline struct address_space *page_mapping(struct page *page)
4042 - struct address_space *mapping = page->mapping;
4044 - VM_BUG_ON(PageSlab(page));
4046 - if (unlikely(PageSwapCache(page)))
4047 - mapping = &swapper_space;
4050 - if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
4055 -static inline int PageAnon(struct page *page)
4057 - return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
4061 - * Return the pagecache index of the passed page. Regular pagecache pages
4062 - * use ->index whereas swapcache pages use ->private
4064 -static inline pgoff_t page_index(struct page *page)
4066 - if (unlikely(PageSwapCache(page)))
4067 - return page_private(page);
4068 - return page->index;
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).
4076 -static inline void reset_page_mapcount(struct page *page)
4078 - atomic_set(&(page)->_mapcount, -1);
4081 -static inline int page_mapcount(struct page *page)
4083 - return atomic_read(&(page)->_mapcount) + 1;
4087 - * Return true if this page is mapped into pagetables.
4089 -static inline int page_mapped(struct page *page)
4091 - return atomic_read(&(page)->_mapcount) >= 0;
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.
4100 -#define VM_FAULT_MINOR 0 /* For backwards compat. Remove me quickly. */
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 */
4107 -#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
4108 -#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
4110 -#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS)
4112 -#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
4114 -extern void show_free_areas(void);
4116 -#ifdef CONFIG_SHMEM
4117 -int shmem_lock(struct file *file, int lock, struct user_struct *user);
4119 -static inline int shmem_lock(struct file *file, int lock,
4120 - struct user_struct *user)
4125 -struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags);
4127 -int shmem_zero_setup(struct vm_area_struct *);
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);
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 *);
4142 - * Parameter block passed down to zap_pte_range in exceptional cases.
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 */
4153 -struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
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 *);
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
4173 - * (see walk_page_range for more details)
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;
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);
4196 -static inline void unmap_shared_mapping_range(struct address_space *mapping,
4197 - loff_t const holebegin, loff_t const holelen)
4199 - unmap_mapping_range(mapping, holebegin, holelen, 0);
4202 -extern int vmtruncate(struct inode * inode, loff_t offset);
4203 -extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
4206 -extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
4207 - unsigned long address, int write_access);
4209 -static inline int handle_mm_fault(struct mm_struct *mm,
4210 - struct vm_area_struct *vma, unsigned long address,
4213 - /* should never happen if there's no MMU */
4215 - return VM_FAULT_SIGBUS;
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);
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);
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);
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);
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);
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).
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).
4256 -int get_user_pages_fast(unsigned long start, int nr_pages, int write,
4257 - struct page **pages);
4260 - * A callback you can register to apply pressure to ageable caches.
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).
4268 - * The 'gfpmask' refers to the allocation we are currently trying to
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.
4275 - int (*shrink)(int nr_to_scan, gfp_t gfp_mask);
4276 - int seeks; /* seeks to recreate an obj */
4278 - /* These are for internal use */
4279 - struct list_head list;
4280 - long nr; /* objs pending delete */
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 *);
4286 -int vma_wants_writenotify(struct vm_area_struct *vma);
4288 -extern pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl);
4290 -#ifdef __PAGETABLE_PUD_FOLDED
4291 -static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
4292 - unsigned long address)
4297 -int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
4300 -#ifdef __PAGETABLE_PMD_FOLDED
4301 -static inline int __pmd_alloc(struct mm_struct *mm, pud_t *pud,
4302 - unsigned long address)
4307 -int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address);
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);
4314 - * The following ifdef needed to get the 4level-fixup.h header to work.
4315 - * Remove it when 4level-fixup.h has been removed.
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)
4320 - return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address))?
4321 - NULL: pud_offset(pgd, address);
4324 -static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
4326 - return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))?
4327 - NULL: pmd_offset(pud, address);
4329 -#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
4331 -#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
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.
4338 -#define __pte_lockptr(page) &((page)->ptl)
4339 -#define pte_lock_init(_page) do { \
4340 - spin_lock_init(__pte_lockptr(_page)); \
4342 -#define pte_lock_deinit(page) ((page)->mapping = NULL)
4343 -#define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));})
4346 - * We use mm->page_table_lock to guard all pagetable pages of the mm.
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 */
4353 -static inline void pgtable_page_ctor(struct page *page)
4355 - pte_lock_init(page);
4356 - inc_zone_page_state(page, NR_PAGETABLE);
4359 -static inline void pgtable_page_dtor(struct page *page)
4361 - pte_lock_deinit(page);
4362 - dec_zone_page_state(page, NR_PAGETABLE);
4365 -#define pte_offset_map_lock(mm, pmd, address, ptlp) \
4367 - spinlock_t *__ptl = pte_lockptr(mm, pmd); \
4368 - pte_t *__pte = pte_offset_map(pmd, address); \
4369 - *(ptlp) = __ptl; \
4370 - spin_lock(__ptl); \
4374 -#define pte_unmap_unlock(pte, ptl) do { \
4375 - spin_unlock(ptl); \
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))
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))
4387 -#define pte_alloc_kernel(pmd, address) \
4388 - ((unlikely(!pmd_present(*(pmd))) && __pte_alloc_kernel(pmd, address))? \
4389 - NULL: pte_offset_kernel(pmd, address))
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
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()
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
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);
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.
4419 - * See mm/page_alloc.c for more information on each function exposed by
4420 - * CONFIG_ARCH_POPULATES_NODE_MAP
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;
4455 -extern void setup_per_cpu_pageset(void);
4457 -static inline void setup_per_cpu_pageset(void) {}
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);
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)); )
4471 -static inline void vma_nonlinear_insert(struct vm_area_struct *vma,
4472 - struct list_head *list)
4474 - vma->shared.vm_set.parent = NULL;
4475 - list_add_tail(&vma->shared.vm_set.list, list);
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 *);
4497 -extern int mm_take_all_locks(struct mm_struct *mm);
4498 -extern void mm_drop_all_locks(struct mm_struct *mm);
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);
4505 -static inline void added_exe_file_vma(struct mm_struct *mm)
4508 -static inline void removed_exe_file_vma(struct mm_struct *mm)
4510 -#endif /* CONFIG_PROC_FS */
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);
4517 -extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
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,
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)
4531 - unsigned long ret = -EINVAL;
4532 - if ((offset + PAGE_ALIGN(len)) < offset)
4534 - if (!(offset & ~PAGE_MASK))
4535 - ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
4540 -extern int do_munmap(struct mm_struct *, unsigned long, size_t);
4542 -extern unsigned long do_brk(unsigned long, unsigned long);
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);
4550 -/* generic vm_area_ops exported for stackable file systems */
4551 -extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
4553 -/* mm/page-writeback.c */
4554 -int write_one_page(struct page *page, int wait);
4557 -#define VM_MAX_READAHEAD 128 /* kbytes */
4558 -#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
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);
4565 -void page_cache_sync_readahead(struct address_space *mapping,
4566 - struct file_ra_state *ra,
4567 - struct file *filp,
4569 - unsigned long size);
4571 -void page_cache_async_readahead(struct address_space *mapping,
4572 - struct file_ra_state *ra,
4573 - struct file *filp,
4576 - unsigned long size);
4578 -unsigned long max_sane_readahead(unsigned long nr);
4580 -/* Do stack extension */
4581 -extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
4583 -extern int expand_upwards(struct vm_area_struct *vma, unsigned long address);
4585 -extern int expand_stack_downwards(struct vm_area_struct *vma,
4586 - unsigned long address);
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);
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)
4597 - struct vm_area_struct * vma = find_vma(mm,start_addr);
4599 - if (vma && end_addr <= vma->vm_start)
4604 -static inline unsigned long vma_pages(struct vm_area_struct *vma)
4606 - return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
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);
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 */
4626 -typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
4628 -extern int apply_to_page_range(struct mm_struct *mm, unsigned long address,
4629 - unsigned long size, pte_fn_t fn, void *data);
4631 -#ifdef CONFIG_PROC_FS
4632 -void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
4634 -static inline void vm_stat_account(struct mm_struct *mm,
4635 - unsigned long flags, struct file *file, long pages)
4638 -#endif /* CONFIG_PROC_FS */
4640 -#ifdef CONFIG_DEBUG_PAGEALLOC
4641 -extern int debug_pagealloc_enabled;
4643 -extern void kernel_map_pages(struct page *page, int numpages, int enable);
4645 -static inline void enable_debug_pagealloc(void)
4647 - debug_pagealloc_enabled = 1;
4649 -#ifdef CONFIG_HIBERNATION
4650 -extern bool kernel_page_present(struct page *page);
4651 -#endif /* CONFIG_HIBERNATION */
4654 -kernel_map_pages(struct page *page, int numpages, int enable) {}
4655 -static inline void enable_debug_pagealloc(void)
4658 -#ifdef CONFIG_HIBERNATION
4659 -static inline bool kernel_page_present(struct page *page) { return true; }
4660 -#endif /* CONFIG_HIBERNATION */
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);
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 */
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);
4678 -#define randomize_va_space 0
4680 -extern int randomize_va_space;
4683 -const char * arch_vma_name(struct vm_area_struct *vma);
4684 -void print_vma_addr(char *prefix, unsigned long rip);
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);
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 @@
4705 struct garp_port *garp_port;
4707 - /* Click polling support */
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
4714 - int (*poll_on)(struct net_device *);
4715 - int (*poll_off)(struct net_device *);
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.
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.
4728 - int (*rx_refill)(struct net_device*, struct sk_buff**);
4730 - * place sk_buff on the transmit ring. returns 0 if successful, 1
4733 - int (*tx_queue)(struct net_device *, struct sk_buff *);
4735 - * clean tx dma ring. returns the list of skb objects cleaned
4737 - struct sk_buff* (*tx_clean)(struct net_device *);
4739 - * start transmission. returns 0 if successful, 1 otherwise
4741 - int (*tx_start)(struct net_device *);
4743 - * tell device the end of a batch of packets
4745 - int (*tx_eob)(struct net_device *);
4747 /* class/net/name entry */
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);
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 */
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);
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 @@
4776 extern void netif_device_attach(struct net_device *dev);
4778 -static inline int netif_receive_skb(struct sk_buff *skb)
4780 - return __netif_receive_skb(skb, skb->protocol, 0);
4784 * Network interface message level settings
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
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.
4795 - * Definitions for the Interfaces handler.
4797 - * Version: @(#)dev.h 1.0.10 08/12/93
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>
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.
4812 - * Moved to /usr/include/linux for NET3
4814 -#ifndef _LINUX_NETDEVICE_H
4815 -#define _LINUX_NETDEVICE_H
4817 -#include <linux/if.h>
4818 -#include <linux/if_ether.h>
4819 -#include <linux/if_packet.h>
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>
4828 -#include <linux/device.h>
4829 -#include <linux/percpu.h>
4830 -#include <linux/dmaengine.h>
4831 -#include <linux/workqueue.h>
4833 -#include <net/net_namespace.h>
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) )
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() */
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 */
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 */
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)
4871 -#define MAX_ADDR_LEN 32 /* Largest hardware address length */
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 */
4881 - * Compute the worst case header length according to the protocols
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
4889 -# define LL_MAX_HEADER 96
4891 -#elif defined(CONFIG_TR)
4892 -# define LL_MAX_HEADER 48
4894 -# define LL_MAX_HEADER 32
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
4903 -#define MAX_HEADER (LL_MAX_HEADER + 48)
4906 -#endif /* __KERNEL__ */
4909 - * Network device statistics. Akin to the 2.0 ether stats but
4910 - * with byte counters.
4913 -struct net_device_stats
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;
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 */
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;
4941 - /* for cslip etc */
4942 - unsigned long rx_compressed;
4943 - unsigned long tx_compressed;
4947 -/* Media selection options. */
4949 - IF_PORT_UNKNOWN = 0,
4954 - IF_PORT_100BASETX,
4960 -#include <linux/cache.h>
4961 -#include <linux/skbuff.h>
4964 -struct neigh_parms;
4967 -struct netif_rx_stats
4971 - unsigned time_squeeze;
4972 - unsigned cpu_collision;
4975 -DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
4977 -struct dev_addr_list
4979 - struct dev_addr_list *next;
4980 - u8 da_addr[MAX_ADDR_LEN];
4988 - * We tag multicasts with these structures.
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
4999 - struct hh_cache *hh_next; /* Next entry */
5000 - atomic_t hh_refcnt; /* number of users */
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.
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
5012 - u16 hh_len; /* length of header */
5013 - int (*hh_output)(struct sk_buff *skb);
5014 - seqlock_t hh_lock;
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)];
5025 -/* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much.
5027 - * dev->hard_header_len ? (dev->hard_header_len +
5028 - * (HH_DATA_MOD - 1)) & ~(HH_DATA_MOD - 1) : 0
5030 - * We could use other alignment values, but we must maintain the
5031 - * relationship HH alignment <= LL alignment.
5033 - * LL_ALLOCATED_SPACE also takes into account the tailroom the device
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)
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);
5056 -/* These flag bits are private to the generic network queueing
5057 - * layer, they may not be explicitly referenced by any other
5061 -enum netdev_state_t
5063 - __LINK_STATE_START,
5064 - __LINK_STATE_PRESENT,
5065 - __LINK_STATE_NOCARRIER,
5066 - __LINK_STATE_LINKWATCH_PENDING,
5067 - __LINK_STATE_DORMANT,
5072 - * This structure holds at boot time configured netdevice settings. They
5073 - * are then used in the device probing.
5075 -struct netdev_boot_setup {
5076 - char name[IFNAMSIZ];
5079 -#define NETDEV_BOOT_SETUP_MAX 8
5081 -extern int __init netdev_boot_setup(char *str);
5084 - * Structure for NAPI scheduling similar to tasklet but with weighting
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.
5093 - struct list_head poll_list;
5095 - unsigned long state;
5097 - int (*poll)(struct napi_struct *, int);
5098 -#ifdef CONFIG_NETPOLL
5099 - spinlock_t poll_lock;
5101 - struct net_device *dev;
5102 - struct list_head dev_list;
5108 - NAPI_STATE_SCHED, /* Poll is scheduled */
5109 - NAPI_STATE_DISABLE, /* Disable pending */
5112 -extern void __napi_schedule(struct napi_struct *n);
5114 -static inline int napi_disable_pending(struct napi_struct *n)
5116 - return test_bit(NAPI_STATE_DISABLE, &n->state);
5120 - * napi_schedule_prep - check if napi can be scheduled
5121 - * @n: napi context
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.
5128 -static inline int napi_schedule_prep(struct napi_struct *n)
5130 - return !napi_disable_pending(n) &&
5131 - !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
5135 - * napi_schedule - schedule NAPI poll
5136 - * @n: napi context
5138 - * Schedule NAPI poll routine to be called if it is not already
5141 -static inline void napi_schedule(struct napi_struct *n)
5143 - if (napi_schedule_prep(n))
5144 - __napi_schedule(n);
5147 -/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */
5148 -static inline int napi_reschedule(struct napi_struct *napi)
5150 - if (napi_schedule_prep(napi)) {
5151 - __napi_schedule(napi);
5158 - * napi_complete - NAPI processing complete
5159 - * @n: napi context
5161 - * Mark NAPI processing as complete.
5163 -static inline void __napi_complete(struct napi_struct *n)
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);
5171 -static inline void napi_complete(struct napi_struct *n)
5173 - unsigned long flags;
5175 - local_irq_save(flags);
5176 - __napi_complete(n);
5177 - local_irq_restore(flags);
5181 - * napi_disable - prevent NAPI from scheduling
5182 - * @n: napi context
5184 - * Stop NAPI from being scheduled on this context.
5185 - * Waits till any outstanding processing completes.
5187 -static inline void napi_disable(struct napi_struct *n)
5189 - set_bit(NAPI_STATE_DISABLE, &n->state);
5190 - while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
5192 - clear_bit(NAPI_STATE_DISABLE, &n->state);
5196 - * napi_enable - enable NAPI scheduling
5197 - * @n: napi context
5199 - * Resume NAPI from being scheduled on this context.
5200 - * Must be paired with napi_disable.
5202 -static inline void napi_enable(struct napi_struct *n)
5204 - BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
5205 - smp_mb__before_clear_bit();
5206 - clear_bit(NAPI_STATE_SCHED, &n->state);
5211 - * napi_synchronize - wait until NAPI is not running
5212 - * @n: napi context
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.
5218 -static inline void napi_synchronize(const struct napi_struct *n)
5220 - while (test_bit(NAPI_STATE_SCHED, &n->state))
5224 -# define napi_synchronize(n) barrier()
5227 -enum netdev_queue_state_t
5229 - __QUEUE_STATE_XOFF,
5230 - __QUEUE_STATE_FROZEN,
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;
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.
5248 - * FIXME: cleanup struct net_device such that network protocol info
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
5260 - char name[IFNAMSIZ];
5261 - /* device name hash chain */
5262 - struct hlist_node name_hlist;
5265 - * I/O specific fields
5266 - * FIXME: Merge these and struct ifmap into one
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 */
5274 - * Some hardware also needs these fields, but they are not
5275 - * part of the usual set specified in Space.c.
5278 - unsigned char if_port; /* Selectable AUI, TP,..*/
5279 - unsigned char dma; /* DMA channel */
5281 - unsigned long state;
5283 - struct list_head dev_list;
5284 -#ifdef CONFIG_NETPOLL
5285 - struct list_head napi_list;
5288 - /* The device initialization function. Called only once. */
5289 - int (*init)(struct net_device *dev);
5291 - /* ------- Fields preinitialized in Space.c finish here ------- */
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 */
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)
5321 - /* List of features with software fallbacks. */
5322 -#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
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)
5330 - /* Interface index. Unique device identifier */
5335 - struct net_device_stats* (*get_stats)(struct net_device *dev);
5336 - struct net_device_stats stats;
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;
5345 - const struct ethtool_ops *ethtool_ops;
5347 - /* Hardware header description */
5348 - const struct header_ops *header_ops;
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).
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() */
5362 - unsigned char operstate; /* RFC2863 operstate */
5363 - unsigned char link_mode; /* mapping policy to operstate */
5365 - unsigned mtu; /* interface MTU value */
5366 - unsigned short type; /* interface hardware type */
5367 - unsigned short hard_header_len; /* hardware hdr length */
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.
5373 - unsigned short needed_headroom;
5374 - unsigned short needed_tailroom;
5376 - struct net_device *master; /* Pointer to master device of a group,
5377 - * which this device is member of.
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 */
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 */
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;
5395 - /* Protocol specific pointers */
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 */
5407 - * Cache line mostly used on receive path (including eth_type_trans())
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) */
5414 - unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
5416 - struct netdev_queue rx_queue;
5418 - struct netdev_queue *_tx ____cacheline_aligned_in_smp;
5420 - /* Number of TX queues allocated at alloc_netdev_mq() time */
5421 - unsigned int num_tx_queues;
5423 - /* Number of TX queues currently active in device */
5424 - unsigned int real_num_tx_queues;
5426 - unsigned long tx_queue_len; /* Max frames per queue allowed */
5427 - spinlock_t tx_global_lock;
5429 - * One part is mostly used on xmit path (device)
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 */
5437 - int watchdog_timeo; /* used by dev_watchdog() */
5438 - struct timer_list watchdog_timer;
5441 - * refcnt is a very hot point, so align it on SMP
5443 - /* Number of references to this device */
5444 - atomic_t refcnt ____cacheline_aligned_in_smp;
5446 - /* delayed register/unregister */
5447 - struct list_head todo_list;
5448 - /* device index hash chain */
5449 - struct hlist_node index_hlist;
5451 - struct net_device *link_watch_next;
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 */
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);
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,
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,
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);
5491 -#define HAVE_TX_TIMEOUT
5492 - void (*tx_timeout) (struct net_device *dev);
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);
5501 - int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
5502 -#ifdef CONFIG_NETPOLL
5503 - struct netpoll_info *npinfo;
5505 -#ifdef CONFIG_NET_POLL_CONTROLLER
5506 - void (*poll_controller)(struct net_device *dev);
5509 - u16 (*select_queue)(struct net_device *dev,
5510 - struct sk_buff *skb);
5512 -#ifdef CONFIG_NET_NS
5513 - /* Network namespace this network device is inside */
5514 - struct net *nd_net;
5517 - /* mid-layer private */
5520 - /* bridge stuff */
5521 - struct net_bridge_port *br_port;
5523 - struct macvlan_port *macvlan_port;
5525 - struct garp_port *garp_port;
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];
5532 - /* rtnetlink link ops */
5533 - const struct rtnl_link_ops *rtnl_link_ops;
5535 - /* VLAN feature mask */
5536 - unsigned long vlan_features;
5538 - /* for setting kernel sock attribute on TCP connection setup */
5539 -#define GSO_MAX_SIZE 65536
5540 - unsigned int gso_max_size;
5542 -#define to_net_dev(d) container_of(d, struct net_device, dev)
5544 -#define NETDEV_ALIGN 32
5545 -#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
5548 -struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
5549 - unsigned int index)
5551 - return &dev->_tx[index];
5554 -static inline void netdev_for_each_tx_queue(struct net_device *dev,
5555 - void (*f)(struct net_device *,
5556 - struct netdev_queue *,
5562 - for (i = 0; i < dev->num_tx_queues; i++)
5563 - f(dev, &dev->_tx[i], arg);
5567 - * Net namespace inlines
5570 -struct net *dev_net(const struct net_device *dev)
5572 -#ifdef CONFIG_NET_NS
5573 - return dev->nd_net;
5580 -void dev_net_set(struct net_device *dev, struct net *net)
5582 -#ifdef CONFIG_NET_NS
5583 - release_net(dev->nd_net);
5584 - dev->nd_net = hold_net(net);
5589 - * netdev_priv - access network device private data
5590 - * @dev: network device
5592 - * Get network device private data
5594 -static inline void *netdev_priv(const struct net_device *dev)
5596 - return (char *)dev + ((sizeof(struct net_device)
5597 - + NETDEV_ALIGN_CONST)
5598 - & ~NETDEV_ALIGN_CONST);
5601 -/* Set the sysfs physical device reference for the network logical device
5602 - * if set prior to registration will cause a symlink during initialization.
5604 -#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
5607 - * netif_napi_add - initialize a napi context
5608 - * @dev: network device
5609 - * @napi: napi context
5610 - * @poll: polling function
5611 - * @weight: default weight
5613 - * netif_napi_add() must be used to initialize a napi context prior to calling
5614 - * *any* of the other napi related functions.
5616 -static inline void netif_napi_add(struct net_device *dev,
5617 - struct napi_struct *napi,
5618 - int (*poll)(struct napi_struct *, int),
5621 - INIT_LIST_HEAD(&napi->poll_list);
5622 - napi->poll = poll;
5623 - napi->weight = weight;
5624 -#ifdef CONFIG_NETPOLL
5626 - list_add(&napi->dev_list, &dev->napi_list);
5627 - spin_lock_init(&napi->poll_lock);
5628 - napi->poll_owner = -1;
5630 - set_bit(NAPI_STATE_SCHED, &napi->state);
5634 - * netif_napi_del - remove a napi context
5635 - * @napi: napi context
5637 - * netif_napi_del() removes a napi context from the network device napi list
5639 -static inline void netif_napi_del(struct napi_struct *napi)
5641 -#ifdef CONFIG_NETPOLL
5642 - list_del(&napi->dev_list);
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,
5656 - int (*gso_send_check)(struct sk_buff *skb);
5657 - void *af_packet_priv;
5658 - struct list_head list;
5661 -#include <linux/interrupt.h>
5662 -#include <linux/notifier.h>
5664 -extern rwlock_t dev_base_lock; /* Device list lock */
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)
5675 -static inline struct net_device *next_net_device(struct net_device *dev)
5677 - struct list_head *lh;
5680 - net = dev_net(dev);
5681 - lh = dev->dev_list.next;
5682 - return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
5685 -static inline struct net_device *first_net_device(struct net *net)
5687 - return list_empty(&net->dev_base_head) ? NULL :
5688 - net_device_entry(net->dev_base_head.next);
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);
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);
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,
5728 - if (!dev->header_ops || !dev->header_ops->create)
5731 - return dev->header_ops->create(skb, dev, type, daddr, saddr, len);
5734 -static inline int dev_parse_header(const struct sk_buff *skb,
5735 - unsigned char *haddr)
5737 - const struct net_device *dev = skb->dev;
5739 - if (!dev->header_ops || !dev->header_ops->parse)
5741 - return dev->header_ops->parse(skb, haddr);
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)
5748 - return register_gifconf(family, NULL);
5752 - * Incoming packets are placed on per-cpu queues so that
5753 - * no locking is needed.
5755 -struct softnet_data
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;
5762 - struct napi_struct backlog;
5763 -#ifdef CONFIG_NET_DMA
5764 - struct dma_chan *net_dma;
5768 -DECLARE_PER_CPU(struct softnet_data,softnet_data);
5770 -#define HAVE_NETIF_QUEUE
5772 -extern void __netif_schedule(struct Qdisc *q);
5774 -static inline void netif_schedule_queue(struct netdev_queue *txq)
5776 - if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
5777 - __netif_schedule(txq->qdisc);
5780 -static inline void netif_tx_schedule_all(struct net_device *dev)
5784 - for (i = 0; i < dev->num_tx_queues; i++)
5785 - netif_schedule_queue(netdev_get_tx_queue(dev, i));
5788 -static inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
5790 - clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
5794 - * netif_start_queue - allow transmit
5795 - * @dev: network device
5797 - * Allow upper layers to call the device hard_start_xmit routine.
5799 -static inline void netif_start_queue(struct net_device *dev)
5801 - netif_tx_start_queue(netdev_get_tx_queue(dev, 0));
5804 -static inline void netif_tx_start_all_queues(struct net_device *dev)
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);
5814 -static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
5816 -#ifdef CONFIG_NETPOLL_TRAP
5817 - if (netpoll_trap()) {
5818 - clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
5822 - if (test_and_clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state))
5823 - __netif_schedule(dev_queue->qdisc);
5827 - * netif_wake_queue - restart transmit
5828 - * @dev: network device
5830 - * Allow upper layers to call the device hard_start_xmit routine.
5831 - * Used for flow control when transmit resources are available.
5833 -static inline void netif_wake_queue(struct net_device *dev)
5835 - netif_tx_wake_queue(netdev_get_tx_queue(dev, 0));
5838 -static inline void netif_tx_wake_all_queues(struct net_device *dev)
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);
5848 -static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
5850 - set_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
5854 - * netif_stop_queue - stop transmitted packets
5855 - * @dev: network device
5857 - * Stop upper layers calling the device hard_start_xmit routine.
5858 - * Used for flow control when transmit resources are unavailable.
5860 -static inline void netif_stop_queue(struct net_device *dev)
5862 - netif_tx_stop_queue(netdev_get_tx_queue(dev, 0));
5865 -static inline void netif_tx_stop_all_queues(struct net_device *dev)
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);
5875 -static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
5877 - return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
5881 - * netif_queue_stopped - test if transmit queue is flowblocked
5882 - * @dev: network device
5884 - * Test if transmit queue on device is currently unable to send.
5886 -static inline int netif_queue_stopped(const struct net_device *dev)
5888 - return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
5891 -static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue)
5893 - return test_bit(__QUEUE_STATE_FROZEN, &dev_queue->state);
5897 - * netif_running - test if up
5898 - * @dev: network device
5900 - * Test if the device has been brought up.
5902 -static inline int netif_running(const struct net_device *dev)
5904 - return test_bit(__LINK_STATE_START, &dev->state);
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.
5915 - * netif_start_subqueue - allow sending packets on subqueue
5916 - * @dev: network device
5917 - * @queue_index: sub queue index
5919 - * Start individual transmit queue of a device with multiple transmit queues.
5921 -static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
5923 - struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
5924 - clear_bit(__QUEUE_STATE_XOFF, &txq->state);
5928 - * netif_stop_subqueue - stop sending packets on subqueue
5929 - * @dev: network device
5930 - * @queue_index: sub queue index
5932 - * Stop individual transmit queue of a device with multiple transmit queues.
5934 -static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
5936 - struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
5937 -#ifdef CONFIG_NETPOLL_TRAP
5938 - if (netpoll_trap())
5941 - set_bit(__QUEUE_STATE_XOFF, &txq->state);
5945 - * netif_subqueue_stopped - test status of subqueue
5946 - * @dev: network device
5947 - * @queue_index: sub queue index
5949 - * Check individual transmit queue of a device with multiple transmit queues.
5951 -static inline int __netif_subqueue_stopped(const struct net_device *dev,
5954 - struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
5955 - return test_bit(__QUEUE_STATE_XOFF, &txq->state);
5958 -static inline int netif_subqueue_stopped(const struct net_device *dev,
5959 - struct sk_buff *skb)
5961 - return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
5965 - * netif_wake_subqueue - allow sending packets on subqueue
5966 - * @dev: network device
5967 - * @queue_index: sub queue index
5969 - * Resume individual transmit queue of a device with multiple transmit queues.
5971 -static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
5973 - struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
5974 -#ifdef CONFIG_NETPOLL_TRAP
5975 - if (netpoll_trap())
5978 - if (test_and_clear_bit(__QUEUE_STATE_XOFF, &txq->state))
5979 - __netif_schedule(txq->qdisc);
5983 - * netif_is_multiqueue - test if device has multiple transmit queues
5984 - * @dev: network device
5986 - * Check if device has multiple transmit queues
5988 -static inline int netif_is_multiqueue(const struct net_device *dev)
5990 - return (dev->num_tx_queues > 1);
5993 -/* Use this variant when it is known for sure that it
5994 - * is executing from hardware interrupt context or with hardware interrupts
5997 -extern void dev_kfree_skb_irq(struct sk_buff *skb);
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.
6003 -extern void dev_kfree_skb_any(struct sk_buff *skb);
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);
6026 -extern int netdev_budget;
6028 -/* Called by rtnetlink.c:rtnl_unlock() */
6029 -extern void netdev_run_todo(void);
6032 - * dev_put - release reference to device
6033 - * @dev: network device
6035 - * Release reference to device to allow it to be freed.
6037 -static inline void dev_put(struct net_device *dev)
6039 - atomic_dec(&dev->refcnt);
6043 - * dev_hold - get reference to device
6044 - * @dev: network device
6046 - * Hold reference to device to keep it from being freed.
6048 -static inline void dev_hold(struct net_device *dev)
6050 - atomic_inc(&dev->refcnt);
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.
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.
6062 -extern void linkwatch_fire_event(struct net_device *dev);
6065 - * netif_carrier_ok - test if carrier present
6066 - * @dev: network device
6068 - * Check if carrier is present on device
6070 -static inline int netif_carrier_ok(const struct net_device *dev)
6072 - return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
6075 -extern void __netdev_watchdog_up(struct net_device *dev);
6077 -extern void netif_carrier_on(struct net_device *dev);
6079 -extern void netif_carrier_off(struct net_device *dev);
6082 - * netif_dormant_on - mark device as dormant.
6083 - * @dev: network device
6085 - * Mark device as dormant (as per RFC2863).
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.
6094 -static inline void netif_dormant_on(struct net_device *dev)
6096 - if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state))
6097 - linkwatch_fire_event(dev);
6101 - * netif_dormant_off - set device as not dormant.
6102 - * @dev: network device
6104 - * Device is not in dormant state.
6106 -static inline void netif_dormant_off(struct net_device *dev)
6108 - if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state))
6109 - linkwatch_fire_event(dev);
6113 - * netif_dormant - test if carrier present
6114 - * @dev: network device
6116 - * Check if carrier is present on device
6118 -static inline int netif_dormant(const struct net_device *dev)
6120 - return test_bit(__LINK_STATE_DORMANT, &dev->state);
6125 - * netif_oper_up - test if device is operational
6126 - * @dev: network device
6128 - * Check if carrier is operational
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 */);
6136 - * netif_device_present - is device available or removed
6137 - * @dev: network device
6139 - * Check if device has not been removed from system.
6141 -static inline int netif_device_present(struct net_device *dev)
6143 - return test_bit(__LINK_STATE_PRESENT, &dev->state);
6146 -extern void netif_device_detach(struct net_device *dev);
6148 -extern void netif_device_attach(struct net_device *dev);
6151 - * Network interface message level settings
6153 -#define HAVE_NETIF_MSG 1
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,
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)
6189 -static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
6192 - if (debug_value < 0 || debug_value >= (sizeof(u32) * 8))
6193 - return default_msg_enable_bits;
6194 - if (debug_value == 0) /* no output */
6196 - /* set low N bits */
6197 - return (1 << debug_value) - 1;
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)
6204 - return napi_schedule_prep(napi);
6207 -/* Add interface to tail of rx poll list. This assumes that _prep has
6208 - * already been called and returned 1.
6210 -static inline void __netif_rx_schedule(struct net_device *dev,
6211 - struct napi_struct *napi)
6213 - __napi_schedule(napi);
6216 -/* Try to reschedule poll. Called by irq handler. */
6218 -static inline void netif_rx_schedule(struct net_device *dev,
6219 - struct napi_struct *napi)
6221 - if (netif_rx_schedule_prep(dev, napi))
6222 - __netif_rx_schedule(dev, napi);
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)
6229 - if (napi_schedule_prep(napi)) {
6230 - __netif_rx_schedule(dev, napi);
6236 -/* same as netif_rx_complete, except that local_irq_save(flags)
6237 - * has already been issued
6239 -static inline void __netif_rx_complete(struct net_device *dev,
6240 - struct napi_struct *napi)
6242 - __napi_complete(napi);
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().
6250 -static inline void netif_rx_complete(struct net_device *dev,
6251 - struct napi_struct *napi)
6253 - unsigned long flags;
6255 - local_irq_save(flags);
6256 - __netif_rx_complete(dev, napi);
6257 - local_irq_restore(flags);
6260 -static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
6262 - spin_lock(&txq->_xmit_lock);
6263 - txq->xmit_lock_owner = cpu;
6266 -static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
6268 - spin_lock_bh(&txq->_xmit_lock);
6269 - txq->xmit_lock_owner = smp_processor_id();
6272 -static inline int __netif_tx_trylock(struct netdev_queue *txq)
6274 - int ok = spin_trylock(&txq->_xmit_lock);
6276 - txq->xmit_lock_owner = smp_processor_id();
6280 -static inline void __netif_tx_unlock(struct netdev_queue *txq)
6282 - txq->xmit_lock_owner = -1;
6283 - spin_unlock(&txq->_xmit_lock);
6286 -static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
6288 - txq->xmit_lock_owner = -1;
6289 - spin_unlock_bh(&txq->_xmit_lock);
6293 - * netif_tx_lock - grab network device transmit lock
6294 - * @dev: network device
6295 - * @cpu: cpu number of lock owner
6297 - * Get network device transmit lock
6299 -static inline void netif_tx_lock(struct net_device *dev)
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);
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.
6315 - __netif_tx_lock(txq, cpu);
6316 - set_bit(__QUEUE_STATE_FROZEN, &txq->state);
6317 - __netif_tx_unlock(txq);
6321 -static inline void netif_tx_lock_bh(struct net_device *dev)
6323 - local_bh_disable();
6324 - netif_tx_lock(dev);
6327 -static inline void netif_tx_unlock(struct net_device *dev)
6331 - for (i = 0; i < dev->num_tx_queues; i++) {
6332 - struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
6334 - /* No need to grab the _xmit_lock here. If the
6335 - * queue is not stopped for another reason, we
6336 - * force a schedule.
6338 - clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
6339 - if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
6340 - __netif_schedule(txq->qdisc);
6342 - spin_unlock(&dev->tx_global_lock);
6345 -static inline void netif_tx_unlock_bh(struct net_device *dev)
6347 - netif_tx_unlock(dev);
6348 - local_bh_enable();
6351 -#define HARD_TX_LOCK(dev, txq, cpu) { \
6352 - if ((dev->features & NETIF_F_LLTX) == 0) { \
6353 - __netif_tx_lock(txq, cpu); \
6357 -#define HARD_TX_UNLOCK(dev, txq) { \
6358 - if ((dev->features & NETIF_F_LLTX) == 0) { \
6359 - __netif_tx_unlock(txq); \
6363 -static inline void netif_tx_disable(struct net_device *dev)
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);
6373 - __netif_tx_lock(txq, cpu);
6374 - netif_tx_stop_queue(txq);
6375 - __netif_tx_unlock(txq);
6377 - local_bh_enable();
6380 -static inline void netif_addr_lock(struct net_device *dev)
6382 - spin_lock(&dev->addr_list_lock);
6385 -static inline void netif_addr_lock_bh(struct net_device *dev)
6387 - spin_lock_bh(&dev->addr_list_lock);
6390 -static inline void netif_addr_unlock(struct net_device *dev)
6392 - spin_unlock(&dev->addr_list_lock);
6395 -static inline void netif_addr_unlock_bh(struct net_device *dev)
6397 - spin_unlock_bh(&dev->addr_list_lock);
6400 -/* These functions live elsewhere (drivers/net/net_init.c, but related) */
6402 -extern void ether_setup(struct net_device *dev);
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);
6441 -extern void netdev_rx_csum_fault(struct net_device *dev);
6443 -static inline void netdev_rx_csum_fault(struct net_device *dev)
6447 -/* rx skb timestamps */
6448 -extern void net_enable_timestamp(void);
6449 -extern void net_disable_timestamp(void);
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);
6457 -extern int netdev_class_create_file(struct class_attribute *class_attr);
6458 -extern void netdev_class_remove_file(struct class_attribute *class_attr);
6460 -extern char *netdev_drivername(struct net_device *dev, char *buffer, int len);
6462 -extern void linkwatch_run_queue(void);
6464 -extern int netdev_compute_features(unsigned long all, unsigned long one);
6466 -static inline int net_gso_ok(int features, int gso_type)
6468 - int feature = gso_type << NETIF_F_GSO_SHIFT;
6469 - return (features & feature) == feature;
6472 -static inline int skb_gso_ok(struct sk_buff *skb, int features)
6474 - return net_gso_ok(features, skb_shinfo(skb)->gso_type);
6477 -static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
6479 - return skb_is_gso(skb) &&
6480 - (!skb_gso_ok(skb, dev->features) ||
6481 - unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
6484 -static inline void netif_set_gso_max_size(struct net_device *dev,
6485 - unsigned int size)
6487 - dev->gso_max_size = size;
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.
6494 -static inline int skb_bond_should_drop(struct sk_buff *skb)
6496 - struct net_device *dev = skb->dev;
6497 - struct net_device *master = dev->master;
6500 - (dev->priv_flags & IFF_SLAVE_INACTIVE)) {
6501 - if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
6502 - skb->protocol == __constant_htons(ETH_P_ARP))
6505 - if (master->priv_flags & IFF_MASTER_ALB) {
6506 - if (skb->pkt_type != PACKET_BROADCAST &&
6507 - skb->pkt_type != PACKET_MULTICAST)
6510 - if (master->priv_flags & IFF_MASTER_8023AD &&
6511 - skb->protocol == __constant_htons(ETH_P_SLOW))
6519 -#endif /* __KERNEL__ */
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
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);
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)
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
6553 #ifdef ARCH_HAS_PREFETCH
6555 - char *end = (char*)(addr) + len;
6556 + char *end = addr + len;
6558 - for (cp = (char*)(addr); cp < end; cp += PREFETCH_STRIDE)
6559 + for (cp = addr; cp < end; cp += PREFETCH_STRIDE)
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
6568 static inline struct net *PDE_NET(struct proc_dir_entry *pde)
6570 - return (struct net *) pde->parent->data;
6571 + return pde->parent->data;
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
6579 static inline void list_del_rcu(struct list_head *entry)
6581 __list_del(entry->prev, entry->next);
6582 - entry->prev = (struct list_head *) LIST_POISON2;
6583 + entry->prev = LIST_POISON2;
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;
6597 static inline void hlist_del_rcu(struct hlist_node *n)
6600 - n->pprev = (struct hlist_node **) LIST_POISON2;
6601 + n->pprev = LIST_POISON2;
6606 rcu_assign_pointer(*new->pprev, new);
6608 new->next->pprev = &new->next;
6609 - old->pprev = (struct hlist_node **) LIST_POISON2;
6610 + old->pprev = LIST_POISON2;
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
6619 } reiserfs_proc_info_data_t;
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;
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
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);
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
6644 static inline void *sg_virt(struct scatterlist *sg)
6646 - return (char *) page_address(sg_page(sg)) + sg->offset;
6647 + return page_address(sg_page(sg)) + sg->offset;
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 @@
6656 extern void sched_init(void);
6657 extern void sched_init_smp(void);
6659 -asmlinkage void schedule_tail(struct task_struct *prev);
6661 extern asmlinkage void schedule_tail(struct task_struct *prev);
6664 extern void init_idle(struct task_struct *idle, int cpu);
6665 extern void init_idle_bootup_task(struct task_struct *idle);
6667 @@ -1982,7 +1977,7 @@
6669 static inline unsigned long *end_of_stack(struct task_struct *p)
6671 - return (unsigned long *)((char *) task_thread_info(p) + 1);
6672 + return (unsigned long *)(task_thread_info(p) + 1);
6676 @@ -1991,7 +1986,7 @@
6678 void *stack = task_stack_page(current);
6680 - return (obj >= stack) && ((char *) obj < ((char *) stack + THREAD_SIZE));
6681 + return (obj >= stack) && (obj < (stack + THREAD_SIZE));
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
6689 -#ifndef _LINUX_SCHED_H
6690 -#define _LINUX_SCHED_H
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 */
6721 - * Scheduling policies
6723 -#define SCHED_NORMAL 0
6724 -#define SCHED_FIFO 1
6726 -#define SCHED_BATCH 3
6727 -/* SCHED_ISO: reserved but not implemented yet */
6728 -#define SCHED_IDLE 5
6732 -struct sched_param {
6733 - int sched_priority;
6736 -#include <asm/param.h> /* for HZ */
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>
6751 -#include <asm/system.h>
6752 -#include <asm/page.h>
6753 -#include <asm/ptrace.h>
6754 -#include <asm/cputime.h>
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>
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>
6780 -#include <asm/processor.h>
6783 -struct exec_domain;
6784 -struct futex_pi_state;
6785 -struct robust_list_head;
6789 - * List of flags we want to share for kernel threads,
6790 - * if only because they are not used by them anyway.
6792 -#define CLONE_KERNEL (CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
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.
6804 -extern unsigned long avenrun[]; /* Load averages */
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) */
6813 -#define CALC_LOAD(load,exp,n) \
6815 - load += n*(FIXED_1-exp); \
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);
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);
6834 -print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
6837 -proc_sched_show_task(struct task_struct *p, struct seq_file *m)
6840 -static inline void proc_sched_set_task(struct task_struct *p)
6844 -print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
6849 -extern unsigned long long time_sync_thresh;
6852 - * Task state bitmask. NOTE! These bits are also
6853 - * encoded in fs/proc/array.c: get_task_state().
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
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
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)
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)
6882 -/* get_task_state() */
6883 -#define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \
6884 - TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \
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)
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))
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
6904 - * set_current_state(TASK_UNINTERRUPTIBLE);
6905 - * if (do_i_need_to_sleep())
6908 - * If the caller does not need such serialisation then use __set_current_state()
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))
6915 -/* Task command name length */
6916 -#define TASK_COMM_LEN 16
6918 -#include <linux/spinlock.h>
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).
6926 -extern rwlock_t tasklist_lock;
6927 -extern spinlock_t mmlist_lock;
6929 -struct task_struct;
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);
6937 -extern int runqueue_is_locked(void);
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);
6943 -static inline int select_nohz_load_balancer(int cpu)
6949 -extern unsigned long rt_needs_cpu(int cpu);
6952 - * Only dump TASK_* tasks. (0 for all tasks)
6954 -extern void show_state_filter(unsigned long state_filter);
6956 -static inline void show_state(void)
6958 - show_state_filter(0);
6961 -extern void show_regs(struct pt_regs *);
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).
6968 -extern void show_stack(struct task_struct *task, unsigned long *sp);
6970 -void io_schedule(void);
6971 -long io_schedule_timeout(long timeout);
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);
6980 -extern void sched_show_task(struct task_struct *p);
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;
6992 -static inline void softlockup_tick(void)
6995 -static inline void spawn_softlockup_task(void)
6998 -static inline void touch_softlockup_watchdog(void)
7001 -static inline void touch_all_softlockup_watchdogs(void)
7007 -/* Attach to any functions which should be ignored in wchan output. */
7008 -#define __sched __attribute__((__section__(".sched.text")))
7010 -/* Linker adds these: start and end of __sched functions */
7011 -extern char __sched_text_start[], __sched_text_end[];
7013 -/* Is this address in the __sched functions? */
7014 -extern int in_sched_functions(unsigned long addr);
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);
7024 -struct user_namespace;
7026 -/* Maximum number of active map areas.. This is a random (large) number */
7027 -#define DEFAULT_MAX_MAP_COUNT 65536
7029 -extern int sysctl_max_map_count;
7031 -#include <linux/aio.h>
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);
7043 -#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
7045 - * The mm counters are not protected by its page_table_lock,
7046 - * so must be incremented atomically.
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 */
7054 - * The mm counters are protected by its page_table_lock,
7055 - * so can be incremented directly.
7057 -#define __set_mm_counter(mm, member, value) (mm)->_##member = (value)
7058 -#define get_mm_counter(mm, member) ((mm)->_##member)
7060 -#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
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))
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; \
7076 -#define update_hiwater_vm(mm) do { \
7077 - if ((mm)->hiwater_vm < (mm)->total_vm) \
7078 - (mm)->hiwater_vm = (mm)->total_vm; \
7081 -extern void set_dumpable(struct mm_struct *mm, int value);
7082 -extern int get_dumpable(struct mm_struct *mm);
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
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))
7103 -struct sighand_struct {
7105 - struct k_sigaction action[_NSIG];
7106 - spinlock_t siglock;
7107 - wait_queue_head_t signalfd_wqh;
7110 -struct pacct_struct {
7113 - unsigned long ac_mem;
7114 - cputime_t ac_utime, ac_stime;
7115 - unsigned long ac_minflt, ac_majflt;
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.
7125 -struct signal_struct {
7129 - wait_queue_head_t wait_chldexit; /* for wait4() */
7131 - /* current thread group signal load-balancing target: */
7132 - struct task_struct *curr_target;
7134 - /* shared signal handling: */
7135 - struct sigpending shared_pending;
7137 - /* thread group exit support */
7138 - int group_exit_code;
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.
7144 - struct task_struct *group_exit_task;
7147 - /* thread group stop support, overloads group_exit_code too */
7148 - int group_stop_count;
7149 - unsigned int flags; /* see SIGNAL_* flags below */
7151 - /* POSIX.1b Interval Timers */
7152 - struct list_head posix_timers;
7154 - /* ITIMER_REAL timer for the process */
7155 - struct hrtimer real_timer;
7156 - struct pid *leader_pid;
7157 - ktime_t it_real_incr;
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;
7163 - /* job control IDs */
7166 - * pgrp and session fields are deprecated.
7167 - * use the task_session_Xnr and task_pgrp_Xnr routines below
7171 - pid_t pgrp __deprecated;
7175 - struct pid *tty_old_pgrp;
7178 - pid_t session __deprecated;
7182 - /* boolean value for session group leader */
7185 - struct tty_struct *tty; /* NULL if no tty */
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.
7193 - cputime_t utime, stime, cutime, cstime;
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;
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.)
7207 - unsigned long long sum_sched_runtime;
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.
7218 - struct rlimit rlim[RLIM_NLIMITS];
7220 - struct list_head cpu_timers[3];
7222 - /* keep the process-shared keyrings here so that they do the right
7223 - * thing in threads created with CLONE_THREAD */
7225 - struct key *session_keyring; /* keyring inherited over fork */
7226 - struct key *process_keyring; /* keyring private to this process */
7228 -#ifdef CONFIG_BSD_PROCESS_ACCT
7229 - struct pacct_struct pacct; /* per-process accounting information */
7231 -#ifdef CONFIG_TASKSTATS
7232 - struct taskstats *stats;
7234 -#ifdef CONFIG_AUDIT
7235 - unsigned audit_tty;
7236 - struct tty_audit_buf *tty_audit_buf;
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
7246 - * Bits in flags field of signal_struct.
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 */
7253 - * Pending notifications to parent.
7255 -#define SIGNAL_CLD_STOPPED 0x00000010
7256 -#define SIGNAL_CLD_CONTINUED 0x00000020
7257 -#define SIGNAL_CLD_MASK (SIGNAL_CLD_STOPPED|SIGNAL_CLD_CONTINUED)
7259 -#define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */
7261 -/* If true, all threads except ->group_exit_task have pending SIGKILL */
7262 -static inline int signal_group_exit(const struct signal_struct *sig)
7264 - return (sig->flags & SIGNAL_GROUP_EXIT) ||
7265 - (sig->group_exit_task != NULL);
7269 - * Some day this will be a full-fledged user tracking system..
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? */
7280 -#ifdef CONFIG_EPOLL
7281 - atomic_t epoll_watches; /* The number of file descriptors currently watched */
7283 -#ifdef CONFIG_POSIX_MQUEUE
7284 - /* protected by mq_lock */
7285 - unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */
7287 - unsigned long locked_shm; /* How many pages of mlocked shm ? */
7290 - struct key *uid_keyring; /* UID specific keyring */
7291 - struct key *session_keyring; /* UID's default session keyring */
7294 - /* Hash table maintenance information */
7295 - struct hlist_node uidhash_node;
7298 -#ifdef CONFIG_USER_SCHED
7299 - struct task_group *tg;
7300 -#ifdef CONFIG_SYSFS
7301 - struct kobject kobj;
7302 - struct work_struct work;
7307 -extern int uids_sysfs_init(void);
7309 -extern struct user_struct *find_user(uid_t);
7311 -extern struct user_struct root_user;
7312 -#define INIT_USER (&root_user)
7314 -struct backing_dev_info;
7315 -struct reclaim_state;
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 */
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
7329 - unsigned int bkl_count;
7332 -#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
7334 -#ifdef CONFIG_SCHEDSTATS
7335 -extern const struct file_operations proc_schedstat_operations;
7336 -#endif /* CONFIG_SCHEDSTATS */
7338 -#ifdef CONFIG_TASK_DELAY_ACCT
7339 -struct task_delay_info {
7341 - unsigned int flags; /* Private per-task flags */
7343 - /* For each stat XXX, add following, aligned appropriately
7345 - * struct timespec XXX_start, XXX_end;
7349 - * Atomicity of updates to XXX_delay, XXX_count protected by
7350 - * single lock above (split into XXX_lock if contention is an issue).
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.
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 */
7366 - struct timespec freepages_start, freepages_end;
7367 - u64 freepages_delay; /* wait for memory reclaim */
7368 - u32 freepages_count; /* total count of memory reclaim */
7370 -#endif /* CONFIG_TASK_DELAY_ACCT */
7372 -static inline int sched_info_on(void)
7374 -#ifdef CONFIG_SCHEDSTATS
7376 -#elif defined(CONFIG_TASK_DELAY_ACCT)
7377 - extern int delayacct_on;
7378 - return delayacct_on;
7384 -enum cpu_idle_type {
7388 - CPU_MAX_IDLE_TYPES
7392 - * sched-domains (multiprocessor balancing) declarations:
7396 - * Increase resolution of nice-level calculations:
7398 -#define SCHED_LOAD_SHIFT 10
7399 -#define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT)
7401 -#define SCHED_LOAD_SCALE_FUZZ SCHED_LOAD_SCALE
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 */
7417 -#define BALANCE_FOR_MC_POWER \
7418 - (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0)
7420 -#define BALANCE_FOR_PKG_POWER \
7421 - ((sched_mc_power_savings || sched_smt_power_savings) ? \
7422 - SD_POWERSAVINGS_BALANCE : 0)
7424 -#define test_sd_parent(sd, flag) ((sd->parent && \
7425 - (sd->parent->flags & flag)) ? 1 : 0)
7428 -struct sched_group {
7429 - struct sched_group *next; /* Must be a circular list */
7430 - cpumask_t cpumask;
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
7437 - unsigned int __cpu_power;
7439 - * reciprocal value of cpu_power to avoid expensive divides
7440 - * (see include/linux/reciprocal_div.h)
7442 - u32 reciprocal_cpu_power;
7445 -enum sched_domain_level {
7455 -struct sched_domain_attr {
7456 - int relax_domain_level;
7459 -#define SD_ATTR_INIT (struct sched_domain_attr) { \
7460 - .relax_domain_level = -1, \
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;
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 */
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];
7500 - /* Active load balancing */
7501 - unsigned int alb_count;
7502 - unsigned int alb_failed;
7503 - unsigned int alb_pushed;
7505 - /* SD_BALANCE_EXEC stats */
7506 - unsigned int sbe_count;
7507 - unsigned int sbe_balanced;
7508 - unsigned int sbe_pushed;
7510 - /* SD_BALANCE_FORK stats */
7511 - unsigned int sbf_count;
7512 - unsigned int sbf_balanced;
7513 - unsigned int sbf_pushed;
7515 - /* try_to_wake_up() stats */
7516 - unsigned int ttwu_wake_remote;
7517 - unsigned int ttwu_move_affine;
7518 - unsigned int ttwu_move_balance;
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);
7526 -#else /* CONFIG_SMP */
7528 -struct sched_domain_attr;
7531 -partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
7532 - struct sched_domain_attr *dattr_new)
7535 -#endif /* !CONFIG_SMP */
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 {
7543 - gid_t small_block[NGROUPS_SMALL];
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.
7554 -#define get_group_info(group_info) do { \
7555 - atomic_inc(&(group_info)->usage); \
7558 -#define put_group_info(group_info) do { \
7559 - if (atomic_dec_and_test(&(group_info)->usage)) \
7560 - groups_free(group_info); \
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])
7571 -#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK
7572 -extern void prefetch_stack(struct task_struct *t);
7574 -static inline void prefetch_stack(struct task_struct *t) { }
7577 -struct audit_context; /* See audit.c */
7579 -struct pipe_inode_info;
7580 -struct uts_namespace;
7583 -struct sched_domain;
7585 -struct sched_class {
7586 - const struct sched_class *next;
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);
7593 - void (*check_preempt_curr) (struct rq *rq, struct task_struct *p);
7595 - struct task_struct * (*pick_next_task) (struct rq *rq);
7596 - void (*put_prev_task) (struct rq *rq, struct task_struct *p);
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);
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);
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);
7618 - void (*rq_online)(struct rq *rq);
7619 - void (*rq_offline)(struct rq *rq);
7621 - void (*switched_from) (struct rq *this_rq, struct task_struct *task,
7623 - void (*switched_to) (struct rq *this_rq, struct task_struct *task,
7625 - void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
7626 - int oldprio, int running);
7628 -#ifdef CONFIG_FAIR_GROUP_SCHED
7629 - void (*moved_group) (struct task_struct *p);
7633 -struct load_weight {
7634 - unsigned long weight, inv_weight;
7638 - * CFS stats for a schedulable entity (task, task-group etc)
7640 - * Current field usage histogram:
7642 - * 4 se->block_start
7644 - * 4 se->sleep_start
7645 - * 6 se->load.weight
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;
7654 - u64 sum_exec_runtime;
7656 - u64 prev_sum_exec_runtime;
7661 -#ifdef CONFIG_SCHEDSTATS
7669 - s64 sum_sleep_runtime;
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;
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;
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;
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;
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;
7720 -struct task_struct {
7721 - volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
7724 - unsigned int flags; /* per process flags, defined below */
7725 - unsigned int ptrace;
7727 - int lock_depth; /* BKL lock depth */
7730 -#ifdef __ARCH_WANT_UNLOCKED_CTXSW
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;
7741 -#ifdef CONFIG_PREEMPT_NOTIFIERS
7742 - /* list of struct preempt_notifier: */
7743 - struct hlist_head preempt_notifiers;
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
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;
7760 - unsigned int policy;
7761 - cpumask_t cpus_allowed;
7763 -#ifdef CONFIG_PREEMPT_RCU
7764 - int rcu_read_lock_nesting;
7765 - int rcu_flipctr_idx;
7766 -#endif /* #ifdef CONFIG_PREEMPT_RCU */
7768 -#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
7769 - struct sched_info sched_info;
7772 - struct list_head tasks;
7774 - struct mm_struct *mm, *active_mm;
7777 - struct linux_binfmt *binfmt;
7779 - int exit_code, exit_signal;
7780 - int pdeath_signal; /* The signal sent when the parent dies */
7782 - unsigned int personality;
7783 - unsigned did_exec:1;
7787 -#ifdef CONFIG_CC_STACKPROTECTOR
7788 - /* Canary value for the -fstack-protector gcc feature */
7789 - unsigned long stack_canary;
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)
7796 - struct task_struct *real_parent; /* real parent process */
7797 - struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */
7799 - * children/sibling forms the list of my natural children
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 */
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.
7810 - struct list_head ptraced;
7811 - struct list_head ptrace_entry;
7813 - /* PID/PID hash table linkage. */
7814 - struct pid_link pids[PIDTYPE_MAX];
7815 - struct list_head thread_group;
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 */
7821 - cputime_t utime, stime, utimescaled, stimescaled;
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;
7830 - cputime_t it_prof_expires, it_virt_expires;
7831 - unsigned long long it_sched_expires;
7832 - struct list_head cpu_timers[3];
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;
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 */
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
7854 - struct sysv_sem sysvsem;
7856 -#ifdef CONFIG_DETECT_SOFTLOCKUP
7857 -/* hung task detection */
7858 - unsigned long last_switch_timestamp;
7859 - unsigned long last_switch_count;
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;
7868 - struct nsproxy *nsproxy;
7869 -/* signal handlers */
7870 - struct signal_struct *signal;
7871 - struct sighand_struct *sighand;
7873 - sigset_t blocked, real_blocked;
7874 - sigset_t saved_sigmask; /* restored if set_restore_sigmask() was used */
7875 - struct sigpending pending;
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
7885 - struct audit_context *audit_context;
7886 -#ifdef CONFIG_AUDITSYSCALL
7888 - unsigned int sessionid;
7890 - seccomp_t seccomp;
7892 -/* vserver context data */
7893 - struct vx_info *vx_info;
7894 - struct nx_info *nx_info;
7900 -/* Thread group tracking */
7901 - u32 parent_exec_id;
7903 -/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
7904 - spinlock_t alloc_lock;
7906 - /* Protection of the PI data structures: */
7907 - spinlock_t pi_lock;
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;
7916 -#ifdef CONFIG_DEBUG_MUTEXES
7917 - /* mutex deadlock detection */
7918 - struct mutex_waiter *blocked_on;
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;
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];
7943 -/* journalling filesystem info */
7944 - void *journal_info;
7946 -/* stacked block device info */
7947 - struct bio *bio_list, **bio_tail;
7950 - struct reclaim_state *reclaim_state;
7952 - struct backing_dev_info *backing_dev_info;
7954 - struct io_context *io_context;
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 */
7964 -#ifdef CONFIG_CPUSETS
7965 - nodemask_t mems_allowed;
7966 - int cpuset_mems_generation;
7967 - int cpuset_mem_spread_rotor;
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;
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;
7980 - struct list_head pi_state_list;
7981 - struct futex_pi_state *pi_state_cache;
7984 - struct mempolicy *mempolicy;
7987 - atomic_t fs_excl; /* holding fs exclusive resources */
7988 - struct rcu_head rcu;
7990 - struct list_head *scm_work_list;
7993 - * cache last used pipe for splice
7995 - struct pipe_inode_info *splice_pipe;
7996 -#ifdef CONFIG_TASK_DELAY_ACCT
7997 - struct task_delay_info *delays;
7999 -#ifdef CONFIG_FAULT_INJECTION
8002 - struct prop_local_single dirties;
8003 -#ifdef CONFIG_LATENCYTOP
8004 - int latency_record_count;
8005 - struct latency_record latency_record[LT_SAVECOUNT];
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.
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.
8022 -#define MAX_USER_RT_PRIO 100
8023 -#define MAX_RT_PRIO MAX_USER_RT_PRIO
8025 -#define MAX_PRIO (MAX_RT_PRIO + 40)
8026 -#define DEFAULT_PRIO (MAX_RT_PRIO + 20)
8028 -static inline int rt_prio(int prio)
8030 - if (unlikely(prio < MAX_RT_PRIO))
8035 -static inline int rt_task(struct task_struct *p)
8037 - return rt_prio(p->prio);
8040 -static inline void set_task_session(struct task_struct *tsk, pid_t session)
8042 - tsk->signal->__session = session;
8045 -static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp)
8047 - tsk->signal->__pgrp = pgrp;
8050 -static inline struct pid *task_pid(struct task_struct *task)
8052 - return task->pids[PIDTYPE_PID].pid;
8055 -static inline struct pid *task_tgid(struct task_struct *task)
8057 - return task->group_leader->pids[PIDTYPE_PID].pid;
8060 -static inline struct pid *task_pgrp(struct task_struct *task)
8062 - return task->group_leader->pids[PIDTYPE_PGID].pid;
8065 -static inline struct pid *task_session(struct task_struct *task)
8067 - return task->group_leader->pids[PIDTYPE_SID].pid;
8070 -struct pid_namespace;
8073 - * the helpers to get the task's different pids as they are seen
8074 - * from various namespaces
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
8079 - * task_xid_nr_ns() : id seen from the ns specified;
8081 - * set_task_vxid() : assigns a virtual id to a task;
8083 - * see also pid_nr() etc in include/linux/pid.h
8086 -#include <linux/vserver/base.h>
8087 -#include <linux/vserver/context.h>
8088 -#include <linux/vserver/debug.h>
8089 -#include <linux/vserver/pid.h>
8091 -static inline pid_t task_pid_nr(struct task_struct *tsk)
8096 -pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
8098 -static inline pid_t task_pid_vnr(struct task_struct *tsk)
8100 - return vx_map_pid(pid_vnr(task_pid(tsk)));
8104 -static inline pid_t task_tgid_nr(struct task_struct *tsk)
8109 -pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
8111 -static inline pid_t task_tgid_vnr(struct task_struct *tsk)
8113 - return vx_map_tgid(pid_vnr(task_tgid(tsk)));
8117 -static inline pid_t task_pgrp_nr(struct task_struct *tsk)
8119 - return tsk->signal->__pgrp;
8122 -pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
8124 -static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
8126 - return pid_vnr(task_pgrp(tsk));
8130 -static inline pid_t task_session_nr(struct task_struct *tsk)
8132 - return tsk->signal->__session;
8135 -pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
8137 -static inline pid_t task_session_vnr(struct task_struct *tsk)
8139 - return pid_vnr(task_session(tsk));
8144 - * pid_alive - check that a task structure is not stale
8145 - * @p: Task structure to be checked.
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.
8151 -static inline int pid_alive(struct task_struct *p)
8153 - return p->pids[PIDTYPE_PID].pid != NULL;
8157 - * is_global_init - check if a task structure is init
8158 - * @tsk: Task structure to be checked.
8160 - * Check if a task structure is the first user space task the kernel created.
8162 -static inline int is_global_init(struct task_struct *tsk)
8164 - return tsk->pid == 1;
8168 - * is_container_init:
8169 - * check whether in the task is init in its own pid namespace.
8171 -extern int is_container_init(struct task_struct *tsk);
8173 -extern struct pid *cad_pid;
8175 -extern void free_task(struct task_struct *tsk);
8176 -#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
8178 -extern void __put_task_struct(struct task_struct *t);
8180 -static inline void put_task_struct(struct task_struct *t)
8182 - if (atomic_dec_and_test(&t->usage))
8183 - __put_task_struct(t);
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);
8191 - * Per process flags
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 */
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.
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)
8249 -extern int set_cpus_allowed_ptr(struct task_struct *p,
8250 - const cpumask_t *new_mask);
8252 -static inline int set_cpus_allowed_ptr(struct task_struct *p,
8253 - const cpumask_t *new_mask)
8255 - if (!cpu_isset(0, *new_mask))
8260 -static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
8262 - return set_cpus_allowed_ptr(p, &new_mask);
8265 -extern unsigned long long sched_clock(void);
8267 -extern void sched_clock_init(void);
8268 -extern u64 sched_clock_cpu(int cpu);
8270 -#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
8271 -static inline void sched_clock_tick(void)
8275 -static inline void sched_clock_idle_sleep_event(void)
8279 -static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
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);
8289 - * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
8290 - * clock constructed from sched_clock():
8292 -extern unsigned long long cpu_clock(int cpu);
8294 -extern unsigned long long
8295 -task_sched_runtime(struct task_struct *task);
8297 -/* sched_exec is called by processes performing an exec */
8299 -extern void sched_exec(void);
8301 -#define sched_exec() {}
8304 -extern void sched_clock_idle_sleep_event(void);
8305 -extern void sched_clock_idle_wakeup_event(u64 delta_ns);
8307 -#ifdef CONFIG_HOTPLUG_CPU
8308 -extern void idle_task_exit(void);
8310 -static inline void idle_task_exit(void) {}
8313 -extern void sched_idle_next(void);
8315 -#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
8316 -extern void wake_up_idle_cpu(int cpu);
8318 -static inline void wake_up_idle_cpu(int cpu) { }
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;
8331 -int sched_nr_latency_handler(struct ctl_table *table, int write,
8332 - struct file *file, void __user *buffer, size_t *length,
8335 -extern unsigned int sysctl_sched_rt_period;
8336 -extern int sysctl_sched_rt_runtime;
8338 -int sched_rt_handler(struct ctl_table *table, int write,
8339 - struct file *filp, void __user *buffer, size_t *lenp,
8342 -extern unsigned int sysctl_sched_compat_yield;
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);
8349 -static inline int rt_mutex_getprio(struct task_struct *p)
8351 - return p->normal_prio;
8353 -# define rt_mutex_adjust_pi(p) do { } while (0)
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);
8372 - * The default (Linux) execution domain.
8374 -extern struct exec_domain default_exec_domain;
8376 -union thread_union {
8377 - struct thread_info thread_info;
8378 - unsigned long stack[THREAD_SIZE/sizeof(long)];
8381 -#ifndef __HAVE_ARCH_KSTACK_END
8382 -static inline int kstack_end(void *addr)
8384 - /* Reliable end of stack detection:
8385 - * Some APM bios versions misalign the stack
8387 - return !(((unsigned long)addr+sizeof(void*)-1) & (THREAD_SIZE-sizeof(void*)));
8391 -extern union thread_union init_thread_union;
8392 -extern struct task_struct init_task;
8394 -extern struct mm_struct init_mm;
8396 -extern struct pid_namespace init_pid_ns;
8399 - * find a task by one of its numerical ids
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
8409 - * see also find_vpid() etc in include/linux/pid.h
8412 -extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
8413 - struct pid_namespace *ns);
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);
8419 -extern void __set_special_pids(struct pid *pid);
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)
8425 - atomic_inc(&u->__count);
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);
8432 -#include <asm/current.h>
8434 -extern void do_timer(unsigned long ticks);
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);
8441 - extern void kick_process(struct task_struct *tsk);
8443 - static inline void kick_process(struct task_struct *tsk) { }
8445 -extern void sched_fork(struct task_struct *p, int clone_flags);
8446 -extern void sched_dead(struct task_struct *p);
8448 -extern int in_group_p(gid_t);
8449 -extern int in_egroup_p(gid_t);
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);
8457 -static inline int dequeue_signal_lock(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
8459 - unsigned long flags;
8462 - spin_lock_irqsave(&tsk->sighand->siglock, flags);
8463 - ret = dequeue_signal(tsk, mask, info);
8464 - spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
8469 -extern void block_all_signals(int (*notifier)(void *priv), void *priv,
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);
8493 -static inline int kill_cad_pid(int sig, int priv)
8495 - return kill_pid(cad_pid, sig, priv);
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)
8503 -static inline int is_si_special(const struct siginfo *info)
8505 - return info <= SEND_SIG_FORCED;
8508 -/* True if we are on the alternate signal stack. */
8510 -static inline int on_sig_stack(unsigned long sp)
8512 - return (sp - current->sas_ss_sp < current->sas_ss_size);
8515 -static inline int sas_ss_flags(unsigned long sp)
8517 - return (current->sas_ss_size == 0 ? SS_DISABLE
8518 - : on_sig_stack(sp) ? SS_ONSTACK : 0);
8522 - * Routines for handling mm_structs
8524 -extern struct mm_struct * mm_alloc(void);
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)
8530 - if (unlikely(atomic_dec_and_test(&mm->mm_count)))
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);
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);
8547 -extern void exit_files(struct task_struct *);
8548 -extern void __cleanup_signal(struct signal_struct *);
8549 -extern void __cleanup_sighand(struct sighand_struct *);
8551 -extern void exit_itimers(struct signal_struct *);
8552 -extern void flush_itimer_signals(void);
8554 -extern NORET_TYPE void do_group_exit(int);
8556 -extern void daemonize(const char *, ...);
8557 -extern int allow_signal(int);
8558 -extern int disallow_signal(int);
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);
8564 -extern void set_task_comm(struct task_struct *tsk, char *from);
8565 -extern char *get_task_comm(char *to, struct task_struct *tsk);
8568 -extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
8570 -static inline unsigned long wait_task_inactive(struct task_struct *p,
8577 -#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
8579 -#define for_each_process(p) \
8580 - for (p = &init_task ; (p = next_task(p)) != &init_task ; )
8583 - * Careful: do_each_thread/while_each_thread is a double loop so
8584 - * 'break' will not work as expected - use goto instead.
8586 -#define do_each_thread(g, t) \
8587 - for (g = t = &init_task ; (g = t = next_task(g)) != &init_task ; ) do
8589 -#define while_each_thread(g, t) \
8590 - while ((t = next_thread(t)) != g)
8592 -/* de_thread depends on thread_group_leader not being a pid based check */
8593 -#define thread_group_leader(p) (p == p->group_leader)
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.
8601 -static inline int has_group_leader_pid(struct task_struct *p)
8603 - return p->pid == p->tgid;
8607 -int same_thread_group(struct task_struct *p1, struct task_struct *p2)
8609 - return p1->tgid == p2->tgid;
8612 -static inline struct task_struct *next_thread(const struct task_struct *p)
8614 - return list_entry(rcu_dereference(p->thread_group.next),
8615 - struct task_struct, thread_group);
8618 -static inline int thread_group_empty(struct task_struct *p)
8620 - return list_empty(&p->thread_group);
8623 -#define delay_group_leader(p) \
8624 - (thread_group_leader(p) && !thread_group_empty(p))
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[].
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.
8636 -static inline void task_lock(struct task_struct *p)
8638 - spin_lock(&p->alloc_lock);
8641 -static inline void task_unlock(struct task_struct *p)
8643 - spin_unlock(&p->alloc_lock);
8646 -extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
8647 - unsigned long *flags);
8649 -static inline void unlock_task_sighand(struct task_struct *tsk,
8650 - unsigned long *flags)
8652 - spin_unlock_irqrestore(&tsk->sighand->siglock, *flags);
8655 -#ifndef __HAVE_THREAD_FUNCTIONS
8657 -#define task_thread_info(task) ((struct thread_info *)(task)->stack)
8658 -#define task_stack_page(task) ((task)->stack)
8660 -static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org)
8662 - *task_thread_info(p) = *task_thread_info(org);
8663 - task_thread_info(p)->task = p;
8666 -static inline unsigned long *end_of_stack(struct task_struct *p)
8668 - return (unsigned long *)(task_thread_info(p) + 1);
8673 -static inline int object_is_on_stack(void *obj)
8675 - void *stack = task_stack_page(current);
8677 - return (obj >= stack) && (obj < (stack + THREAD_SIZE));
8680 -extern void thread_info_cache_init(void);
8682 -/* set thread flags in other task's structures
8683 - * - see asm/thread_info.h for TIF_xxxx flags available
8685 -static inline void set_tsk_thread_flag(struct task_struct *tsk, int flag)
8687 - set_ti_thread_flag(task_thread_info(tsk), flag);
8690 -static inline void clear_tsk_thread_flag(struct task_struct *tsk, int flag)
8692 - clear_ti_thread_flag(task_thread_info(tsk), flag);
8695 -static inline int test_and_set_tsk_thread_flag(struct task_struct *tsk, int flag)
8697 - return test_and_set_ti_thread_flag(task_thread_info(tsk), flag);
8700 -static inline int test_and_clear_tsk_thread_flag(struct task_struct *tsk, int flag)
8702 - return test_and_clear_ti_thread_flag(task_thread_info(tsk), flag);
8705 -static inline int test_tsk_thread_flag(struct task_struct *tsk, int flag)
8707 - return test_ti_thread_flag(task_thread_info(tsk), flag);
8710 -static inline void set_tsk_need_resched(struct task_struct *tsk)
8712 - set_tsk_thread_flag(tsk,TIF_NEED_RESCHED);
8715 -static inline void clear_tsk_need_resched(struct task_struct *tsk)
8717 - clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED);
8720 -static inline int test_tsk_need_resched(struct task_struct *tsk)
8722 - return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED));
8725 -static inline int signal_pending(struct task_struct *p)
8727 - return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
8730 -extern int __fatal_signal_pending(struct task_struct *p);
8732 -static inline int fatal_signal_pending(struct task_struct *p)
8734 - return signal_pending(p) && __fatal_signal_pending(p);
8737 -static inline int signal_pending_state(long state, struct task_struct *p)
8739 - if (!(state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
8741 - if (!signal_pending(p))
8744 - return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
8747 -static inline int need_resched(void)
8749 - return unlikely(test_thread_flag(TIF_NEED_RESCHED));
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.
8759 -extern int _cond_resched(void);
8760 -#ifdef CONFIG_PREEMPT_BKL
8761 -static inline int cond_resched(void)
8766 -static inline int cond_resched(void)
8768 - return _cond_resched();
8771 -extern int cond_resched_lock(spinlock_t * lock);
8772 -extern int cond_resched_softirq(void);
8773 -static inline int cond_resched_bkl(void)
8775 - return _cond_resched();
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)
8783 -static inline int spin_needbreak(spinlock_t *lock)
8785 -#ifdef CONFIG_PREEMPT
8786 - return spin_is_contended(lock);
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.
8798 -extern void recalc_sigpending_and_wake(struct task_struct *t);
8799 -extern void recalc_sigpending(void);
8801 -extern void signal_wake_up(struct task_struct *t, int resume_stopped);
8804 - * Wrappers for p->thread_info->cpu access. No-op on UP.
8808 -static inline unsigned int task_cpu(const struct task_struct *p)
8810 - return task_thread_info(p)->cpu;
8813 -extern void set_task_cpu(struct task_struct *p, unsigned int cpu);
8817 -static inline unsigned int task_cpu(const struct task_struct *p)
8822 -static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
8826 -#endif /* CONFIG_SMP */
8828 -extern void arch_pick_mmap_layout(struct mm_struct *mm);
8830 -#ifdef CONFIG_TRACING
8832 -__trace_special(void *__tr, void *__data,
8833 - unsigned long arg1, unsigned long arg2, unsigned long arg3);
8836 -__trace_special(void *__tr, void *__data,
8837 - unsigned long arg1, unsigned long arg2, unsigned long arg3)
8842 -extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask);
8843 -extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
8845 -extern int sched_mc_power_savings, sched_smt_power_savings;
8847 -extern void normalize_rt_tasks(void);
8849 -#ifdef CONFIG_GROUP_SCHED
8851 -extern struct task_group init_task_group;
8852 -#ifdef CONFIG_USER_SCHED
8853 -extern struct task_group root_task_group;
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);
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);
8873 -#ifdef CONFIG_TASK_XACCT
8874 -static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
8876 - tsk->ioac.rchar += amt;
8879 -static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
8881 - tsk->ioac.wchar += amt;
8884 -static inline void inc_syscr(struct task_struct *tsk)
8886 - tsk->ioac.syscr++;
8889 -static inline void inc_syscw(struct task_struct *tsk)
8891 - tsk->ioac.syscw++;
8894 -static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
8898 -static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
8902 -static inline void inc_syscr(struct task_struct *tsk)
8906 -static inline void inc_syscw(struct task_struct *tsk)
8911 -#ifndef TASK_SIZE_OF
8912 -#define TASK_SIZE_OF(tsk) TASK_SIZE
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);
8919 -static inline void mm_update_next_owner(struct mm_struct *mm)
8923 -static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
8926 -#endif /* CONFIG_MM_OWNER */
8928 -#define TASK_STATE_TO_CHAR_STR "RSDTtZX"
8930 -#endif /* __KERNEL__ */
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
8938 #else /* CONFIG_SECCOMP */
8940 -typedef EMPTY_STRUCT_DECL(/* unnamed */) seccomp_t;
8941 +typedef struct { } seccomp_t;
8943 #define secure_computing(x) do { } while (0)
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)
8952 - return (struct dentry *) ERR_PTR(-ENODEV);
8953 + return ERR_PTR(-ENODEV);
8956 static inline struct dentry *securityfs_create_file(const char *name,
8957 @@ -2436,7 +2436,7 @@
8959 const struct file_operations *fops)
8961 - return (struct dentry *) ERR_PTR(-ENODEV);
8962 + return ERR_PTR(-ENODEV);
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
8970 struct list_head wait_list;
8974 -#define __SEMAPHORE_INITIALIZER(name, n) \
8975 -({ struct semaphore duh; \
8976 - duh.lock = __SPIN_LOCK_UNLOCKED((name).lock), \
8978 - duh.wait_list = LIST_HEAD_INIT((name).wait_list), \
8981 #define __SEMAPHORE_INITIALIZER(name, n) \
8983 .lock = __SPIN_LOCK_UNLOCKED((name).lock), \
8985 .wait_list = LIST_HEAD_INIT((name).wait_list), \
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;
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 */
9005 * struct sk_buff - socket buffer
9006 * @next: Next buffer in list
9009 extern struct sk_buff *pskb_copy(struct sk_buff *skb,
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,
9015 @@ -1333,7 +1326,7 @@
9018 static inline int skb_add_data(struct sk_buff *skb,
9019 - unsigned char __user *from, int copy)
9020 + char __user *from, int copy)
9022 const int off = skb->len;
9024 @@ -1409,7 +1402,7 @@
9025 const void *start, unsigned int len)
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));
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
9038 - * Definitions for the 'struct sk_buff' memory handlers.
9041 - * Alan Cox, <gw4pts@gw4pts.ampr.org>
9042 - * Florian La Roche, <rzsfl@rz.uni-sb.de>
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.
9050 -#ifndef _LINUX_SKBUFF_H
9051 -#define _LINUX_SKBUFF_H
9053 -#include <linux/kernel.h>
9054 -#include <linux/compiler.h>
9055 -#include <linux/time.h>
9056 -#include <linux/cache.h>
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>
9068 -#define HAVE_ALLOC_SKB /* For the drivers to know */
9069 -#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
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
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))
9086 -/* A. Checksumming of received packets by device.
9088 - * NONE: device failed to checksum this packet.
9089 - * skb->csum is undefined.
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)
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.
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.
9110 - * B. Checksumming on output.
9112 - * NONE: skb is checksummed by protocol or csum is not required.
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.
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
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.
9129 - * Any questions? No questions, good. --ANK
9133 -struct scatterlist;
9134 -struct pipe_inode_info;
9136 -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
9137 -struct nf_conntrack {
9142 -#ifdef CONFIG_BRIDGE_NETFILTER
9143 -struct nf_bridge_info {
9145 - struct net_device *physindev;
9146 - struct net_device *physoutdev;
9147 - unsigned int mask;
9148 - unsigned long data[32 / sizeof(unsigned long)];
9152 -struct sk_buff_head {
9153 - /* These two members must be first. */
9154 - struct sk_buff *next;
9155 - struct sk_buff *prev;
9163 -/* To allow 64K frame to be packed as single skb without frag_list */
9164 -#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2)
9166 -typedef struct skb_frag_struct skb_frag_t;
9168 -struct skb_frag_struct {
9169 - struct page *page;
9170 - __u32 page_offset;
9174 -/* This data is invariant across clones and lives at
9175 - * the end of the header data, ie. at skb->end.
9177 -struct skb_shared_info {
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];
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.
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.
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.
9200 -#define SKB_DATAREF_SHIFT 16
9201 -#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
9205 - SKB_FCLONE_UNAVAILABLE,
9211 - SKB_GSO_TCPV4 = 1 << 0,
9212 - SKB_GSO_UDP = 1 << 1,
9214 - /* This indicates the skb is from an untrusted source. */
9215 - SKB_GSO_DODGY = 1 << 2,
9217 - /* This indicates the tcp segment has CWR set. */
9218 - SKB_GSO_TCP_ECN = 1 << 3,
9220 - SKB_GSO_TCPV6 = 1 << 4,
9223 -#if BITS_PER_LONG > 32
9224 -#define NET_SKBUFF_DATA_USES_OFFSET 1
9227 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
9228 -typedef unsigned int sk_buff_data_t;
9230 -typedef unsigned char *sk_buff_data_t;
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
9290 - /* These two members must be first. */
9291 - struct sk_buff *next;
9292 - struct sk_buff *prev;
9296 - struct net_device *dev;
9299 - struct dst_entry *dst;
9300 - struct rtable *rtable;
9302 - struct sec_path *sp;
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.
9320 - __u16 csum_offset;
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;
9341 -#ifdef CONFIG_BRIDGE_NETFILTER
9342 - struct nf_bridge_info *nf_bridge;
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 */
9353 -#ifdef CONFIG_IPV6_NDISC_NODETYPE
9354 - __u8 ndisc_nodetype:2;
9356 -#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
9357 - __u8 do_not_encrypt:1;
9359 - /* 0/13/14 bit hole */
9361 -#ifdef CONFIG_NET_DMA
9362 - dma_cookie_t dma_cookie;
9364 -#ifdef CONFIG_NETWORK_SECMARK
9369 -#define skb_tag mark
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,
9381 - unsigned int truesize;
9387 - * Handling routines are only of interest to the kernel
9389 -#include <linux/slab.h>
9391 -#include <asm/system.h>
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,
9400 - return __alloc_skb(size, priority, 0, -1);
9403 -static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
9406 - return __alloc_skb(size, priority, 1, -1);
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,
9412 -extern struct sk_buff *skb_copy(const struct sk_buff *skb,
9414 -extern struct sk_buff *pskb_copy(struct sk_buff *skb,
9416 -extern int pskb_expand_head(struct sk_buff *skb,
9417 - int nhead, int ntail,
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,
9424 -extern int skb_to_sgvec(struct sk_buff *skb,
9425 - struct scatterlist *sg, int offset,
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,
9433 -extern void skb_under_panic(struct sk_buff *skb, int len,
9435 -extern void skb_truesize_bug(struct sk_buff *skb);
9437 -static inline void skb_truesize_check(struct sk_buff *skb)
9439 - int len = sizeof(struct sk_buff) + skb->len;
9441 - if (unlikely((int)skb->truesize < len))
9442 - skb_truesize_bug(skb);
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);
9450 -struct skb_seq_state
9452 - __u32 lower_offset;
9453 - __u32 upper_offset;
9455 - __u32 stepped_offset;
9456 - struct sk_buff *root_skb;
9457 - struct sk_buff *cur_skb;
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);
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);
9472 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
9473 -static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
9475 - return skb->head + skb->end;
9478 -static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
9485 -#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB)))
9488 - * skb_queue_empty - check if a queue is empty
9489 - * @list: queue head
9491 - * Returns true if the queue is empty, false otherwise.
9493 -static inline int skb_queue_empty(const struct sk_buff_head *list)
9495 - return list->next == (struct sk_buff *)list;
9499 - * skb_get - reference buffer
9500 - * @skb: buffer to reference
9502 - * Makes another reference to a socket buffer and returns a pointer
9505 -static inline struct sk_buff *skb_get(struct sk_buff *skb)
9507 - atomic_inc(&skb->users);
9512 - * If users == 1, we are the only owner and are can avoid redundant
9517 - * skb_cloned - is the buffer a clone
9518 - * @skb: buffer to check
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.
9524 -static inline int skb_cloned(const struct sk_buff *skb)
9526 - return skb->cloned &&
9527 - (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1;
9531 - * skb_header_cloned - is the header a clone
9532 - * @skb: buffer to check
9534 - * Returns true if modifying the header part of the buffer requires
9535 - * the data to be copied.
9537 -static inline int skb_header_cloned(const struct sk_buff *skb)
9544 - dataref = atomic_read(&skb_shinfo(skb)->dataref);
9545 - dataref = (dataref & SKB_DATAREF_MASK) - (dataref >> SKB_DATAREF_SHIFT);
9546 - return dataref != 1;
9550 - * skb_header_release - release reference to header
9551 - * @skb: buffer to operate on
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.
9557 -static inline void skb_header_release(struct sk_buff *skb)
9559 - BUG_ON(skb->nohdr);
9561 - atomic_add(1 << SKB_DATAREF_SHIFT, &skb_shinfo(skb)->dataref);
9565 - * skb_shared - is the buffer shared
9566 - * @skb: buffer to check
9568 - * Returns true if more than one person has a reference to this
9571 -static inline int skb_shared(const struct sk_buff *skb)
9573 - return atomic_read(&skb->users) != 1;
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
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
9587 - * NULL is returned on a memory allocation failure.
9589 -static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
9592 - might_sleep_if(pri & __GFP_WAIT);
9593 - if (skb_shared(skb)) {
9594 - struct sk_buff *nskb = skb_clone(skb, pri);
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.
9609 - * skb_unshare - make a copy of a shared buffer
9610 - * @skb: buffer to check
9611 - * @pri: priority for memory allocation
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
9619 - * %NULL is returned on a memory allocation failure.
9621 -static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
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 */
9635 - * @list_: list to peek at
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.
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.
9646 -static inline struct sk_buff *skb_peek(struct sk_buff_head *list_)
9648 - struct sk_buff *list = ((struct sk_buff *)list_)->next;
9649 - if (list == (struct sk_buff *)list_)
9656 - * @list_: list to peek at
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.
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.
9667 -static inline struct sk_buff *skb_peek_tail(struct sk_buff_head *list_)
9669 - struct sk_buff *list = ((struct sk_buff *)list_)->prev;
9670 - if (list == (struct sk_buff *)list_)
9676 - * skb_queue_len - get queue length
9677 - * @list_: list to measure
9679 - * Return the length of an &sk_buff queue.
9681 -static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
9683 - return list_->qlen;
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.
9694 -static inline void skb_queue_head_init(struct sk_buff_head *list)
9696 - spin_lock_init(&list->lock);
9697 - list->prev = list->next = (struct sk_buff *)list;
9701 -static inline void skb_queue_head_init_class(struct sk_buff_head *list,
9702 - struct lock_class_key *class)
9704 - skb_queue_head_init(list);
9705 - lockdep_set_class(&list->lock, class);
9709 - * Insert an sk_buff on a list.
9711 - * The "__skb_xxxx()" functions are the non-atomic ones that
9712 - * can only be called with interrupts disabled.
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)
9719 - newsk->next = next;
9720 - newsk->prev = prev;
9721 - next->prev = prev->next = newsk;
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
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.
9734 - * A buffer cannot be placed on two lists at the same time.
9736 -static inline void __skb_queue_after(struct sk_buff_head *list,
9737 - struct sk_buff *prev,
9738 - struct sk_buff *newsk)
9740 - __skb_insert(newsk, prev, prev->next, list);
9743 -extern void skb_append(struct sk_buff *old, struct sk_buff *newsk,
9744 - struct sk_buff_head *list);
9746 -static inline void __skb_queue_before(struct sk_buff_head *list,
9747 - struct sk_buff *next,
9748 - struct sk_buff *newsk)
9750 - __skb_insert(newsk, next->prev, next, list);
9754 - * __skb_queue_head - queue a buffer at the list head
9755 - * @list: list to use
9756 - * @newsk: buffer to queue
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.
9761 - * A buffer cannot be placed on two lists at the same time.
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)
9767 - __skb_queue_after(list, (struct sk_buff *)list, newsk);
9771 - * __skb_queue_tail - queue a buffer at the list tail
9772 - * @list: list to use
9773 - * @newsk: buffer to queue
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.
9778 - * A buffer cannot be placed on two lists at the same time.
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)
9784 - __skb_queue_before(list, (struct sk_buff *)list, newsk);
9788 - * remove sk_buff from list. _Must_ be called atomically, and with
9789 - * the list known..
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)
9794 - struct sk_buff *next, *prev;
9799 - skb->next = skb->prev = NULL;
9800 - next->prev = prev;
9801 - prev->next = next;
9805 - * __skb_dequeue - remove from the head of the queue
9806 - * @list: list to dequeue from
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.
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)
9815 - struct sk_buff *skb = skb_peek(list);
9817 - __skb_unlink(skb, list);
9822 - * __skb_dequeue_tail - remove from the tail of the queue
9823 - * @list: list to dequeue from
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.
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)
9832 - struct sk_buff *skb = skb_peek_tail(list);
9834 - __skb_unlink(skb, list);
9839 -static inline int skb_is_nonlinear(const struct sk_buff *skb)
9841 - return skb->data_len;
9844 -static inline unsigned int skb_headlen(const struct sk_buff *skb)
9846 - return skb->len - skb->data_len;
9849 -static inline int skb_pagelen(const struct sk_buff *skb)
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);
9858 -static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
9859 - struct page *page, int off, int size)
9861 - skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
9863 - frag->page = page;
9864 - frag->page_offset = off;
9865 - frag->size = size;
9866 - skb_shinfo(skb)->nr_frags = i + 1;
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))
9873 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
9874 -static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
9876 - return skb->head + skb->tail;
9879 -static inline void skb_reset_tail_pointer(struct sk_buff *skb)
9881 - skb->tail = skb->data - skb->head;
9884 -static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
9886 - skb_reset_tail_pointer(skb);
9887 - skb->tail += offset;
9889 -#else /* NET_SKBUFF_DATA_USES_OFFSET */
9890 -static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
9895 -static inline void skb_reset_tail_pointer(struct sk_buff *skb)
9897 - skb->tail = skb->data;
9900 -static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
9902 - skb->tail = skb->data + offset;
9905 -#endif /* NET_SKBUFF_DATA_USES_OFFSET */
9908 - * Add data to an sk_buff
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)
9913 - unsigned char *tmp = skb_tail_pointer(skb);
9914 - SKB_LINEAR_ASSERT(skb);
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)
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)
9932 - BUG_ON(skb->len < skb->data_len);
9933 - return skb->data += len;
9936 -extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
9938 -static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
9940 - if (len > skb_headlen(skb) &&
9941 - !__pskb_pull_tail(skb, len - skb_headlen(skb)))
9944 - return skb->data += len;
9947 -static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len)
9949 - return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len);
9952 -static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
9954 - if (likely(len <= skb_headlen(skb)))
9956 - if (unlikely(len > skb->len))
9958 - return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL;
9962 - * skb_headroom - bytes at buffer head
9963 - * @skb: buffer to check
9965 - * Return the number of bytes of free space at the head of an &sk_buff.
9967 -static inline unsigned int skb_headroom(const struct sk_buff *skb)
9969 - return skb->data - skb->head;
9973 - * skb_tailroom - bytes at buffer end
9974 - * @skb: buffer to check
9976 - * Return the number of bytes of free space at the tail of an sk_buff
9978 -static inline int skb_tailroom(const struct sk_buff *skb)
9980 - return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail;
9984 - * skb_reserve - adjust headroom
9985 - * @skb: buffer to alter
9986 - * @len: bytes to move
9988 - * Increase the headroom of an empty &sk_buff by reducing the tail
9989 - * room. This is only allowed for an empty buffer.
9991 -static inline void skb_reserve(struct sk_buff *skb, int len)
9997 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
9998 -static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
10000 - return skb->head + skb->transport_header;
10003 -static inline void skb_reset_transport_header(struct sk_buff *skb)
10005 - skb->transport_header = skb->data - skb->head;
10008 -static inline void skb_set_transport_header(struct sk_buff *skb,
10009 - const int offset)
10011 - skb_reset_transport_header(skb);
10012 - skb->transport_header += offset;
10015 -static inline unsigned char *skb_network_header(const struct sk_buff *skb)
10017 - return skb->head + skb->network_header;
10020 -static inline void skb_reset_network_header(struct sk_buff *skb)
10022 - skb->network_header = skb->data - skb->head;
10025 -static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
10027 - skb_reset_network_header(skb);
10028 - skb->network_header += offset;
10031 -static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
10033 - return skb->head + skb->mac_header;
10036 -static inline int skb_mac_header_was_set(const struct sk_buff *skb)
10038 - return skb->mac_header != ~0U;
10041 -static inline void skb_reset_mac_header(struct sk_buff *skb)
10043 - skb->mac_header = skb->data - skb->head;
10046 -static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
10048 - skb_reset_mac_header(skb);
10049 - skb->mac_header += offset;
10052 -#else /* NET_SKBUFF_DATA_USES_OFFSET */
10054 -static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
10056 - return skb->transport_header;
10059 -static inline void skb_reset_transport_header(struct sk_buff *skb)
10061 - skb->transport_header = skb->data;
10064 -static inline void skb_set_transport_header(struct sk_buff *skb,
10065 - const int offset)
10067 - skb->transport_header = skb->data + offset;
10070 -static inline unsigned char *skb_network_header(const struct sk_buff *skb)
10072 - return skb->network_header;
10075 -static inline void skb_reset_network_header(struct sk_buff *skb)
10077 - skb->network_header = skb->data;
10080 -static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
10082 - skb->network_header = skb->data + offset;
10085 -static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
10087 - return skb->mac_header;
10090 -static inline int skb_mac_header_was_set(const struct sk_buff *skb)
10092 - return skb->mac_header != NULL;
10095 -static inline void skb_reset_mac_header(struct sk_buff *skb)
10097 - skb->mac_header = skb->data;
10100 -static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
10102 - skb->mac_header = skb->data + offset;
10104 -#endif /* NET_SKBUFF_DATA_USES_OFFSET */
10106 -static inline int skb_transport_offset(const struct sk_buff *skb)
10108 - return skb_transport_header(skb) - skb->data;
10111 -static inline u32 skb_network_header_len(const struct sk_buff *skb)
10113 - return skb->transport_header - skb->network_header;
10116 -static inline int skb_network_offset(const struct sk_buff *skb)
10118 - return skb_network_header(skb) - skb->data;
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
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
10132 - * skb_reserve(NET_IP_ALIGN);
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.
10138 - * Since this trade off varies between architectures, we allow NET_IP_ALIGN
10139 - * to be overridden.
10141 -#ifndef NET_IP_ALIGN
10142 -#define NET_IP_ALIGN 2
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.
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.
10157 - * Various parts of the networking layer expect at least 16 bytes of
10158 - * headroom, you should not reduce this.
10160 -#ifndef NET_SKB_PAD
10161 -#define NET_SKB_PAD 16
10164 -extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
10166 -static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
10168 - if (unlikely(skb->data_len)) {
10173 - skb_set_tail_pointer(skb, len);
10176 -extern void skb_trim(struct sk_buff *skb, unsigned int len);
10178 -static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
10180 - if (skb->data_len)
10181 - return ___pskb_trim(skb, len);
10182 - __skb_trim(skb, len);
10186 -static inline int pskb_trim(struct sk_buff *skb, unsigned int len)
10188 - return (len < skb->len) ? __pskb_trim(skb, len) : 0;
10192 - * pskb_trim_unique - remove end from a paged unique (not cloned) buffer
10193 - * @skb: buffer to alter
10194 - * @len: new length
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-
10200 -static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len)
10202 - int err = pskb_trim(skb, len);
10207 - * skb_orphan - orphan a buffer
10208 - * @skb: buffer to orphan
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.
10214 -static inline void skb_orphan(struct sk_buff *skb)
10216 - if (skb->destructor)
10217 - skb->destructor(skb);
10218 - skb->destructor = NULL;
10223 - * __skb_queue_purge - empty a list
10224 - * @list: list to empty
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.
10230 -extern void skb_queue_purge(struct sk_buff_head *list);
10231 -static inline void __skb_queue_purge(struct sk_buff_head *list)
10233 - struct sk_buff *skb;
10234 - while ((skb = __skb_dequeue(list)) != NULL)
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
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.
10248 - * %NULL is returned if there is no free memory.
10250 -static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
10253 - struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
10255 - skb_reserve(skb, NET_SKB_PAD);
10259 -extern struct sk_buff *dev_alloc_skb(unsigned int length);
10261 -extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
10262 - unsigned int length, gfp_t gfp_mask);
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
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.
10274 - * %NULL is returned if there is no free memory. Although this function
10275 - * allocates memory it can be called from an interrupt.
10277 -static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
10278 - unsigned int length)
10280 - return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
10284 - * skb_clone_writable - is the header of a clone writable
10285 - * @skb: buffer to check
10286 - * @len: length up to which to write
10288 - * Returns true if modifying the header part of the cloned buffer
10289 - * does not requires the data to be copied.
10291 -static inline int skb_clone_writable(struct sk_buff *skb, unsigned int len)
10293 - return !skb_header_cloned(skb) &&
10294 - skb_headroom(skb) + len <= skb->hdr_len;
10297 -static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom,
10302 - if (headroom < NET_SKB_PAD)
10303 - headroom = NET_SKB_PAD;
10304 - if (headroom > skb_headroom(skb))
10305 - delta = headroom - skb_headroom(skb);
10307 - if (delta || cloned)
10308 - return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0,
10314 - * skb_cow - copy header of skb when it is required
10315 - * @skb: buffer to cow
10316 - * @headroom: needed headroom
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.
10322 - * The result is skb with writable area skb->head...skb->tail
10323 - * and at least @headroom of space at head.
10325 -static inline int skb_cow(struct sk_buff *skb, unsigned int headroom)
10327 - return __skb_cow(skb, headroom, skb_cloned(skb));
10331 - * skb_cow_head - skb_cow but only making the head writable
10332 - * @skb: buffer to cow
10333 - * @headroom: needed headroom
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
10340 -static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom)
10342 - return __skb_cow(skb, headroom, skb_header_cloned(skb));
10346 - * skb_padto - pad an skbuff up to a minimal size
10347 - * @skb: buffer to pad
10348 - * @len: minimal length
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.
10356 -static inline int skb_padto(struct sk_buff *skb, unsigned int len)
10358 - unsigned int size = skb->len;
10359 - if (likely(size >= len))
10361 - return skb_pad(skb, len - size);
10364 -static inline int skb_add_data(struct sk_buff *skb,
10365 - char __user *from, int copy)
10367 - const int off = skb->len;
10369 - if (skb->ip_summed == CHECKSUM_NONE) {
10371 - __wsum csum = csum_and_copy_from_user(from, skb_put(skb, copy),
10374 - skb->csum = csum_block_add(skb->csum, csum, off);
10377 - } else if (!copy_from_user(skb_put(skb, copy), from, copy))
10380 - __skb_trim(skb, off);
10384 -static inline int skb_can_coalesce(struct sk_buff *skb, int i,
10385 - struct page *page, int off)
10388 - struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1];
10390 - return page == frag->page &&
10391 - off == frag->page_offset + frag->size;
10396 -static inline int __skb_linearize(struct sk_buff *skb)
10398 - return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM;
10402 - * skb_linearize - convert paged skb to linear one
10403 - * @skb: buffer to linarize
10405 - * If there is no free memory -ENOMEM is returned, otherwise zero
10406 - * is returned and the old skb data released.
10408 -static inline int skb_linearize(struct sk_buff *skb)
10410 - return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0;
10414 - * skb_linearize_cow - make sure skb is linear and writable
10415 - * @skb: buffer to process
10417 - * If there is no free memory -ENOMEM is returned, otherwise zero
10418 - * is returned and the old skb data released.
10420 -static inline int skb_linearize_cow(struct sk_buff *skb)
10422 - return skb_is_nonlinear(skb) || skb_cloned(skb) ?
10423 - __skb_linearize(skb) : 0;
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
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.
10437 -static inline void skb_postpull_rcsum(struct sk_buff *skb,
10438 - const void *start, unsigned int len)
10440 - if (skb->ip_summed == CHECKSUM_COMPLETE)
10441 - skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
10444 -unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
10447 - * pskb_trim_rcsum - trim received skb and update checksum
10448 - * @skb: buffer to trim
10449 - * @len: new length
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.
10455 -static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
10457 - if (likely(len >= skb->len))
10459 - if (skb->ip_summed == CHECKSUM_COMPLETE)
10460 - skb->ip_summed = CHECKSUM_NONE;
10461 - return __pskb_trim(skb, len);
10464 -#define skb_queue_walk(queue, skb) \
10465 - for (skb = (queue)->next; \
10466 - prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \
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)
10474 -#define skb_queue_reverse_walk(queue, skb) \
10475 - for (skb = (queue)->prev; \
10476 - prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \
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,
10489 -extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
10491 - struct iovec *iov);
10492 -extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
10494 - struct iovec *from,
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,
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);
10517 -extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
10519 -static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
10520 - int len, void *buffer)
10522 - int hlen = skb_headlen(skb);
10524 - if (hlen - offset >= len)
10525 - return skb->data + offset;
10527 - if (skb_copy_bits(skb, offset, buffer, len) < 0)
10533 -static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
10535 - const unsigned int len)
10537 - memcpy(to, skb->data, len);
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)
10544 - memcpy(to, skb->data + offset, len);
10547 -static inline void skb_copy_to_linear_data(struct sk_buff *skb,
10548 - const void *from,
10549 - const unsigned int len)
10551 - memcpy(skb->data, from, len);
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)
10559 - memcpy(skb->data + offset, from, len);
10562 -extern void skb_init(void);
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
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
10573 -static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
10575 - *stamp = ktime_to_timeval(skb->tstamp);
10578 -static inline void __net_timestamp(struct sk_buff *skb)
10580 - skb->tstamp = ktime_get_real();
10583 -static inline ktime_t net_timedelta(ktime_t t)
10585 - return ktime_sub(ktime_get_real(), t);
10588 -static inline ktime_t net_invalid_timestamp(void)
10590 - return ktime_set(0, 0);
10593 -extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
10594 -extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
10596 -static inline int skb_csum_unnecessary(const struct sk_buff *skb)
10598 - return skb->ip_summed & CHECKSUM_UNNECESSARY;
10602 - * skb_checksum_complete - Calculate checksum of an entire packet
10603 - * @skb: packet to process
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
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.
10617 -static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
10619 - return skb_csum_unnecessary(skb) ?
10620 - 0 : __skb_checksum_complete(skb);
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)
10627 - if (nfct && atomic_dec_and_test(&nfct->use))
10628 - nf_conntrack_destroy(nfct);
10630 -static inline void nf_conntrack_get(struct nf_conntrack *nfct)
10633 - atomic_inc(&nfct->use);
10635 -static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
10638 - atomic_inc(&skb->users);
10640 -static inline void nf_conntrack_put_reasm(struct sk_buff *skb)
10646 -#ifdef CONFIG_BRIDGE_NETFILTER
10647 -static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
10649 - if (nf_bridge && atomic_dec_and_test(&nf_bridge->use))
10650 - kfree(nf_bridge);
10652 -static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
10655 - atomic_inc(&nf_bridge->use);
10657 -#endif /* CONFIG_BRIDGE_NETFILTER */
10658 -static inline void nf_reset(struct sk_buff *skb)
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;
10666 -#ifdef CONFIG_BRIDGE_NETFILTER
10667 - nf_bridge_put(skb->nf_bridge);
10668 - skb->nf_bridge = NULL;
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)
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);
10682 -#ifdef CONFIG_BRIDGE_NETFILTER
10683 - dst->nf_bridge = src->nf_bridge;
10684 - nf_bridge_get(src->nf_bridge);
10688 -static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
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);
10694 -#ifdef CONFIG_BRIDGE_NETFILTER
10695 - nf_bridge_put(dst->nf_bridge);
10697 - __nf_copy(dst, src);
10700 -#ifdef CONFIG_NETWORK_SECMARK
10701 -static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
10703 - to->secmark = from->secmark;
10706 -static inline void skb_init_secmark(struct sk_buff *skb)
10708 - skb->secmark = 0;
10711 -static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
10714 -static inline void skb_init_secmark(struct sk_buff *skb)
10718 -static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
10720 - skb->queue_mapping = queue_mapping;
10723 -static inline u16 skb_get_queue_mapping(struct sk_buff *skb)
10725 - return skb->queue_mapping;
10728 -static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_buff *from)
10730 - to->queue_mapping = from->queue_mapping;
10733 -static inline int skb_is_gso(const struct sk_buff *skb)
10735 - return skb_shinfo(skb)->gso_size;
10738 -static inline int skb_is_gso_v6(const struct sk_buff *skb)
10740 - return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
10743 -extern void __skb_warn_lro_forwarding(const struct sk_buff *skb);
10745 -static inline bool skb_warn_if_lro(const struct sk_buff *skb)
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);
10757 -static inline void skb_forward_csum(struct sk_buff *skb)
10759 - /* Unfortunately we don't support this one. Any brave souls? */
10760 - if (skb->ip_summed == CHECKSUM_COMPLETE)
10761 - skb->ip_summed = CHECKSUM_NONE;
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
10771 #include <linux/kernel.h>
10772 #include <linux/stringify.h>
10773 #include <linux/bottom_half.h>
10774 -#include <linux/types.h>
10776 #include <asm/system.h>
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 @@
10783 #define SPINLOCK_OWNER_INIT ((void *)-1L)
10785 -#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
10786 -# define SPINLOCK_BREAK_LOCK_INIT 0,
10788 -# define SPINLOCK_BREAK_LOCK_INIT
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 }
10795 # define SPIN_DEP_MAP_INIT(lockname)
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 }
10802 # define RW_DEP_MAP_INIT(lockname)
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) }
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) }
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 @@
10848 -#ifndef __cplusplus
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);
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);
10868 extern int proc_dostring(struct ctl_table *, int, struct file *,
10869 @@ -1066,7 +1066,7 @@
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 */
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
10883 - * sysctl.h: General linux system control interface
10885 - * Begun 24 March 1995, Stephen Tweedie
10887 - ****************************************************************
10888 - ****************************************************************
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.
10899 - ** For new interfaces unless you really need a binary number
10900 - ** please use CTL_UNNUMBERED.
10902 - ****************************************************************
10903 - ****************************************************************
10906 -#ifndef _LINUX_SYSCTL_H
10907 -#define _LINUX_SYSCTL_H
10909 -#include <linux/kernel.h>
10910 -#include <linux/types.h>
10911 -#include <linux/compiler.h>
10914 -struct completion;
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? */
10921 -struct __sysctl_args {
10922 - int __user *name;
10924 - void __user *oldval;
10925 - size_t __user *oldlenp;
10926 - void __user *newval;
10928 - unsigned long __unused[4];
10931 -/* Define sysctl names first */
10933 -/* Top-level names: */
10935 -/* For internal pattern-matching use only: */
10937 -#define CTL_NONE 0
10938 -#define CTL_UNNUMBERED CTL_NONE /* sysctl without a binary number */
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 */
10961 -/* CTL_BUS names: */
10964 - CTL_BUS_ISA=1 /* ISA */
10967 -/* /proc/sys/fs/inotify/ */
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 */
10975 -/* CTL_KERN names: */
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 */
10985 - KERN_DOMAINNAME=8,
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 */
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 */
11003 - KERN_RTSIGNR=32, /* Number of rt sigs queued */
11004 - KERN_RTSIGMAX=33, /* Max queuable */
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 */
11053 -/* CTL_VM names: */
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 */
11094 -/* CTL_NET names: */
11115 - NET_NETFILTER=19,
11120 -/* /proc/sys/kernel/random */
11123 - RANDOM_POOLSIZE=1,
11124 - RANDOM_ENTROPY_COUNT=2,
11125 - RANDOM_READ_THRESH=3,
11126 - RANDOM_WRITE_THRESH=4,
11127 - RANDOM_BOOT_ID=5,
11131 -/* /proc/sys/kernel/pty */
11138 -/* /proc/sys/bus/isa */
11141 - BUS_ISA_MEM_BASE=1,
11142 - BUS_ISA_PORT_BASE=2,
11143 - BUS_ISA_PORT_SHIFT=3
11146 -/* /proc/sys/net/core */
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,
11173 -/* /proc/sys/net/ethernet */
11175 -/* /proc/sys/net/802 */
11177 -/* /proc/sys/net/unix */
11181 - NET_UNIX_DESTROY_DELAY=1,
11182 - NET_UNIX_DELETE_DELAY=2,
11183 - NET_UNIX_MAX_DGRAM_QLEN=3,
11186 -/* /proc/sys/net/netfilter */
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,
11223 -/* /proc/sys/net/ipv4 */
11226 - /* v2.0 compatibile variables */
11227 - NET_IPV4_FORWARD=8,
11228 - NET_IPV4_DYNADDR=9,
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,
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,
11283 - NET_TCP_REORDERING=80,
11285 - NET_TCP_DSACK=82,
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,
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,
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
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,
11354 - NET_PROTO_CONF_ALL=-2,
11355 - NET_PROTO_CONF_DEFAULT=-3
11357 - /* And device ifindices ... */
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
11386 -/* /proc/sys/net/ipv4/netfilter */
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,
11419 -/* /proc/sys/net/ipv6 */
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,
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
11447 - NET_IPV6_FORWARDING=1,
11448 - NET_IPV6_HOP_LIMIT=2,
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,
11474 -/* /proc/sys/net/ipv6/icmp */
11476 - NET_IPV6_ICMP_RATELIMIT=1
11479 -/* /proc/sys/net/<protocol>/neigh/<dev> */
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,
11502 -/* /proc/sys/net/dccp */
11504 - NET_DCCP_DEFAULT=1,
11507 -/* /proc/sys/net/ipx */
11509 - NET_IPX_PPROP_BROADCASTING=1,
11510 - NET_IPX_FORWARDING=2
11513 -/* /proc/sys/net/llc */
11516 - NET_LLC_STATION=2,
11519 -/* /proc/sys/net/llc/llc2 */
11521 - NET_LLC2_TIMEOUT=1,
11524 -/* /proc/sys/net/llc/station */
11526 - NET_LLC_STATION_ACK_TIMEOUT=1,
11529 -/* /proc/sys/net/llc/llc2/timeout */
11531 - NET_LLC2_ACK_TIMEOUT=1,
11532 - NET_LLC2_P_TIMEOUT=2,
11533 - NET_LLC2_REJ_TIMEOUT=3,
11534 - NET_LLC2_BUSY_TIMEOUT=4,
11537 -/* /proc/sys/net/appletalk */
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
11546 -/* /proc/sys/net/netrom */
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
11562 -/* /proc/sys/net/ax25 */
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,
11575 - NET_AX25_PACLEN=12,
11576 - NET_AX25_PROTOCOL=13,
11577 - NET_AX25_DAMA_SLAVE_TIMEOUT=14
11580 -/* /proc/sys/net/rose */
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
11594 -/* /proc/sys/net/x25 */
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
11604 -/* /proc/sys/net/token-ring */
11607 - NET_TR_RIF_TIMEOUT=1
11610 -/* /proc/sys/net/decnet/ */
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
11629 -/* /proc/sys/net/decnet/conf/<dev> */
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
11638 - /* ... and ifindex of devices */
11641 -/* /proc/sys/net/decnet/conf/<dev>/ */
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
11652 -/* /proc/sys/net/sctp */
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,
11673 -/* /proc/sys/net/bridge */
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,
11682 -/* proc/sys/net/irda */
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,
11701 -/* CTL_FS names: */
11704 - FS_NRINODE=1, /* int:current number of allocated inodes */
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 */
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 */
11727 -/* /proc/sys/fs/quota/ */
11729 - FS_DQ_LOOKUPS = 1,
11732 - FS_DQ_WRITES = 4,
11733 - FS_DQ_CACHE_HITS = 5,
11734 - FS_DQ_ALLOCATED = 6,
11737 - FS_DQ_WARNINGS = 9,
11740 -/* CTL_DEBUG names: */
11742 -/* CTL_DEV names: */
11753 -/* /proc/sys/dev/cdrom */
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
11763 -/* /proc/sys/dev/parport */
11765 - DEV_PARPORT_DEFAULT=-3
11768 -/* /proc/sys/dev/raid */
11770 - DEV_RAID_SPEED_LIMIT_MIN=1,
11771 - DEV_RAID_SPEED_LIMIT_MAX=2
11774 -/* /proc/sys/dev/parport/default */
11776 - DEV_PARPORT_DEFAULT_TIMESLICE=1,
11777 - DEV_PARPORT_DEFAULT_SPINTIME=2
11780 -/* /proc/sys/dev/parport/parport n */
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
11791 -/* /proc/sys/dev/parport/parport n/devices/ */
11793 - DEV_PARPORT_DEVICES_ACTIVE=-3,
11796 -/* /proc/sys/dev/parport/parport n/devices/device n */
11798 - DEV_PARPORT_DEVICE_TIMESLICE=1,
11801 -/* /proc/sys/dev/mac_hid */
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
11811 -/* /proc/sys/dev/scsi */
11813 - DEV_SCSI_LOGGING_LEVEL=1,
11816 -/* /proc/sys/dev/ipmi */
11818 - DEV_IPMI_POWEROFF_POWERCYCLE=1,
11821 -/* /proc/sys/abi */
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 */
11833 -#include <linux/list.h>
11835 -/* For the /proc/sys support */
11838 -struct ctl_table_root;
11840 -struct ctl_table_set {
11841 - struct list_head list;
11842 - struct ctl_table_set *parent;
11843 - int (*is_seen)(struct ctl_table_set *);
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 *));
11850 -struct ctl_table_header;
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);
11863 -typedef struct ctl_table ctl_table;
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);
11869 -typedef int proc_handler (struct ctl_table *ctl, int write, struct file * filp,
11870 - void __user *buffer, size_t *lenp, loff_t *ppos);
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 *);
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);
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;
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.
11906 - * sysctl names can be mirrored automatically under /proc/sys. The
11907 - * procname supplied controls /proc naming.
11909 - * The table's mode will be honoured both for sys_sysctl(2) and
11910 - * proc-fs access.
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.
11916 - * sysctl entries with a zero ctl_name will not be available through
11917 - * the binary sysctl interface.
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.
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.
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.
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.
11940 -/* A sysctl table is an array of struct ctl_table: */
11943 - int ctl_name; /* Binary ID */
11944 - const char *procname; /* Text ID for /proc/sys, or zero */
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 */
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);
11965 -/* struct ctl_table_header is used to maintain dynamic lists of
11966 - struct ctl_table trees. */
11967 -struct ctl_table_header
11969 - struct ctl_table *ctl_table;
11970 - struct list_head ctl_entry;
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;
11982 -/* struct ctl_path describes where in the hierarchy a table is added */
11984 - const char *procname;
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);
11996 -void unregister_sysctl_table(struct ctl_table_header * table);
11997 -int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table);
11999 -#endif /* __KERNEL__ */
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 @@
12007 struct ts_config *conf;
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);
12012 - return (struct ts_config *) ERR_PTR(-ENOMEM);
12013 + return ERR_PTR(-ENOMEM);
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
12021 typedef __kernel_mqd_t mqd_t;
12024 -#ifndef __cplusplus
12025 typedef _Bool bool;
12028 typedef __kernel_uid32_t uid_t;
12029 typedef __kernel_gid32_t gid_t;
12030 @@ -211,12 +209,4 @@
12032 #endif /* __KERNEL__ */
12035 - * Click: Macros for defining empty structures. Needed because GCC's C and C++
12036 - * compilers have different ABIs for empty structures.
12039 -#define EMPTY_STRUCT_DECL(s) struct s { int gcc_is_buggy; }
12040 -#define EMPTY_STRUCT_INIT(s) (s) { 0 }
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
12050 -EMPTY_STRUCT_DECL(unwind_frame_info);
12051 +struct unwind_frame_info {};
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)
12062 - if (!test_bit(bit, (volatile unsigned long *) word))
12063 + if (!test_bit(bit, word))
12065 return out_of_line_wait_on_bit(word, bit, action, mode);
12067 @@ -509,7 +509,7 @@
12068 static inline int wait_on_bit_lock(void *word, int bit,
12069 int (*action)(void *), unsigned mode)
12071 - if (!test_and_set_bit(bit, (volatile unsigned long *) word))
12072 + if (!test_and_set_bit(bit, word))
12074 return out_of_line_wait_on_bit_lock(word, bit, action, mode);
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
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 *);
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,
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);
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,
12111 - unsigned char *data = (unsigned char *) nlmsg_data(nlh);
12112 + unsigned char *data = nlmsg_data(nlh);
12113 return (struct nlattr *) (data + NLMSG_ALIGN(hdrlen));
12116 @@ -732,7 +732,7 @@
12118 static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
12120 - return nla_find((struct nlattr *) nla_data(nla), nla_len(nla), attrtype);
12121 + return nla_find(nla_data(nla), nla_len(nla), attrtype);
12125 @@ -748,7 +748,7 @@
12126 struct nlattr *nla,
12127 const struct nla_policy *policy)
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);
12134 @@ -775,7 +775,7 @@
12135 if (nested_len < 0)
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));
12143 @@ -1069,7 +1069,7 @@
12145 static inline int nla_nest_compat_end(struct sk_buff *skb, struct nlattr *start)
12147 - struct nlattr *nest = (struct nlattr *) (char *)start + NLMSG_ALIGN(start->nla_len);
12148 + struct nlattr *nest = (void *)start + NLMSG_ALIGN(start->nla_len);
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)
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);
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 @@
12166 #else /* CONFIG_NET_EMATCH */
12168 -EMPTY_STRUCT_DECL(tcf_ematch_tree);
12169 +struct tcf_ematch_tree
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
12180 static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *ops)
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);
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,
12194 -#ifdef __cplusplus
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;
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 =
12210 .dport = dport } } };
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 @@
12220 if (skb->ip_summed == CHECKSUM_NONE) {
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,
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))
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];
12242 -EMPTY_STRUCT_DECL(ib_uverbs_modify_qp_resp);
12243 +struct ib_uverbs_modify_qp_resp {
12246 struct ib_uverbs_destroy_qp {
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 @@
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)
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);
12267 -/* Click: input packet handlers, might steal packets from net_rx_action. */
12268 -static RAW_NOTIFIER_HEAD(net_in_chain);
12271 * Our notifier list
12273 @@ -2024,31 +2021,6 @@
12274 return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
12279 - * Click: Allow Click to ask to intercept input packets.
12282 -register_net_in(struct notifier_block *nb)
12286 - err = raw_notifier_chain_register(&net_in_chain, nb);
12292 -unregister_net_in(struct notifier_block *nb)
12296 - err = raw_notifier_chain_unregister(&net_in_chain, nb);
12302 #if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE)
12303 /* These hooks defined here for ATM */
12305 @@ -2219,14 +2191,14 @@
12306 * NET_RX_SUCCESS: no congestion
12307 * NET_RX_DROP: packet was dropped
12309 -int __netif_receive_skb(struct sk_buff *skb)
12310 +int netif_receive_skb(struct sk_buff *skb)
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);
12322 @@ -2255,14 +2227,6 @@
12323 skb_reset_transport_header(skb);
12324 skb->mac_len = skb->network_header - skb->mac_header;
12326 - /* Click: may want to steal the packet */
12327 - if (notifier_data >= 0
12328 - && raw_notifier_call_chain(&net_in_chain,
12330 - skb) & NOTIFY_STOP_MASK) {
12337 @@ -2381,8 +2345,7 @@
12339 local_irq_enable();
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);
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);
12366 -EXPORT_SYMBOL(register_net_in);
12367 -EXPORT_SYMBOL(unregister_net_in);
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
12377 - * NET3 Protocol independent device support routines.
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.
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>
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>
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
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
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
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
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
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>
12509 -#include "net-sysfs.h"
12512 - * The list of packet types we will receive (as opposed to discard)
12513 - * and the routines to invoke.
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.
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.
12526 - * 8100 802.1Q VLAN
12539 -#define PTYPE_HASH_SIZE (16)
12540 -#define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1)
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 */
12546 -#ifdef CONFIG_NET_DMA
12548 - struct dma_client client;
12550 - cpumask_t channel_mask;
12551 - struct dma_chan **channels;
12554 -static enum dma_state_client
12555 -netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
12556 - enum dma_state state);
12558 -static struct net_dma net_dma = {
12560 - .event_callback = netdev_dma_event,
12566 - * The @dev_base_head list is protected by @dev_base_lock and the rtnl
12569 - * Pure readers hold dev_base_lock for reading.
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.
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.
12580 - * See, for example usages, register_netdevice() and
12581 - * unregister_netdevice(), which must be called with the rtnl
12582 - * semaphore held.
12584 -DEFINE_RWLOCK(dev_base_lock);
12586 -EXPORT_SYMBOL(dev_base_lock);
12588 -#define NETDEV_HASHBITS 8
12589 -#define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS)
12591 -static inline struct hlist_head *dev_name_hash(struct net *net, const char *name)
12593 - unsigned hash = full_name_hash(name, strnlen(name, IFNAMSIZ));
12594 - return &net->dev_name_head[hash & ((1 << NETDEV_HASHBITS) - 1)];
12597 -static inline struct hlist_head *dev_index_hash(struct net *net, int ifindex)
12599 - return &net->dev_index_head[ifindex & ((1 << NETDEV_HASHBITS) - 1)];
12602 -/* Device list insertion */
12603 -static int list_netdevice(struct net_device *dev)
12605 - struct net *net = dev_net(dev);
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);
12617 -/* Device list removal */
12618 -static void unlist_netdevice(struct net_device *dev)
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);
12631 - * Our notifier list
12634 -static RAW_NOTIFIER_HEAD(netdev_chain);
12637 - * Device drivers call our routines to queue packets here. We empty the
12638 - * queue in the local softnet handler.
12641 -DEFINE_PER_CPU(struct softnet_data, softnet_data);
12643 -#ifdef CONFIG_LOCKDEP
12645 - * register_netdevice() inits txq->_xmit_lock and sets lockdep class
12646 - * according to dev->type
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,
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",
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)];
12685 -static inline unsigned short netdev_lock_pos(unsigned short dev_type)
12689 - for (i = 0; i < ARRAY_SIZE(netdev_lock_type); i++)
12690 - if (netdev_lock_type[i] == dev_type)
12692 - /* the last key is used by default */
12693 - return ARRAY_SIZE(netdev_lock_type) - 1;
12696 -static inline void netdev_set_xmit_lockdep_class(spinlock_t *lock,
12697 - unsigned short dev_type)
12701 - i = netdev_lock_pos(dev_type);
12702 - lockdep_set_class_and_name(lock, &netdev_xmit_lock_key[i],
12703 - netdev_lock_name[i]);
12706 -static inline void netdev_set_addr_lockdep_class(struct net_device *dev)
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]);
12716 -static inline void netdev_set_xmit_lockdep_class(spinlock_t *lock,
12717 - unsigned short dev_type)
12720 -static inline void netdev_set_addr_lockdep_class(struct net_device *dev)
12725 -/*******************************************************************************
12727 - Protocol management and registration routines
12729 -*******************************************************************************/
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
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.
12748 - * dev_add_pack - add packet handler
12749 - * @pt: packet type declaration
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.
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).
12760 -void dev_add_pack(struct packet_type *pt)
12764 - spin_lock_bh(&ptype_lock);
12765 - if (pt->type == htons(ETH_P_ALL))
12766 - list_add_rcu(&pt->list, &ptype_all);
12768 - hash = ntohs(pt->type) & PTYPE_HASH_MASK;
12769 - list_add_rcu(&pt->list, &ptype_base[hash]);
12771 - spin_unlock_bh(&ptype_lock);
12775 - * __dev_remove_pack - remove packet handler
12776 - * @pt: packet type declaration
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
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.
12787 -void __dev_remove_pack(struct packet_type *pt)
12789 - struct list_head *head;
12790 - struct packet_type *pt1;
12792 - spin_lock_bh(&ptype_lock);
12794 - if (pt->type == htons(ETH_P_ALL))
12795 - head = &ptype_all;
12797 - head = &ptype_base[ntohs(pt->type) & PTYPE_HASH_MASK];
12799 - list_for_each_entry(pt1, head, list) {
12801 - list_del_rcu(&pt->list);
12806 - printk(KERN_WARNING "dev_remove_pack: %p not found.\n", pt);
12808 - spin_unlock_bh(&ptype_lock);
12811 - * dev_remove_pack - remove packet handler
12812 - * @pt: packet type declaration
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
12819 - * This call sleeps to guarantee that no CPU is looking at the packet
12820 - * type after return.
12822 -void dev_remove_pack(struct packet_type *pt)
12824 - __dev_remove_pack(pt);
12826 - synchronize_net();
12829 -/******************************************************************************
12831 - Device Boot-time Settings Routines
12833 -*******************************************************************************/
12835 -/* Boot time configuration table */
12836 -static struct netdev_boot_setup dev_boot_setup[NETDEV_BOOT_SETUP_MAX];
12839 - * netdev_boot_setup_add - add new setup entry
12840 - * @name: name of the device
12841 - * @map: configured settings for the device
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.
12847 -static int netdev_boot_setup_add(char *name, struct ifmap *map)
12849 - struct netdev_boot_setup *s;
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));
12862 - return i >= NETDEV_BOOT_SETUP_MAX ? 0 : 1;
12866 - * netdev_boot_setup_check - check boot time settings
12867 - * @dev: the netdevice
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.
12874 -int netdev_boot_setup_check(struct net_device *dev)
12876 - struct netdev_boot_setup *s = dev_boot_setup;
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;
12894 - * netdev_boot_base - get address from boot time settings
12895 - * @prefix: prefix for network device
12896 - * @unit: id for network device
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.
12903 -unsigned long netdev_boot_base(const char *prefix, int unit)
12905 - const struct netdev_boot_setup *s = dev_boot_setup;
12906 - char name[IFNAMSIZ];
12909 - sprintf(name, "%s%d", prefix, unit);
12912 - * If device already registered then return base of 1
12913 - * to indicate not to probe for this interface
12915 - if (__dev_get_by_name(&init_net, name))
12918 - for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++)
12919 - if (!strcmp(name, s[i].name))
12920 - return s[i].map.base_addr;
12925 - * Saves at boot time configured settings for any netdevice.
12927 -int __init netdev_boot_setup(char *str)
12930 - struct ifmap map;
12932 - str = get_options(str, ARRAY_SIZE(ints), ints);
12933 - if (!str || !*str)
12936 - /* Save settings */
12937 - memset(&map, 0, sizeof(map));
12939 - map.irq = ints[1];
12941 - map.base_addr = ints[2];
12943 - map.mem_start = ints[3];
12945 - map.mem_end = ints[4];
12947 - /* Add new entry to the list */
12948 - return netdev_boot_setup_add(str, &map);
12951 -__setup("netdev=", netdev_boot_setup);
12953 -/*******************************************************************************
12955 - Device Interface Subroutines
12957 -*******************************************************************************/
12960 - * __dev_get_by_name - find a device by its name
12961 - * @net: the applicable net namespace
12962 - * @name: name to find
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.
12971 -struct net_device *__dev_get_by_name(struct net *net, const char *name)
12973 - struct hlist_node *p;
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))
12985 - * dev_get_by_name - find a device by its name
12986 - * @net: the applicable net namespace
12987 - * @name: name to find
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.
12996 -struct net_device *dev_get_by_name(struct net *net, const char *name)
12998 - struct net_device *dev;
13000 - read_lock(&dev_base_lock);
13001 - dev = __dev_get_by_name(net, name);
13004 - read_unlock(&dev_base_lock);
13009 - * __dev_get_by_index - find a device by its ifindex
13010 - * @net: the applicable net namespace
13011 - * @ifindex: index of device
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.
13020 -struct net_device *__dev_get_by_index(struct net *net, int ifindex)
13022 - struct hlist_node *p;
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)
13035 - * dev_get_by_index - find a device by its ifindex
13036 - * @net: the applicable net namespace
13037 - * @ifindex: index of device
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.
13045 -struct net_device *dev_get_by_index(struct net *net, int ifindex)
13047 - struct net_device *dev;
13049 - read_lock(&dev_base_lock);
13050 - dev = __dev_get_by_index(net, ifindex);
13053 - read_unlock(&dev_base_lock);
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
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
13069 - * If the API was consistent this would be __dev_get_by_hwaddr
13072 -struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type, char *ha)
13074 - struct net_device *dev;
13078 - for_each_netdev(net, dev)
13079 - if (dev->type == type &&
13080 - !memcmp(dev->dev_addr, ha, dev->addr_len))
13086 -EXPORT_SYMBOL(dev_getbyhwaddr);
13088 -struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type)
13090 - struct net_device *dev;
13093 - for_each_netdev(net, dev)
13094 - if (dev->type == type)
13100 -EXPORT_SYMBOL(__dev_getfirstbyhwtype);
13102 -struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type)
13104 - struct net_device *dev;
13107 - dev = __dev_getfirstbyhwtype(net, type);
13114 -EXPORT_SYMBOL(dev_getfirstbyhwtype);
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
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.
13128 -struct net_device * dev_get_by_flags(struct net *net, unsigned short if_flags, unsigned short mask)
13130 - struct net_device *dev, *ret;
13133 - read_lock(&dev_base_lock);
13134 - for_each_netdev(net, dev) {
13135 - if (((dev->flags ^ if_flags) & mask) == 0) {
13141 - read_unlock(&dev_base_lock);
13146 - * dev_valid_name - check if name is okay for network device
13147 - * @name: name string
13149 - * Network device names need to be valid file names to
13150 - * to allow sysfs to work. We also disallow any kind of
13153 -int dev_valid_name(const char *name)
13155 - if (*name == '\0')
13157 - if (strlen(name) >= IFNAMSIZ)
13159 - if (!strcmp(name, ".") || !strcmp(name, ".."))
13163 - if (*name == '/' || isspace(*name))
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
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
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.
13185 -static int __dev_alloc_name(struct net *net, const char *name, char *buf)
13189 - const int max_netdevices = 8*PAGE_SIZE;
13190 - unsigned long *inuse;
13191 - struct net_device *d;
13193 - p = strnchr(name, IFNAMSIZ-1, '%');
13196 - * Verify the string as this thing may have come from
13197 - * the user. There must be either one "%d" and no other "%"
13200 - if (p[1] != 'd' || strchr(p + 2, '%'))
13203 - /* Use one page as a bit array of possible slots */
13204 - inuse = (unsigned long *) get_zeroed_page(GFP_ATOMIC);
13208 - for_each_netdev(net, d) {
13209 - if (!sscanf(d->name, name, &i))
13211 - if (i < 0 || i >= max_netdevices)
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);
13220 - i = find_first_zero_bit(inuse, max_netdevices);
13221 - free_page((unsigned long) inuse);
13224 - snprintf(buf, IFNAMSIZ, name, i);
13225 - if (!__dev_get_by_name(net, buf))
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.
13236 - * dev_alloc_name - allocate a name for a device
13238 - * @name: name format string
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
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.
13249 -int dev_alloc_name(struct net_device *dev, const char *name)
13251 - char buf[IFNAMSIZ];
13255 - BUG_ON(!dev_net(dev));
13256 - net = dev_net(dev);
13257 - ret = __dev_alloc_name(net, name, buf);
13259 - strlcpy(dev->name, buf, IFNAMSIZ);
13265 - * dev_change_name - change name of a device
13267 - * @newname: name (or format string) must be at least IFNAMSIZ
13269 - * Change name of a device, can pass format strings "eth%d".
13270 - * for wildcarding.
13272 -int dev_change_name(struct net_device *dev, char *newname)
13274 - char oldname[IFNAMSIZ];
13280 - BUG_ON(!dev_net(dev));
13282 - net = dev_net(dev);
13283 - if (dev->flags & IFF_UP)
13286 - if (!dev_valid_name(newname))
13289 - if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
13292 - memcpy(oldname, dev->name, IFNAMSIZ);
13294 - if (strchr(newname, '%')) {
13295 - err = dev_alloc_name(dev, newname);
13298 - strcpy(newname, dev->name);
13300 - else if (__dev_get_by_name(net, newname))
13303 - strlcpy(dev->name, newname, IFNAMSIZ);
13306 - /* For now only devices in the initial network namespace
13309 - if (net == &init_net) {
13310 - ret = device_rename(&dev->dev, dev->name);
13312 - memcpy(dev->name, oldname, IFNAMSIZ);
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);
13322 - ret = call_netdevice_notifiers(NETDEV_CHANGENAME, dev);
13323 - ret = notifier_to_errno(ret);
13328 - "%s: name change rollback failed: %d.\n",
13332 - memcpy(dev->name, oldname, IFNAMSIZ);
13341 - * netdev_features_change - device changes features
13342 - * @dev: device to cause notification
13344 - * Called to indicate a device has changed features.
13346 -void netdev_features_change(struct net_device *dev)
13348 - call_netdevice_notifiers(NETDEV_FEAT_CHANGE, dev);
13350 -EXPORT_SYMBOL(netdev_features_change);
13353 - * netdev_state_change - device changes state
13354 - * @dev: device to cause notification
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.
13360 -void netdev_state_change(struct net_device *dev)
13362 - if (dev->flags & IFF_UP) {
13363 - call_netdevice_notifiers(NETDEV_CHANGE, dev);
13364 - rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
13368 -void netdev_bonding_change(struct net_device *dev)
13370 - call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, dev);
13372 -EXPORT_SYMBOL(netdev_bonding_change);
13375 - * dev_load - load a network module
13376 - * @net: the applicable net namespace
13377 - * @name: name of interface
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.
13384 -void dev_load(struct net *net, const char *name)
13386 - struct net_device *dev;
13388 - read_lock(&dev_base_lock);
13389 - dev = __dev_get_by_name(net, name);
13390 - read_unlock(&dev_base_lock);
13392 - if (!dev && capable(CAP_SYS_MODULE))
13393 - request_module("%s", name);
13397 - * dev_open - prepare an interface for use.
13398 - * @dev: device to open
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.
13405 - * Calling this function on an active interface is a nop. On a failure
13406 - * a negative errno code is returned.
13408 -int dev_open(struct net_device *dev)
13415 - * Is it already up?
13418 - if (dev->flags & IFF_UP)
13422 - * Is it even present?
13424 - if (!netif_device_present(dev))
13428 - * Call device private open method
13430 - set_bit(__LINK_STATE_START, &dev->state);
13432 - if (dev->validate_addr)
13433 - ret = dev->validate_addr(dev);
13435 - if (!ret && dev->open)
13436 - ret = dev->open(dev);
13439 - * If it went open OK then:
13443 - clear_bit(__LINK_STATE_START, &dev->state);
13448 - dev->flags |= IFF_UP;
13451 - * Initialize multicasting status
13453 - dev_set_rx_mode(dev);
13456 - * Wakeup transmit queue engine
13458 - dev_activate(dev);
13461 - * ... and announce new interface.
13463 - call_netdevice_notifiers(NETDEV_UP, dev);
13470 - * dev_close - shutdown an interface.
13471 - * @dev: device to shutdown
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
13478 -int dev_close(struct net_device *dev)
13484 - if (!(dev->flags & IFF_UP))
13488 - * Tell people we are going down, so that they can
13489 - * prepare to death, when device is still operating.
13491 - call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
13493 - clear_bit(__LINK_STATE_START, &dev->state);
13495 - /* Synchronize to scheduled poll. We cannot touch poll list,
13496 - * it can be even on different cpu. So just clear netif_running().
13498 - * dev->stop() will invoke napi_disable() on all of it's
13499 - * napi_struct instances on this device.
13501 - smp_mb__after_clear_bit(); /* Commit netif_running(). */
13503 - dev_deactivate(dev);
13506 - * Call the device specific close. This cannot fail.
13507 - * Only if device is UP
13509 - * We allow it to be called even after a DETACH hot-plug
13516 - * Device is now down.
13519 - dev->flags &= ~IFF_UP;
13522 - * Tell people we are down
13524 - call_netdevice_notifiers(NETDEV_DOWN, dev);
13531 - * dev_disable_lro - disable Large Receive Offload on a device
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.
13538 -void dev_disable_lro(struct net_device *dev)
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);
13548 - WARN_ON(dev->features & NETIF_F_LRO);
13550 -EXPORT_SYMBOL(dev_disable_lro);
13553 -static int dev_boot_phase = 1;
13556 - * Device change register/unregister. These are not inline or static
13557 - * as we export them to the world.
13561 - * register_netdevice_notifier - register a network notifier block
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.
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.
13574 -int register_netdevice_notifier(struct notifier_block *nb)
13576 - struct net_device *dev;
13577 - struct net_device *last;
13582 - err = raw_notifier_chain_register(&netdev_chain, nb);
13585 - if (dev_boot_phase)
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);
13594 - if (!(dev->flags & IFF_UP))
13597 - nb->notifier_call(nb, NETDEV_UP, dev);
13607 - for_each_net(net) {
13608 - for_each_netdev(net, dev) {
13612 - if (dev->flags & IFF_UP) {
13613 - nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
13614 - nb->notifier_call(nb, NETDEV_DOWN, dev);
13616 - nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
13620 - raw_notifier_chain_unregister(&netdev_chain, nb);
13625 - * unregister_netdevice_notifier - unregister a network notifier block
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.
13634 -int unregister_netdevice_notifier(struct notifier_block *nb)
13639 - err = raw_notifier_chain_unregister(&netdev_chain, nb);
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
13649 - * Call all network notifier blocks. Parameters and return value
13650 - * are as for raw_notifier_call_chain().
13653 -int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
13655 - return raw_notifier_call_chain(&netdev_chain, val, dev);
13658 -/* When > 0 there are consumers of rx skb time stamps */
13659 -static atomic_t netstamp_needed = ATOMIC_INIT(0);
13661 -void net_enable_timestamp(void)
13663 - atomic_inc(&netstamp_needed);
13666 -void net_disable_timestamp(void)
13668 - atomic_dec(&netstamp_needed);
13671 -static inline void net_timestamp(struct sk_buff *skb)
13673 - if (atomic_read(&netstamp_needed))
13674 - __net_timestamp(skb);
13676 - skb->tstamp.tv64 = 0;
13680 - * Support routine. Sends outgoing frames to any network
13681 - * taps currently in use.
13684 -static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
13686 - struct packet_type *ptype;
13688 - net_timestamp(skb);
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)
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);
13702 - /* skb->nh should be correctly
13703 - set by sender, so that the second statement is
13704 - just protection against buggy protocols.
13706 - skb_reset_mac_header(skb2);
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);
13717 - skb2->transport_header = skb2->network_header;
13718 - skb2->pkt_type = PACKET_OUTGOING;
13719 - ptype->func(skb2, skb->dev, ptype, skb->dev);
13722 - rcu_read_unlock();
13726 -static inline void __netif_reschedule(struct Qdisc *q)
13728 - struct softnet_data *sd;
13729 - unsigned long flags;
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);
13739 -void __netif_schedule(struct Qdisc *q)
13741 - if (!test_and_set_bit(__QDISC_STATE_SCHED, &q->state))
13742 - __netif_reschedule(q);
13744 -EXPORT_SYMBOL(__netif_schedule);
13746 -void dev_kfree_skb_irq(struct sk_buff *skb)
13748 - if (atomic_dec_and_test(&skb->users)) {
13749 - struct softnet_data *sd;
13750 - unsigned long flags;
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);
13760 -EXPORT_SYMBOL(dev_kfree_skb_irq);
13762 -void dev_kfree_skb_any(struct sk_buff *skb)
13764 - if (in_irq() || irqs_disabled())
13765 - dev_kfree_skb_irq(skb);
13767 - dev_kfree_skb(skb);
13769 -EXPORT_SYMBOL(dev_kfree_skb_any);
13773 - * netif_device_detach - mark device as removed
13774 - * @dev: network device
13776 - * Mark device as removed from system and therefore no longer available.
13778 -void netif_device_detach(struct net_device *dev)
13780 - if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) &&
13781 - netif_running(dev)) {
13782 - netif_stop_queue(dev);
13785 -EXPORT_SYMBOL(netif_device_detach);
13788 - * netif_device_attach - mark device as attached
13789 - * @dev: network device
13791 - * Mark device as attached from system and restart if needed.
13793 -void netif_device_attach(struct net_device *dev)
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);
13801 -EXPORT_SYMBOL(netif_device_attach);
13803 -static bool can_checksum_protocol(unsigned long features, __be16 protocol)
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)));
13812 -static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb)
13814 - if (can_checksum_protocol(dev->features, skb->protocol))
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))
13828 - * Invalidate hardware checksum when packet is to be mangled, and
13829 - * complete checksum manually on outgoing path.
13831 -int skb_checksum_help(struct sk_buff *skb)
13834 - int ret = 0, offset;
13836 - if (skb->ip_summed == CHECKSUM_COMPLETE)
13837 - goto out_set_summed;
13839 - if (unlikely(skb_shinfo(skb)->gso_size)) {
13840 - /* Let GSO fix up the checksum. */
13841 - goto out_set_summed;
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);
13848 - offset += skb->csum_offset;
13849 - BUG_ON(offset + sizeof(__sum16) > skb_headlen(skb));
13851 - if (skb_cloned(skb) &&
13852 - !skb_clone_writable(skb, offset + sizeof(__sum16))) {
13853 - ret = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
13858 - *(__sum16 *)(skb->data + offset) = csum_fold(csum);
13860 - skb->ip_summed = CHECKSUM_NONE;
13866 - * skb_gso_segment - Perform segmentation on skb.
13867 - * @skb: buffer to segment
13868 - * @features: features for the output path (see dev->features)
13870 - * This function segments the given skb and returns a list of segments.
13872 - * It may return NULL if the skb requires no segmentation. This is
13873 - * only possible when GSO is used for verifying header integrity.
13875 -struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
13877 - struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
13878 - struct packet_type *ptype;
13879 - __be16 type = skb->protocol;
13882 - BUG_ON(skb_shinfo(skb)->frag_list);
13884 - skb_reset_mac_header(skb);
13885 - skb->mac_len = skb->network_header - skb->mac_header;
13886 - __skb_pull(skb, skb->mac_len);
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);
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))
13903 - __skb_push(skb, (skb->data -
13904 - skb_network_header(skb)));
13906 - segs = ptype->gso_segment(skb, features);
13910 - rcu_read_unlock();
13912 - __skb_push(skb, skb->data - skb_mac_header(skb));
13917 -EXPORT_SYMBOL(skb_gso_segment);
13919 -/* Take action when hardware reception checksum errors are detected. */
13921 -void netdev_rx_csum_fault(struct net_device *dev)
13923 - if (net_ratelimit()) {
13924 - printk(KERN_ERR "%s: hw csum failure.\n",
13925 - dev ? dev->name : "<unknown>");
13929 -EXPORT_SYMBOL(netdev_rx_csum_fault);
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.
13937 -static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
13939 -#ifdef CONFIG_HIGHMEM
13942 - if (dev->features & NETIF_F_HIGHDMA)
13945 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
13946 - if (PageHighMem(skb_shinfo(skb)->frags[i].page))
13953 -struct dev_gso_cb {
13954 - void (*destructor)(struct sk_buff *skb);
13957 -#define DEV_GSO_CB(skb) ((struct dev_gso_cb *)(skb)->cb)
13959 -static void dev_gso_skb_destructor(struct sk_buff *skb)
13961 - struct dev_gso_cb *cb;
13964 - struct sk_buff *nskb = skb->next;
13966 - skb->next = nskb->next;
13967 - nskb->next = NULL;
13969 - } while (skb->next);
13971 - cb = DEV_GSO_CB(skb);
13972 - if (cb->destructor)
13973 - cb->destructor(skb);
13977 - * dev_gso_segment - Perform emulated hardware segmentation on skb.
13978 - * @skb: buffer to segment
13980 - * This function segments the given skb and stores the list of segments
13983 -static int dev_gso_segment(struct sk_buff *skb)
13985 - struct net_device *dev = skb->dev;
13986 - struct sk_buff *segs;
13987 - int features = dev->features & ~(illegal_highdma(dev, skb) ?
13990 - segs = skb_gso_segment(skb, features);
13992 - /* Verifying header integrity only. */
13996 - if (IS_ERR(segs))
13997 - return PTR_ERR(segs);
13999 - skb->next = segs;
14000 - DEV_GSO_CB(skb)->destructor = skb->destructor;
14001 - skb->destructor = dev_gso_skb_destructor;
14006 -int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
14007 - struct netdev_queue *txq)
14009 - if (likely(!skb->next)) {
14010 - if (!list_empty(&ptype_all))
14011 - dev_queue_xmit_nit(skb, dev);
14013 - if (netif_needs_gso(dev, skb)) {
14014 - if (unlikely(dev_gso_segment(skb)))
14015 - goto out_kfree_skb;
14020 - return dev->hard_start_xmit(skb, dev);
14025 - struct sk_buff *nskb = skb->next;
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;
14036 - if (unlikely(netif_tx_queue_stopped(txq) && skb->next))
14037 - return NETDEV_TX_BUSY;
14038 - } while (skb->next);
14040 - skb->destructor = DEV_GSO_CB(skb)->destructor;
14047 -static u32 simple_tx_hashrnd;
14048 -static int simple_tx_hashrnd_initialized = 0;
14050 -static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
14052 - u32 addr1, addr2, ports;
14056 - if (unlikely(!simple_tx_hashrnd_initialized)) {
14057 - get_random_bytes(&simple_tx_hashrnd, 4);
14058 - simple_tx_hashrnd_initialized = 1;
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;
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];
14080 - switch (ip_proto) {
14081 - case IPPROTO_TCP:
14082 - case IPPROTO_UDP:
14083 - case IPPROTO_DCCP:
14084 - case IPPROTO_ESP:
14086 - case IPPROTO_SCTP:
14087 - case IPPROTO_UDPLITE:
14088 - ports = *((u32 *) (skb_network_header(skb) + (ihl * 4)));
14096 - hash = jhash_3words(addr1, addr2, ports, simple_tx_hashrnd);
14098 - return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32);
14101 -static struct netdev_queue *dev_pick_tx(struct net_device *dev,
14102 - struct sk_buff *skb)
14104 - u16 queue_index = 0;
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);
14111 - skb_set_queue_mapping(skb, queue_index);
14112 - return netdev_get_tx_queue(dev, queue_index);
14116 - * dev_queue_xmit - transmit a buffer
14117 - * @skb: buffer to transmit
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.
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.
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
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.)
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.
14140 -int dev_queue_xmit(struct sk_buff *skb)
14142 - struct net_device *dev = skb->dev;
14143 - struct netdev_queue *txq;
14145 - int rc = -ENOMEM;
14147 - /* GSO will handle the following emulations directly. */
14148 - if (netif_needs_gso(dev, skb))
14151 - if (skb_shinfo(skb)->frag_list &&
14152 - !(dev->features & NETIF_F_FRAGLIST) &&
14153 - __skb_linearize(skb))
14154 - goto out_kfree_skb;
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.
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;
14165 - /* If packet is not checksummed and device does not support
14166 - * checksumming for this protocol, complete checksumming here.
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;
14176 - /* Disable soft irqs for various locks below. Also
14177 - * stops preemption for RCU.
14179 - rcu_read_lock_bh();
14181 - txq = dev_pick_tx(dev, skb);
14182 - q = rcu_dereference(txq->qdisc);
14184 -#ifdef CONFIG_NET_CLS_ACT
14185 - skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS);
14187 - if (q->enqueue) {
14188 - spinlock_t *root_lock = qdisc_lock(q);
14190 - spin_lock(root_lock);
14192 - if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) {
14194 - rc = NET_XMIT_DROP;
14196 - rc = qdisc_enqueue_root(skb, q);
14199 - spin_unlock(root_lock);
14204 - /* The device has no queue. Common case for software devices:
14205 - loopback, all the sorts of tunnels...
14207 - Really, it is unlikely that netif_tx_lock protection is necessary
14208 - here. (f.e. loopback and IP tunnels are clean ignoring statistics
14210 - However, it is possible, that they rely on protection
14213 - Check this and shot the lock. It is not prone from deadlocks.
14214 - Either shot noqueue qdisc, it is even simpler 8)
14216 - if (dev->flags & IFF_UP) {
14217 - int cpu = smp_processor_id(); /* ok because BHs are off */
14219 - if (txq->xmit_lock_owner != cpu) {
14221 - HARD_TX_LOCK(dev, txq, cpu);
14223 - if (!netif_tx_queue_stopped(txq)) {
14225 - if (!dev_hard_start_xmit(skb, dev, txq)) {
14226 - HARD_TX_UNLOCK(dev, txq);
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);
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);
14244 - rcu_read_unlock_bh();
14250 - rcu_read_unlock_bh();
14255 -/*=======================================================================
14256 - Receiver routines
14257 - =======================================================================*/
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 */
14263 -DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, };
14267 - * netif_rx - post buffer to the network code
14268 - * @skb: buffer to post
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.
14276 - * NET_RX_SUCCESS (no congestion)
14277 - * NET_RX_DROP (packet was dropped)
14281 -int netif_rx(struct sk_buff *skb)
14283 - struct softnet_data *queue;
14284 - unsigned long flags;
14286 - /* if netpoll wants it, pretend we never saw it */
14287 - if (netpoll_rx(skb))
14288 - return NET_RX_DROP;
14290 - if (!skb->tstamp.tv64)
14291 - net_timestamp(skb);
14294 - * The code is rearranged so that the path is the most
14295 - * short when CPU is congested, but is still operating.
14297 - local_irq_save(flags);
14298 - queue = &__get_cpu_var(softnet_data);
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) {
14304 - __skb_queue_tail(&queue->input_pkt_queue, skb);
14305 - local_irq_restore(flags);
14306 - return NET_RX_SUCCESS;
14309 - napi_schedule(&queue->backlog);
14313 - __get_cpu_var(netdev_rx_stat).dropped++;
14314 - local_irq_restore(flags);
14317 - return NET_RX_DROP;
14320 -int netif_rx_ni(struct sk_buff *skb)
14324 - preempt_disable();
14325 - err = netif_rx(skb);
14326 - if (local_softirq_pending())
14328 - preempt_enable();
14333 -EXPORT_SYMBOL(netif_rx_ni);
14335 -static void net_tx_action(struct softirq_action *h)
14337 - struct softnet_data *sd = &__get_cpu_var(softnet_data);
14339 - if (sd->completion_queue) {
14340 - struct sk_buff *clist;
14342 - local_irq_disable();
14343 - clist = sd->completion_queue;
14344 - sd->completion_queue = NULL;
14345 - local_irq_enable();
14348 - struct sk_buff *skb = clist;
14349 - clist = clist->next;
14351 - WARN_ON(atomic_read(&skb->users));
14352 - __kfree_skb(skb);
14356 - if (sd->output_queue) {
14357 - struct Qdisc *head;
14359 - local_irq_disable();
14360 - head = sd->output_queue;
14361 - sd->output_queue = NULL;
14362 - local_irq_enable();
14365 - struct Qdisc *q = head;
14366 - spinlock_t *root_lock;
14368 - head = head->next_sched;
14370 - root_lock = qdisc_lock(q);
14371 - if (spin_trylock(root_lock)) {
14372 - smp_mb__before_clear_bit();
14373 - clear_bit(__QDISC_STATE_SCHED,
14376 - spin_unlock(root_lock);
14378 - if (!test_bit(__QDISC_STATE_DEACTIVATED,
14380 - __netif_reschedule(q);
14382 - smp_mb__before_clear_bit();
14383 - clear_bit(__QDISC_STATE_SCHED,
14391 -static inline int deliver_skb(struct sk_buff *skb,
14392 - struct packet_type *pt_prev,
14393 - struct net_device *orig_dev)
14395 - atomic_inc(&skb->users);
14396 - return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
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;
14407 - * If bridge module is loaded call bridging hook.
14408 - * returns NULL if packet was consumed.
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)
14416 - struct net_bridge_port *port;
14418 - if (skb->pkt_type == PACKET_LOOPBACK ||
14419 - (port = rcu_dereference(skb->dev->br_port)) == NULL)
14423 - *ret = deliver_skb(skb, *pt_prev, orig_dev);
14427 - return br_handle_frame_hook(port, skb);
14430 -#define handle_bridge(skb, pt_prev, ret, orig_dev) (skb)
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);
14437 -static inline struct sk_buff *handle_macvlan(struct sk_buff *skb,
14438 - struct packet_type **pt_prev,
14440 - struct net_device *orig_dev)
14442 - if (skb->dev->macvlan_port == NULL)
14446 - *ret = deliver_skb(skb, *pt_prev, orig_dev);
14449 - return macvlan_handle_frame_hook(skb);
14452 -#define handle_macvlan(skb, pt_prev, ret, orig_dev) (skb)
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.
14464 -static int ing_filter(struct sk_buff *skb)
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;
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;
14479 - skb->tc_verd = SET_TC_RTTL(skb->tc_verd, ttl);
14480 - skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_INGRESS);
14482 - rxq = &dev->rx_queue;
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));
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)
14499 - if (skb->dev->rx_queue.qdisc == &noop_qdisc)
14503 - *ret = deliver_skb(skb, *pt_prev, orig_dev);
14506 - /* Huh? Why does turning on AF_PACKET affect this? */
14507 - skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd);
14510 - switch (ing_filter(skb)) {
14511 - case TC_ACT_SHOT:
14512 - case TC_ACT_STOLEN:
14518 - skb->tc_verd = 0;
14524 - * netif_nit_deliver - deliver received packets to network taps
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.
14531 -void netif_nit_deliver(struct sk_buff *skb)
14533 - struct packet_type *ptype;
14535 - if (list_empty(&ptype_all))
14538 - skb_reset_network_header(skb);
14539 - skb_reset_transport_header(skb);
14540 - skb->mac_len = skb->network_header - skb->mac_header;
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);
14547 - rcu_read_unlock();
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;
14555 - * netif_receive_skb - process receive buffer from network
14556 - * @skb: buffer to process
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.
14562 - * This function may only be called from softirq context and interrupts
14563 - * should be enabled.
14565 - * Return values (usually ignored):
14566 - * NET_RX_SUCCESS: no congestion
14567 - * NET_RX_DROP: packet was dropped
14569 -int netif_receive_skb(struct sk_buff *skb)
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);
14578 - *cur_elevator = 0;
14580 - /* if we've gotten here through NAPI, check netpoll */
14581 - if (netpoll_receive_skb(skb))
14582 - return NET_RX_DROP;
14584 - if (!skb->tstamp.tv64)
14585 - net_timestamp(skb);
14588 - skb->iif = skb->dev->ifindex;
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 */
14596 - skb->dev = orig_dev->master;
14599 - __get_cpu_var(netdev_rx_stat).total++;
14601 - skb_reset_network_header(skb);
14602 - skb_reset_transport_header(skb);
14603 - skb->mac_len = skb->network_header - skb->mac_header;
14609 - /* Don't receive packets in an exiting network namespace */
14610 - if (!net_alive(dev_net(skb->dev)))
14613 -#ifdef CONFIG_NET_CLS_ACT
14614 - if (skb->tc_verd & TC_NCLS) {
14615 - skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
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) {
14624 - ret = deliver_skb(skb, pt_prev, orig_dev);
14629 -#ifdef CONFIG_NET_CLS_ACT
14630 - skb = handle_ing(skb, &pt_prev, &ret, orig_dev);
14636 - skb = handle_bridge(skb, &pt_prev, &ret, orig_dev);
14639 - skb = handle_macvlan(skb, &pt_prev, &ret, orig_dev);
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)) {
14650 - ret = deliver_skb(skb, pt_prev, orig_dev);
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);
14662 - ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
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);
14673 - if (*cur_elevator) {
14674 - /* We have a packet */
14679 - /* Jamal, now you will not able to escape explaining
14680 - * me how you were going to use this. :-)
14682 - ret = NET_RX_DROP;
14686 - rcu_read_unlock();
14690 -/* Network device is going away, flush any packets still pending */
14691 -static void flush_backlog(void *arg)
14693 - struct net_device *dev = arg;
14694 - struct softnet_data *queue = &__get_cpu_var(softnet_data);
14695 - struct sk_buff *skb, *tmp;
14697 - skb_queue_walk_safe(&queue->input_pkt_queue, skb, tmp)
14698 - if (skb->dev == dev) {
14699 - __skb_unlink(skb, &queue->input_pkt_queue);
14704 -static int process_backlog(struct napi_struct *napi, int quota)
14707 - struct softnet_data *queue = &__get_cpu_var(softnet_data);
14708 - unsigned long start_time = jiffies;
14710 - napi->weight = weight_p;
14712 - struct sk_buff *skb;
14714 - local_irq_disable();
14715 - skb = __skb_dequeue(&queue->input_pkt_queue);
14717 - __napi_complete(napi);
14718 - local_irq_enable();
14721 - local_irq_enable();
14723 - netif_receive_skb(skb);
14724 - } while (++work < quota && jiffies == start_time);
14730 - * __napi_schedule - schedule for receive
14731 - * @n: entry to schedule
14733 - * The entry's receive function will be scheduled to run
14735 -void __napi_schedule(struct napi_struct *n)
14737 - unsigned long flags;
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);
14744 -EXPORT_SYMBOL(__napi_schedule);
14747 -static void net_rx_action(struct softirq_action *h)
14749 - struct list_head *list = &__get_cpu_var(softnet_data).poll_list;
14750 - unsigned long start_time = jiffies;
14751 - int budget = netdev_budget;
14754 - local_irq_disable();
14756 - while (!list_empty(list)) {
14757 - struct napi_struct *n;
14758 - int work, weight;
14760 - /* If softirq window is exhuasted then punt.
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".
14767 - if (unlikely(budget <= 0 || jiffies != start_time))
14768 - goto softnet_break;
14770 - local_irq_enable();
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.
14777 - n = list_entry(list->next, struct napi_struct, poll_list);
14779 - have = netpoll_poll_lock(n);
14781 - weight = n->weight;
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.
14790 - if (test_bit(NAPI_STATE_SCHED, &n->state))
14791 - work = n->poll(n, weight);
14793 - WARN_ON_ONCE(work > weight);
14797 - local_irq_disable();
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.
14804 - if (unlikely(work == weight)) {
14805 - if (unlikely(napi_disable_pending(n)))
14806 - __napi_complete(n);
14808 - list_move_tail(&n->poll_list, list);
14811 - netpoll_poll_unlock(have);
14814 - local_irq_enable();
14816 -#ifdef CONFIG_NET_DMA
14818 - * There may not be any more sk_buffs coming right now, so push
14819 - * any pending DMA copies to hardware
14821 - if (!cpus_empty(net_dma.channel_mask)) {
14823 - for_each_cpu_mask_nr(chan_idx, net_dma.channel_mask) {
14824 - struct dma_chan *chan = net_dma.channels[chan_idx];
14826 - dma_async_memcpy_issue_pending(chan);
14834 - __get_cpu_var(netdev_rx_stat).time_squeeze++;
14835 - __raise_softirq_irqoff(NET_RX_SOFTIRQ);
14839 -static gifconf_func_t * gifconf_list [NPROTO];
14842 - * register_gifconf - register a SIOCGIF handler
14843 - * @family: Address family
14844 - * @gifconf: Function handler
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.
14850 -int register_gifconf(unsigned int family, gifconf_func_t * gifconf)
14852 - if (family >= NPROTO)
14854 - gifconf_list[family] = gifconf;
14860 - * Map an interface index to its name (SIOCGIFNAME)
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
14870 -static int dev_ifname(struct net *net, struct ifreq __user *arg)
14872 - struct net_device *dev;
14873 - struct ifreq ifr;
14876 - * Fetch the caller's info block.
14879 - if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
14882 - read_lock(&dev_base_lock);
14883 - dev = __dev_get_by_index(net, ifr.ifr_ifindex);
14885 - read_unlock(&dev_base_lock);
14889 - strcpy(ifr.ifr_name, dev->name);
14890 - read_unlock(&dev_base_lock);
14892 - if (copy_to_user(arg, &ifr, sizeof(struct ifreq)))
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'.
14903 -static int dev_ifconf(struct net *net, char __user *arg)
14905 - struct ifconf ifc;
14906 - struct net_device *dev;
14907 - char __user *pos;
14913 - * Fetch the caller's info block.
14916 - if (copy_from_user(&ifc, arg, sizeof(struct ifconf)))
14919 - pos = ifc.ifc_buf;
14920 - len = ifc.ifc_len;
14923 - * Loop over the interfaces, and write an info block for each.
14927 - for_each_netdev(net, dev) {
14928 - if (!nx_dev_visible(current->nx_info, dev))
14930 - for (i = 0; i < NPROTO; i++) {
14931 - if (gifconf_list[i]) {
14934 - done = gifconf_list[i](dev, NULL, 0);
14936 - done = gifconf_list[i](dev, pos + total,
14946 - * All done. Write the updated control block back to the caller.
14948 - ifc.ifc_len = total;
14951 - * Both BSD and Solaris return 0 here, so we do too.
14953 - return copy_to_user(arg, &ifc, sizeof(struct ifconf)) ? -EFAULT : 0;
14956 -#ifdef CONFIG_PROC_FS
14958 - * This is invoked by the /proc filesystem handler to display a device
14961 -void *dev_seq_start(struct seq_file *seq, loff_t *pos)
14962 - __acquires(dev_base_lock)
14964 - struct net *net = seq_file_net(seq);
14966 - struct net_device *dev;
14968 - read_lock(&dev_base_lock);
14970 - return SEQ_START_TOKEN;
14973 - for_each_netdev(net, dev)
14974 - if (off++ == *pos)
14980 -void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
14982 - struct net *net = seq_file_net(seq);
14984 - return v == SEQ_START_TOKEN ?
14985 - first_net_device(net) : next_net_device((struct net_device *)v);
14988 -void dev_seq_stop(struct seq_file *seq, void *v)
14989 - __releases(dev_base_lock)
14991 - read_unlock(&dev_base_lock);
14994 -static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
14996 - struct net_device_stats *stats = dev->get_stats(dev);
14998 - if (!nx_dev_visible(current->nx_info, dev))
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);
15021 - * Called from the PROCfs module. This now uses the new arbitrary sized
15022 - * /proc/net interface to create /proc/net/dev
15024 -static int dev_seq_show(struct seq_file *seq, void *v)
15026 - if (v == SEQ_START_TOKEN)
15027 - seq_puts(seq, "Inter-| Receive "
15029 - " face |bytes packets errs drop fifo frame "
15030 - "compressed multicast|bytes packets errs "
15031 - "drop fifo colls carrier compressed\n");
15033 - dev_seq_printf_stats(seq, v);
15037 -static struct netif_rx_stats *softnet_get_online(loff_t *pos)
15039 - struct netif_rx_stats *rc = NULL;
15041 - while (*pos < nr_cpu_ids)
15042 - if (cpu_online(*pos)) {
15043 - rc = &per_cpu(netdev_rx_stat, *pos);
15050 -static void *softnet_seq_start(struct seq_file *seq, loff_t *pos)
15052 - return softnet_get_online(pos);
15055 -static void *softnet_seq_next(struct seq_file *seq, void *v, loff_t *pos)
15058 - return softnet_get_online(pos);
15061 -static void softnet_seq_stop(struct seq_file *seq, void *v)
15065 -static int softnet_seq_show(struct seq_file *seq, void *v)
15067 - struct netif_rx_stats *s = v;
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 );
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,
15083 -static int dev_seq_open(struct inode *inode, struct file *file)
15085 - return seq_open_net(inode, file, &dev_seq_ops,
15086 - sizeof(struct seq_net_private));
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,
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,
15104 -static int softnet_seq_open(struct inode *inode, struct file *file)
15106 - return seq_open(file, &softnet_seq_ops);
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,
15117 -static void *ptype_get_idx(loff_t pos)
15119 - struct packet_type *pt = NULL;
15123 - list_for_each_entry_rcu(pt, &ptype_all, list) {
15129 - for (t = 0; t < PTYPE_HASH_SIZE; t++) {
15130 - list_for_each_entry_rcu(pt, &ptype_base[t], list) {
15139 -static void *ptype_seq_start(struct seq_file *seq, loff_t *pos)
15143 - return *pos ? ptype_get_idx(*pos - 1) : SEQ_START_TOKEN;
15146 -static void *ptype_seq_next(struct seq_file *seq, void *v, loff_t *pos)
15148 - struct packet_type *pt;
15149 - struct list_head *nxt;
15153 - if (v == SEQ_START_TOKEN)
15154 - return ptype_get_idx(0);
15157 - nxt = pt->list.next;
15158 - if (pt->type == htons(ETH_P_ALL)) {
15159 - if (nxt != &ptype_all)
15162 - nxt = ptype_base[0].next;
15164 - hash = ntohs(pt->type) & PTYPE_HASH_MASK;
15166 - while (nxt == &ptype_base[hash]) {
15167 - if (++hash >= PTYPE_HASH_SIZE)
15169 - nxt = ptype_base[hash].next;
15172 - return list_entry(nxt, struct packet_type, list);
15175 -static void ptype_seq_stop(struct seq_file *seq, void *v)
15178 - rcu_read_unlock();
15181 -static void ptype_seq_decode(struct seq_file *seq, void *sym)
15183 -#ifdef CONFIG_KALLSYMS
15184 - unsigned long offset = 0, symsize;
15185 - const char *symname;
15187 - char namebuf[128];
15189 - symname = kallsyms_lookup((unsigned long)sym, &symsize, &offset,
15190 - &modname, namebuf);
15193 - char *delim = ":";
15196 - modname = delim = "";
15197 - seq_printf(seq, "%s%s%s%s+0x%lx", delim, modname, delim,
15198 - symname, offset);
15203 - seq_printf(seq, "[%p]", sym);
15206 -static int ptype_seq_show(struct seq_file *seq, void *v)
15208 - struct packet_type *pt = v;
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 ");
15216 - seq_printf(seq, "%04x", ntohs(pt->type));
15218 - seq_printf(seq, " %-8s ",
15219 - pt->dev ? pt->dev->name : "");
15220 - ptype_seq_decode(seq, pt->func);
15221 - seq_putc(seq, '\n');
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,
15234 -static int ptype_seq_open(struct inode *inode, struct file *file)
15236 - return seq_open_net(inode, file, &ptype_seq_ops,
15237 - sizeof(struct seq_net_private));
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,
15249 -static int __net_init dev_proc_net_init(struct net *net)
15251 - int rc = -ENOMEM;
15253 - if (!proc_net_fops_create(net, "dev", S_IRUGO, &dev_seq_fops))
15255 - if (!proc_net_fops_create(net, "softnet_stat", S_IRUGO, &softnet_seq_fops))
15257 - if (!proc_net_fops_create(net, "ptype", S_IRUGO, &ptype_seq_fops))
15258 - goto out_softnet;
15260 - if (wext_proc_init(net))
15266 - proc_net_remove(net, "ptype");
15268 - proc_net_remove(net, "softnet_stat");
15270 - proc_net_remove(net, "dev");
15274 -static void __net_exit dev_proc_net_exit(struct net *net)
15276 - wext_proc_exit(net);
15278 - proc_net_remove(net, "ptype");
15279 - proc_net_remove(net, "softnet_stat");
15280 - proc_net_remove(net, "dev");
15283 -static struct pernet_operations __net_initdata dev_proc_ops = {
15284 - .init = dev_proc_net_init,
15285 - .exit = dev_proc_net_exit,
15288 -static int __init dev_proc_init(void)
15290 - return register_pernet_subsys(&dev_proc_ops);
15293 -#define dev_proc_init() 0
15294 -#endif /* CONFIG_PROC_FS */
15298 - * netdev_set_master - set up master/slave pair
15299 - * @slave: slave device
15300 - * @master: new master device
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.
15308 -int netdev_set_master(struct net_device *slave, struct net_device *master)
15310 - struct net_device *old = slave->master;
15317 - dev_hold(master);
15320 - slave->master = master;
15322 - synchronize_net();
15328 - slave->flags |= IFF_SLAVE;
15330 - slave->flags &= ~IFF_SLAVE;
15332 - rtmsg_ifinfo(RTM_NEWLINK, slave, IFF_SLAVE);
15336 -static void dev_change_rx_flags(struct net_device *dev, int flags)
15338 - if (dev->flags & IFF_UP && dev->change_rx_flags)
15339 - dev->change_rx_flags(dev, flags);
15342 -static int __dev_set_promiscuity(struct net_device *dev, int inc)
15344 - unsigned short old_flags = dev->flags;
15348 - dev->flags |= IFF_PROMISC;
15349 - dev->promiscuity += inc;
15350 - if (dev->promiscuity == 0) {
15352 - * Avoid overflow.
15353 - * If inc causes overflow, untouch promisc and return error.
15356 - dev->flags &= ~IFF_PROMISC;
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;
15365 - if (dev->flags != old_flags) {
15366 - printk(KERN_INFO "device %s %s promiscuous mode\n",
15367 - dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
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));
15379 - dev_change_rx_flags(dev, IFF_PROMISC);
15385 - * dev_set_promiscuity - update promiscuity count on a device
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.
15395 -int dev_set_promiscuity(struct net_device *dev, int inc)
15397 - unsigned short old_flags = dev->flags;
15400 - err = __dev_set_promiscuity(dev, inc);
15403 - if (dev->flags != old_flags)
15404 - dev_set_rx_mode(dev);
15409 - * dev_set_allmulti - update allmulti count on a device
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.
15421 -int dev_set_allmulti(struct net_device *dev, int inc)
15423 - unsigned short old_flags = dev->flags;
15427 - dev->flags |= IFF_ALLMULTI;
15428 - dev->allmulti += inc;
15429 - if (dev->allmulti == 0) {
15431 - * Avoid overflow.
15432 - * If inc causes overflow, untouch allmulti and return error.
15435 - dev->flags &= ~IFF_ALLMULTI;
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;
15444 - if (dev->flags ^ old_flags) {
15445 - dev_change_rx_flags(dev, IFF_ALLMULTI);
15446 - dev_set_rx_mode(dev);
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
15457 -void __dev_set_rx_mode(struct net_device *dev)
15459 - /* dev_open will call this function so the list will stay sane. */
15460 - if (!(dev->flags&IFF_UP))
15463 - if (!netif_device_present(dev))
15466 - if (dev->set_rx_mode)
15467 - dev->set_rx_mode(dev);
15469 - /* Unicast addresses changes may only happen under the rtnl,
15470 - * therefore calling __dev_set_promiscuity here is safe.
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;
15480 - if (dev->set_multicast_list)
15481 - dev->set_multicast_list(dev);
15485 -void dev_set_rx_mode(struct net_device *dev)
15487 - netif_addr_lock_bh(dev);
15488 - __dev_set_rx_mode(dev);
15489 - netif_addr_unlock_bh(dev);
15492 -int __dev_addr_delete(struct dev_addr_list **list, int *count,
15493 - void *addr, int alen, int glbl)
15495 - struct dev_addr_list *da;
15497 - for (; (da = *list) != NULL; list = &da->next) {
15498 - if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 &&
15499 - alen == da->da_addrlen) {
15501 - int old_glbl = da->da_gusers;
15502 - da->da_gusers = 0;
15503 - if (old_glbl == 0)
15506 - if (--da->da_users)
15509 - *list = da->next;
15518 -int __dev_addr_add(struct dev_addr_list **list, int *count,
15519 - void *addr, int alen, int glbl)
15521 - struct dev_addr_list *da;
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) {
15527 - int old_glbl = da->da_gusers;
15528 - da->da_gusers = 1;
15537 - da = kzalloc(sizeof(*da), GFP_ATOMIC);
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;
15551 - * dev_unicast_delete - Release secondary unicast address.
15553 - * @addr: address to delete
15554 - * @alen: length of @addr
15556 - * Release reference to a secondary unicast address and remove it
15557 - * from the device if the reference count drops to zero.
15559 - * The caller must hold the rtnl_mutex.
15561 -int dev_unicast_delete(struct net_device *dev, void *addr, int alen)
15567 - netif_addr_lock_bh(dev);
15568 - err = __dev_addr_delete(&dev->uc_list, &dev->uc_count, addr, alen, 0);
15570 - __dev_set_rx_mode(dev);
15571 - netif_addr_unlock_bh(dev);
15574 -EXPORT_SYMBOL(dev_unicast_delete);
15577 - * dev_unicast_add - add a secondary unicast address
15579 - * @addr: address to add
15580 - * @alen: length of @addr
15582 - * Add a secondary unicast address to the device or increase
15583 - * the reference count if it already exists.
15585 - * The caller must hold the rtnl_mutex.
15587 -int dev_unicast_add(struct net_device *dev, void *addr, int alen)
15593 - netif_addr_lock_bh(dev);
15594 - err = __dev_addr_add(&dev->uc_list, &dev->uc_count, addr, alen, 0);
15596 - __dev_set_rx_mode(dev);
15597 - netif_addr_unlock_bh(dev);
15600 -EXPORT_SYMBOL(dev_unicast_add);
15602 -int __dev_addr_sync(struct dev_addr_list **to, int *to_count,
15603 - struct dev_addr_list **from, int *from_count)
15605 - struct dev_addr_list *da, *next;
15609 - while (da != NULL) {
15611 - if (!da->da_synced) {
15612 - err = __dev_addr_add(to, to_count,
15613 - da->da_addr, da->da_addrlen, 0);
15616 - da->da_synced = 1;
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);
15629 -void __dev_addr_unsync(struct dev_addr_list **to, int *to_count,
15630 - struct dev_addr_list **from, int *from_count)
15632 - struct dev_addr_list *da, *next;
15635 - while (da != NULL) {
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);
15649 - * dev_unicast_sync - Synchronize device's unicast list to another device
15650 - * @to: destination device
15651 - * @from: source device
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.
15657 - * This function is intended to be called from the dev->set_rx_mode
15658 - * function of layered software devices.
15660 -int dev_unicast_sync(struct net_device *to, struct net_device *from)
15664 - netif_addr_lock_bh(to);
15665 - err = __dev_addr_sync(&to->uc_list, &to->uc_count,
15666 - &from->uc_list, &from->uc_count);
15668 - __dev_set_rx_mode(to);
15669 - netif_addr_unlock_bh(to);
15672 -EXPORT_SYMBOL(dev_unicast_sync);
15675 - * dev_unicast_unsync - Remove synchronized addresses from the destination device
15676 - * @to: destination device
15677 - * @from: source device
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.
15683 -void dev_unicast_unsync(struct net_device *to, struct net_device *from)
15685 - netif_addr_lock_bh(from);
15686 - netif_addr_lock(to);
15688 - __dev_addr_unsync(&to->uc_list, &to->uc_count,
15689 - &from->uc_list, &from->uc_count);
15690 - __dev_set_rx_mode(to);
15692 - netif_addr_unlock(to);
15693 - netif_addr_unlock_bh(from);
15695 -EXPORT_SYMBOL(dev_unicast_unsync);
15697 -static void __dev_addr_discard(struct dev_addr_list **list)
15699 - struct dev_addr_list *tmp;
15701 - while (*list != NULL) {
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);
15711 -static void dev_addr_discard(struct net_device *dev)
15713 - netif_addr_lock_bh(dev);
15715 - __dev_addr_discard(&dev->uc_list);
15716 - dev->uc_count = 0;
15718 - __dev_addr_discard(&dev->mc_list);
15719 - dev->mc_count = 0;
15721 - netif_addr_unlock_bh(dev);
15724 -unsigned dev_get_flags(const struct net_device *dev)
15728 - flags = (dev->flags & ~(IFF_PROMISC |
15733 - (dev->gflags & (IFF_PROMISC |
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;
15748 -int dev_change_flags(struct net_device *dev, unsigned flags)
15750 - int ret, changes;
15751 - int old_flags = dev->flags;
15756 - * Set the flags on our device.
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 |
15766 - * Load in the correct multicast list now the flags have changed.
15769 - if ((old_flags ^ flags) & IFF_MULTICAST)
15770 - dev_change_rx_flags(dev, IFF_MULTICAST);
15772 - dev_set_rx_mode(dev);
15775 - * Have we downed the interface. We handle IFF_UP ourselves
15776 - * according to user attempts to set it, rather than blindly
15781 - if ((old_flags ^ flags) & IFF_UP) { /* Bit is different ? */
15782 - ret = ((old_flags & IFF_UP) ? dev_close : dev_open)(dev);
15785 - dev_set_rx_mode(dev);
15788 - if (dev->flags & IFF_UP &&
15789 - ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI |
15791 - call_netdevice_notifiers(NETDEV_CHANGE, dev);
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);
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.
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);
15809 - /* Exclude state transition flags, already notified */
15810 - changes = (old_flags ^ dev->flags) & ~(IFF_UP | IFF_RUNNING);
15812 - rtmsg_ifinfo(RTM_NEWLINK, dev, changes);
15817 -int dev_set_mtu(struct net_device *dev, int new_mtu)
15821 - if (new_mtu == dev->mtu)
15824 - /* MTU must be positive. */
15828 - if (!netif_device_present(dev))
15832 - if (dev->change_mtu)
15833 - err = dev->change_mtu(dev, new_mtu);
15835 - dev->mtu = new_mtu;
15836 - if (!err && dev->flags & IFF_UP)
15837 - call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
15841 -int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
15845 - if (!dev->set_mac_address)
15846 - return -EOPNOTSUPP;
15847 - if (sa->sa_family != dev->type)
15849 - if (!netif_device_present(dev))
15851 - err = dev->set_mac_address(dev, sa);
15853 - call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
15858 - * Perform the SIOCxIFxxx calls, inside read_lock(dev_base_lock)
15860 -static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cmd)
15863 - struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name);
15869 - case SIOCGIFFLAGS: /* Get interface flags */
15870 - ifr->ifr_flags = dev_get_flags(dev);
15873 - case SIOCGIFMETRIC: /* Get the metric on the interface
15874 - (currently unused) */
15875 - ifr->ifr_metric = 0;
15878 - case SIOCGIFMTU: /* Get the MTU of a device */
15879 - ifr->ifr_mtu = dev->mtu;
15882 - case SIOCGIFHWADDR:
15883 - if (!dev->addr_len)
15884 - memset(ifr->ifr_hwaddr.sa_data, 0, sizeof ifr->ifr_hwaddr.sa_data);
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;
15891 - case SIOCGIFSLAVE:
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;
15904 - case SIOCGIFINDEX:
15905 - ifr->ifr_ifindex = dev->ifindex;
15908 - case SIOCGIFTXQLEN:
15909 - ifr->ifr_qlen = dev->tx_queue_len;
15913 - /* dev_ioctl() should ensure this case
15914 - * is never reached
15925 - * Perform the SIOCxIFxxx calls, inside rtnl_lock()
15927 -static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
15930 - struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name);
15936 - case SIOCSIFFLAGS: /* Set interface flags */
15937 - return dev_change_flags(dev, ifr->ifr_flags);
15939 - case SIOCSIFMETRIC: /* Set the metric on the interface
15940 - (currently unused) */
15941 - return -EOPNOTSUPP;
15943 - case SIOCSIFMTU: /* Set the MTU of a device */
15944 - return dev_set_mtu(dev, ifr->ifr_mtu);
15946 - case SIOCSIFHWADDR:
15947 - return dev_set_mac_address(dev, &ifr->ifr_hwaddr);
15949 - case SIOCSIFHWBROADCAST:
15950 - if (ifr->ifr_hwaddr.sa_family != dev->type)
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);
15958 - if (dev->set_config) {
15959 - if (!netif_device_present(dev))
15961 - return dev->set_config(dev, &ifr->ifr_map);
15963 - return -EOPNOTSUPP;
15965 - case SIOCADDMULTI:
15966 - if ((!dev->set_multicast_list && !dev->set_rx_mode) ||
15967 - ifr->ifr_hwaddr.sa_family != AF_UNSPEC)
15969 - if (!netif_device_present(dev))
15971 - return dev_mc_add(dev, ifr->ifr_hwaddr.sa_data,
15972 - dev->addr_len, 1);
15974 - case SIOCDELMULTI:
15975 - if ((!dev->set_multicast_list && !dev->set_rx_mode) ||
15976 - ifr->ifr_hwaddr.sa_family != AF_UNSPEC)
15978 - if (!netif_device_present(dev))
15980 - return dev_mc_delete(dev, ifr->ifr_hwaddr.sa_data,
15981 - dev->addr_len, 1);
15983 - case SIOCSIFTXQLEN:
15984 - if (ifr->ifr_qlen < 0)
15986 - dev->tx_queue_len = ifr->ifr_qlen;
15989 - case SIOCSIFNAME:
15990 - ifr->ifr_newname[IFNAMSIZ-1] = '\0';
15991 - return dev_change_name(dev, ifr->ifr_newname);
15994 - * Unknown or private ioctl
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,
16028 - * This function handles all "interface"-type I/O control requests. The actual
16029 - * 'doing' part of this is dev_ifsioc above.
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
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.
16044 -int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
16046 - struct ifreq ifr;
16050 - /* One special case: SIOCGIFCONF takes ifconf argument
16051 - and requires shared lock, because it sleeps writing
16055 - if (cmd == SIOCGIFCONF) {
16057 - ret = dev_ifconf(net, (char __user *) arg);
16061 - if (cmd == SIOCGIFNAME)
16062 - return dev_ifname(net, (struct ifreq __user *)arg);
16064 - if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
16067 - ifr.ifr_name[IFNAMSIZ-1] = 0;
16069 - colon = strchr(ifr.ifr_name, ':');
16074 - * See which interface the caller is talking about.
16079 - * These ioctl calls:
16080 - * - can be done by all.
16081 - * - atomic and do not require locking.
16082 - * - return a value
16084 - case SIOCGIFFLAGS:
16085 - case SIOCGIFMETRIC:
16087 - case SIOCGIFHWADDR:
16088 - case SIOCGIFSLAVE:
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);
16099 - if (copy_to_user(arg, &ifr,
16100 - sizeof(struct ifreq)))
16105 - case SIOCETHTOOL:
16106 - dev_load(net, ifr.ifr_name);
16108 - ret = dev_ethtool(net, &ifr);
16113 - if (copy_to_user(arg, &ifr,
16114 - sizeof(struct ifreq)))
16120 - * These ioctl calls:
16121 - * - require superuser power.
16122 - * - require strict serialization.
16123 - * - return a value
16125 - case SIOCGMIIPHY:
16126 - case SIOCGMIIREG:
16127 - case SIOCSIFNAME:
16128 - if (!capable(CAP_NET_ADMIN))
16130 - dev_load(net, ifr.ifr_name);
16132 - ret = dev_ifsioc(net, &ifr, cmd);
16137 - if (copy_to_user(arg, &ifr,
16138 - sizeof(struct ifreq)))
16144 - * These ioctl calls:
16145 - * - require superuser power.
16146 - * - require strict serialization.
16147 - * - do not return a value
16149 - case SIOCSIFFLAGS:
16150 - case SIOCSIFMETRIC:
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))
16168 - /* fall through */
16169 - case SIOCBONDSLAVEINFOQUERY:
16170 - case SIOCBONDINFOQUERY:
16171 - dev_load(net, ifr.ifr_name);
16173 - ret = dev_ifsioc(net, &ifr, cmd);
16178 - /* Get the per device memory space. We can add this but
16179 - * currently do not support it */
16181 - /* Set the per device memory buffer space.
16182 - * Not applicable in our case */
16183 - case SIOCSIFLINK:
16187 - * Unknown or private ioctl.
16190 - if (cmd == SIOCWANDEV ||
16191 - (cmd >= SIOCDEVPRIVATE &&
16192 - cmd <= SIOCDEVPRIVATE + 15)) {
16193 - dev_load(net, ifr.ifr_name);
16195 - ret = dev_ifsioc(net, &ifr, cmd);
16197 - if (!ret && copy_to_user(arg, &ifr,
16198 - sizeof(struct ifreq)))
16202 - /* Take care of Wireless Extensions */
16203 - if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST)
16204 - return wext_handle_ioctl(net, &ifr, cmd, arg);
16211 - * dev_new_index - allocate an ifindex
16212 - * @net: the applicable net namespace
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.
16218 -static int dev_new_index(struct net *net)
16220 - static int ifindex;
16222 - if (++ifindex <= 0)
16224 - if (!__dev_get_by_index(net, ifindex))
16229 -/* Delayed registration/unregisteration */
16230 -static LIST_HEAD(net_todo_list);
16232 -static void net_set_todo(struct net_device *dev)
16234 - list_add_tail(&dev->todo_list, &net_todo_list);
16237 -static void rollback_registered(struct net_device *dev)
16239 - BUG_ON(dev_boot_phase);
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);
16251 - BUG_ON(dev->reg_state != NETREG_REGISTERED);
16253 - /* If device is running, close it first. */
16256 - /* And unlink it from device chain. */
16257 - unlist_netdevice(dev);
16259 - dev->reg_state = NETREG_UNREGISTERING;
16261 - synchronize_net();
16263 - /* Shutdown queueing discipline. */
16264 - dev_shutdown(dev);
16267 - /* Notify protocols, that we are about to destroy
16268 - this device. They should clean all the things.
16270 - call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
16273 - * Flush the unicast and multicast chains
16275 - dev_addr_discard(dev);
16278 - dev->uninit(dev);
16280 - /* Notifier chain MUST detach us from master device. */
16281 - WARN_ON(dev->master);
16283 - /* Remove entries from kobject tree */
16284 - netdev_unregister_kobject(dev);
16286 - synchronize_net();
16291 -static void __netdev_init_queue_locks_one(struct net_device *dev,
16292 - struct netdev_queue *dev_queue,
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;
16300 -static void netdev_init_queue_locks(struct net_device *dev)
16302 - netdev_for_each_tx_queue(dev, __netdev_init_queue_locks_one, NULL);
16303 - __netdev_init_queue_locks_one(dev, &dev->rx_queue, NULL);
16307 - * register_netdevice - register a network device
16308 - * @dev: device to register
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.
16315 - * Callers must hold the rtnl semaphore. You may want
16316 - * register_netdev() instead of this.
16319 - * The locking appears insufficient to guarantee two parallel registers
16320 - * will not get the same name.
16323 -int register_netdevice(struct net_device *dev)
16325 - struct hlist_head *head;
16326 - struct hlist_node *p;
16330 - BUG_ON(dev_boot_phase);
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);
16340 - spin_lock_init(&dev->addr_list_lock);
16341 - netdev_set_addr_lockdep_class(dev);
16342 - netdev_init_queue_locks(dev);
16344 - dev->iflink = -1;
16346 - /* Init, if this function is available */
16348 - ret = dev->init(dev);
16356 - if (!dev_valid_name(dev->name)) {
16361 - dev->ifindex = dev_new_index(net);
16362 - if (dev->iflink == -1)
16363 - dev->iflink = dev->ifindex;
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)) {
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",
16381 - dev->features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
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",
16388 - dev->features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM);
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",
16397 - dev->features &= ~NETIF_F_SG;
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",
16405 - dev->features &= ~NETIF_F_TSO;
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",
16412 - dev->features &= ~NETIF_F_UFO;
16414 - if (!(dev->features & NETIF_F_SG)) {
16415 - printk(KERN_ERR "%s: Dropping NETIF_F_UFO since no "
16416 - "NETIF_F_SG feature.\n",
16418 - dev->features &= ~NETIF_F_UFO;
16422 - /* Enable software GSO if SG is supported. */
16423 - if (dev->features & NETIF_F_SG)
16424 - dev->features |= NETIF_F_GSO;
16426 - netdev_initialize_kobject(dev);
16427 - ret = netdev_register_kobject(dev);
16430 - dev->reg_state = NETREG_REGISTERED;
16433 - * Default initial state at registry is that the
16434 - * device is present.
16437 - set_bit(__LINK_STATE_PRESENT, &dev->state);
16439 - dev_init_scheduler(dev);
16441 - list_netdevice(dev);
16443 - /* Notify protocols, that a new device appeared. */
16444 - ret = call_netdevice_notifiers(NETDEV_REGISTER, dev);
16445 - ret = notifier_to_errno(ret);
16447 - rollback_registered(dev);
16448 - dev->reg_state = NETREG_UNREGISTERED;
16456 - dev->uninit(dev);
16461 - * register_netdev - register a network device
16462 - * @dev: device to register
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.
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
16473 -int register_netdev(struct net_device *dev)
16480 - * If the name is a format string the caller wants us to do a
16481 - * name allocation.
16483 - if (strchr(dev->name, '%')) {
16484 - err = dev_alloc_name(dev, dev->name);
16489 - err = register_netdevice(dev);
16494 -EXPORT_SYMBOL(register_netdev);
16497 - * netdev_wait_allrefs - wait until all references are gone.
16499 - * This is called when unregistering network devices.
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
16507 -static void netdev_wait_allrefs(struct net_device *dev)
16509 - unsigned long rebroadcast_time, warning_time;
16511 - rebroadcast_time = warning_time = jiffies;
16512 - while (atomic_read(&dev->refcnt) != 0) {
16513 - if (time_after(jiffies, rebroadcast_time + 1 * HZ)) {
16516 - /* Rebroadcast unregister notification */
16517 - call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
16519 - if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
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.
16527 - linkwatch_run_queue();
16532 - rebroadcast_time = jiffies;
16537 - if (time_after(jiffies, warning_time + 10 * HZ)) {
16538 - printk(KERN_EMERG "unregister_netdevice: "
16539 - "waiting for %s to become free. Usage "
16541 - dev->name, atomic_read(&dev->refcnt));
16542 - warning_time = jiffies;
16547 -/* The sequence is:
16551 - * register_netdevice(x1);
16552 - * register_netdevice(x2);
16554 - * unregister_netdevice(y1);
16555 - * unregister_netdevice(y2);
16558 - * free_netdev(y1);
16559 - * free_netdev(y2);
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.
16568 - * We must not return until all unregister events added during
16569 - * the interval the lock was held have been completed.
16571 -void netdev_run_todo(void)
16573 - struct list_head list;
16575 - /* Snapshot list, allow later requests */
16576 - list_replace_init(&net_todo_list, &list);
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);
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);
16592 - dev->reg_state = NETREG_UNREGISTERED;
16594 - on_each_cpu(flush_backlog, dev, 1);
16596 - netdev_wait_allrefs(dev);
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);
16604 - if (dev->destructor)
16605 - dev->destructor(dev);
16607 - /* Free network device */
16608 - kobject_put(&dev->dev.kobj);
16612 -static struct net_device_stats *internal_stats(struct net_device *dev)
16614 - return &dev->stats;
16617 -static void netdev_init_one_queue(struct net_device *dev,
16618 - struct netdev_queue *queue,
16621 - queue->dev = dev;
16624 -static void netdev_init_queues(struct net_device *dev)
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);
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
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.
16642 -struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
16643 - void (*setup)(struct net_device *), unsigned int queue_count)
16645 - struct netdev_queue *tx;
16646 - struct net_device *dev;
16647 - size_t alloc_size;
16650 - BUG_ON(strlen(name) >= sizeof(dev->name));
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;
16658 - /* ensure 32-byte alignment of whole construct */
16659 - alloc_size += NETDEV_ALIGN_CONST;
16661 - p = kzalloc(alloc_size, GFP_KERNEL);
16663 - printk(KERN_ERR "alloc_netdev: Unable to allocate device.\n");
16667 - tx = kcalloc(queue_count, sizeof(struct netdev_queue), GFP_KERNEL);
16669 - printk(KERN_ERR "alloc_netdev: Unable to allocate "
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);
16681 - dev->num_tx_queues = queue_count;
16682 - dev->real_num_tx_queues = queue_count;
16684 - if (sizeof_priv) {
16685 - dev->priv = ((char *)dev +
16686 - ((sizeof(struct net_device) + NETDEV_ALIGN_CONST)
16687 - & ~NETDEV_ALIGN_CONST));
16690 - dev->gso_max_size = GSO_MAX_SIZE;
16692 - netdev_init_queues(dev);
16694 - dev->get_stats = internal_stats;
16695 - netpoll_netdev_init(dev);
16697 - strcpy(dev->name, name);
16700 -EXPORT_SYMBOL(alloc_netdev_mq);
16703 - * free_netdev - free network device
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.
16710 -void free_netdev(struct net_device *dev)
16712 - release_net(dev_net(dev));
16716 - /* Compatibility with error handling in drivers */
16717 - if (dev->reg_state == NETREG_UNINITIALIZED) {
16718 - kfree((char *)dev - dev->padded);
16722 - BUG_ON(dev->reg_state != NETREG_UNREGISTERED);
16723 - dev->reg_state = NETREG_RELEASED;
16725 - /* will free via device release */
16726 - put_device(&dev->dev);
16729 -/* Synchronize with packet receive processing. */
16730 -void synchronize_net(void)
16733 - synchronize_rcu();
16737 - * unregister_netdevice - remove device from the kernel
16740 - * This function shuts down a device interface and removes it
16741 - * from the kernel tables.
16743 - * Callers must hold the rtnl semaphore. You may want
16744 - * unregister_netdev() instead of this.
16747 -void unregister_netdevice(struct net_device *dev)
16751 - rollback_registered(dev);
16752 - /* Finish processing unregister after unlock */
16753 - net_set_todo(dev);
16757 - * unregister_netdev - remove device from the kernel
16760 - * This function shuts down a device interface and removes it
16761 - * from the kernel tables.
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.
16767 -void unregister_netdev(struct net_device *dev)
16770 - unregister_netdevice(dev);
16774 -EXPORT_SYMBOL(unregister_netdev);
16777 - * dev_change_net_namespace - move device to different nethost namespace
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.
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.
16787 - * Callers must hold the rtnl semaphore.
16790 -int dev_change_net_namespace(struct net_device *dev, struct net *net, const char *pat)
16792 - char buf[IFNAMSIZ];
16793 - const char *destname;
16798 - /* Don't allow namespace local devices to be moved. */
16800 - if (dev->features & NETIF_F_NETNS_LOCAL)
16803 -#ifdef CONFIG_SYSFS
16804 - /* Don't allow real devices to be moved when sysfs
16808 - if (dev->dev.parent)
16812 - /* Ensure the device has been registrered */
16814 - if (dev->reg_state != NETREG_REGISTERED)
16817 - /* Get out if there is nothing todo */
16819 - if (net_eq(dev_net(dev), net))
16822 - /* Pick the destination device name, and ensure
16823 - * we can use it in the destination network namespace.
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 */
16831 - if (!dev_valid_name(pat))
16833 - if (strchr(pat, '%')) {
16834 - if (__dev_alloc_name(net, pat, buf) < 0)
16839 - if (__dev_get_by_name(net, destname))
16844 - * And now a mini version of register_netdevice unregister_netdevice.
16847 - /* If device is running close it first. */
16850 - /* And unlink it from device chain */
16852 - unlist_netdevice(dev);
16854 - synchronize_net();
16856 - /* Shutdown queueing discipline. */
16857 - dev_shutdown(dev);
16859 - /* Notify protocols, that we are about to destroy
16860 - this device. They should clean all the things.
16862 - call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
16865 - * Flush the unicast and multicast chains
16867 - dev_addr_discard(dev);
16869 - netdev_unregister_kobject(dev);
16871 - /* Actually switch the network namespace */
16872 - dev_net_set(dev, net);
16874 - /* Assign the new device name */
16875 - if (destname != dev->name)
16876 - strcpy(dev->name, destname);
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);
16883 - dev->iflink = dev->ifindex;
16886 - /* Fixup kobjects */
16887 - err = netdev_register_kobject(dev);
16890 - /* Add the device back in the hashes */
16891 - list_netdevice(dev);
16893 - /* Notify protocols, that a new device appeared. */
16894 - call_netdevice_notifiers(NETDEV_REGISTER, dev);
16896 - synchronize_net();
16902 -static int dev_cpu_callback(struct notifier_block *nfb,
16903 - unsigned long action,
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;
16912 - if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
16913 - return NOTIFY_OK;
16915 - local_irq_disable();
16916 - cpu = smp_processor_id();
16917 - sd = &per_cpu(softnet_data, cpu);
16918 - oldsd = &per_cpu(softnet_data, oldcpu);
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;
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;
16936 - raise_softirq_irqoff(NET_TX_SOFTIRQ);
16937 - local_irq_enable();
16939 - /* Process offline CPU's input_pkt_queue */
16940 - while ((skb = __skb_dequeue(&oldsd->input_pkt_queue)))
16943 - return NOTIFY_OK;
16946 -#ifdef CONFIG_NET_DMA
16948 - * net_dma_rebalance - try to maintain one DMA channel per CPU
16949 - * @net_dma: DMA client and associated data (lock, channels, channel_mask)
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.
16955 -static void net_dma_rebalance(struct net_dma *net_dma)
16957 - unsigned int cpu, i, n, chan_idx;
16958 - struct dma_chan *chan;
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);
16967 - cpu = first_cpu(cpu_online_map);
16969 - for_each_cpu_mask_nr(chan_idx, net_dma->channel_mask) {
16970 - chan = net_dma->channels[chan_idx];
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));
16977 - per_cpu(softnet_data, cpu).net_dma = chan;
16978 - cpu = next_cpu(cpu, cpu_online_map);
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
16991 -static enum dma_state_client
16992 -netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
16993 - enum dma_state state)
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 */
17000 - spin_lock(&net_dma->lock);
17002 - case DMA_RESOURCE_AVAILABLE:
17003 - for (i = 0; i < nr_cpu_ids; i++)
17004 - if (net_dma->channels[i] == chan) {
17007 - } else if (net_dma->channels[i] == NULL && pos < 0)
17010 - if (!found && pos >= 0) {
17012 - net_dma->channels[pos] = chan;
17013 - cpu_set(pos, net_dma->channel_mask);
17014 - net_dma_rebalance(net_dma);
17017 - case DMA_RESOURCE_REMOVED:
17018 - for (i = 0; i < nr_cpu_ids; i++)
17019 - if (net_dma->channels[i] == chan) {
17027 - cpu_clear(pos, net_dma->channel_mask);
17028 - net_dma->channels[i] = NULL;
17029 - net_dma_rebalance(net_dma);
17035 - spin_unlock(&net_dma->lock);
17041 - * netdev_dma_regiser - register the networking subsystem as a DMA client
17043 -static int __init netdev_dma_register(void)
17045 - net_dma.channels = kzalloc(nr_cpu_ids * sizeof(struct net_dma),
17047 - if (unlikely(!net_dma.channels)) {
17048 - printk(KERN_NOTICE
17049 - "netdev_dma: no memory for net_dma.channels\n");
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);
17060 -static int __init netdev_dma_register(void) { return -ENODEV; }
17061 -#endif /* CONFIG_NET_DMA */
17064 - * netdev_compute_feature - compute conjunction of two feature sets
17065 - * @all: first feature set
17066 - * @one: second feature set
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.
17072 -int netdev_compute_features(unsigned long all, unsigned long one)
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;
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;
17083 - if (one & NETIF_F_GSO)
17084 - one |= NETIF_F_GSO_SOFTWARE;
17085 - one |= NETIF_F_GSO;
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;
17091 - all &= one | NETIF_F_LLTX;
17093 - if (!(all & NETIF_F_ALL_CSUM))
17094 - all &= ~NETIF_F_SG;
17095 - if (!(all & NETIF_F_SG))
17096 - all &= ~NETIF_F_GSO_MASK;
17100 -EXPORT_SYMBOL(netdev_compute_features);
17102 -static struct hlist_head *netdev_create_hash(void)
17105 - struct hlist_head *hash;
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]);
17115 -/* Initialize per network namespace state */
17116 -static int __net_init netdev_init(struct net *net)
17118 - INIT_LIST_HEAD(&net->dev_base_head);
17120 - net->dev_name_head = netdev_create_hash();
17121 - if (net->dev_name_head == NULL)
17124 - net->dev_index_head = netdev_create_hash();
17125 - if (net->dev_index_head == NULL)
17131 - kfree(net->dev_name_head);
17136 -char *netdev_drivername(struct net_device *dev, char *buffer, int len)
17138 - struct device_driver *driver;
17139 - struct device *parent;
17141 - if (len <= 0 || !buffer)
17145 - parent = dev->dev.parent;
17150 - driver = parent->driver;
17151 - if (driver && driver->name)
17152 - strlcpy(buffer, driver->name, len);
17156 -static void __net_exit netdev_exit(struct net *net)
17158 - kfree(net->dev_name_head);
17159 - kfree(net->dev_index_head);
17162 -static struct pernet_operations __net_initdata netdev_net_ops = {
17163 - .init = netdev_init,
17164 - .exit = netdev_exit,
17167 -static void __net_exit default_device_exit(struct net *net)
17169 - struct net_device *dev, *next;
17171 - * Push all migratable of the network devices back to the
17172 - * initial network namespace
17175 - for_each_netdev_safe(net, dev, next) {
17177 - char fb_name[IFNAMSIZ];
17179 - /* Ignore unmoveable devices (i.e. loopback) */
17180 - if (dev->features & NETIF_F_NETNS_LOCAL)
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);
17187 - printk(KERN_EMERG "%s: failed to move %s to init_net: %d\n",
17188 - __func__, dev->name, err);
17195 -static struct pernet_operations __net_initdata default_device_ops = {
17196 - .exit = default_device_exit,
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.
17207 - * This is called single threaded during boot, so no need
17208 - * to take the rtnl semaphore.
17210 -static int __init net_dev_init(void)
17212 - int i, rc = -ENOMEM;
17214 - BUG_ON(!dev_boot_phase);
17216 - if (dev_proc_init())
17219 - if (netdev_kobject_init())
17222 - INIT_LIST_HEAD(&ptype_all);
17223 - for (i = 0; i < PTYPE_HASH_SIZE; i++)
17224 - INIT_LIST_HEAD(&ptype_base[i]);
17226 - if (register_pernet_subsys(&netdev_net_ops))
17229 - if (register_pernet_device(&default_device_ops))
17233 - * Initialise the packet receive queues.
17236 - for_each_possible_cpu(i) {
17237 - struct softnet_data *queue;
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);
17244 - queue->backlog.poll = process_backlog;
17245 - queue->backlog.weight = weight_p;
17248 - netdev_dma_register();
17250 - dev_boot_phase = 0;
17252 - open_softirq(NET_TX_SOFTIRQ, net_tx_action);
17253 - open_softirq(NET_RX_SOFTIRQ, net_rx_action);
17255 - hotcpu_notifier(dev_cpu_callback, 0);
17257 - dev_mcast_init();
17263 -subsys_initcall(net_dev_init);
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);
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);
17307 -#ifdef CONFIG_KMOD
17308 -EXPORT_SYMBOL(dev_load);
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
17317 -*** 2187,2199 ****
17318 - * NET_RX_SUCCESS: no congestion
17319 - * NET_RX_DROP: packet was dropped
17321 -- int netif_receive_skb(struct sk_buff *skb)
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;
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
17335 -+ //int netif_receive_skb(struct sk_buff *skb)
17336 -+ int __netif_receive_skb(struct sk_buff *skb, unsigned short type, int notifier_data)
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;
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 @@
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)
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;
17366 -/* Click: clear skb header state */
17367 -static inline void skb_headerinit(void *p, struct kmem_cache *cache,
17368 - unsigned long flags)
17370 - struct sk_buff *skb = p;
17372 - skb->next = NULL;
17373 - skb->prev = NULL;
17375 - skb->tstamp.tv64 = 0; /* No idea about time */
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;
17386 -#ifdef CONFIG_NETFILTER
17388 - skb->nfct = NULL;
17389 -# if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
17390 - skb->nfct_reasm = NULL;
17392 -# ifdef CONFIG_BRIDGE_NETFILTER
17393 - skb->nf_bridge = NULL;
17396 -#ifdef CONFIG_NET_SCHED
17397 - skb->tc_index = 0;
17398 -# ifdef CONFIG_NET_CLS_ACT
17399 - skb->tc_verd = 0;
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)
17407 - if (atomic_dec_and_test(&skb->users)) {
17408 - dst_release(skb->dst);
17409 -#ifdef CONFIG_XFRM
17410 - secpath_put(skb->sp);
17412 - if(skb->destructor) {
17413 - WARN_ON(in_irq());
17414 - skb->destructor(skb);
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);
17421 -# ifdef CONFIG_BRIDGE_NETFILTER
17422 - nf_bridge_put(skb->nf_bridge);
17425 - skb_headerinit(skb, NULL, 0);
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. */
17433 - if (skb_shinfo(skb)->nr_frags) {
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;
17441 - if (skb_shinfo(skb)->frag_list)
17442 - skb_drop_fraglist(skb);
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; */
17450 - /* set up other state */
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;
17465 - kfree_skbmem(skb);
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);
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
17487 - * Routines having to do with the 'struct sk_buff' memory handlers.
17489 - * Authors: Alan Cox <iiitac@pyr.swan.ac.uk>
17490 - * Florian La Roche <rzsfl@rz.uni-sb.de>
17493 - * Alan Cox : Fixed the worst of the load
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
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).
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.
17521 - * The functions in this file will not compile correctly with gcc 2.4.x
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>
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>
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>
17551 -#include <asm/uaccess.h>
17552 -#include <asm/system.h>
17554 -#include "kmap_skb.h"
17556 -static struct kmem_cache *skbuff_head_cache __read_mostly;
17557 -static struct kmem_cache *skbuff_fclone_cache __read_mostly;
17559 -static void sock_pipe_buf_release(struct pipe_inode_info *pipe,
17560 - struct pipe_buffer *buf)
17562 - struct sk_buff *skb = (struct sk_buff *) buf->private;
17567 -static void sock_pipe_buf_get(struct pipe_inode_info *pipe,
17568 - struct pipe_buffer *buf)
17570 - struct sk_buff *skb = (struct sk_buff *) buf->private;
17575 -static int sock_pipe_buf_steal(struct pipe_inode_info *pipe,
17576 - struct pipe_buffer *buf)
17582 -/* Pipe buffer operations for a socket. */
17583 -static struct pipe_buf_operations sock_pipe_buf_ops = {
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,
17594 - * Keep out-of-line to prevent kernel bloat.
17595 - * __builtin_return_address is not used because it is not always
17600 - * skb_over_panic - private function
17605 - * Out of line support code for skb_put(). Not user callable.
17607 -void skb_over_panic(struct sk_buff *skb, int sz, void *here)
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>");
17618 - * skb_under_panic - private function
17623 - * Out of line support code for skb_push(). Not user callable.
17626 -void skb_under_panic(struct sk_buff *skb, int sz, void *here)
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>");
17636 -void skb_truesize_bug(struct sk_buff *skb)
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));
17642 -EXPORT_SYMBOL(skb_truesize_bug);
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
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
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.
17662 - * Buffers may only be allocated from interrupts using a @gfp_mask of
17665 -struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
17666 - int fclone, int node)
17668 - struct kmem_cache *cache;
17669 - struct skb_shared_info *shinfo;
17670 - struct sk_buff *skb;
17673 - cache = fclone ? skbuff_fclone_cache : skbuff_head_cache;
17675 - /* Get the HEAD */
17676 - skb = kmem_cache_alloc_node(cache, gfp_mask & ~__GFP_DMA, node);
17680 - size = SKB_DATA_ALIGN(size);
17681 - data = kmalloc_node_track_caller(size + sizeof(struct skb_shared_info),
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!
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;
17710 - struct sk_buff *child = skb + 1;
17711 - atomic_t *fclone_ref = (atomic_t *) (child + 1);
17713 - skb->fclone = SKB_FCLONE_ORIG;
17714 - atomic_set(fclone_ref, 1);
17716 - child->fclone = SKB_FCLONE_UNAVAILABLE;
17721 - kmem_cache_free(cache, skb);
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
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.
17737 - * %NULL is returned if there is no free memory.
17739 -struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
17740 - unsigned int length, gfp_t gfp_mask)
17742 - int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1;
17743 - struct sk_buff *skb;
17745 - skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node);
17746 - if (likely(skb)) {
17747 - skb_reserve(skb, NET_SKB_PAD);
17754 - * dev_alloc_skb - allocate an skbuff for receiving
17755 - * @length: length to allocate
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.
17762 - * %NULL is returned if there is no free memory. Although this function
17763 - * allocates memory it can be called from an interrupt.
17765 -struct sk_buff *dev_alloc_skb(unsigned int length)
17768 - * There is more code here than it seems:
17769 - * __dev_alloc_skb is an inline
17771 - return __dev_alloc_skb(length, GFP_ATOMIC);
17773 -EXPORT_SYMBOL(dev_alloc_skb);
17775 -static void skb_drop_list(struct sk_buff **listp)
17777 - struct sk_buff *list = *listp;
17782 - struct sk_buff *this = list;
17783 - list = list->next;
17788 -static inline void skb_drop_fraglist(struct sk_buff *skb)
17790 - skb_drop_list(&skb_shinfo(skb)->frag_list);
17793 -static void skb_clone_fraglist(struct sk_buff *skb)
17795 - struct sk_buff *list;
17797 - for (list = skb_shinfo(skb)->frag_list; list; list = list->next)
17801 -static void skb_release_data(struct sk_buff *skb)
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) {
17808 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
17809 - put_page(skb_shinfo(skb)->frags[i].page);
17812 - if (skb_shinfo(skb)->frag_list)
17813 - skb_drop_fraglist(skb);
17815 - kfree(skb->head);
17820 - * Free an skbuff by memory without cleaning the state.
17822 -static void kfree_skbmem(struct sk_buff *skb)
17824 - struct sk_buff *other;
17825 - atomic_t *fclone_ref;
17827 - switch (skb->fclone) {
17828 - case SKB_FCLONE_UNAVAILABLE:
17829 - kmem_cache_free(skbuff_head_cache, skb);
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);
17838 - case SKB_FCLONE_CLONE:
17839 - fclone_ref = (atomic_t *) (skb + 1);
17842 - /* The clone portion is available for
17843 - * fast-cloning again.
17845 - skb->fclone = SKB_FCLONE_UNAVAILABLE;
17847 - if (atomic_dec_and_test(fclone_ref))
17848 - kmem_cache_free(skbuff_fclone_cache, other);
17853 -/* Free everything but the sk_buff shell. */
17854 -static void skb_release_all(struct sk_buff *skb)
17856 - dst_release(skb->dst);
17857 -#ifdef CONFIG_XFRM
17858 - secpath_put(skb->sp);
17860 - if (skb->destructor) {
17861 - WARN_ON(in_irq());
17862 - skb->destructor(skb);
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);
17868 -#ifdef CONFIG_BRIDGE_NETFILTER
17869 - nf_bridge_put(skb->nf_bridge);
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;
17878 - skb_release_data(skb);
17882 - * __kfree_skb - private function
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
17890 -void __kfree_skb(struct sk_buff *skb)
17892 - skb_release_all(skb);
17893 - kfree_skbmem(skb);
17897 - * kfree_skb - free an sk_buff
17898 - * @skb: buffer to free
17900 - * Drop a reference to the buffer and free it if the usage count has
17903 -void kfree_skb(struct sk_buff *skb)
17905 - if (unlikely(!skb))
17907 - if (likely(atomic_read(&skb->users) == 1))
17909 - else if (likely(!atomic_dec_and_test(&skb->users)))
17911 - __kfree_skb(skb);
17914 -static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
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);
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;
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;
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;
17949 - new->vlan_tci = old->vlan_tci;
17950 - new->skb_tag = old->skb_tag;
17952 - skb_copy_secmark(new, old);
17955 -static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
17957 -#define C(x) n->x = skb->x
17959 - n->next = n->prev = NULL;
17961 - __copy_skb_header(n, skb);
17966 - n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len;
17969 - n->destructor = NULL;
17976 -#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
17977 - C(do_not_encrypt);
17979 - atomic_set(&n->users, 1);
17981 - /* Sapan: Cloned skbs aren't owned by anyone. Let the cloner decide who it belongs to. */
17983 - atomic_inc(&(skb_shinfo(skb)->dataref));
17991 - * skb_morph - morph one skb into another
17992 - * @dst: the skb to receive the contents
17993 - * @src: the skb to supply the contents
17995 - * This is identical to skb_clone except that the target skb is
17996 - * supplied by the user.
17998 - * The target skb is returned upon exit.
18000 -struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src)
18002 - skb_release_all(dst);
18003 - return __skb_clone(dst, src);
18005 -EXPORT_SYMBOL_GPL(skb_morph);
18008 - * skb_clone - duplicate an sk_buff
18009 - * @skb: buffer to clone
18010 - * @gfp_mask: allocation priority
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.
18017 - * If this function is called from an interrupt gfp_mask() must be
18021 -struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
18023 - struct sk_buff *n;
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);
18032 - n = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
18035 - n->fclone = SKB_FCLONE_UNAVAILABLE;
18038 - return __skb_clone(n, skb);
18041 -static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
18043 -#ifndef NET_SKBUFF_DATA_USES_OFFSET
18045 - * Shift between the two data areas in bytes
18047 - unsigned long offset = new->data - old->data;
18050 - __copy_skb_header(new, old);
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;
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;
18064 - * skb_copy - create private copy of an sk_buff
18065 - * @skb: buffer to copy
18066 - * @gfp_mask: allocation priority
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.
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.
18080 -struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
18082 - int headerlen = skb->data - skb->head;
18084 - * Allocate the copy buffer
18086 - struct sk_buff *n;
18087 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18088 - n = alloc_skb(skb->end + skb->data_len, gfp_mask);
18090 - n = alloc_skb(skb->end - skb->head + skb->data_len, gfp_mask);
18095 - /* Set the data pointer */
18096 - skb_reserve(n, headerlen);
18097 - /* Set the tail pointer and length */
18098 - skb_put(n, skb->len);
18100 - if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))
18103 - copy_skb_header(n, skb);
18109 - * pskb_copy - create copy of an sk_buff with private head.
18110 - * @skb: buffer to copy
18111 - * @gfp_mask: allocation priority
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.
18121 -struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask)
18124 - * Allocate the copy buffer
18126 - struct sk_buff *n;
18127 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18128 - n = alloc_skb(skb->end, gfp_mask);
18130 - n = alloc_skb(skb->end - skb->head, gfp_mask);
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);
18142 - n->truesize += skb->data_len;
18143 - n->data_len = skb->data_len;
18144 - n->len = skb->len;
18146 - if (skb_shinfo(skb)->nr_frags) {
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);
18153 - skb_shinfo(n)->nr_frags = i;
18156 - if (skb_shinfo(skb)->frag_list) {
18157 - skb_shinfo(n)->frag_list = skb_shinfo(skb)->frag_list;
18158 - skb_clone_fraglist(n);
18161 - copy_skb_header(n, skb);
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
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.
18178 - * All the pointers pointing into skb header may change and must be
18179 - * reloaded after call to this function.
18182 -int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
18187 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18188 - int size = nhead + skb->end + ntail;
18190 - int size = nhead + (skb->end - skb->head) + ntail;
18194 - if (skb_shared(skb))
18197 - size = SKB_DATA_ALIGN(size);
18199 - data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
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);
18208 - memcpy(data + nhead, skb->head, skb->tail - skb->head);
18210 - memcpy(data + size, skb_end_pointer(skb),
18211 - sizeof(struct skb_shared_info));
18213 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
18214 - get_page(skb_shinfo(skb)->frags[i].page);
18216 - if (skb_shinfo(skb)->frag_list)
18217 - skb_clone_fraglist(skb);
18219 - skb_release_data(skb);
18221 - off = (data + nhead) - skb->head;
18223 - skb->head = data;
18224 - skb->data += off;
18225 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
18229 - skb->end = skb->head + size;
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;
18238 - skb->hdr_len = 0;
18240 - atomic_set(&skb_shinfo(skb)->dataref, 1);
18247 -/* Make private copy of skb with writable head and some headroom */
18249 -struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom)
18251 - struct sk_buff *skb2;
18252 - int delta = headroom - skb_headroom(skb);
18255 - skb2 = pskb_copy(skb, GFP_ATOMIC);
18257 - skb2 = skb_clone(skb, GFP_ATOMIC);
18258 - if (skb2 && pskb_expand_head(skb2, SKB_DATA_ALIGN(delta), 0,
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
18275 - * Make a copy of both an &sk_buff and its data and while doing so
18276 - * allocate additional space.
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.
18283 - * You must pass %GFP_ATOMIC as the allocation priority if this function
18284 - * is called from an interrupt.
18286 -struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
18287 - int newheadroom, int newtailroom,
18291 - * Allocate the copy buffer
18293 - struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom,
18295 - int oldheadroom = skb_headroom(skb);
18296 - int head_copy_len, head_copy_off;
18302 - skb_reserve(n, newheadroom);
18304 - /* Set the tail pointer and length */
18305 - skb_put(n, skb->len);
18307 - head_copy_len = oldheadroom;
18308 - head_copy_off = 0;
18309 - if (newheadroom <= head_copy_len)
18310 - head_copy_len = newheadroom;
18312 - head_copy_off = newheadroom - head_copy_len;
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))
18319 - copy_skb_header(n, skb);
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;
18333 - * skb_pad - zero pad the tail of an skb
18334 - * @skb: buffer to pad
18335 - * @pad: space to pad
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.
18341 - * May return error in out of memory cases. The skb is freed on error.
18344 -int skb_pad(struct sk_buff *skb, int pad)
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);
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))
18362 - /* FIXME: The use of this function with non-linear skb's really needs
18365 - err = skb_linearize(skb);
18366 - if (unlikely(err))
18369 - memset(skb->data + skb->len, 0, pad);
18378 - * skb_put - add data to a buffer
18379 - * @skb: buffer to use
18380 - * @len: amount of data to add
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.
18386 -unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
18388 - unsigned char *tmp = skb_tail_pointer(skb);
18389 - SKB_LINEAR_ASSERT(skb);
18390 - skb->tail += len;
18392 - if (unlikely(skb->tail > skb->end))
18393 - skb_over_panic(skb, len, __builtin_return_address(0));
18396 -EXPORT_SYMBOL(skb_put);
18399 - * skb_push - add data to the start of a buffer
18400 - * @skb: buffer to use
18401 - * @len: amount of data to add
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.
18407 -unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
18409 - skb->data -= len;
18411 - if (unlikely(skb->data<skb->head))
18412 - skb_under_panic(skb, len, __builtin_return_address(0));
18413 - return skb->data;
18415 -EXPORT_SYMBOL(skb_push);
18418 - * skb_pull - remove data from the start of a buffer
18419 - * @skb: buffer to use
18420 - * @len: amount of data to remove
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
18427 -unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
18429 - return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
18431 -EXPORT_SYMBOL(skb_pull);
18434 - * skb_trim - remove end from a buffer
18435 - * @skb: buffer to alter
18436 - * @len: new length
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.
18442 -void skb_trim(struct sk_buff *skb, unsigned int len)
18444 - if (skb->len > len)
18445 - __skb_trim(skb, len);
18447 -EXPORT_SYMBOL(skb_trim);
18449 -/* Trims skb to length len. It can change skb pointers.
18452 -int ___pskb_trim(struct sk_buff *skb, unsigned int len)
18454 - struct sk_buff **fragp;
18455 - struct sk_buff *frag;
18456 - int offset = skb_headlen(skb);
18457 - int nfrags = skb_shinfo(skb)->nr_frags;
18461 - if (skb_cloned(skb) &&
18462 - unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))))
18466 - if (offset >= len)
18469 - for (; i < nfrags; i++) {
18470 - int end = offset + skb_shinfo(skb)->frags[i].size;
18477 - skb_shinfo(skb)->frags[i++].size = len - offset;
18480 - skb_shinfo(skb)->nr_frags = i;
18482 - for (; i < nfrags; i++)
18483 - put_page(skb_shinfo(skb)->frags[i].page);
18485 - if (skb_shinfo(skb)->frag_list)
18486 - skb_drop_fraglist(skb);
18490 - for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp);
18491 - fragp = &frag->next) {
18492 - int end = offset + frag->len;
18494 - if (skb_shared(frag)) {
18495 - struct sk_buff *nfrag;
18497 - nfrag = skb_clone(frag, GFP_ATOMIC);
18498 - if (unlikely(!nfrag))
18501 - nfrag->next = frag->next;
18513 - unlikely((err = pskb_trim(frag, len - offset))))
18517 - skb_drop_list(&frag->next);
18522 - if (len > skb_headlen(skb)) {
18523 - skb->data_len -= skb->len - len;
18527 - skb->data_len = 0;
18528 - skb_set_tail_pointer(skb, len);
18535 - * __pskb_pull_tail - advance tail of skb header
18536 - * @skb: buffer to reallocate
18537 - * @delta: number of bytes to advance tail
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.
18543 - * &sk_buff MUST have reference count of 1.
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.
18548 - * All the pointers pointing into skb header may change and must be
18549 - * reloaded after call to this function.
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.
18557 - * It is pretty complicated. Luckily, it is called only in exceptional cases.
18559 -unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
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.
18565 - int i, k, eat = (skb->tail + delta) - skb->end;
18567 - if (eat > 0 || skb_cloned(skb)) {
18568 - if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0,
18573 - if (skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb), delta))
18576 - /* Optimization: no fragments, no reasons to preestimate
18577 - * size of pulled pages. Superb.
18579 - if (!skb_shinfo(skb)->frag_list)
18582 - /* Estimate size of pulled pages. */
18584 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
18585 - if (skb_shinfo(skb)->frags[i].size >= eat)
18587 - eat -= skb_shinfo(skb)->frags[i].size;
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)
18598 - struct sk_buff *list = skb_shinfo(skb)->frag_list;
18599 - struct sk_buff *clone = NULL;
18600 - struct sk_buff *insp = NULL;
18605 - if (list->len <= eat) {
18606 - /* Eaten as whole. */
18607 - eat -= list->len;
18608 - list = list->next;
18611 - /* Eaten partially. */
18613 - if (skb_shared(list)) {
18614 - /* Sucks! We need to fork list. :-( */
18615 - clone = skb_clone(list, GFP_ATOMIC);
18618 - insp = list->next;
18621 - /* This may be pulled without
18625 - if (!pskb_pull(list, eat)) {
18627 - kfree_skb(clone);
18634 - /* Free pulled out fragments. */
18635 - while ((list = skb_shinfo(skb)->frag_list) != insp) {
18636 - skb_shinfo(skb)->frag_list = list->next;
18639 - /* And insert new clone at head. */
18641 - clone->next = list;
18642 - skb_shinfo(skb)->frag_list = clone;
18645 - /* Success! Now we may commit changes to skb data. */
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;
18655 - skb_shinfo(skb)->frags[k] = skb_shinfo(skb)->frags[i];
18657 - skb_shinfo(skb)->frags[k].page_offset += eat;
18658 - skb_shinfo(skb)->frags[k].size -= eat;
18664 - skb_shinfo(skb)->nr_frags = k;
18666 - skb->tail += delta;
18667 - skb->data_len -= delta;
18669 - return skb_tail_pointer(skb);
18672 -/* Copy some data bits from skb to kernel buffer. */
18674 -int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len)
18677 - int start = skb_headlen(skb);
18679 - if (offset > (int)skb->len - len)
18682 - /* Copy header. */
18683 - if ((copy = start - offset) > 0) {
18686 - skb_copy_from_linear_data_offset(skb, offset, to, copy);
18687 - if ((len -= copy) == 0)
18693 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
18696 - WARN_ON(start > offset + len);
18698 - end = start + skb_shinfo(skb)->frags[i].size;
18699 - if ((copy = end - offset) > 0) {
18705 - vaddr = kmap_skb_frag(&skb_shinfo(skb)->frags[i]);
18707 - vaddr + skb_shinfo(skb)->frags[i].page_offset+
18708 - offset - start, copy);
18709 - kunmap_skb_frag(vaddr);
18711 - if ((len -= copy) == 0)
18719 - if (skb_shinfo(skb)->frag_list) {
18720 - struct sk_buff *list = skb_shinfo(skb)->frag_list;
18722 - for (; list; list = list->next) {
18725 - WARN_ON(start > offset + len);
18727 - end = start + list->len;
18728 - if ((copy = end - offset) > 0) {
18731 - if (skb_copy_bits(list, offset - start,
18734 - if ((len -= copy) == 0)
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.
18753 -static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
18755 - struct sk_buff *skb = (struct sk_buff *) spd->partial[i].private;
18761 - * Fill page/offset/length into spd, if it can hold more pages.
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)
18767 - if (unlikely(spd->nr_pages == PIPE_BUFFERS))
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);
18778 -static inline void __segment_seek(struct page **page, unsigned int *poff,
18779 - unsigned int *plen, unsigned int off)
18782 - *page += *poff / PAGE_SIZE;
18783 - *poff = *poff % PAGE_SIZE;
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)
18795 - /* skip this segment if already processed */
18796 - if (*off >= plen) {
18801 - /* ignore any bits we already processed */
18803 - __segment_seek(&page, &poff, &plen, *off);
18808 - unsigned int flen = min(*len, plen);
18810 - /* the linear region may spread across several pages */
18811 - flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
18813 - if (spd_fill_page(spd, page, flen, poff, skb))
18816 - __segment_seek(&page, &poff, &plen, flen);
18819 - } while (*len && plen);
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.
18828 -static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
18829 - unsigned int *len,
18830 - struct splice_pipe_desc *spd)
18835 - * map the linear part
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))
18844 - * then map the fragments
18846 - for (seg = 0; seg < skb_shinfo(skb)->nr_frags; seg++) {
18847 - const skb_frag_t *f = &skb_shinfo(skb)->frags[seg];
18849 - if (__splice_segment(f->page, f->page_offset, f->size,
18850 - offset, len, skb, spd))
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.
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)
18867 - struct partial_page partial[PIPE_BUFFERS];
18868 - struct page *pages[PIPE_BUFFERS];
18869 - struct splice_pipe_desc spd = {
18871 - .partial = partial,
18873 - .ops = &sock_pipe_buf_ops,
18874 - .spd_release = sock_spd_release,
18876 - struct sk_buff *skb;
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.
18883 - skb = skb_clone(__skb, GFP_KERNEL);
18884 - if (unlikely(!skb))
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.
18891 - if (__skb_splice_bits(skb, &offset, &tlen, &spd))
18897 - * now see if we have a frag_list to map
18899 - if (skb_shinfo(skb)->frag_list) {
18900 - struct sk_buff *list = skb_shinfo(skb)->frag_list;
18902 - for (; list && tlen; list = list->next) {
18903 - if (__skb_splice_bits(list, &offset, &tlen, &spd))
18910 - * drop our reference to the clone, the pipe consumption will
18915 - if (spd.nr_pages) {
18917 - struct sock *sk = __skb->sk;
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.
18928 - release_sock(sk);
18929 - ret = splice_to_pipe(pipe, &spd);
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
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.
18949 -int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len)
18952 - int start = skb_headlen(skb);
18954 - if (offset > (int)skb->len - len)
18957 - if ((copy = start - offset) > 0) {
18960 - skb_copy_to_linear_data_offset(skb, offset, from, copy);
18961 - if ((len -= copy) == 0)
18967 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
18968 - skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
18971 - WARN_ON(start > offset + len);
18973 - end = start + frag->size;
18974 - if ((copy = end - offset) > 0) {
18980 - vaddr = kmap_skb_frag(frag);
18981 - memcpy(vaddr + frag->page_offset + offset - start,
18983 - kunmap_skb_frag(vaddr);
18985 - if ((len -= copy) == 0)
18993 - if (skb_shinfo(skb)->frag_list) {
18994 - struct sk_buff *list = skb_shinfo(skb)->frag_list;
18996 - for (; list; list = list->next) {
18999 - WARN_ON(start > offset + len);
19001 - end = start + list->len;
19002 - if ((copy = end - offset) > 0) {
19005 - if (skb_store_bits(list, offset - start,
19008 - if ((len -= copy) == 0)
19023 -EXPORT_SYMBOL(skb_store_bits);
19025 -/* Checksum skb data. */
19027 -__wsum skb_checksum(const struct sk_buff *skb, int offset,
19028 - int len, __wsum csum)
19030 - int start = skb_headlen(skb);
19031 - int i, copy = start - offset;
19034 - /* Checksum header. */
19038 - csum = csum_partial(skb->data + offset, copy, csum);
19039 - if ((len -= copy) == 0)
19045 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
19048 - WARN_ON(start > offset + len);
19050 - end = start + skb_shinfo(skb)->frags[i].size;
19051 - if ((copy = end - offset) > 0) {
19054 - skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
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))
19071 - if (skb_shinfo(skb)->frag_list) {
19072 - struct sk_buff *list = skb_shinfo(skb)->frag_list;
19074 - for (; list; list = list->next) {
19077 - WARN_ON(start > offset + len);
19079 - end = start + list->len;
19080 - if ((copy = end - offset) > 0) {
19084 - csum2 = skb_checksum(list, offset - start,
19086 - csum = csum_block_add(csum, csum2, pos);
19087 - if ((len -= copy) == 0)
19100 -/* Both of above in one bottle. */
19102 -__wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
19103 - u8 *to, int len, __wsum csum)
19105 - int start = skb_headlen(skb);
19106 - int i, copy = start - offset;
19109 - /* Copy header. */
19113 - csum = csum_partial_copy_nocheck(skb->data + offset, to,
19115 - if ((len -= copy) == 0)
19122 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
19125 - WARN_ON(start > offset + len);
19127 - end = start + skb_shinfo(skb)->frags[i].size;
19128 - if ((copy = end - offset) > 0) {
19131 - skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
19135 - vaddr = kmap_skb_frag(frag);
19136 - csum2 = csum_partial_copy_nocheck(vaddr +
19137 - frag->page_offset +
19138 - offset - start, to,
19140 - kunmap_skb_frag(vaddr);
19141 - csum = csum_block_add(csum, csum2, pos);
19142 - if (!(len -= copy))
19151 - if (skb_shinfo(skb)->frag_list) {
19152 - struct sk_buff *list = skb_shinfo(skb)->frag_list;
19154 - for (; list; list = list->next) {
19158 - WARN_ON(start > offset + len);
19160 - end = start + list->len;
19161 - if ((copy = end - offset) > 0) {
19164 - csum2 = skb_copy_and_csum_bits(list,
19167 - csum = csum_block_add(csum, csum2, pos);
19168 - if ((len -= copy) == 0)
19181 -void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
19186 - if (skb->ip_summed == CHECKSUM_PARTIAL)
19187 - csstart = skb->csum_start - skb_headroom(skb);
19189 - csstart = skb_headlen(skb);
19191 - BUG_ON(csstart > skb_headlen(skb));
19193 - skb_copy_from_linear_data(skb, to, csstart);
19196 - if (csstart != skb->len)
19197 - csum = skb_copy_and_csum_bits(skb, csstart, to + csstart,
19198 - skb->len - csstart, 0);
19200 - if (skb->ip_summed == CHECKSUM_PARTIAL) {
19201 - long csstuff = csstart + skb->csum_offset;
19203 - *((__sum16 *)(to + csstuff)) = csum_fold(csum);
19208 - * skb_dequeue - remove from the head of the queue
19209 - * @list: list to dequeue from
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.
19216 -struct sk_buff *skb_dequeue(struct sk_buff_head *list)
19218 - unsigned long flags;
19219 - struct sk_buff *result;
19221 - spin_lock_irqsave(&list->lock, flags);
19222 - result = __skb_dequeue(list);
19223 - spin_unlock_irqrestore(&list->lock, flags);
19228 - * skb_dequeue_tail - remove from the tail of the queue
19229 - * @list: list to dequeue from
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.
19235 -struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list)
19237 - unsigned long flags;
19238 - struct sk_buff *result;
19240 - spin_lock_irqsave(&list->lock, flags);
19241 - result = __skb_dequeue_tail(list);
19242 - spin_unlock_irqrestore(&list->lock, flags);
19247 - * skb_queue_purge - empty a list
19248 - * @list: list to empty
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.
19254 -void skb_queue_purge(struct sk_buff_head *list)
19256 - struct sk_buff *skb;
19257 - while ((skb = skb_dequeue(list)) != NULL)
19262 - * skb_queue_head - queue a buffer at the list head
19263 - * @list: list to use
19264 - * @newsk: buffer to queue
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
19270 - * A buffer cannot be placed on two lists at the same time.
19272 -void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk)
19274 - unsigned long flags;
19276 - spin_lock_irqsave(&list->lock, flags);
19277 - __skb_queue_head(list, newsk);
19278 - spin_unlock_irqrestore(&list->lock, flags);
19282 - * skb_queue_tail - queue a buffer at the list tail
19283 - * @list: list to use
19284 - * @newsk: buffer to queue
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
19290 - * A buffer cannot be placed on two lists at the same time.
19292 -void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk)
19294 - unsigned long flags;
19296 - spin_lock_irqsave(&list->lock, flags);
19297 - __skb_queue_tail(list, newsk);
19298 - spin_unlock_irqrestore(&list->lock, flags);
19302 - * skb_unlink - remove a buffer from a list
19303 - * @skb: buffer to remove
19304 - * @list: list to use
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
19309 - * You must know what list the SKB is on.
19311 -void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
19313 - unsigned long flags;
19315 - spin_lock_irqsave(&list->lock, flags);
19316 - __skb_unlink(skb, list);
19317 - spin_unlock_irqrestore(&list->lock, flags);
19321 - * skb_append - append a buffer
19322 - * @old: buffer to insert after
19323 - * @newsk: buffer to insert
19324 - * @list: list to use
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.
19330 -void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
19332 - unsigned long flags;
19334 - spin_lock_irqsave(&list->lock, flags);
19335 - __skb_queue_after(list, old, newsk);
19336 - spin_unlock_irqrestore(&list->lock, flags);
19341 - * skb_insert - insert a buffer
19342 - * @old: buffer to insert before
19343 - * @newsk: buffer to insert
19344 - * @list: list to use
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
19350 - * A buffer cannot be placed on two lists at the same time.
19352 -void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
19354 - unsigned long flags;
19356 - spin_lock_irqsave(&list->lock, flags);
19357 - __skb_insert(newsk, old->prev, old, list);
19358 - spin_unlock_irqrestore(&list->lock, flags);
19361 -static inline void skb_split_inside_header(struct sk_buff *skb,
19362 - struct sk_buff* skb1,
19363 - const u32 len, const int pos)
19367 - skb_copy_from_linear_data_offset(skb, len, skb_put(skb1, 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];
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;
19379 - skb_set_tail_pointer(skb, len);
19382 -static inline void skb_split_no_header(struct sk_buff *skb,
19383 - struct sk_buff* skb1,
19384 - const u32 len, int pos)
19387 - const int nfrags = skb_shinfo(skb)->nr_frags;
19389 - skb_shinfo(skb)->nr_frags = 0;
19390 - skb1->len = skb1->data_len = skb->len - len;
19392 - skb->data_len = len - pos;
19394 - for (i = 0; i < nfrags; i++) {
19395 - int size = skb_shinfo(skb)->frags[i].size;
19397 - if (pos + size > len) {
19398 - skb_shinfo(skb1)->frags[k] = skb_shinfo(skb)->frags[i];
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.
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++;
19417 - skb_shinfo(skb)->nr_frags++;
19420 - skb_shinfo(skb1)->nr_frags = k;
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
19429 -void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len)
19431 - int pos = skb_headlen(skb);
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);
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
19446 - * Initializes the specified state variable. Must be called before
19447 - * invoking skb_seq_read() for the first time.
19449 -void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
19450 - unsigned int to, struct skb_seq_state *st)
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;
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
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.
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.
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.
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.
19484 -unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
19485 - struct skb_seq_state *st)
19487 - unsigned int block_limit, abs_offset = consumed + st->lower_offset;
19488 - skb_frag_t *frag;
19490 - if (unlikely(abs_offset >= st->upper_offset))
19494 - block_limit = skb_headlen(st->cur_skb);
19496 - if (abs_offset < block_limit) {
19497 - *data = st->cur_skb->data + abs_offset;
19498 - return block_limit - abs_offset;
19501 - if (st->frag_idx == 0 && !st->frag_data)
19502 - st->stepped_offset += skb_headlen(st->cur_skb);
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;
19508 - if (abs_offset < block_limit) {
19509 - if (!st->frag_data)
19510 - st->frag_data = kmap_skb_frag(frag);
19512 - *data = (u8 *) st->frag_data + frag->page_offset +
19513 - (abs_offset - st->stepped_offset);
19515 - return block_limit - abs_offset;
19518 - if (st->frag_data) {
19519 - kunmap_skb_frag(st->frag_data);
19520 - st->frag_data = NULL;
19524 - st->stepped_offset += frag->size;
19527 - if (st->frag_data) {
19528 - kunmap_skb_frag(st->frag_data);
19529 - st->frag_data = NULL;
19532 - if (st->cur_skb->next) {
19533 - st->cur_skb = st->cur_skb->next;
19534 - st->frag_idx = 0;
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;
19546 - * skb_abort_seq_read - Abort a sequential read of skb data
19547 - * @st: state variable
19549 - * Must be called if skb_seq_read() was not called until it
19552 -void skb_abort_seq_read(struct skb_seq_state *st)
19554 - if (st->frag_data)
19555 - kunmap_skb_frag(st->frag_data);
19558 -#define TS_SKB_CB(state) ((struct skb_seq_state *) &((state)->cb))
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)
19564 - return skb_seq_read(offset, text, TS_SKB_CB(state));
19567 -static void skb_ts_finish(struct ts_config *conf, struct ts_state *state)
19569 - skb_abort_seq_read(TS_SKB_CB(state));
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
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.
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)
19589 - unsigned int ret;
19591 - config->get_next_block = skb_ts_get_next_block;
19592 - config->finish = skb_ts_finish;
19594 - skb_prepare_seq_read(skb, from, to, TS_SKB_CB(state));
19596 - ret = textsearch_find(config, state);
19597 - return (ret <= to - from ? ret : UINT_MAX);
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
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
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)
19617 - skb_frag_t *frag = NULL;
19618 - struct page *page = NULL;
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)
19629 - /* allocate a new page for next frag */
19630 - page = alloc_pages(sk->sk_allocation, 0);
19632 - /* If alloc_page fails just return failure and caller will
19633 - * free previous allocated pages by doing kfree_skb()
19635 - if (page == NULL)
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);
19645 - /* get the new initialized frag */
19646 - frg_cnt = skb_shinfo(skb)->nr_frags;
19647 - frag = &skb_shinfo(skb)->frags[frg_cnt - 1];
19649 - /* copy the user data to page */
19650 - left = PAGE_SIZE - frag->page_offset;
19651 - copy = (length > left)? left : length;
19653 - ret = getfrag(from, (page_address(frag->page) +
19654 - frag->page_offset + frag->size),
19655 - offset, copy, 0, skb);
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;
19667 - } while (length > 0);
19673 - * skb_pull_rcsum - pull skb and update receive checksum
19674 - * @skb: buffer to update
19675 - * @len: length of data pulled
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.
19683 -unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len)
19685 - BUG_ON(len > skb->len);
19687 - BUG_ON(skb->len < skb->data_len);
19688 - skb_postpull_rcsum(skb, skb->data, len);
19689 - return skb->data += len;
19692 -EXPORT_SYMBOL_GPL(skb_pull_rcsum);
19695 - * skb_segment - Perform protocol segmentation on skb.
19696 - * @skb: buffer to segment
19697 - * @features: features for the output path (see dev->features)
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).
19703 -struct sk_buff *skb_segment(struct sk_buff *skb, int features)
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;
19718 - __skb_push(skb, doffset);
19719 - headroom = skb_headroom(skb);
19720 - pos = skb_headlen(skb);
19723 - struct sk_buff *nskb;
19724 - skb_frag_t *frag;
19729 - len = skb->len - offset;
19733 - hsize = skb_headlen(skb) - offset;
19736 - if (hsize > len || !sg)
19739 - nskb = alloc_skb(hsize + doffset + headroom, GFP_ATOMIC);
19740 - if (unlikely(!nskb))
19744 - tail->next = nskb;
19749 - __copy_skb_header(nskb, skb);
19750 - nskb->mac_len = skb->mac_len;
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),
19760 - nskb->ip_summed = CHECKSUM_NONE;
19761 - nskb->csum = skb_copy_and_csum_bits(skb, offset,
19762 - skb_put(nskb, len),
19767 - frag = skb_shinfo(nskb)->frags;
19770 - skb_copy_from_linear_data_offset(skb, offset,
19771 - skb_put(nskb, hsize), hsize);
19773 - while (pos < offset + len) {
19774 - BUG_ON(i >= nfrags);
19776 - *frag = skb_shinfo(skb)->frags[i];
19777 - get_page(frag->page);
19778 - size = frag->size;
19780 - if (pos < offset) {
19781 - frag->page_offset += offset - pos;
19782 - frag->size -= offset - pos;
19787 - if (pos + size <= offset + len) {
19791 - frag->size -= pos + size - (offset + len);
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);
19807 - while ((skb = segs)) {
19808 - segs = skb->next;
19811 - return ERR_PTR(err);
19814 -EXPORT_SYMBOL_GPL(skb_segment);
19816 -void __init skb_init(void)
19818 - skbuff_head_cache = kmem_cache_create("skbuff_head_cache",
19819 - sizeof(struct sk_buff),
19821 - SLAB_HWCACHE_ALIGN|SLAB_PANIC,
19823 - skbuff_fclone_cache = kmem_cache_create("skbuff_fclone_cache",
19824 - (2*sizeof(struct sk_buff)) +
19825 - sizeof(atomic_t),
19827 - SLAB_HWCACHE_ALIGN|SLAB_PANIC,
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
19838 - * Fill the specified scatter-gather list with mappings/pointers into a
19839 - * region of the buffer space attached to a socket buffer.
19842 -__skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
19844 - int start = skb_headlen(skb);
19845 - int i, copy = start - offset;
19851 - sg_set_buf(sg, skb->data + offset, copy);
19853 - if ((len -= copy) == 0)
19858 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
19861 - WARN_ON(start > offset + len);
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];
19869 - sg_set_page(&sg[elt], frag->page, copy,
19870 - frag->page_offset+offset-start);
19872 - if (!(len -= copy))
19879 - if (skb_shinfo(skb)->frag_list) {
19880 - struct sk_buff *list = skb_shinfo(skb)->frag_list;
19882 - for (; list; list = list->next) {
19885 - WARN_ON(start > offset + len);
19887 - end = start + list->len;
19888 - if ((copy = end - offset) > 0) {
19891 - elt += __skb_to_sgvec(list, sg+elt, offset - start,
19893 - if ((len -= copy) == 0)
19904 -int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
19906 - int nsg = __skb_to_sgvec(skb, sg, offset, len);
19908 - sg_mark_end(&sg[nsg - 1]);
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
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.
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.
19927 - * The number of scatterlist elements required to completely map the
19928 - * COW'd and extended socket buffer will be returned.
19930 -int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
19934 - struct sk_buff *skb1, **skb_p;
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).
19940 - if ((skb_cloned(skb) || skb_shinfo(skb)->nr_frags) &&
19941 - __pskb_pull_tail(skb, skb_pagelen(skb)-skb_headlen(skb)) == NULL)
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. */
19951 - if (skb_tailroom(skb) < tailbits &&
19952 - pskb_expand_head(skb, 0, tailbits-skb_tailroom(skb)+128, GFP_ATOMIC))
19960 - /* Misery. We are in troubles, going to mincer fragments... */
19963 - skb_p = &skb_shinfo(skb)->frag_list;
19966 - while ((skb1 = *skb_p) != NULL) {
19969 - /* The fragment is partially pulled by someone,
19970 - * this can happen on input. Copy it and everything
19973 - if (skb_shared(skb1))
19976 - /* If the skb is the last, worry about trailer. */
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;
19986 - skb_cloned(skb1) ||
19988 - skb_shinfo(skb1)->nr_frags ||
19989 - skb_shinfo(skb1)->frag_list) {
19990 - struct sk_buff *skb2;
19992 - /* Fuck, we are miserable poor guys... */
19994 - skb2 = skb_copy(skb1, GFP_ATOMIC);
19996 - skb2 = skb_copy_expand(skb1,
19997 - skb_headroom(skb1),
20000 - if (unlikely(skb2 == NULL))
20004 - skb_set_owner_w(skb2, skb1->sk);
20006 - /* Looking around. Are we still alive?
20007 - * OK, link new skb, drop old one */
20009 - skb2->next = skb1->next;
20016 - skb_p = &skb1->next;
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.
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.
20031 - * This function checks and sets those values and skb->ip_summed: if this
20032 - * returns false you should drop the packet.
20034 -bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)
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);
20044 - skb->ip_summed = CHECKSUM_PARTIAL;
20045 - skb->csum_start = skb_headroom(skb) + start;
20046 - skb->csum_offset = off;
20050 -void __skb_warn_lro_forwarding(const struct sk_buff *skb)
20052 - if (net_ratelimit())
20053 - pr_warning("%s: received packets cannot be forwarded"
20054 - " while LRO is enabled\n", skb->dev->name);
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);
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 @@
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) {
20116 neigh_app_ns(neigh);
20117 @@ -377,6 +376,8 @@
20119 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
20120 dst_ha, dev->dev_addr, NULL);
20122 + read_unlock_bh(&neigh->lock);
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
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