aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig20
-rw-r--r--arch/arm/kernel/entry-armv.S14
-rw-r--r--arch/arm/kernel/head.S3
-rw-r--r--arch/arm/kernel/process.c25
-rw-r--r--arch/arm/kernel/sys_arm.c2
-rw-r--r--arch/arm/kernel/traps.c14
-rw-r--r--arch/arm/kernel/vmlinux.lds.S3
-rw-r--r--arch/arm/mach-clps711x/Kconfig3
-rw-r--r--arch/arm/mach-footbridge/Kconfig12
-rw-r--r--arch/arm/mach-imx/Kconfig1
-rw-r--r--arch/arm/mm/Kconfig24
-rw-r--r--drivers/net/appletalk/cops.c4
-rw-r--r--drivers/net/appletalk/ltpc.c2
-rw-r--r--drivers/net/tg3.c85
-rw-r--r--fs/xfs/Makefile2
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c81
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c11
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c43
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h10
-rw-r--r--fs/xfs/xfs_dfrag.c2
-rw-r--r--fs/xfs/xfs_iget.c51
-rw-r--r--fs/xfs/xfs_inode.c2
-rw-r--r--fs/xfs/xfs_inode.h6
-rw-r--r--fs/xfs/xfs_iomap.c26
-rw-r--r--fs/xfs/xfs_iomap.h25
-rw-r--r--fs/xfs/xfs_mount.c9
-rw-r--r--fs/xfs/xfs_mount.h19
-rw-r--r--fs/xfs/xfs_types.h1
-rw-r--r--fs/xfs/xfs_utils.c2
-rw-r--r--fs/xfs/xfs_utils.h2
-rw-r--r--fs/xfs/xfs_vfsops.c67
-rw-r--r--fs/xfs/xfs_vnodeops.c11
-rw-r--r--include/asm-arm/arch-imx/imxfb.h35
-rw-r--r--include/asm-arm/processor.h7
-rw-r--r--include/asm-arm/thread_info.h6
-rw-r--r--include/linux/if_ltalk.h2
-rw-r--r--include/net/sock.h2
-rw-r--r--net/appletalk/dev.c22
-rw-r--r--net/core/sock.c12
-rw-r--r--net/decnet/dn_dev.c2
-rw-r--r--net/ipv4/multipath_wrandom.c6
-rw-r--r--scripts/kconfig/Makefile14
-rw-r--r--scripts/kconfig/POTFILES.in5
-rw-r--r--scripts/kconfig/conf.c20
-rw-r--r--scripts/kconfig/confdata.c16
-rw-r--r--scripts/kconfig/gconf.c52
-rw-r--r--scripts/kconfig/kxgettext.c221
-rw-r--r--scripts/kconfig/lkc.h8
-rw-r--r--scripts/kconfig/mconf.c120
-rw-r--r--scripts/kconfig/menu.c4
-rw-r--r--scripts/kconfig/qconf.cc59
53 files changed, 852 insertions, 351 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8bfcb37460fa..bf397a9f8ac2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -85,6 +85,7 @@ choice
85config ARCH_CLPS7500 85config ARCH_CLPS7500
86 bool "Cirrus-CL-PS7500FE" 86 bool "Cirrus-CL-PS7500FE"
87 select TIMER_ACORN 87 select TIMER_ACORN
88 select ISA
88 89
89config ARCH_CLPS711X 90config ARCH_CLPS711X
90 bool "CLPS711x/EP721x-based" 91 bool "CLPS711x/EP721x-based"
@@ -96,6 +97,7 @@ config ARCH_CO285
96 97
97config ARCH_EBSA110 98config ARCH_EBSA110
98 bool "EBSA-110" 99 bool "EBSA-110"
100 select ISA
99 help 101 help
100 This is an evaluation board for the StrongARM processor available 102 This is an evaluation board for the StrongARM processor available
101 from Digital. It has limited hardware on-board, including an onboard 103 from Digital. It has limited hardware on-board, including an onboard
@@ -120,13 +122,16 @@ config ARCH_INTEGRATOR
120 122
121config ARCH_IOP3XX 123config ARCH_IOP3XX
122 bool "IOP3xx-based" 124 bool "IOP3xx-based"
125 select PCI
123 126
124config ARCH_IXP4XX 127config ARCH_IXP4XX
125 bool "IXP4xx-based" 128 bool "IXP4xx-based"
126 select DMABOUNCE 129 select DMABOUNCE
130 select PCI
127 131
128config ARCH_IXP2000 132config ARCH_IXP2000
129 bool "IXP2400/2800-based" 133 bool "IXP2400/2800-based"
134 select PCI
130 135
131config ARCH_L7200 136config ARCH_L7200
132 bool "LinkUp-L7200" 137 bool "LinkUp-L7200"
@@ -155,6 +160,8 @@ config ARCH_RPC
155 160
156config ARCH_SA1100 161config ARCH_SA1100
157 bool "SA1100-based" 162 bool "SA1100-based"
163 select ISA
164 select DISCONTIGMEM
158 165
159config ARCH_S3C2410 166config ARCH_S3C2410
160 bool "Samsung S3C2410" 167 bool "Samsung S3C2410"
@@ -165,6 +172,9 @@ config ARCH_S3C2410
165 172
166config ARCH_SHARK 173config ARCH_SHARK
167 bool "Shark" 174 bool "Shark"
175 select ISA
176 select ISA_DMA
177 select PCI
168 178
169config ARCH_LH7A40X 179config ARCH_LH7A40X
170 bool "Sharp LH7A40X" 180 bool "Sharp LH7A40X"
@@ -252,8 +262,6 @@ config ARM_AMBA
252 262
253config ISA 263config ISA
254 bool 264 bool
255 depends on FOOTBRIDGE_HOST || ARCH_SHARK || ARCH_CLPS7500 || ARCH_EBSA110 || ARCH_CDB89712 || ARCH_EDB7211 || ARCH_SA1100 || ARCH_MX1ADS
256 default y
257 help 265 help
258 Find out whether you have ISA slots on your motherboard. ISA is the 266 Find out whether you have ISA slots on your motherboard. ISA is the
259 name of a bus system, i.e. the way the CPU talks to the other stuff 267 name of a bus system, i.e. the way the CPU talks to the other stuff
@@ -263,8 +271,6 @@ config ISA
263 271
264config ISA_DMA 272config ISA_DMA
265 bool 273 bool
266 depends on FOOTBRIDGE_HOST || ARCH_SHARK
267 default y
268 274
269config ISA_DMA_API 275config ISA_DMA_API
270 bool 276 bool
@@ -272,7 +278,6 @@ config ISA_DMA_API
272 278
273config PCI 279config PCI
274 bool "PCI support" if ARCH_INTEGRATOR_AP 280 bool "PCI support" if ARCH_INTEGRATOR_AP
275 default y if ARCH_SHARK || FOOTBRIDGE_HOST || ARCH_IOP3XX || ARCH_IXP4XX || ARCH_IXP2000
276 help 281 help
277 Find out whether you have a PCI motherboard. PCI is the name of a 282 Find out whether you have a PCI motherboard. PCI is the name of a
278 bus system, i.e. the way the CPU talks to the other stuff inside 283 bus system, i.e. the way the CPU talks to the other stuff inside
@@ -300,7 +305,7 @@ menu "Kernel Features"
300 305
301config SMP 306config SMP
302 bool "Symmetric Multi-Processing (EXPERIMENTAL)" 307 bool "Symmetric Multi-Processing (EXPERIMENTAL)"
303 depends on EXPERIMENTAL && n 308 depends on EXPERIMENTAL #&& n
304 help 309 help
305 This enables support for systems with more than one CPU. If you have 310 This enables support for systems with more than one CPU. If you have
306 a system with only one CPU, like most personal computers, say N. If 311 a system with only one CPU, like most personal computers, say N. If
@@ -340,8 +345,7 @@ config PREEMPT
340 345
341config DISCONTIGMEM 346config DISCONTIGMEM
342 bool 347 bool
343 depends on ARCH_EDB7211 || ARCH_SA1100 || (ARCH_LH7A40X && !LH7A40X_CONTIGMEM) 348 default (ARCH_LH7A40X && !LH7A40X_CONTIGMEM)
344 default y
345 help 349 help
346 Say Y to support efficient handling of discontiguous physical memory, 350 Say Y to support efficient handling of discontiguous physical memory,
347 for architectures which are either NUMA (Non-Uniform Memory Access) 351 for architectures which are either NUMA (Non-Uniform Memory Access)
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 080df907f242..4eb36155dc93 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -17,8 +17,8 @@
17 17
18#include <asm/glue.h> 18#include <asm/glue.h>
19#include <asm/vfpmacros.h> 19#include <asm/vfpmacros.h>
20#include <asm/hardware.h> @ should be moved into entry-macro.S 20#include <asm/hardware.h> /* should be moved into entry-macro.S */
21#include <asm/arch/irqs.h> @ should be moved into entry-macro.S 21#include <asm/arch/irqs.h> /* should be moved into entry-macro.S */
22#include <asm/arch/entry-macro.S> 22#include <asm/arch/entry-macro.S>
23 23
24#include "entry-header.S" 24#include "entry-header.S"
@@ -505,9 +505,9 @@ ENTRY(__switch_to)
505 mra r4, r5, acc0 505 mra r4, r5, acc0
506 stmia ip, {r4, r5} 506 stmia ip, {r4, r5}
507#endif 507#endif
508#ifdef CONFIG_HAS_TLS_REG 508#if defined(CONFIG_HAS_TLS_REG)
509 mcr p15, 0, r3, c13, c0, 3 @ set TLS register 509 mcr p15, 0, r3, c13, c0, 3 @ set TLS register
510#else 510#elif !defined(CONFIG_TLS_REG_EMUL)
511 mov r4, #0xffff0fff 511 mov r4, #0xffff0fff
512 str r3, [r4, #-15] @ TLS val at 0xffff0ff0 512 str r3, [r4, #-15] @ TLS val at 0xffff0ff0
513#endif 513#endif
@@ -690,11 +690,7 @@ __kuser_cmpxchg: @ 0xffff0fc0
690 690
691__kuser_get_tls: @ 0xffff0fe0 691__kuser_get_tls: @ 0xffff0fe0
692 692
693#ifndef CONFIG_HAS_TLS_REG 693#if !defined(CONFIG_HAS_TLS_REG) && !defined(CONFIG_TLS_REG_EMUL)
694
695#ifdef CONFIG_SMP /* sanity check */
696#error "CONFIG_SMP without CONFIG_HAS_TLS_REG is wrong"
697#endif
698 694
699 ldr r0, [pc, #(16 - 8)] @ TLS stored at 0xffff0ff0 695 ldr r0, [pc, #(16 - 8)] @ TLS stored at 0xffff0ff0
700 mov pc, lr 696 mov pc, lr
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 171b3e811c71..4733877296d4 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -19,6 +19,7 @@
19#include <asm/procinfo.h> 19#include <asm/procinfo.h>
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/constants.h> 21#include <asm/constants.h>
22#include <asm/thread_info.h>
22#include <asm/system.h> 23#include <asm/system.h>
23 24
24#define PROCINFO_MMUFLAGS 8 25#define PROCINFO_MMUFLAGS 8
@@ -131,7 +132,7 @@ __switch_data:
131 .long processor_id @ r4 132 .long processor_id @ r4
132 .long __machine_arch_type @ r5 133 .long __machine_arch_type @ r5
133 .long cr_alignment @ r6 134 .long cr_alignment @ r6
134 .long init_thread_union+8192 @ sp 135 .long init_thread_union + THREAD_START_SP @ sp
135 136
136/* 137/*
137 * The following fragment of code is executed with the MMU on, and uses 138 * The following fragment of code is executed with the MMU on, and uses
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 26eacd3e5def..8f146a4b4752 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -256,8 +256,6 @@ static unsigned long *thread_info_head;
256static unsigned int nr_thread_info; 256static unsigned int nr_thread_info;
257 257
258#define EXTRA_TASK_STRUCT 4 258#define EXTRA_TASK_STRUCT 4
259#define ll_alloc_task_struct() ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
260#define ll_free_task_struct(p) free_pages((unsigned long)(p),1)
261 259
262struct thread_info *alloc_thread_info(struct task_struct *task) 260struct thread_info *alloc_thread_info(struct task_struct *task)
263{ 261{
@@ -274,17 +272,16 @@ struct thread_info *alloc_thread_info(struct task_struct *task)
274 } 272 }
275 273
276 if (!thread) 274 if (!thread)
277 thread = ll_alloc_task_struct(); 275 thread = (struct thread_info *)
276 __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER);
278 277
279#ifdef CONFIG_MAGIC_SYSRQ 278#ifdef CONFIG_DEBUG_STACK_USAGE
280 /* 279 /*
281 * The stack must be cleared if you want SYSRQ-T to 280 * The stack must be cleared if you want SYSRQ-T to
282 * give sensible stack usage information 281 * give sensible stack usage information
283 */ 282 */
284 if (thread) { 283 if (thread)
285 char *p = (char *)thread; 284 memzero(thread, THREAD_SIZE);
286 memzero(p+KERNEL_STACK_SIZE, KERNEL_STACK_SIZE);
287 }
288#endif 285#endif
289 return thread; 286 return thread;
290} 287}
@@ -297,7 +294,7 @@ void free_thread_info(struct thread_info *thread)
297 thread_info_head = p; 294 thread_info_head = p;
298 nr_thread_info += 1; 295 nr_thread_info += 1;
299 } else 296 } else
300 ll_free_task_struct(thread); 297 free_pages((unsigned long)thread, THREAD_SIZE_ORDER);
301} 298}
302 299
303/* 300/*
@@ -350,7 +347,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start,
350 struct thread_info *thread = p->thread_info; 347 struct thread_info *thread = p->thread_info;
351 struct pt_regs *childregs; 348 struct pt_regs *childregs;
352 349
353 childregs = ((struct pt_regs *)((unsigned long)thread + THREAD_SIZE - 8)) - 1; 350 childregs = ((struct pt_regs *)((unsigned long)thread + THREAD_START_SP)) - 1;
354 *childregs = *regs; 351 *childregs = *regs;
355 childregs->ARM_r0 = 0; 352 childregs->ARM_r0 = 0;
356 childregs->ARM_sp = stack_start; 353 childregs->ARM_sp = stack_start;
@@ -447,15 +444,17 @@ EXPORT_SYMBOL(kernel_thread);
447unsigned long get_wchan(struct task_struct *p) 444unsigned long get_wchan(struct task_struct *p)
448{ 445{
449 unsigned long fp, lr; 446 unsigned long fp, lr;
450 unsigned long stack_page; 447 unsigned long stack_start, stack_end;
451 int count = 0; 448 int count = 0;
452 if (!p || p == current || p->state == TASK_RUNNING) 449 if (!p || p == current || p->state == TASK_RUNNING)
453 return 0; 450 return 0;
454 451
455 stack_page = 4096 + (unsigned long)p->thread_info; 452 stack_start = (unsigned long)(p->thread_info + 1);
453 stack_end = ((unsigned long)p->thread_info) + THREAD_SIZE;
454
456 fp = thread_saved_fp(p); 455 fp = thread_saved_fp(p);
457 do { 456 do {
458 if (fp < stack_page || fp > 4092+stack_page) 457 if (fp < stack_start || fp > stack_end)
459 return 0; 458 return 0;
460 lr = pc_pointer (((unsigned long *)fp)[-1]); 459 lr = pc_pointer (((unsigned long *)fp)[-1]);
461 if (!in_sched_functions(lr)) 460 if (!in_sched_functions(lr))
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index ef32577da304..f897ce2ccf0d 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -302,7 +302,7 @@ long execve(const char *filename, char **argv, char **envp)
302 "b ret_to_user" 302 "b ret_to_user"
303 : 303 :
304 : "r" (current_thread_info()), 304 : "r" (current_thread_info()),
305 "Ir" (THREAD_SIZE - 8 - sizeof(regs)), 305 "Ir" (THREAD_START_SP - sizeof(regs)),
306 "r" (&regs), 306 "r" (&regs),
307 "Ir" (sizeof(regs)) 307 "Ir" (sizeof(regs))
308 : "r0", "r1", "r2", "r3", "ip", "memory"); 308 : "r0", "r1", "r2", "r3", "ip", "memory");
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 3a001fe5540b..14df16b983f4 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -218,7 +218,8 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
218 tsk->comm, tsk->pid, tsk->thread_info + 1); 218 tsk->comm, tsk->pid, tsk->thread_info + 1);
219 219
220 if (!user_mode(regs) || in_interrupt()) { 220 if (!user_mode(regs) || in_interrupt()) {
221 dump_mem("Stack: ", regs->ARM_sp, 8192+(unsigned long)tsk->thread_info); 221 dump_mem("Stack: ", regs->ARM_sp,
222 THREAD_SIZE + (unsigned long)tsk->thread_info);
222 dump_backtrace(regs, tsk); 223 dump_backtrace(regs, tsk);
223 dump_instr(regs); 224 dump_instr(regs);
224 } 225 }
@@ -450,9 +451,9 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
450 451
451 case NR(set_tls): 452 case NR(set_tls):
452 thread->tp_value = regs->ARM_r0; 453 thread->tp_value = regs->ARM_r0;
453#ifdef CONFIG_HAS_TLS_REG 454#if defined(CONFIG_HAS_TLS_REG)
454 asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (regs->ARM_r0) ); 455 asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (regs->ARM_r0) );
455#else 456#elif !defined(CONFIG_TLS_REG_EMUL)
456 /* 457 /*
457 * User space must never try to access this directly. 458 * User space must never try to access this directly.
458 * Expect your app to break eventually if you do so. 459 * Expect your app to break eventually if you do so.
@@ -497,11 +498,14 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
497 return 0; 498 return 0;
498} 499}
499 500
500#if defined(CONFIG_CPU_32v6) && !defined(CONFIG_HAS_TLS_REG) 501#ifdef CONFIG_TLS_REG_EMUL
501 502
502/* 503/*
503 * We might be running on an ARMv6+ processor which should have the TLS 504 * We might be running on an ARMv6+ processor which should have the TLS
504 * register, but for some reason we can't use it and have to emulate it. 505 * register but for some reason we can't use it, or maybe an SMP system
506 * using a pre-ARMv6 processor (there are apparently a few prototypes like
507 * that in existence) and therefore access to that register must be
508 * emulated.
505 */ 509 */
506 510
507static int get_tp_trap(struct pt_regs *regs, unsigned int instr) 511static int get_tp_trap(struct pt_regs *regs, unsigned int instr)
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index a39c6a42d68a..ad2d66c93a5c 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -5,6 +5,7 @@
5 5
6#include <asm-generic/vmlinux.lds.h> 6#include <asm-generic/vmlinux.lds.h>
7#include <linux/config.h> 7#include <linux/config.h>
8#include <asm/thread_info.h>
8 9
9OUTPUT_ARCH(arm) 10OUTPUT_ARCH(arm)
10ENTRY(stext) 11ENTRY(stext)
@@ -103,7 +104,7 @@ SECTIONS
103 __data_loc = ALIGN(4); /* location in binary */ 104 __data_loc = ALIGN(4); /* location in binary */
104 . = DATAADDR; 105 . = DATAADDR;
105#else 106#else
106 . = ALIGN(8192); 107 . = ALIGN(THREAD_SIZE);
107 __data_loc = .; 108 __data_loc = .;
108#endif 109#endif
109 110
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index f6e676322ca9..45c930ccd064 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -10,6 +10,7 @@ config ARCH_AUTCPU12
10 10
11config ARCH_CDB89712 11config ARCH_CDB89712
12 bool "CDB89712" 12 bool "CDB89712"
13 select ISA
13 help 14 help
14 This is an evaluation board from Cirrus for the CS89712 processor. 15 This is an evaluation board from Cirrus for the CS89712 processor.
15 The board includes 2 serial ports, Ethernet, IRDA, and expansion 16 The board includes 2 serial ports, Ethernet, IRDA, and expansion
@@ -26,6 +27,8 @@ config ARCH_CLEP7312
26 27
27config ARCH_EDB7211 28config ARCH_EDB7211
28 bool "EDB7211" 29 bool "EDB7211"
30 select ISA
31 select DISCONTIGMEM
29 help 32 help
30 Say Y here if you intend to run this kernel on a Cirrus Logic EDB-7211 33 Say Y here if you intend to run this kernel on a Cirrus Logic EDB-7211
31 evaluation board. 34 evaluation board.
diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig
index 1090c680b6dd..324d9edeec38 100644
--- a/arch/arm/mach-footbridge/Kconfig
+++ b/arch/arm/mach-footbridge/Kconfig
@@ -5,6 +5,9 @@ menu "Footbridge Implementations"
5config ARCH_CATS 5config ARCH_CATS
6 bool "CATS" 6 bool "CATS"
7 select FOOTBRIDGE_HOST 7 select FOOTBRIDGE_HOST
8 select ISA
9 select ISA_DMA
10 select PCI
8 help 11 help
9 Say Y here if you intend to run this kernel on the CATS. 12 Say Y here if you intend to run this kernel on the CATS.
10 13
@@ -13,6 +16,9 @@ config ARCH_CATS
13config ARCH_PERSONAL_SERVER 16config ARCH_PERSONAL_SERVER
14 bool "Compaq Personal Server" 17 bool "Compaq Personal Server"
15 select FOOTBRIDGE_HOST 18 select FOOTBRIDGE_HOST
19 select ISA
20 select ISA_DMA
21 select PCI
16 ---help--- 22 ---help---
17 Say Y here if you intend to run this kernel on the Compaq 23 Say Y here if you intend to run this kernel on the Compaq
18 Personal Server. 24 Personal Server.
@@ -42,6 +48,9 @@ config ARCH_EBSA285_HOST
42 bool "EBSA285 (host mode)" 48 bool "EBSA285 (host mode)"
43 select ARCH_EBSA285 49 select ARCH_EBSA285
44 select FOOTBRIDGE_HOST 50 select FOOTBRIDGE_HOST
51 select ISA
52 select ISA_DMA
53 select PCI
45 help 54 help
46 Say Y here if you intend to run this kernel on the EBSA285 card 55 Say Y here if you intend to run this kernel on the EBSA285 card
47 in host ("central function") mode. 56 in host ("central function") mode.
@@ -51,6 +60,9 @@ config ARCH_EBSA285_HOST
51config ARCH_NETWINDER 60config ARCH_NETWINDER
52 bool "NetWinder" 61 bool "NetWinder"
53 select FOOTBRIDGE_HOST 62 select FOOTBRIDGE_HOST
63 select ISA
64 select ISA_DMA
65 select PCI
54 help 66 help
55 Say Y here if you intend to run this kernel on the Rebel.COM 67 Say Y here if you intend to run this kernel on the Rebel.COM
56 NetWinder. Information about this machine can be found at: 68 NetWinder. Information about this machine can be found at:
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index ec85813ee5dc..cddd194ac6eb 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -4,6 +4,7 @@ menu "IMX Implementations"
4config ARCH_MX1ADS 4config ARCH_MX1ADS
5 bool "mx1ads" 5 bool "mx1ads"
6 depends on ARCH_IMX 6 depends on ARCH_IMX
7 select ISA
7 help 8 help
8 Say Y here if you are using the Motorola MX1ADS board 9 Say Y here if you are using the Motorola MX1ADS board
9 10
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 27892e34b060..c4fc6be629de 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -410,17 +410,23 @@ config CPU_BPREDICT_DISABLE
410 help 410 help
411 Say Y here to disable branch prediction. If unsure, say N. 411 Say Y here to disable branch prediction. If unsure, say N.
412 412
413config TLS_REG_EMUL
414 bool
415 default y if (SMP || CPU_32v6) && (CPU_32v5 || CPU_32v4 || CPU_32v3)
416 help
417 We might be running on an ARMv6+ processor which should have the TLS
418 register but for some reason we can't use it, or maybe an SMP system
419 using a pre-ARMv6 processor (there are apparently a few prototypes
420 like that in existence) and therefore access to that register must
421 be emulated.
422
413config HAS_TLS_REG 423config HAS_TLS_REG
414 bool 424 bool
415 depends on CPU_32v6 && !CPU_32v5 && !CPU_32v4 && !CPU_32v3 425 depends on CPU_32v6
416 default y 426 default y if !TLS_REG_EMUL
417 help 427 help
418 This selects support for the CP15 thread register. 428 This selects support for the CP15 thread register.
419 It is defined to be available on ARMv6 or later. However 429 It is defined to be available on ARMv6 or later. If a particular
420 if the kernel is configured to support multiple CPUs including 430 ARMv6 or later CPU doesn't support it then it must omc;ide "select
421 a pre-ARMv6 processors, or if a given ARMv6 processor doesn't 431 TLS_REG_EMUL" along with its other caracteristics.
422 implement the thread register for some reason, then access to
423 this register from user space must be trapped and emulated.
424 If user space is relying on the __kuser_get_tls code then
425 there should not be any impact.
426 432
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index 2161c2d585f0..9edaa183227a 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -65,7 +65,7 @@ static const char *version =
65#include <linux/etherdevice.h> 65#include <linux/etherdevice.h>
66#include <linux/skbuff.h> 66#include <linux/skbuff.h>
67#include <linux/if_arp.h> 67#include <linux/if_arp.h>
68#include <linux/if_ltalk.h> /* For ltalk_setup() */ 68#include <linux/if_ltalk.h>
69#include <linux/delay.h> /* For udelay() */ 69#include <linux/delay.h> /* For udelay() */
70#include <linux/atalk.h> 70#include <linux/atalk.h>
71#include <linux/spinlock.h> 71#include <linux/spinlock.h>
@@ -223,7 +223,7 @@ struct net_device * __init cops_probe(int unit)
223 int base_addr; 223 int base_addr;
224 int err = 0; 224 int err = 0;
225 225
226 dev = alloc_netdev(sizeof(struct cops_local), "lt%d", ltalk_setup); 226 dev = alloc_ltalkdev(sizeof(struct cops_local));
227 if (!dev) 227 if (!dev)
228 return ERR_PTR(-ENOMEM); 228 return ERR_PTR(-ENOMEM);
229 229
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index ad8e943231a1..db4f369637b6 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1039,7 +1039,7 @@ struct net_device * __init ltpc_probe(void)
1039 unsigned long f; 1039 unsigned long f;
1040 unsigned long timeout; 1040 unsigned long timeout;
1041 1041
1042 dev = alloc_netdev(sizeof(struct ltpc_private), "lt%d", ltalk_setup); 1042 dev = alloc_ltalkdev(sizeof(struct ltpc_private));
1043 if (!dev) 1043 if (!dev)
1044 goto out; 1044 goto out;
1045 1045
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 058c70c6f1ac..f79b02e80e75 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -61,8 +61,8 @@
61 61
62#define DRV_MODULE_NAME "tg3" 62#define DRV_MODULE_NAME "tg3"
63#define PFX DRV_MODULE_NAME ": " 63#define PFX DRV_MODULE_NAME ": "
64#define DRV_MODULE_VERSION "3.26" 64#define DRV_MODULE_VERSION "3.27"
65#define DRV_MODULE_RELDATE "April 24, 2005" 65#define DRV_MODULE_RELDATE "May 5, 2005"
66 66
67#define TG3_DEF_MAC_MODE 0 67#define TG3_DEF_MAC_MODE 0
68#define TG3_DEF_RX_MODE 0 68#define TG3_DEF_RX_MODE 0
@@ -3020,7 +3020,7 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id,
3020} 3020}
3021 3021
3022static int tg3_init_hw(struct tg3 *); 3022static int tg3_init_hw(struct tg3 *);
3023static int tg3_halt(struct tg3 *); 3023static int tg3_halt(struct tg3 *, int);
3024 3024
3025#ifdef CONFIG_NET_POLL_CONTROLLER 3025#ifdef CONFIG_NET_POLL_CONTROLLER
3026static void tg3_poll_controller(struct net_device *dev) 3026static void tg3_poll_controller(struct net_device *dev)
@@ -3044,7 +3044,7 @@ static void tg3_reset_task(void *_data)
3044 restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER; 3044 restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER;
3045 tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER; 3045 tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER;
3046 3046
3047 tg3_halt(tp); 3047 tg3_halt(tp, 0);
3048 tg3_init_hw(tp); 3048 tg3_init_hw(tp);
3049 3049
3050 tg3_netif_start(tp); 3050 tg3_netif_start(tp);
@@ -3390,7 +3390,7 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu)
3390 spin_lock_irq(&tp->lock); 3390 spin_lock_irq(&tp->lock);
3391 spin_lock(&tp->tx_lock); 3391 spin_lock(&tp->tx_lock);
3392 3392
3393 tg3_halt(tp); 3393 tg3_halt(tp, 1);
3394 3394
3395 tg3_set_mtu(dev, tp, new_mtu); 3395 tg3_set_mtu(dev, tp, new_mtu);
3396 3396
@@ -3657,7 +3657,7 @@ err_out:
3657/* To stop a block, clear the enable bit and poll till it 3657/* To stop a block, clear the enable bit and poll till it
3658 * clears. tp->lock is held. 3658 * clears. tp->lock is held.
3659 */ 3659 */
3660static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit) 3660static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, int silent)
3661{ 3661{
3662 unsigned int i; 3662 unsigned int i;
3663 u32 val; 3663 u32 val;
@@ -3690,7 +3690,7 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit)
3690 break; 3690 break;
3691 } 3691 }
3692 3692
3693 if (i == MAX_WAIT_CNT) { 3693 if (i == MAX_WAIT_CNT && !silent) {
3694 printk(KERN_ERR PFX "tg3_stop_block timed out, " 3694 printk(KERN_ERR PFX "tg3_stop_block timed out, "
3695 "ofs=%lx enable_bit=%x\n", 3695 "ofs=%lx enable_bit=%x\n",
3696 ofs, enable_bit); 3696 ofs, enable_bit);
@@ -3701,7 +3701,7 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit)
3701} 3701}
3702 3702
3703/* tp->lock is held. */ 3703/* tp->lock is held. */
3704static int tg3_abort_hw(struct tg3 *tp) 3704static int tg3_abort_hw(struct tg3 *tp, int silent)
3705{ 3705{
3706 int i, err; 3706 int i, err;
3707 3707
@@ -3711,22 +3711,20 @@ static int tg3_abort_hw(struct tg3 *tp)
3711 tw32_f(MAC_RX_MODE, tp->rx_mode); 3711 tw32_f(MAC_RX_MODE, tp->rx_mode);
3712 udelay(10); 3712 udelay(10);
3713 3713
3714 err = tg3_stop_block(tp, RCVBDI_MODE, RCVBDI_MODE_ENABLE); 3714 err = tg3_stop_block(tp, RCVBDI_MODE, RCVBDI_MODE_ENABLE, silent);
3715 err |= tg3_stop_block(tp, RCVLPC_MODE, RCVLPC_MODE_ENABLE); 3715 err |= tg3_stop_block(tp, RCVLPC_MODE, RCVLPC_MODE_ENABLE, silent);
3716 err |= tg3_stop_block(tp, RCVLSC_MODE, RCVLSC_MODE_ENABLE); 3716 err |= tg3_stop_block(tp, RCVLSC_MODE, RCVLSC_MODE_ENABLE, silent);
3717 err |= tg3_stop_block(tp, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE); 3717 err |= tg3_stop_block(tp, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE, silent);
3718 err |= tg3_stop_block(tp, RCVDCC_MODE, RCVDCC_MODE_ENABLE); 3718 err |= tg3_stop_block(tp, RCVDCC_MODE, RCVDCC_MODE_ENABLE, silent);
3719 err |= tg3_stop_block(tp, RCVCC_MODE, RCVCC_MODE_ENABLE); 3719 err |= tg3_stop_block(tp, RCVCC_MODE, RCVCC_MODE_ENABLE, silent);
3720 3720
3721 err |= tg3_stop_block(tp, SNDBDS_MODE, SNDBDS_MODE_ENABLE); 3721 err |= tg3_stop_block(tp, SNDBDS_MODE, SNDBDS_MODE_ENABLE, silent);
3722 err |= tg3_stop_block(tp, SNDBDI_MODE, SNDBDI_MODE_ENABLE); 3722 err |= tg3_stop_block(tp, SNDBDI_MODE, SNDBDI_MODE_ENABLE, silent);
3723 err |= tg3_stop_block(tp, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE); 3723 err |= tg3_stop_block(tp, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE, silent);
3724 err |= tg3_stop_block(tp, RDMAC_MODE, RDMAC_MODE_ENABLE); 3724 err |= tg3_stop_block(tp, RDMAC_MODE, RDMAC_MODE_ENABLE, silent);
3725 err |= tg3_stop_block(tp, SNDDATAC_MODE, SNDDATAC_MODE_ENABLE); 3725 err |= tg3_stop_block(tp, SNDDATAC_MODE, SNDDATAC_MODE_ENABLE, silent);
3726 err |= tg3_stop_block(tp, DMAC_MODE, DMAC_MODE_ENABLE); 3726 err |= tg3_stop_block(tp, DMAC_MODE, DMAC_MODE_ENABLE, silent);
3727 err |= tg3_stop_block(tp, SNDBDC_MODE, SNDBDC_MODE_ENABLE); 3727 err |= tg3_stop_block(tp, SNDBDC_MODE, SNDBDC_MODE_ENABLE, silent);
3728 if (err)
3729 goto out;
3730 3728
3731 tp->mac_mode &= ~MAC_MODE_TDE_ENABLE; 3729 tp->mac_mode &= ~MAC_MODE_TDE_ENABLE;
3732 tw32_f(MAC_MODE, tp->mac_mode); 3730 tw32_f(MAC_MODE, tp->mac_mode);
@@ -3744,27 +3742,24 @@ static int tg3_abort_hw(struct tg3 *tp)
3744 printk(KERN_ERR PFX "tg3_abort_hw timed out for %s, " 3742 printk(KERN_ERR PFX "tg3_abort_hw timed out for %s, "
3745 "TX_MODE_ENABLE will not clear MAC_TX_MODE=%08x\n", 3743 "TX_MODE_ENABLE will not clear MAC_TX_MODE=%08x\n",
3746 tp->dev->name, tr32(MAC_TX_MODE)); 3744 tp->dev->name, tr32(MAC_TX_MODE));
3747 return -ENODEV; 3745 err |= -ENODEV;
3748 } 3746 }
3749 3747
3750 err = tg3_stop_block(tp, HOSTCC_MODE, HOSTCC_MODE_ENABLE); 3748 err |= tg3_stop_block(tp, HOSTCC_MODE, HOSTCC_MODE_ENABLE, silent);
3751 err |= tg3_stop_block(tp, WDMAC_MODE, WDMAC_MODE_ENABLE); 3749 err |= tg3_stop_block(tp, WDMAC_MODE, WDMAC_MODE_ENABLE, silent);
3752 err |= tg3_stop_block(tp, MBFREE_MODE, MBFREE_MODE_ENABLE); 3750 err |= tg3_stop_block(tp, MBFREE_MODE, MBFREE_MODE_ENABLE, silent);
3753 3751
3754 tw32(FTQ_RESET, 0xffffffff); 3752 tw32(FTQ_RESET, 0xffffffff);
3755 tw32(FTQ_RESET, 0x00000000); 3753 tw32(FTQ_RESET, 0x00000000);
3756 3754
3757 err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE); 3755 err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE, silent);
3758 err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE); 3756 err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE, silent);
3759 if (err)
3760 goto out;
3761 3757
3762 if (tp->hw_status) 3758 if (tp->hw_status)
3763 memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE); 3759 memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
3764 if (tp->hw_stats) 3760 if (tp->hw_stats)
3765 memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); 3761 memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
3766 3762
3767out:
3768 return err; 3763 return err;
3769} 3764}
3770 3765
@@ -4086,7 +4081,7 @@ static void tg3_stop_fw(struct tg3 *tp)
4086} 4081}
4087 4082
4088/* tp->lock is held. */ 4083/* tp->lock is held. */
4089static int tg3_halt(struct tg3 *tp) 4084static int tg3_halt(struct tg3 *tp, int silent)
4090{ 4085{
4091 int err; 4086 int err;
4092 4087
@@ -4094,7 +4089,7 @@ static int tg3_halt(struct tg3 *tp)
4094 4089
4095 tg3_write_sig_pre_reset(tp, RESET_KIND_SHUTDOWN); 4090 tg3_write_sig_pre_reset(tp, RESET_KIND_SHUTDOWN);
4096 4091
4097 tg3_abort_hw(tp); 4092 tg3_abort_hw(tp, silent);
4098 err = tg3_chip_reset(tp); 4093 err = tg3_chip_reset(tp);
4099 4094
4100 tg3_write_sig_legacy(tp, RESET_KIND_SHUTDOWN); 4095 tg3_write_sig_legacy(tp, RESET_KIND_SHUTDOWN);
@@ -5063,9 +5058,7 @@ static int tg3_reset_hw(struct tg3 *tp)
5063 tg3_write_sig_pre_reset(tp, RESET_KIND_INIT); 5058 tg3_write_sig_pre_reset(tp, RESET_KIND_INIT);
5064 5059
5065 if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) { 5060 if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) {
5066 err = tg3_abort_hw(tp); 5061 tg3_abort_hw(tp, 1);
5067 if (err)
5068 return err;
5069 } 5062 }
5070 5063
5071 err = tg3_chip_reset(tp); 5064 err = tg3_chip_reset(tp);
@@ -5919,7 +5912,7 @@ static int tg3_test_msi(struct tg3 *tp)
5919 spin_lock_irq(&tp->lock); 5912 spin_lock_irq(&tp->lock);
5920 spin_lock(&tp->tx_lock); 5913 spin_lock(&tp->tx_lock);
5921 5914
5922 tg3_halt(tp); 5915 tg3_halt(tp, 1);
5923 err = tg3_init_hw(tp); 5916 err = tg3_init_hw(tp);
5924 5917
5925 spin_unlock(&tp->tx_lock); 5918 spin_unlock(&tp->tx_lock);
@@ -5984,7 +5977,7 @@ static int tg3_open(struct net_device *dev)
5984 5977
5985 err = tg3_init_hw(tp); 5978 err = tg3_init_hw(tp);
5986 if (err) { 5979 if (err) {
5987 tg3_halt(tp); 5980 tg3_halt(tp, 1);
5988 tg3_free_rings(tp); 5981 tg3_free_rings(tp);
5989 } else { 5982 } else {
5990 tp->timer_offset = HZ / 10; 5983 tp->timer_offset = HZ / 10;
@@ -6020,7 +6013,7 @@ static int tg3_open(struct net_device *dev)
6020 pci_disable_msi(tp->pdev); 6013 pci_disable_msi(tp->pdev);
6021 tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; 6014 tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI;
6022 } 6015 }
6023 tg3_halt(tp); 6016 tg3_halt(tp, 1);
6024 tg3_free_rings(tp); 6017 tg3_free_rings(tp);
6025 tg3_free_consistent(tp); 6018 tg3_free_consistent(tp);
6026 6019
@@ -6293,7 +6286,7 @@ static int tg3_close(struct net_device *dev)
6293 6286
6294 tg3_disable_ints(tp); 6287 tg3_disable_ints(tp);
6295 6288
6296 tg3_halt(tp); 6289 tg3_halt(tp, 1);
6297 tg3_free_rings(tp); 6290 tg3_free_rings(tp);
6298 tp->tg3_flags &= 6291 tp->tg3_flags &=
6299 ~(TG3_FLAG_INIT_COMPLETE | 6292 ~(TG3_FLAG_INIT_COMPLETE |
@@ -7013,7 +7006,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
7013 tp->tx_pending = ering->tx_pending; 7006 tp->tx_pending = ering->tx_pending;
7014 7007
7015 if (netif_running(dev)) { 7008 if (netif_running(dev)) {
7016 tg3_halt(tp); 7009 tg3_halt(tp, 1);
7017 tg3_init_hw(tp); 7010 tg3_init_hw(tp);
7018 tg3_netif_start(tp); 7011 tg3_netif_start(tp);
7019 } 7012 }
@@ -7056,7 +7049,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
7056 tp->tg3_flags &= ~TG3_FLAG_TX_PAUSE; 7049 tp->tg3_flags &= ~TG3_FLAG_TX_PAUSE;
7057 7050
7058 if (netif_running(dev)) { 7051 if (netif_running(dev)) {
7059 tg3_halt(tp); 7052 tg3_halt(tp, 1);
7060 tg3_init_hw(tp); 7053 tg3_init_hw(tp);
7061 tg3_netif_start(tp); 7054 tg3_netif_start(tp);
7062 } 7055 }
@@ -9239,7 +9232,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
9239 (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { 9232 (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
9240 pci_save_state(tp->pdev); 9233 pci_save_state(tp->pdev);
9241 tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); 9234 tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
9242 tg3_halt(tp); 9235 tg3_halt(tp, 1);
9243 } 9236 }
9244 9237
9245 err = tg3_test_dma(tp); 9238 err = tg3_test_dma(tp);
@@ -9362,7 +9355,7 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
9362 9355
9363 spin_lock_irq(&tp->lock); 9356 spin_lock_irq(&tp->lock);
9364 spin_lock(&tp->tx_lock); 9357 spin_lock(&tp->tx_lock);
9365 tg3_halt(tp); 9358 tg3_halt(tp, 1);
9366 spin_unlock(&tp->tx_lock); 9359 spin_unlock(&tp->tx_lock);
9367 spin_unlock_irq(&tp->lock); 9360 spin_unlock_irq(&tp->lock);
9368 9361
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 554e4a18c152..d3ff78354638 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -49,7 +49,7 @@ ifeq ($(CONFIG_XFS_TRACE),y)
49 EXTRA_CFLAGS += -DXFS_LOG_TRACE 49 EXTRA_CFLAGS += -DXFS_LOG_TRACE
50 EXTRA_CFLAGS += -DXFS_RW_TRACE 50 EXTRA_CFLAGS += -DXFS_RW_TRACE
51 EXTRA_CFLAGS += -DPAGEBUF_TRACE 51 EXTRA_CFLAGS += -DPAGEBUF_TRACE
52 # EXTRA_CFLAGS += -DXFS_VNODE_TRACE 52 EXTRA_CFLAGS += -DXFS_VNODE_TRACE
53endif 53endif
54 54
55obj-$(CONFIG_XFS_FS) += xfs.o 55obj-$(CONFIG_XFS_FS) += xfs.o
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 76a84758073a..9278e9aba9ba 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -558,7 +558,8 @@ xfs_submit_page(
558 int i; 558 int i;
559 559
560 BUG_ON(PageWriteback(page)); 560 BUG_ON(PageWriteback(page));
561 set_page_writeback(page); 561 if (bh_count)
562 set_page_writeback(page);
562 if (clear_dirty) 563 if (clear_dirty)
563 clear_page_dirty(page); 564 clear_page_dirty(page);
564 unlock_page(page); 565 unlock_page(page);
@@ -578,9 +579,6 @@ xfs_submit_page(
578 579
579 if (probed_page && clear_dirty) 580 if (probed_page && clear_dirty)
580 wbc->nr_to_write--; /* Wrote an "extra" page */ 581 wbc->nr_to_write--; /* Wrote an "extra" page */
581 } else {
582 end_page_writeback(page);
583 wbc->pages_skipped++; /* We didn't write this page */
584 } 582 }
585} 583}
586 584
@@ -602,21 +600,26 @@ xfs_convert_page(
602{ 600{
603 struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head; 601 struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
604 xfs_iomap_t *mp = iomapp, *tmp; 602 xfs_iomap_t *mp = iomapp, *tmp;
605 unsigned long end, offset; 603 unsigned long offset, end_offset;
606 pgoff_t end_index; 604 int index = 0;
607 int i = 0, index = 0;
608 int bbits = inode->i_blkbits; 605 int bbits = inode->i_blkbits;
606 int len, page_dirty;
609 607
610 end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT; 608 end_offset = (i_size_read(inode) & (PAGE_CACHE_SIZE - 1));
611 if (page->index < end_index) { 609
612 end = PAGE_CACHE_SIZE; 610 /*
613 } else { 611 * page_dirty is initially a count of buffers on the page before
614 end = i_size_read(inode) & (PAGE_CACHE_SIZE-1); 612 * EOF and is decrememted as we move each into a cleanable state.
615 } 613 */
614 len = 1 << inode->i_blkbits;
615 end_offset = max(end_offset, PAGE_CACHE_SIZE);
616 end_offset = roundup(end_offset, len);
617 page_dirty = end_offset / len;
618
619 offset = 0;
616 bh = head = page_buffers(page); 620 bh = head = page_buffers(page);
617 do { 621 do {
618 offset = i << bbits; 622 if (offset >= end_offset)
619 if (offset >= end)
620 break; 623 break;
621 if (!(PageUptodate(page) || buffer_uptodate(bh))) 624 if (!(PageUptodate(page) || buffer_uptodate(bh)))
622 continue; 625 continue;
@@ -625,6 +628,7 @@ xfs_convert_page(
625 if (startio) { 628 if (startio) {
626 lock_buffer(bh); 629 lock_buffer(bh);
627 bh_arr[index++] = bh; 630 bh_arr[index++] = bh;
631 page_dirty--;
628 } 632 }
629 continue; 633 continue;
630 } 634 }
@@ -657,10 +661,11 @@ xfs_convert_page(
657 unlock_buffer(bh); 661 unlock_buffer(bh);
658 mark_buffer_dirty(bh); 662 mark_buffer_dirty(bh);
659 } 663 }
660 } while (i++, (bh = bh->b_this_page) != head); 664 page_dirty--;
665 } while (offset += len, (bh = bh->b_this_page) != head);
661 666
662 if (startio) { 667 if (startio && index) {
663 xfs_submit_page(page, wbc, bh_arr, index, 1, index == i); 668 xfs_submit_page(page, wbc, bh_arr, index, 1, !page_dirty);
664 } else { 669 } else {
665 unlock_page(page); 670 unlock_page(page);
666 } 671 }
@@ -725,8 +730,11 @@ xfs_page_state_convert(
725 __uint64_t end_offset; 730 __uint64_t end_offset;
726 pgoff_t end_index, last_index, tlast; 731 pgoff_t end_index, last_index, tlast;
727 int len, err, i, cnt = 0, uptodate = 1; 732 int len, err, i, cnt = 0, uptodate = 1;
728 int flags = startio ? 0 : BMAPI_TRYLOCK; 733 int flags;
729 int page_dirty, delalloc = 0; 734 int page_dirty;
735
736 /* wait for other IO threads? */
737 flags = (startio && wbc->sync_mode != WB_SYNC_NONE) ? 0 : BMAPI_TRYLOCK;
730 738
731 /* Is this page beyond the end of the file? */ 739 /* Is this page beyond the end of the file? */
732 offset = i_size_read(inode); 740 offset = i_size_read(inode);
@@ -740,19 +748,22 @@ xfs_page_state_convert(
740 } 748 }
741 } 749 }
742 750
743 offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
744 end_offset = min_t(unsigned long long, 751 end_offset = min_t(unsigned long long,
745 offset + PAGE_CACHE_SIZE, i_size_read(inode)); 752 (loff_t)(page->index + 1) << PAGE_CACHE_SHIFT, offset);
746 753 offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
747 bh = head = page_buffers(page);
748 iomp = NULL;
749 754
750 /* 755 /*
751 * page_dirty is initially a count of buffers on the page and 756 * page_dirty is initially a count of buffers on the page before
752 * is decrememted as we move each into a cleanable state. 757 * EOF and is decrememted as we move each into a cleanable state.
753 */ 758 */
754 len = bh->b_size; 759 len = 1 << inode->i_blkbits;
755 page_dirty = PAGE_CACHE_SIZE / len; 760 p_offset = max(p_offset, PAGE_CACHE_SIZE);
761 p_offset = roundup(p_offset, len);
762 page_dirty = p_offset / len;
763
764 iomp = NULL;
765 p_offset = 0;
766 bh = head = page_buffers(page);
756 767
757 do { 768 do {
758 if (offset >= end_offset) 769 if (offset >= end_offset)
@@ -804,7 +815,6 @@ xfs_page_state_convert(
804 */ 815 */
805 } else if (buffer_delay(bh)) { 816 } else if (buffer_delay(bh)) {
806 if (!iomp) { 817 if (!iomp) {
807 delalloc = 1;
808 err = xfs_map_blocks(inode, offset, len, &iomap, 818 err = xfs_map_blocks(inode, offset, len, &iomap,
809 BMAPI_ALLOCATE | flags); 819 BMAPI_ALLOCATE | flags);
810 if (err) { 820 if (err) {
@@ -875,14 +885,15 @@ xfs_page_state_convert(
875 if (uptodate && bh == head) 885 if (uptodate && bh == head)
876 SetPageUptodate(page); 886 SetPageUptodate(page);
877 887
878 if (startio) 888 if (startio) {
879 xfs_submit_page(page, wbc, bh_arr, cnt, 0, 1); 889 WARN_ON(page_dirty);
890 xfs_submit_page(page, wbc, bh_arr, cnt, 0, !page_dirty);
891 }
880 892
881 if (iomp) { 893 if (iomp) {
882 tlast = (iomp->iomap_offset + iomp->iomap_bsize - 1) >> 894 offset = (iomp->iomap_offset + iomp->iomap_bsize - 1) >>
883 PAGE_CACHE_SHIFT; 895 PAGE_CACHE_SHIFT;
884 if (delalloc && (tlast > last_index)) 896 tlast = min_t(pgoff_t, offset, last_index);
885 tlast = last_index;
886 xfs_cluster_write(inode, page->index + 1, iomp, wbc, 897 xfs_cluster_write(inode, page->index + 1, iomp, wbc,
887 startio, unmapped, tlast); 898 startio, unmapped, tlast);
888 } 899 }
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 23e0eb67fc25..997963e53622 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1746,13 +1746,15 @@ STATIC DECLARE_COMPLETION(pagebuf_daemon_done);
1746STATIC struct task_struct *pagebuf_daemon_task; 1746STATIC struct task_struct *pagebuf_daemon_task;
1747STATIC int pagebuf_daemon_active; 1747STATIC int pagebuf_daemon_active;
1748STATIC int force_flush; 1748STATIC int force_flush;
1749 1749STATIC int force_sleep;
1750 1750
1751STATIC int 1751STATIC int
1752pagebuf_daemon_wakeup( 1752pagebuf_daemon_wakeup(
1753 int priority, 1753 int priority,
1754 unsigned int mask) 1754 unsigned int mask)
1755{ 1755{
1756 if (force_sleep)
1757 return 0;
1756 force_flush = 1; 1758 force_flush = 1;
1757 barrier(); 1759 barrier();
1758 wake_up_process(pagebuf_daemon_task); 1760 wake_up_process(pagebuf_daemon_task);
@@ -1778,7 +1780,12 @@ pagebuf_daemon(
1778 1780
1779 INIT_LIST_HEAD(&tmp); 1781 INIT_LIST_HEAD(&tmp);
1780 do { 1782 do {
1781 try_to_freeze(PF_FREEZE); 1783 if (unlikely(current->flags & PF_FREEZE)) {
1784 force_sleep = 1;
1785 refrigerator(PF_FREEZE);
1786 } else {
1787 force_sleep = 0;
1788 }
1782 1789
1783 set_current_state(TASK_INTERRUPTIBLE); 1790 set_current_state(TASK_INTERRUPTIBLE);
1784 schedule_timeout((xfs_buf_timer_centisecs * HZ) / 100); 1791 schedule_timeout((xfs_buf_timer_centisecs * HZ) / 100);
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 9f057a4a5b06..d0d412afd261 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -515,10 +515,49 @@ open_exec_out:
515} 515}
516#endif /* HAVE_FOP_OPEN_EXEC */ 516#endif /* HAVE_FOP_OPEN_EXEC */
517 517
518/*
519 * Temporary workaround to the AIO direct IO write problem.
520 * This code can go and we can revert to do_sync_write once
521 * the writepage(s) rework is merged.
522 */
523STATIC ssize_t
524linvfs_write(
525 struct file *filp,
526 const char __user *buf,
527 size_t len,
528 loff_t *ppos)
529{
530 struct kiocb kiocb;
531 ssize_t ret;
532
533 init_sync_kiocb(&kiocb, filp);
534 kiocb.ki_pos = *ppos;
535 ret = __linvfs_write(&kiocb, buf, 0, len, kiocb.ki_pos);
536 *ppos = kiocb.ki_pos;
537 return ret;
538}
539STATIC ssize_t
540linvfs_write_invis(
541 struct file *filp,
542 const char __user *buf,
543 size_t len,
544 loff_t *ppos)
545{
546 struct kiocb kiocb;
547 ssize_t ret;
548
549 init_sync_kiocb(&kiocb, filp);
550 kiocb.ki_pos = *ppos;
551 ret = __linvfs_write(&kiocb, buf, IO_INVIS, len, kiocb.ki_pos);
552 *ppos = kiocb.ki_pos;
553 return ret;
554}
555
556
518struct file_operations linvfs_file_operations = { 557struct file_operations linvfs_file_operations = {
519 .llseek = generic_file_llseek, 558 .llseek = generic_file_llseek,
520 .read = do_sync_read, 559 .read = do_sync_read,
521 .write = do_sync_write, 560 .write = linvfs_write,
522 .readv = linvfs_readv, 561 .readv = linvfs_readv,
523 .writev = linvfs_writev, 562 .writev = linvfs_writev,
524 .aio_read = linvfs_aio_read, 563 .aio_read = linvfs_aio_read,
@@ -540,7 +579,7 @@ struct file_operations linvfs_file_operations = {
540struct file_operations linvfs_invis_file_operations = { 579struct file_operations linvfs_invis_file_operations = {
541 .llseek = generic_file_llseek, 580 .llseek = generic_file_llseek,
542 .read = do_sync_read, 581 .read = do_sync_read,
543 .write = do_sync_write, 582 .write = linvfs_write_invis,
544 .readv = linvfs_readv_invis, 583 .readv = linvfs_readv_invis,
545 .writev = linvfs_writev_invis, 584 .writev = linvfs_writev_invis,
546 .aio_read = linvfs_aio_read_invis, 585 .aio_read = linvfs_aio_read_invis,
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index ff145fd0d1a4..aa9daaea6c34 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -683,6 +683,9 @@ xfs_write(
683 (xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ? 683 (xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
684 mp->m_rtdev_targp : mp->m_ddev_targp; 684 mp->m_rtdev_targp : mp->m_ddev_targp;
685 685
686 if (ioflags & IO_ISAIO)
687 return XFS_ERROR(-ENOSYS);
688
686 if ((pos & target->pbr_smask) || (count & target->pbr_smask)) 689 if ((pos & target->pbr_smask) || (count & target->pbr_smask))
687 return XFS_ERROR(-EINVAL); 690 return XFS_ERROR(-EINVAL);
688 691
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index 849c61c74f3c..a832d165f24f 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -156,7 +156,6 @@ vn_initialize(
156 156
157#ifdef XFS_VNODE_TRACE 157#ifdef XFS_VNODE_TRACE
158 vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP); 158 vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP);
159 printk("Allocated VNODE_TRACE at 0x%p\n", vp->v_trace);
160#endif /* XFS_VNODE_TRACE */ 159#endif /* XFS_VNODE_TRACE */
161 160
162 vn_trace_exit(vp, "vn_initialize", (inst_t *)__return_address); 161 vn_trace_exit(vp, "vn_initialize", (inst_t *)__return_address);
@@ -424,13 +423,13 @@ vn_remove(
424 * Vnode tracing code. 423 * Vnode tracing code.
425 */ 424 */
426void 425void
427vn_trace_entry(vnode_t *vp, char *func, inst_t *ra) 426vn_trace_entry(vnode_t *vp, const char *func, inst_t *ra)
428{ 427{
429 KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra); 428 KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra);
430} 429}
431 430
432void 431void
433vn_trace_exit(vnode_t *vp, char *func, inst_t *ra) 432vn_trace_exit(vnode_t *vp, const char *func, inst_t *ra)
434{ 433{
435 KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra); 434 KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra);
436} 435}
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index da76c1f1e11c..00466c3194ac 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -86,10 +86,11 @@ typedef struct vnode {
86 vnumber_t v_number; /* in-core vnode number */ 86 vnumber_t v_number; /* in-core vnode number */
87 vn_bhv_head_t v_bh; /* behavior head */ 87 vn_bhv_head_t v_bh; /* behavior head */
88 spinlock_t v_lock; /* VN_LOCK/VN_UNLOCK */ 88 spinlock_t v_lock; /* VN_LOCK/VN_UNLOCK */
89 struct inode v_inode; /* Linux inode */
90#ifdef XFS_VNODE_TRACE 89#ifdef XFS_VNODE_TRACE
91 struct ktrace *v_trace; /* trace header structure */ 90 struct ktrace *v_trace; /* trace header structure */
92#endif 91#endif
92 struct inode v_inode; /* Linux inode */
93 /* inode MUST be last */
93} vnode_t; 94} vnode_t;
94 95
95#define v_fbhv v_bh.bh_first /* first behavior */ 96#define v_fbhv v_bh.bh_first /* first behavior */
@@ -409,7 +410,7 @@ typedef struct vattr {
409 int va_mask; /* bit-mask of attributes present */ 410 int va_mask; /* bit-mask of attributes present */
410 enum vtype va_type; /* vnode type (for create) */ 411 enum vtype va_type; /* vnode type (for create) */
411 mode_t va_mode; /* file access mode and type */ 412 mode_t va_mode; /* file access mode and type */
412 nlink_t va_nlink; /* number of references to file */ 413 xfs_nlink_t va_nlink; /* number of references to file */
413 uid_t va_uid; /* owner user id */ 414 uid_t va_uid; /* owner user id */
414 gid_t va_gid; /* owner group id */ 415 gid_t va_gid; /* owner group id */
415 xfs_ino_t va_nodeid; /* file id */ 416 xfs_ino_t va_nodeid; /* file id */
@@ -625,6 +626,7 @@ static inline int VN_BAD(struct vnode *vp)
625#define ATTR_DMI 0x08 /* invocation from a DMI function */ 626#define ATTR_DMI 0x08 /* invocation from a DMI function */
626#define ATTR_LAZY 0x80 /* set/get attributes lazily */ 627#define ATTR_LAZY 0x80 /* set/get attributes lazily */
627#define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */ 628#define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */
629#define ATTR_NOLOCK 0x200 /* Don't grab any conflicting locks */
628 630
629/* 631/*
630 * Flags to VOP_FSYNC and VOP_RECLAIM. 632 * Flags to VOP_FSYNC and VOP_RECLAIM.
@@ -646,8 +648,8 @@ static inline int VN_BAD(struct vnode *vp)
646#define VNODE_KTRACE_REF 4 648#define VNODE_KTRACE_REF 4
647#define VNODE_KTRACE_RELE 5 649#define VNODE_KTRACE_RELE 5
648 650
649extern void vn_trace_entry(struct vnode *, char *, inst_t *); 651extern void vn_trace_entry(struct vnode *, const char *, inst_t *);
650extern void vn_trace_exit(struct vnode *, char *, inst_t *); 652extern void vn_trace_exit(struct vnode *, const char *, inst_t *);
651extern void vn_trace_hold(struct vnode *, char *, int, inst_t *); 653extern void vn_trace_hold(struct vnode *, char *, int, inst_t *);
652extern void vn_trace_ref(struct vnode *, char *, int, inst_t *); 654extern void vn_trace_ref(struct vnode *, char *, int, inst_t *);
653extern void vn_trace_rele(struct vnode *, char *, int, inst_t *); 655extern void vn_trace_rele(struct vnode *, char *, int, inst_t *);
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 08d551a17347..63abdc2ac7f4 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -182,7 +182,7 @@ xfs_swapext(
182 182
183 if (VN_CACHED(tvp) != 0) 183 if (VN_CACHED(tvp) != 0)
184 xfs_inval_cached_pages(XFS_ITOV(tip), &(tip->i_iocore), 184 xfs_inval_cached_pages(XFS_ITOV(tip), &(tip->i_iocore),
185 (loff_t)0, 0, 0); 185 (xfs_off_t)0, 0, 0);
186 186
187 /* Verify O_DIRECT for ftmp */ 187 /* Verify O_DIRECT for ftmp */
188 if (VN_CACHED(tvp) != 0) { 188 if (VN_CACHED(tvp) != 0) {
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 3a0ba1dfd0e8..d3da00045f26 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -136,6 +136,40 @@ xfs_chash_free(xfs_mount_t *mp)
136} 136}
137 137
138/* 138/*
139 * Try to move an inode to the front of its hash list if possible
140 * (and if its not there already). Called right after obtaining
141 * the list version number and then dropping the read_lock on the
142 * hash list in question (which is done right after looking up the
143 * inode in question...).
144 */
145STATIC void
146xfs_ihash_promote(
147 xfs_ihash_t *ih,
148 xfs_inode_t *ip,
149 ulong version)
150{
151 xfs_inode_t *iq;
152
153 if ((ip->i_prevp != &ih->ih_next) && write_trylock(&ih->ih_lock)) {
154 if (likely(version == ih->ih_version)) {
155 /* remove from list */
156 if ((iq = ip->i_next)) {
157 iq->i_prevp = ip->i_prevp;
158 }
159 *ip->i_prevp = iq;
160
161 /* insert at list head */
162 iq = ih->ih_next;
163 iq->i_prevp = &ip->i_next;
164 ip->i_next = iq;
165 ip->i_prevp = &ih->ih_next;
166 ih->ih_next = ip;
167 }
168 write_unlock(&ih->ih_lock);
169 }
170}
171
172/*
139 * Look up an inode by number in the given file system. 173 * Look up an inode by number in the given file system.
140 * The inode is looked up in the hash table for the file system 174 * The inode is looked up in the hash table for the file system
141 * represented by the mount point parameter mp. Each bucket of 175 * represented by the mount point parameter mp. Each bucket of
@@ -229,7 +263,9 @@ again:
229 XFS_STATS_INC(xs_ig_found); 263 XFS_STATS_INC(xs_ig_found);
230 264
231 ip->i_flags &= ~XFS_IRECLAIMABLE; 265 ip->i_flags &= ~XFS_IRECLAIMABLE;
266 version = ih->ih_version;
232 read_unlock(&ih->ih_lock); 267 read_unlock(&ih->ih_lock);
268 xfs_ihash_promote(ih, ip, version);
233 269
234 XFS_MOUNT_ILOCK(mp); 270 XFS_MOUNT_ILOCK(mp);
235 list_del_init(&ip->i_reclaim); 271 list_del_init(&ip->i_reclaim);
@@ -259,8 +295,15 @@ again:
259 inode_vp, vp); 295 inode_vp, vp);
260 } 296 }
261 297
298 /*
299 * Inode cache hit: if ip is not at the front of
300 * its hash chain, move it there now.
301 * Do this with the lock held for update, but
302 * do statistics after releasing the lock.
303 */
304 version = ih->ih_version;
262 read_unlock(&ih->ih_lock); 305 read_unlock(&ih->ih_lock);
263 306 xfs_ihash_promote(ih, ip, version);
264 XFS_STATS_INC(xs_ig_found); 307 XFS_STATS_INC(xs_ig_found);
265 308
266finish_inode: 309finish_inode:
@@ -547,6 +590,7 @@ xfs_inode_incore(xfs_mount_t *mp,
547{ 590{
548 xfs_ihash_t *ih; 591 xfs_ihash_t *ih;
549 xfs_inode_t *ip; 592 xfs_inode_t *ip;
593 ulong version;
550 594
551 ih = XFS_IHASH(mp, ino); 595 ih = XFS_IHASH(mp, ino);
552 read_lock(&ih->ih_lock); 596 read_lock(&ih->ih_lock);
@@ -554,11 +598,15 @@ xfs_inode_incore(xfs_mount_t *mp,
554 if (ip->i_ino == ino) { 598 if (ip->i_ino == ino) {
555 /* 599 /*
556 * If we find it and tp matches, return it. 600 * If we find it and tp matches, return it.
601 * Also move it to the front of the hash list
602 * if we find it and it is not already there.
557 * Otherwise break from the loop and return 603 * Otherwise break from the loop and return
558 * NULL. 604 * NULL.
559 */ 605 */
560 if (ip->i_transp == tp) { 606 if (ip->i_transp == tp) {
607 version = ih->ih_version;
561 read_unlock(&ih->ih_lock); 608 read_unlock(&ih->ih_lock);
609 xfs_ihash_promote(ih, ip, version);
562 return (ip); 610 return (ip);
563 } 611 }
564 break; 612 break;
@@ -685,6 +733,7 @@ xfs_iextract(
685 iq->i_prevp = ip->i_prevp; 733 iq->i_prevp = ip->i_prevp;
686 } 734 }
687 *ip->i_prevp = iq; 735 *ip->i_prevp = iq;
736 ih->ih_version++;
688 write_unlock(&ih->ih_lock); 737 write_unlock(&ih->ih_lock);
689 738
690 /* 739 /*
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 43c632ab86ad..bc8c8c7f9039 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1130,7 +1130,7 @@ xfs_ialloc(
1130 xfs_trans_t *tp, 1130 xfs_trans_t *tp,
1131 xfs_inode_t *pip, 1131 xfs_inode_t *pip,
1132 mode_t mode, 1132 mode_t mode,
1133 nlink_t nlink, 1133 xfs_nlink_t nlink,
1134 xfs_dev_t rdev, 1134 xfs_dev_t rdev,
1135 cred_t *cr, 1135 cred_t *cr,
1136 xfs_prid_t prid, 1136 xfs_prid_t prid,
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index a53b1ccf6070..37e1c316f3b6 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -495,9 +495,9 @@ int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
495int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, 495int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
496 xfs_inode_t **, xfs_daddr_t); 496 xfs_inode_t **, xfs_daddr_t);
497int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int); 497int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
498int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, nlink_t, 498int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
499 xfs_dev_t, struct cred *, xfs_prid_t, int, 499 xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t,
500 struct xfs_buf **, boolean_t *, xfs_inode_t **); 500 int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
501void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, 501void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *,
502 int); 502 int);
503uint xfs_ip2xflags(struct xfs_inode *); 503uint xfs_ip2xflags(struct xfs_inode *);
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 3826e8f0e28a..991f8a61f7c4 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -308,7 +308,8 @@ phase2:
308 break; 308 break;
309 } 309 }
310 310
311 error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, &imap, &nimaps); 311 error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count,
312 &imap, &nimaps);
312 break; 313 break;
313 case BMAPI_UNWRITTEN: 314 case BMAPI_UNWRITTEN:
314 lockmode = 0; 315 lockmode = 0;
@@ -365,7 +366,7 @@ xfs_flush_space(
365int 366int
366xfs_iomap_write_direct( 367xfs_iomap_write_direct(
367 xfs_inode_t *ip, 368 xfs_inode_t *ip,
368 loff_t offset, 369 xfs_off_t offset,
369 size_t count, 370 size_t count,
370 int flags, 371 int flags,
371 xfs_bmbt_irec_t *ret_imap, 372 xfs_bmbt_irec_t *ret_imap,
@@ -541,7 +542,7 @@ error_out:
541int 542int
542xfs_iomap_write_delay( 543xfs_iomap_write_delay(
543 xfs_inode_t *ip, 544 xfs_inode_t *ip,
544 loff_t offset, 545 xfs_off_t offset,
545 size_t count, 546 size_t count,
546 int ioflag, 547 int ioflag,
547 xfs_bmbt_irec_t *ret_imap, 548 xfs_bmbt_irec_t *ret_imap,
@@ -746,6 +747,8 @@ write_map:
746int 747int
747xfs_iomap_write_allocate( 748xfs_iomap_write_allocate(
748 xfs_inode_t *ip, 749 xfs_inode_t *ip,
750 xfs_off_t offset,
751 size_t count,
749 xfs_bmbt_irec_t *map, 752 xfs_bmbt_irec_t *map,
750 int *retmap) 753 int *retmap)
751{ 754{
@@ -770,9 +773,9 @@ xfs_iomap_write_allocate(
770 if ((error = XFS_QM_DQATTACH(mp, ip, 0))) 773 if ((error = XFS_QM_DQATTACH(mp, ip, 0)))
771 return XFS_ERROR(error); 774 return XFS_ERROR(error);
772 775
773 offset_fsb = map->br_startoff; 776 offset_fsb = XFS_B_TO_FSBT(mp, offset);
774 count_fsb = map->br_blockcount; 777 count_fsb = map->br_blockcount;
775 map_start_fsb = offset_fsb; 778 map_start_fsb = map->br_startoff;
776 779
777 XFS_STATS_ADD(xs_xstrat_bytes, XFS_FSB_TO_B(mp, count_fsb)); 780 XFS_STATS_ADD(xs_xstrat_bytes, XFS_FSB_TO_B(mp, count_fsb));
778 781
@@ -868,9 +871,9 @@ xfs_iomap_write_allocate(
868 imap[i].br_startoff, 871 imap[i].br_startoff,
869 imap[i].br_blockcount,imap[i].br_state); 872 imap[i].br_blockcount,imap[i].br_state);
870 } 873 }
871 if ((map->br_startoff >= imap[i].br_startoff) && 874 if ((offset_fsb >= imap[i].br_startoff) &&
872 (map->br_startoff < (imap[i].br_startoff + 875 (offset_fsb < (imap[i].br_startoff +
873 imap[i].br_blockcount))) { 876 imap[i].br_blockcount))) {
874 *map = imap[i]; 877 *map = imap[i];
875 *retmap = 1; 878 *retmap = 1;
876 XFS_STATS_INC(xs_xstrat_quick); 879 XFS_STATS_INC(xs_xstrat_quick);
@@ -883,9 +886,8 @@ xfs_iomap_write_allocate(
883 * file, just surrounding data, try again. 886 * file, just surrounding data, try again.
884 */ 887 */
885 nimaps--; 888 nimaps--;
886 offset_fsb = imap[nimaps].br_startoff + 889 map_start_fsb = imap[nimaps].br_startoff +
887 imap[nimaps].br_blockcount; 890 imap[nimaps].br_blockcount;
888 map_start_fsb = offset_fsb;
889 } 891 }
890 892
891trans_cancel: 893trans_cancel:
@@ -899,7 +901,7 @@ error0:
899int 901int
900xfs_iomap_write_unwritten( 902xfs_iomap_write_unwritten(
901 xfs_inode_t *ip, 903 xfs_inode_t *ip,
902 loff_t offset, 904 xfs_off_t offset,
903 size_t count) 905 size_t count)
904{ 906{
905 xfs_mount_t *mp = ip->i_mount; 907 xfs_mount_t *mp = ip->i_mount;
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
index 31c91087cb33..4daaa5212102 100644
--- a/fs/xfs/xfs_iomap.h
+++ b/fs/xfs/xfs_iomap.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2003,2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2003-2005 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as 5 * under the terms of version 2 of the GNU General Public License as
@@ -29,9 +29,6 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33
34
35#ifndef __XFS_IOMAP_H__ 32#ifndef __XFS_IOMAP_H__
36#define __XFS_IOMAP_H__ 33#define __XFS_IOMAP_H__
37 34
@@ -56,7 +53,7 @@ typedef enum {
56 BMAPI_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */ 53 BMAPI_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
57 /* modifiers */ 54 /* modifiers */
58 BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */ 55 BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
59 BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */ 56 BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */
60 BMAPI_MMAP = (1 << 6), /* allocate for mmap write */ 57 BMAPI_MMAP = (1 << 6), /* allocate for mmap write */
61 BMAPI_SYNC = (1 << 7), /* sync write to flush delalloc space */ 58 BMAPI_SYNC = (1 << 7), /* sync write to flush delalloc space */
62 BMAPI_TRYLOCK = (1 << 8), /* non-blocking request */ 59 BMAPI_TRYLOCK = (1 << 8), /* non-blocking request */
@@ -67,13 +64,13 @@ typedef enum {
67/* 64/*
68 * xfs_iomap_t: File system I/O map 65 * xfs_iomap_t: File system I/O map
69 * 66 *
70 * The iomap_bn field is expressed in 512-byte blocks, and is where the 67 * The iomap_bn field is expressed in 512-byte blocks, and is where the
71 * mapping starts on disk. 68 * mapping starts on disk.
72 * 69 *
73 * The iomap_offset, iomap_bsize and iomap_delta fields are in bytes. 70 * The iomap_offset, iomap_bsize and iomap_delta fields are in bytes.
74 * iomap_offset is the offset of the mapping in the file itself. 71 * iomap_offset is the offset of the mapping in the file itself.
75 * iomap_bsize is the size of the mapping, iomap_delta is the 72 * iomap_bsize is the size of the mapping, iomap_delta is the
76 * desired data's offset into the mapping, given the offset supplied 73 * desired data's offset into the mapping, given the offset supplied
77 * to the file I/O map routine. 74 * to the file I/O map routine.
78 * 75 *
79 * When a request is made to read beyond the logical end of the object, 76 * When a request is made to read beyond the logical end of the object,
@@ -84,8 +81,8 @@ typedef enum {
84typedef struct xfs_iomap { 81typedef struct xfs_iomap {
85 xfs_daddr_t iomap_bn; /* first 512b blk of mapping */ 82 xfs_daddr_t iomap_bn; /* first 512b blk of mapping */
86 xfs_buftarg_t *iomap_target; 83 xfs_buftarg_t *iomap_target;
87 loff_t iomap_offset; /* offset of mapping, bytes */ 84 xfs_off_t iomap_offset; /* offset of mapping, bytes */
88 loff_t iomap_bsize; /* size of mapping, bytes */ 85 xfs_off_t iomap_bsize; /* size of mapping, bytes */
89 size_t iomap_delta; /* offset into mapping, bytes */ 86 size_t iomap_delta; /* offset into mapping, bytes */
90 iomap_flags_t iomap_flags; 87 iomap_flags_t iomap_flags;
91} xfs_iomap_t; 88} xfs_iomap_t;
@@ -96,12 +93,12 @@ struct xfs_bmbt_irec;
96 93
97extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int, 94extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int,
98 struct xfs_iomap *, int *); 95 struct xfs_iomap *, int *);
99extern int xfs_iomap_write_direct(struct xfs_inode *, loff_t, size_t, 96extern int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t,
100 int, struct xfs_bmbt_irec *, int *, int); 97 int, struct xfs_bmbt_irec *, int *, int);
101extern int xfs_iomap_write_delay(struct xfs_inode *, loff_t, size_t, int, 98extern int xfs_iomap_write_delay(struct xfs_inode *, xfs_off_t, size_t, int,
102 struct xfs_bmbt_irec *, int *); 99 struct xfs_bmbt_irec *, int *);
103extern int xfs_iomap_write_allocate(struct xfs_inode *, 100extern int xfs_iomap_write_allocate(struct xfs_inode *, xfs_off_t, size_t,
104 struct xfs_bmbt_irec *, int *); 101 struct xfs_bmbt_irec *, int *);
105extern int xfs_iomap_write_unwritten(struct xfs_inode *, loff_t, size_t); 102extern int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, size_t);
106 103
107#endif /* __XFS_IOMAP_H__*/ 104#endif /* __XFS_IOMAP_H__*/
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index b57423caef9b..2ec967d93e5a 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -301,6 +301,15 @@ xfs_mount_validate_sb(
301 } 301 }
302 302
303 /* 303 /*
304 * Version 1 directory format has never worked on Linux.
305 */
306 if (unlikely(!XFS_SB_VERSION_HASDIRV2(sbp))) {
307 cmn_err(CE_WARN,
308 "XFS: Attempted to mount file system using version 1 directory format");
309 return XFS_ERROR(ENOSYS);
310 }
311
312 /*
304 * Until this is fixed only page-sized or smaller data blocks work. 313 * Until this is fixed only page-sized or smaller data blocks work.
305 */ 314 */
306 if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) { 315 if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 5fc6201dd8e2..30dd08fb9f57 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -210,15 +210,16 @@ typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *,
210 struct xfs_bmap_free *); 210 struct xfs_bmap_free *);
211typedef int (*xfs_bmap_eof_t)(void *, xfs_fileoff_t, int, int *); 211typedef int (*xfs_bmap_eof_t)(void *, xfs_fileoff_t, int, int *);
212typedef int (*xfs_iomap_write_direct_t)( 212typedef int (*xfs_iomap_write_direct_t)(
213 void *, loff_t, size_t, int, 213 void *, xfs_off_t, size_t, int,
214 struct xfs_bmbt_irec *, int *, int); 214 struct xfs_bmbt_irec *, int *, int);
215typedef int (*xfs_iomap_write_delay_t)( 215typedef int (*xfs_iomap_write_delay_t)(
216 void *, loff_t, size_t, int, 216 void *, xfs_off_t, size_t, int,
217 struct xfs_bmbt_irec *, int *); 217 struct xfs_bmbt_irec *, int *);
218typedef int (*xfs_iomap_write_allocate_t)( 218typedef int (*xfs_iomap_write_allocate_t)(
219 void *, struct xfs_bmbt_irec *, int *); 219 void *, xfs_off_t, size_t,
220 struct xfs_bmbt_irec *, int *);
220typedef int (*xfs_iomap_write_unwritten_t)( 221typedef int (*xfs_iomap_write_unwritten_t)(
221 void *, loff_t, size_t); 222 void *, xfs_off_t, size_t);
222typedef uint (*xfs_lck_map_shared_t)(void *); 223typedef uint (*xfs_lck_map_shared_t)(void *);
223typedef void (*xfs_lock_t)(void *, uint); 224typedef void (*xfs_lock_t)(void *, uint);
224typedef void (*xfs_lock_demote_t)(void *, uint); 225typedef void (*xfs_lock_demote_t)(void *, uint);
@@ -258,9 +259,9 @@ typedef struct xfs_ioops {
258#define XFS_IOMAP_WRITE_DELAY(mp, io, offset, count, flags, mval, nmap) \ 259#define XFS_IOMAP_WRITE_DELAY(mp, io, offset, count, flags, mval, nmap) \
259 (*(mp)->m_io_ops.xfs_iomap_write_delay) \ 260 (*(mp)->m_io_ops.xfs_iomap_write_delay) \
260 ((io)->io_obj, offset, count, flags, mval, nmap) 261 ((io)->io_obj, offset, count, flags, mval, nmap)
261#define XFS_IOMAP_WRITE_ALLOCATE(mp, io, mval, nmap) \ 262#define XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count, mval, nmap) \
262 (*(mp)->m_io_ops.xfs_iomap_write_allocate) \ 263 (*(mp)->m_io_ops.xfs_iomap_write_allocate) \
263 ((io)->io_obj, mval, nmap) 264 ((io)->io_obj, offset, count, mval, nmap)
264#define XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count) \ 265#define XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count) \
265 (*(mp)->m_io_ops.xfs_iomap_write_unwritten) \ 266 (*(mp)->m_io_ops.xfs_iomap_write_unwritten) \
266 ((io)->io_obj, offset, count) 267 ((io)->io_obj, offset, count)
@@ -428,10 +429,10 @@ typedef struct xfs_mount {
428#define XFS_WRITEIO_LOG_LARGE 16 429#define XFS_WRITEIO_LOG_LARGE 16
429 430
430/* 431/*
431 * Max and min values for UIO and mount-option defined I/O sizes; 432 * Max and min values for mount-option defined I/O
432 * min value can't be less than a page. Currently unused. 433 * preallocation sizes.
433 */ 434 */
434#define XFS_MAX_IO_LOG 16 /* 64K */ 435#define XFS_MAX_IO_LOG 30 /* 1G */
435#define XFS_MIN_IO_LOG PAGE_SHIFT 436#define XFS_MIN_IO_LOG PAGE_SHIFT
436 437
437/* 438/*
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h
index 04609d27ea51..e4bf711e48ff 100644
--- a/fs/xfs/xfs_types.h
+++ b/fs/xfs/xfs_types.h
@@ -63,6 +63,7 @@ typedef __u64 xfs_ino_t; /* <inode> type */
63typedef __s64 xfs_daddr_t; /* <disk address> type */ 63typedef __s64 xfs_daddr_t; /* <disk address> type */
64typedef char * xfs_caddr_t; /* <core address> type */ 64typedef char * xfs_caddr_t; /* <core address> type */
65typedef __u32 xfs_dev_t; 65typedef __u32 xfs_dev_t;
66typedef __u32 xfs_nlink_t;
66 67
67/* __psint_t is the same size as a pointer */ 68/* __psint_t is the same size as a pointer */
68#if (BITS_PER_LONG == 32) 69#if (BITS_PER_LONG == 32)
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c
index 816b945fa0ea..d1f8146a06ea 100644
--- a/fs/xfs/xfs_utils.c
+++ b/fs/xfs/xfs_utils.c
@@ -147,7 +147,7 @@ xfs_dir_ialloc(
147 xfs_inode_t *dp, /* directory within whose allocate 147 xfs_inode_t *dp, /* directory within whose allocate
148 the inode. */ 148 the inode. */
149 mode_t mode, 149 mode_t mode,
150 nlink_t nlink, 150 xfs_nlink_t nlink,
151 xfs_dev_t rdev, 151 xfs_dev_t rdev,
152 cred_t *credp, 152 cred_t *credp,
153 prid_t prid, /* project id */ 153 prid_t prid, /* project id */
diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h
index e1ed6a588000..01d98b4b7af7 100644
--- a/fs/xfs/xfs_utils.h
+++ b/fs/xfs/xfs_utils.h
@@ -42,7 +42,7 @@ extern int xfs_get_dir_entry (vname_t *, xfs_inode_t **);
42extern int xfs_dir_lookup_int (bhv_desc_t *, uint, vname_t *, xfs_ino_t *, 42extern int xfs_dir_lookup_int (bhv_desc_t *, uint, vname_t *, xfs_ino_t *,
43 xfs_inode_t **); 43 xfs_inode_t **);
44extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *); 44extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *);
45extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, nlink_t, 45extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t,
46 xfs_dev_t, cred_t *, prid_t, int, 46 xfs_dev_t, cred_t *, prid_t, int,
47 xfs_inode_t **, int *); 47 xfs_inode_t **, int *);
48extern int xfs_droplink (xfs_trans_t *, xfs_inode_t *); 48extern int xfs_droplink (xfs_trans_t *, xfs_inode_t *);
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index 00aae9c6a904..b53736650100 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -1649,6 +1649,7 @@ xfs_vget(
1649#define MNTOPT_SWIDTH "swidth" /* data volume stripe width */ 1649#define MNTOPT_SWIDTH "swidth" /* data volume stripe width */
1650#define MNTOPT_NOUUID "nouuid" /* ignore filesystem UUID */ 1650#define MNTOPT_NOUUID "nouuid" /* ignore filesystem UUID */
1651#define MNTOPT_MTPT "mtpt" /* filesystem mount point */ 1651#define MNTOPT_MTPT "mtpt" /* filesystem mount point */
1652#define MNTOPT_ALLOCSIZE "allocsize" /* preferred allocation size */
1652#define MNTOPT_IHASHSIZE "ihashsize" /* size of inode hash table */ 1653#define MNTOPT_IHASHSIZE "ihashsize" /* size of inode hash table */
1653#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */ 1654#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */
1654#define MNTOPT_NOLOGFLUSH "nologflush" /* don't hard flush on log writes */ 1655#define MNTOPT_NOLOGFLUSH "nologflush" /* don't hard flush on log writes */
@@ -1657,6 +1658,28 @@ xfs_vget(
1657#define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */ 1658#define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */
1658#define MNTOPT_NOIKEEP "noikeep" /* free empty inode clusters */ 1659#define MNTOPT_NOIKEEP "noikeep" /* free empty inode clusters */
1659 1660
1661STATIC unsigned long
1662suffix_strtoul(const char *cp, char **endp, unsigned int base)
1663{
1664 int last, shift_left_factor = 0;
1665 char *value = (char *)cp;
1666
1667 last = strlen(value) - 1;
1668 if (value[last] == 'K' || value[last] == 'k') {
1669 shift_left_factor = 10;
1670 value[last] = '\0';
1671 }
1672 if (value[last] == 'M' || value[last] == 'm') {
1673 shift_left_factor = 20;
1674 value[last] = '\0';
1675 }
1676 if (value[last] == 'G' || value[last] == 'g') {
1677 shift_left_factor = 30;
1678 value[last] = '\0';
1679 }
1680
1681 return simple_strtoul(cp, endp, base) << shift_left_factor;
1682}
1660 1683
1661int 1684int
1662xfs_parseargs( 1685xfs_parseargs(
@@ -1688,60 +1711,60 @@ xfs_parseargs(
1688 if (!strcmp(this_char, MNTOPT_LOGBUFS)) { 1711 if (!strcmp(this_char, MNTOPT_LOGBUFS)) {
1689 if (!value || !*value) { 1712 if (!value || !*value) {
1690 printk("XFS: %s option requires an argument\n", 1713 printk("XFS: %s option requires an argument\n",
1691 MNTOPT_LOGBUFS); 1714 this_char);
1692 return EINVAL; 1715 return EINVAL;
1693 } 1716 }
1694 args->logbufs = simple_strtoul(value, &eov, 10); 1717 args->logbufs = simple_strtoul(value, &eov, 10);
1695 } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) { 1718 } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
1696 int last, in_kilobytes = 0;
1697
1698 if (!value || !*value) { 1719 if (!value || !*value) {
1699 printk("XFS: %s option requires an argument\n", 1720 printk("XFS: %s option requires an argument\n",
1700 MNTOPT_LOGBSIZE); 1721 this_char);
1701 return EINVAL; 1722 return EINVAL;
1702 } 1723 }
1703 last = strlen(value) - 1; 1724 args->logbufsize = suffix_strtoul(value, &eov, 10);
1704 if (value[last] == 'K' || value[last] == 'k') {
1705 in_kilobytes = 1;
1706 value[last] = '\0';
1707 }
1708 args->logbufsize = simple_strtoul(value, &eov, 10);
1709 if (in_kilobytes)
1710 args->logbufsize <<= 10;
1711 } else if (!strcmp(this_char, MNTOPT_LOGDEV)) { 1725 } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
1712 if (!value || !*value) { 1726 if (!value || !*value) {
1713 printk("XFS: %s option requires an argument\n", 1727 printk("XFS: %s option requires an argument\n",
1714 MNTOPT_LOGDEV); 1728 this_char);
1715 return EINVAL; 1729 return EINVAL;
1716 } 1730 }
1717 strncpy(args->logname, value, MAXNAMELEN); 1731 strncpy(args->logname, value, MAXNAMELEN);
1718 } else if (!strcmp(this_char, MNTOPT_MTPT)) { 1732 } else if (!strcmp(this_char, MNTOPT_MTPT)) {
1719 if (!value || !*value) { 1733 if (!value || !*value) {
1720 printk("XFS: %s option requires an argument\n", 1734 printk("XFS: %s option requires an argument\n",
1721 MNTOPT_MTPT); 1735 this_char);
1722 return EINVAL; 1736 return EINVAL;
1723 } 1737 }
1724 strncpy(args->mtpt, value, MAXNAMELEN); 1738 strncpy(args->mtpt, value, MAXNAMELEN);
1725 } else if (!strcmp(this_char, MNTOPT_RTDEV)) { 1739 } else if (!strcmp(this_char, MNTOPT_RTDEV)) {
1726 if (!value || !*value) { 1740 if (!value || !*value) {
1727 printk("XFS: %s option requires an argument\n", 1741 printk("XFS: %s option requires an argument\n",
1728 MNTOPT_RTDEV); 1742 this_char);
1729 return EINVAL; 1743 return EINVAL;
1730 } 1744 }
1731 strncpy(args->rtname, value, MAXNAMELEN); 1745 strncpy(args->rtname, value, MAXNAMELEN);
1732 } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) { 1746 } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) {
1733 if (!value || !*value) { 1747 if (!value || !*value) {
1734 printk("XFS: %s option requires an argument\n", 1748 printk("XFS: %s option requires an argument\n",
1735 MNTOPT_BIOSIZE); 1749 this_char);
1736 return EINVAL; 1750 return EINVAL;
1737 } 1751 }
1738 iosize = simple_strtoul(value, &eov, 10); 1752 iosize = simple_strtoul(value, &eov, 10);
1739 args->flags |= XFSMNT_IOSIZE; 1753 args->flags |= XFSMNT_IOSIZE;
1740 args->iosizelog = (uint8_t) iosize; 1754 args->iosizelog = (uint8_t) iosize;
1755 } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
1756 if (!value || !*value) {
1757 printk("XFS: %s option requires an argument\n",
1758 this_char);
1759 return EINVAL;
1760 }
1761 iosize = suffix_strtoul(value, &eov, 10);
1762 args->flags |= XFSMNT_IOSIZE;
1763 args->iosizelog = ffs(iosize) - 1;
1741 } else if (!strcmp(this_char, MNTOPT_IHASHSIZE)) { 1764 } else if (!strcmp(this_char, MNTOPT_IHASHSIZE)) {
1742 if (!value || !*value) { 1765 if (!value || !*value) {
1743 printk("XFS: %s option requires an argument\n", 1766 printk("XFS: %s option requires an argument\n",
1744 this_char); 1767 this_char);
1745 return EINVAL; 1768 return EINVAL;
1746 } 1769 }
1747 args->flags |= XFSMNT_IHASHSIZE; 1770 args->flags |= XFSMNT_IHASHSIZE;
@@ -1756,7 +1779,7 @@ xfs_parseargs(
1756 args->flags |= XFSMNT_INO64; 1779 args->flags |= XFSMNT_INO64;
1757#if !XFS_BIG_INUMS 1780#if !XFS_BIG_INUMS
1758 printk("XFS: %s option not allowed on this system\n", 1781 printk("XFS: %s option not allowed on this system\n",
1759 MNTOPT_INO64); 1782 this_char);
1760 return EINVAL; 1783 return EINVAL;
1761#endif 1784#endif
1762 } else if (!strcmp(this_char, MNTOPT_NOALIGN)) { 1785 } else if (!strcmp(this_char, MNTOPT_NOALIGN)) {
@@ -1766,14 +1789,14 @@ xfs_parseargs(
1766 } else if (!strcmp(this_char, MNTOPT_SUNIT)) { 1789 } else if (!strcmp(this_char, MNTOPT_SUNIT)) {
1767 if (!value || !*value) { 1790 if (!value || !*value) {
1768 printk("XFS: %s option requires an argument\n", 1791 printk("XFS: %s option requires an argument\n",
1769 MNTOPT_SUNIT); 1792 this_char);
1770 return EINVAL; 1793 return EINVAL;
1771 } 1794 }
1772 dsunit = simple_strtoul(value, &eov, 10); 1795 dsunit = simple_strtoul(value, &eov, 10);
1773 } else if (!strcmp(this_char, MNTOPT_SWIDTH)) { 1796 } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
1774 if (!value || !*value) { 1797 if (!value || !*value) {
1775 printk("XFS: %s option requires an argument\n", 1798 printk("XFS: %s option requires an argument\n",
1776 MNTOPT_SWIDTH); 1799 this_char);
1777 return EINVAL; 1800 return EINVAL;
1778 } 1801 }
1779 dswidth = simple_strtoul(value, &eov, 10); 1802 dswidth = simple_strtoul(value, &eov, 10);
@@ -1781,7 +1804,7 @@ xfs_parseargs(
1781 args->flags &= ~XFSMNT_32BITINODES; 1804 args->flags &= ~XFSMNT_32BITINODES;
1782#if !XFS_BIG_INUMS 1805#if !XFS_BIG_INUMS
1783 printk("XFS: %s option not allowed on this system\n", 1806 printk("XFS: %s option not allowed on this system\n",
1784 MNTOPT_64BITINODE); 1807 this_char);
1785 return EINVAL; 1808 return EINVAL;
1786#endif 1809#endif
1787 } else if (!strcmp(this_char, MNTOPT_NOUUID)) { 1810 } else if (!strcmp(this_char, MNTOPT_NOUUID)) {
@@ -1877,7 +1900,7 @@ xfs_showargs(
1877 seq_printf(m, "," MNTOPT_IHASHSIZE "=%d", mp->m_ihsize); 1900 seq_printf(m, "," MNTOPT_IHASHSIZE "=%d", mp->m_ihsize);
1878 1901
1879 if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) 1902 if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
1880 seq_printf(m, "," MNTOPT_BIOSIZE "=%d", mp->m_writeio_log); 1903 seq_printf(m, "," MNTOPT_ALLOCSIZE "=%d", 1<<mp->m_writeio_log);
1881 1904
1882 if (mp->m_logbufs > 0) 1905 if (mp->m_logbufs > 0)
1883 seq_printf(m, "," MNTOPT_LOGBUFS "=%d", mp->m_logbufs); 1906 seq_printf(m, "," MNTOPT_LOGBUFS "=%d", mp->m_logbufs);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 70092963ca9e..25a526629b12 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -305,7 +305,7 @@ xfs_setattr(
305 int mandlock_before, mandlock_after; 305 int mandlock_before, mandlock_after;
306 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; 306 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
307 int file_owner; 307 int file_owner;
308 int need_iolock = (flags & ATTR_DMI) == 0; 308 int need_iolock = 1;
309 309
310 vp = BHV_TO_VNODE(bdp); 310 vp = BHV_TO_VNODE(bdp);
311 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 311 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
@@ -384,6 +384,9 @@ xfs_setattr(
384 */ 384 */
385 tp = NULL; 385 tp = NULL;
386 lock_flags = XFS_ILOCK_EXCL; 386 lock_flags = XFS_ILOCK_EXCL;
387 ASSERT(flags & ATTR_NOLOCK ? flags & ATTR_DMI : 1);
388 if (flags & ATTR_NOLOCK)
389 need_iolock = 0;
387 if (!(mask & XFS_AT_SIZE)) { 390 if (!(mask & XFS_AT_SIZE)) {
388 if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) || 391 if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) ||
389 (mp->m_flags & XFS_MOUNT_WSYNC)) { 392 (mp->m_flags & XFS_MOUNT_WSYNC)) {
@@ -4320,7 +4323,7 @@ xfs_free_file_space(
4320 int rt; 4323 int rt;
4321 xfs_fileoff_t startoffset_fsb; 4324 xfs_fileoff_t startoffset_fsb;
4322 xfs_trans_t *tp; 4325 xfs_trans_t *tp;
4323 int need_iolock = (attr_flags & ATTR_DMI) == 0; 4326 int need_iolock = 1;
4324 4327
4325 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); 4328 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
4326 mp = ip->i_mount; 4329 mp = ip->i_mount;
@@ -4348,8 +4351,12 @@ xfs_free_file_space(
4348 return(error); 4351 return(error);
4349 } 4352 }
4350 4353
4354 ASSERT(attr_flags & ATTR_NOLOCK ? attr_flags & ATTR_DMI : 1);
4355 if (attr_flags & ATTR_NOLOCK)
4356 need_iolock = 0;
4351 if (need_iolock) 4357 if (need_iolock)
4352 xfs_ilock(ip, XFS_IOLOCK_EXCL); 4358 xfs_ilock(ip, XFS_IOLOCK_EXCL);
4359
4353 rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog), 4360 rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog),
4354 (__uint8_t)NBPP); 4361 (__uint8_t)NBPP);
4355 ilen = len + (offset & (rounding - 1)); 4362 ilen = len + (offset & (rounding - 1));
diff --git a/include/asm-arm/arch-imx/imxfb.h b/include/asm-arm/arch-imx/imxfb.h
new file mode 100644
index 000000000000..2346d454ab9c
--- /dev/null
+++ b/include/asm-arm/arch-imx/imxfb.h
@@ -0,0 +1,35 @@
1/*
2 * This structure describes the machine which we are running on.
3 */
4struct imxfb_mach_info {
5 u_long pixclock;
6
7 u_short xres;
8 u_short yres;
9
10 u_char bpp;
11 u_char hsync_len;
12 u_char left_margin;
13 u_char right_margin;
14
15 u_char vsync_len;
16 u_char upper_margin;
17 u_char lower_margin;
18 u_char sync;
19
20 u_int cmap_greyscale:1,
21 cmap_inverse:1,
22 cmap_static:1,
23 unused:29;
24
25 u_int pcr;
26 u_int pwmr;
27 u_int lscr1;
28
29 u_char * fixed_screen_cpu;
30 dma_addr_t fixed_screen_dma;
31
32 void (*lcd_power)(int);
33 void (*backlight_power)(int);
34};
35void set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info);
diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h
index 4a9845997a75..7d4118e09054 100644
--- a/include/asm-arm/processor.h
+++ b/include/asm-arm/processor.h
@@ -23,8 +23,6 @@
23#include <asm/procinfo.h> 23#include <asm/procinfo.h>
24#include <asm/types.h> 24#include <asm/types.h>
25 25
26#define KERNEL_STACK_SIZE PAGE_SIZE
27
28union debug_insn { 26union debug_insn {
29 u32 arm; 27 u32 arm;
30 u16 thumb; 28 u16 thumb;
@@ -87,8 +85,9 @@ unsigned long get_wchan(struct task_struct *p);
87 */ 85 */
88extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 86extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
89 87
90#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1019]) 88#define KSTK_REGS(tsk) (((struct pt_regs *)(THREAD_START_SP + (unsigned long)(tsk)->thread_info)) - 1)
91#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1017]) 89#define KSTK_EIP(tsk) KSTK_REGS(tsk)->ARM_pc
90#define KSTK_ESP(tsk) KSTK_REGS(tsk)->ARM_sp
92 91
93/* 92/*
94 * Prefetching support - only ARMv5. 93 * Prefetching support - only ARMv5.
diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h
index a61618fb433c..66c585c50cf9 100644
--- a/include/asm-arm/thread_info.h
+++ b/include/asm-arm/thread_info.h
@@ -14,6 +14,10 @@
14 14
15#include <asm/fpstate.h> 15#include <asm/fpstate.h>
16 16
17#define THREAD_SIZE_ORDER 1
18#define THREAD_SIZE 8192
19#define THREAD_START_SP (THREAD_SIZE - 8)
20
17#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
18 22
19struct task_struct; 23struct task_struct;
@@ -77,8 +81,6 @@ struct thread_info {
77#define init_thread_info (init_thread_union.thread_info) 81#define init_thread_info (init_thread_union.thread_info)
78#define init_stack (init_thread_union.stack) 82#define init_stack (init_thread_union.stack)
79 83
80#define THREAD_SIZE 8192
81
82/* 84/*
83 * how to get the thread information struct from C 85 * how to get the thread information struct from C
84 */ 86 */
diff --git a/include/linux/if_ltalk.h b/include/linux/if_ltalk.h
index e75e832b7ff0..76525760ba48 100644
--- a/include/linux/if_ltalk.h
+++ b/include/linux/if_ltalk.h
@@ -6,7 +6,7 @@
6#define LTALK_ALEN 1 6#define LTALK_ALEN 1
7 7
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9extern void ltalk_setup(struct net_device *); 9extern struct net_device *alloc_ltalkdev(int sizeof_priv);
10#endif 10#endif
11 11
12#endif 12#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index cc4c9190b7fd..77f02f86346e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -141,6 +141,7 @@ struct sock_common {
141 * @sk_callback_lock: used with the callbacks in the end of this struct 141 * @sk_callback_lock: used with the callbacks in the end of this struct
142 * @sk_error_queue: rarely used 142 * @sk_error_queue: rarely used
143 * @sk_prot: protocol handlers inside a network family 143 * @sk_prot: protocol handlers inside a network family
144 * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt, IPV6_ADDRFORM for instance)
144 * @sk_err: last error 145 * @sk_err: last error
145 * @sk_err_soft: errors that don't cause failure but are the cause of a persistent failure not just 'timed out' 146 * @sk_err_soft: errors that don't cause failure but are the cause of a persistent failure not just 'timed out'
146 * @sk_ack_backlog: current listen backlog 147 * @sk_ack_backlog: current listen backlog
@@ -218,6 +219,7 @@ struct sock {
218 } sk_backlog; 219 } sk_backlog;
219 struct sk_buff_head sk_error_queue; 220 struct sk_buff_head sk_error_queue;
220 struct proto *sk_prot; 221 struct proto *sk_prot;
222 struct proto *sk_prot_creator;
221 rwlock_t sk_callback_lock; 223 rwlock_t sk_callback_lock;
222 int sk_err, 224 int sk_err,
223 sk_err_soft; 225 sk_err_soft;
diff --git a/net/appletalk/dev.c b/net/appletalk/dev.c
index 76598445d84b..1237e208e246 100644
--- a/net/appletalk/dev.c
+++ b/net/appletalk/dev.c
@@ -19,7 +19,7 @@ static int ltalk_mac_addr(struct net_device *dev, void *addr)
19 return -EINVAL; 19 return -EINVAL;
20} 20}
21 21
22void ltalk_setup(struct net_device *dev) 22static void ltalk_setup(struct net_device *dev)
23{ 23{
24 /* Fill in the fields of the device structure with localtalk-generic values. */ 24 /* Fill in the fields of the device structure with localtalk-generic values. */
25 25
@@ -40,4 +40,22 @@ void ltalk_setup(struct net_device *dev)
40 40
41 dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; 41 dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
42} 42}
43EXPORT_SYMBOL(ltalk_setup); 43
44/**
45 * alloc_ltalkdev - Allocates and sets up an localtalk device
46 * @sizeof_priv: Size of additional driver-private structure to be allocated
47 * for this localtalk device
48 *
49 * Fill in the fields of the device structure with localtalk-generic
50 * values. Basically does everything except registering the device.
51 *
52 * Constructs a new net device, complete with a private data area of
53 * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for
54 * this private data area.
55 */
56
57struct net_device *alloc_ltalkdev(int sizeof_priv)
58{
59 return alloc_netdev(sizeof_priv, "lt%d", ltalk_setup);
60}
61EXPORT_SYMBOL(alloc_ltalkdev);
diff --git a/net/core/sock.c b/net/core/sock.c
index 98171ddd7e7d..92c0676e4708 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -635,7 +635,11 @@ struct sock *sk_alloc(int family, int priority, struct proto *prot, int zero_it)
635 if (zero_it) { 635 if (zero_it) {
636 memset(sk, 0, prot->obj_size); 636 memset(sk, 0, prot->obj_size);
637 sk->sk_family = family; 637 sk->sk_family = family;
638 sk->sk_prot = prot; 638 /*
639 * See comment in struct sock definition to understand
640 * why we need sk_prot_creator -acme
641 */
642 sk->sk_prot = sk->sk_prot_creator = prot;
639 sock_lock_init(sk); 643 sock_lock_init(sk);
640 } 644 }
641 645
@@ -654,7 +658,7 @@ struct sock *sk_alloc(int family, int priority, struct proto *prot, int zero_it)
654void sk_free(struct sock *sk) 658void sk_free(struct sock *sk)
655{ 659{
656 struct sk_filter *filter; 660 struct sk_filter *filter;
657 struct module *owner = sk->sk_prot->owner; 661 struct module *owner = sk->sk_prot_creator->owner;
658 662
659 if (sk->sk_destruct) 663 if (sk->sk_destruct)
660 sk->sk_destruct(sk); 664 sk->sk_destruct(sk);
@@ -672,8 +676,8 @@ void sk_free(struct sock *sk)
672 __FUNCTION__, atomic_read(&sk->sk_omem_alloc)); 676 __FUNCTION__, atomic_read(&sk->sk_omem_alloc));
673 677
674 security_sk_free(sk); 678 security_sk_free(sk);
675 if (sk->sk_prot->slab != NULL) 679 if (sk->sk_prot_creator->slab != NULL)
676 kmem_cache_free(sk->sk_prot->slab, sk); 680 kmem_cache_free(sk->sk_prot_creator->slab, sk);
677 else 681 else
678 kfree(sk); 682 kfree(sk);
679 module_put(owner); 683 module_put(owner);
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index e6e23eb14428..ee7bf46eb78a 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -1426,7 +1426,7 @@ static struct rtnetlink_link dnet_rtnetlink_table[RTM_NR_MSGTYPES] =
1426 [RTM_GETRULE - RTM_BASE] = { .dumpit = dn_fib_dump_rules, }, 1426 [RTM_GETRULE - RTM_BASE] = { .dumpit = dn_fib_dump_rules, },
1427#else 1427#else
1428 [RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute, 1428 [RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute,
1429 .dumpit = dn_cache_dump, 1429 .dumpit = dn_cache_dump, },
1430#endif 1430#endif
1431 1431
1432}; 1432};
diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c
index 10b23e1bece6..c3d2ca1a6781 100644
--- a/net/ipv4/multipath_wrandom.c
+++ b/net/ipv4/multipath_wrandom.c
@@ -172,7 +172,7 @@ static void wrandom_select_route(const struct flowi *flp,
172 multipath_comparekeys(&rt->fl, flp)) { 172 multipath_comparekeys(&rt->fl, flp)) {
173 struct multipath_candidate* mpc = 173 struct multipath_candidate* mpc =
174 (struct multipath_candidate*) 174 (struct multipath_candidate*)
175 kmalloc(size_mpc, GFP_KERNEL); 175 kmalloc(size_mpc, GFP_ATOMIC);
176 176
177 if (!mpc) 177 if (!mpc)
178 return; 178 return;
@@ -244,7 +244,7 @@ static void wrandom_set_nhinfo(__u32 network,
244 if (!target_route) { 244 if (!target_route) {
245 const size_t size_rt = sizeof(struct multipath_route); 245 const size_t size_rt = sizeof(struct multipath_route);
246 target_route = (struct multipath_route *) 246 target_route = (struct multipath_route *)
247 kmalloc(size_rt, GFP_KERNEL); 247 kmalloc(size_rt, GFP_ATOMIC);
248 248
249 target_route->gw = nh->nh_gw; 249 target_route->gw = nh->nh_gw;
250 target_route->oif = nh->nh_oif; 250 target_route->oif = nh->nh_oif;
@@ -265,7 +265,7 @@ static void wrandom_set_nhinfo(__u32 network,
265 if (!target_dest) { 265 if (!target_dest) {
266 const size_t size_dst = sizeof(struct multipath_dest); 266 const size_t size_dst = sizeof(struct multipath_dest);
267 target_dest = (struct multipath_dest*) 267 target_dest = (struct multipath_dest*)
268 kmalloc(size_dst, GFP_KERNEL); 268 kmalloc(size_dst, GFP_ATOMIC);
269 269
270 target_dest->nh_info = nh; 270 target_dest->nh_info = nh;
271 target_dest->network = network; 271 target_dest->network = network;
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 5a5ddc40f36c..09abb891d11f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -2,7 +2,7 @@
2# Kernel configuration targets 2# Kernel configuration targets
3# These targets are used from top-level makefile 3# These targets are used from top-level makefile
4 4
5.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig 5.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
6 6
7xconfig: $(obj)/qconf 7xconfig: $(obj)/qconf
8 $< arch/$(ARCH)/Kconfig 8 $< arch/$(ARCH)/Kconfig
@@ -23,6 +23,13 @@ oldconfig: $(obj)/conf
23silentoldconfig: $(obj)/conf 23silentoldconfig: $(obj)/conf
24 $< -s arch/$(ARCH)/Kconfig 24 $< -s arch/$(ARCH)/Kconfig
25 25
26update-po-config: $(obj)/kxgettext
27 xgettext --default-domain=linux \
28 --add-comments --keyword=_ --keyword=N_ \
29 --files-from=scripts/kconfig/POTFILES.in \
30 -o scripts/kconfig/linux.pot
31 scripts/kconfig/kxgettext arch/$(ARCH)/Kconfig >> scripts/kconfig/linux.pot
32
26.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig 33.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
27 34
28randconfig: $(obj)/conf 35randconfig: $(obj)/conf
@@ -72,9 +79,10 @@ help:
72# Based on GTK which needs to be installed to compile it 79# Based on GTK which needs to be installed to compile it
73# object files used by all kconfig flavours 80# object files used by all kconfig flavours
74 81
75hostprogs-y := conf mconf qconf gconf 82hostprogs-y := conf mconf qconf gconf kxgettext
76conf-objs := conf.o zconf.tab.o 83conf-objs := conf.o zconf.tab.o
77mconf-objs := mconf.o zconf.tab.o 84mconf-objs := mconf.o zconf.tab.o
85kxgettext-objs := kxgettext.o zconf.tab.o
78 86
79ifeq ($(MAKECMDGOALS),xconfig) 87ifeq ($(MAKECMDGOALS),xconfig)
80 qconf-target := 1 88 qconf-target := 1
@@ -107,7 +115,7 @@ HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs`
107HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \ 115HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \
108 -D LKC_DIRECT_LINK 116 -D LKC_DIRECT_LINK
109 117
110$(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o: $(obj)/zconf.tab.h 118$(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o $(obj)/kxgettext: $(obj)/zconf.tab.h
111 119
112$(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped 120$(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped
113$(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped 121$(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped
diff --git a/scripts/kconfig/POTFILES.in b/scripts/kconfig/POTFILES.in
new file mode 100644
index 000000000000..cc94e46a79e8
--- /dev/null
+++ b/scripts/kconfig/POTFILES.in
@@ -0,0 +1,5 @@
1scripts/kconfig/mconf.c
2scripts/kconfig/conf.c
3scripts/kconfig/confdata.c
4scripts/kconfig/gconf.c
5scripts/kconfig/qconf.cc
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index a494d1aeb9f9..70e7264c6942 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -34,7 +34,7 @@ static int conf_cnt;
34static signed char line[128]; 34static signed char line[128];
35static struct menu *rootEntry; 35static struct menu *rootEntry;
36 36
37static char nohelp_text[] = "Sorry, no help available for this option yet.\n"; 37static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
38 38
39static void strip(signed char *str) 39static void strip(signed char *str)
40{ 40{
@@ -56,9 +56,9 @@ static void strip(signed char *str)
56static void check_stdin(void) 56static void check_stdin(void)
57{ 57{
58 if (!valid_stdin && input_mode == ask_silent) { 58 if (!valid_stdin && input_mode == ask_silent) {
59 printf("aborted!\n\n"); 59 printf(_("aborted!\n\n"));
60 printf("Console input/output is redirected. "); 60 printf(_("Console input/output is redirected. "));
61 printf("Run 'make oldconfig' to update configuration.\n\n"); 61 printf(_("Run 'make oldconfig' to update configuration.\n\n"));
62 exit(1); 62 exit(1);
63 } 63 }
64} 64}
@@ -470,7 +470,7 @@ static void check_conf(struct menu *menu)
470 if (sym) { 470 if (sym) {
471 if (sym_is_changable(sym) && !sym_has_value(sym)) { 471 if (sym_is_changable(sym) && !sym_has_value(sym)) {
472 if (!conf_cnt++) 472 if (!conf_cnt++)
473 printf("*\n* Restart config...\n*\n"); 473 printf(_("*\n* Restart config...\n*\n"));
474 rootEntry = menu_get_parent_menu(menu); 474 rootEntry = menu_get_parent_menu(menu);
475 conf(rootEntry); 475 conf(rootEntry);
476 } 476 }
@@ -504,7 +504,7 @@ int main(int ac, char **av)
504 input_mode = set_default; 504 input_mode = set_default;
505 defconfig_file = av[i++]; 505 defconfig_file = av[i++];
506 if (!defconfig_file) { 506 if (!defconfig_file) {
507 printf("%s: No default config file specified\n", 507 printf(_("%s: No default config file specified\n"),
508 av[0]); 508 av[0]);
509 exit(1); 509 exit(1);
510 } 510 }
@@ -530,7 +530,7 @@ int main(int ac, char **av)
530 } 530 }
531 name = av[i]; 531 name = av[i];
532 if (!name) { 532 if (!name) {
533 printf("%s: Kconfig file missing\n", av[0]); 533 printf(_("%s: Kconfig file missing\n"), av[0]);
534 } 534 }
535 conf_parse(name); 535 conf_parse(name);
536 //zconfdump(stdout); 536 //zconfdump(stdout);
@@ -547,12 +547,12 @@ int main(int ac, char **av)
547 break; 547 break;
548 case ask_silent: 548 case ask_silent:
549 if (stat(".config", &tmpstat)) { 549 if (stat(".config", &tmpstat)) {
550 printf("***\n" 550 printf(_("***\n"
551 "*** You have not yet configured your kernel!\n" 551 "*** You have not yet configured your kernel!\n"
552 "***\n" 552 "***\n"
553 "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 553 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
554 "*** \"make menuconfig\" or \"make xconfig\").\n" 554 "*** \"make menuconfig\" or \"make xconfig\").\n"
555 "***\n"); 555 "***\n"));
556 exit(1); 556 exit(1);
557 } 557 }
558 case ask_all: 558 case ask_all:
@@ -576,7 +576,7 @@ int main(int ac, char **av)
576 check_conf(&rootmenu); 576 check_conf(&rootmenu);
577 } while (conf_cnt); 577 } while (conf_cnt);
578 if (conf_write(NULL)) { 578 if (conf_write(NULL)) {
579 fprintf(stderr, "\n*** Error during writing of the kernel configuration.\n\n"); 579 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
580 return 1; 580 return 1;
581 } 581 }
582 return 0; 582 return 0;
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 1e82ae390a69..2755c459d780 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -88,9 +88,9 @@ int conf_read(const char *name)
88 name = conf_expand_value(name); 88 name = conf_expand_value(name);
89 in = zconf_fopen(name); 89 in = zconf_fopen(name);
90 if (in) { 90 if (in) {
91 printf("#\n" 91 printf(_("#\n"
92 "# using defaults found in %s\n" 92 "# using defaults found in %s\n"
93 "#\n", name); 93 "#\n"), name);
94 break; 94 break;
95 } 95 }
96 } 96 }
@@ -312,11 +312,11 @@ int conf_write(const char *name)
312 if (env && *env) 312 if (env && *env)
313 use_timestamp = 0; 313 use_timestamp = 0;
314 314
315 fprintf(out, "#\n" 315 fprintf(out, _("#\n"
316 "# Automatically generated make config: don't edit\n" 316 "# Automatically generated make config: don't edit\n"
317 "# Linux kernel version: %s\n" 317 "# Linux kernel version: %s\n"
318 "%s%s" 318 "%s%s"
319 "#\n", 319 "#\n"),
320 sym_get_string_value(sym), 320 sym_get_string_value(sym),
321 use_timestamp ? "# " : "", 321 use_timestamp ? "# " : "",
322 use_timestamp ? ctime(&now) : ""); 322 use_timestamp ? ctime(&now) : "");
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 6fdbe6e3ce0d..ad6b12043874 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -41,7 +41,7 @@ static gboolean resizeable = FALSE;
41static gboolean config_changed = FALSE; 41static gboolean config_changed = FALSE;
42 42
43static char nohelp_text[] = 43static char nohelp_text[] =
44 "Sorry, no help available for this option yet.\n"; 44 N_("Sorry, no help available for this option yet.\n");
45 45
46GtkWidget *main_wnd = NULL; 46GtkWidget *main_wnd = NULL;
47GtkWidget *tree1_w = NULL; // left frame 47GtkWidget *tree1_w = NULL; // left frame
@@ -193,7 +193,7 @@ void init_main_window(const gchar * glade_file)
193 193
194 xml = glade_xml_new(glade_file, "window1", NULL); 194 xml = glade_xml_new(glade_file, "window1", NULL);
195 if (!xml) 195 if (!xml)
196 g_error("GUI loading failed !\n"); 196 g_error(_("GUI loading failed !\n"));
197 glade_xml_signal_autoconnect(xml); 197 glade_xml_signal_autoconnect(xml);
198 198
199 main_wnd = glade_xml_get_widget(xml, "window1"); 199 main_wnd = glade_xml_get_widget(xml, "window1");
@@ -275,7 +275,7 @@ void init_main_window(const gchar * glade_file)
275 /*"style", PANGO_STYLE_OBLIQUE, */ 275 /*"style", PANGO_STYLE_OBLIQUE, */
276 NULL); 276 NULL);
277 277
278 sprintf(title, "Linux Kernel v%s Configuration", 278 sprintf(title, _("Linux Kernel v%s Configuration"),
279 getenv("KERNELRELEASE")); 279 getenv("KERNELRELEASE"));
280 gtk_window_set_title(GTK_WINDOW(main_wnd), title); 280 gtk_window_set_title(GTK_WINDOW(main_wnd), title);
281 281
@@ -325,7 +325,7 @@ void init_left_tree(void)
325 325
326 column = gtk_tree_view_column_new(); 326 column = gtk_tree_view_column_new();
327 gtk_tree_view_append_column(view, column); 327 gtk_tree_view_append_column(view, column);
328 gtk_tree_view_column_set_title(column, "Options"); 328 gtk_tree_view_column_set_title(column, _("Options"));
329 329
330 renderer = gtk_cell_renderer_toggle_new(); 330 renderer = gtk_cell_renderer_toggle_new();
331 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), 331 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -370,7 +370,7 @@ void init_right_tree(void)
370 370
371 column = gtk_tree_view_column_new(); 371 column = gtk_tree_view_column_new();
372 gtk_tree_view_append_column(view, column); 372 gtk_tree_view_append_column(view, column);
373 gtk_tree_view_column_set_title(column, "Options"); 373 gtk_tree_view_column_set_title(column, _("Options"));
374 374
375 renderer = gtk_cell_renderer_pixbuf_new(); 375 renderer = gtk_cell_renderer_pixbuf_new();
376 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), 376 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -401,7 +401,7 @@ void init_right_tree(void)
401 401
402 renderer = gtk_cell_renderer_text_new(); 402 renderer = gtk_cell_renderer_text_new();
403 gtk_tree_view_insert_column_with_attributes(view, -1, 403 gtk_tree_view_insert_column_with_attributes(view, -1,
404 "Name", renderer, 404 _("Name"), renderer,
405 "text", COL_NAME, 405 "text", COL_NAME,
406 "foreground-gdk", 406 "foreground-gdk",
407 COL_COLOR, NULL); 407 COL_COLOR, NULL);
@@ -425,7 +425,7 @@ void init_right_tree(void)
425 COL_COLOR, NULL); 425 COL_COLOR, NULL);
426 renderer = gtk_cell_renderer_text_new(); 426 renderer = gtk_cell_renderer_text_new();
427 gtk_tree_view_insert_column_with_attributes(view, -1, 427 gtk_tree_view_insert_column_with_attributes(view, -1,
428 "Value", renderer, 428 _("Value"), renderer,
429 "text", COL_VALUE, 429 "text", COL_VALUE,
430 "editable", 430 "editable",
431 COL_EDIT, 431 COL_EDIT,
@@ -466,15 +466,15 @@ static void text_insert_help(struct menu *menu)
466 GtkTextIter start, end; 466 GtkTextIter start, end;
467 const char *prompt = menu_get_prompt(menu); 467 const char *prompt = menu_get_prompt(menu);
468 gchar *name; 468 gchar *name;
469 const char *help = nohelp_text; 469 const char *help = _(nohelp_text);
470 470
471 if (!menu->sym) 471 if (!menu->sym)
472 help = ""; 472 help = "";
473 else if (menu->sym->help) 473 else if (menu->sym->help)
474 help = menu->sym->help; 474 help = _(menu->sym->help);
475 475
476 if (menu->sym && menu->sym->name) 476 if (menu->sym && menu->sym->name)
477 name = g_strdup_printf(menu->sym->name); 477 name = g_strdup_printf(_(menu->sym->name));
478 else 478 else
479 name = g_strdup(""); 479 name = g_strdup("");
480 480
@@ -530,7 +530,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
530 if (config_changed == FALSE) 530 if (config_changed == FALSE)
531 return FALSE; 531 return FALSE;
532 532
533 dialog = gtk_dialog_new_with_buttons("Warning !", 533 dialog = gtk_dialog_new_with_buttons(_("Warning !"),
534 GTK_WINDOW(main_wnd), 534 GTK_WINDOW(main_wnd),
535 (GtkDialogFlags) 535 (GtkDialogFlags)
536 (GTK_DIALOG_MODAL | 536 (GTK_DIALOG_MODAL |
@@ -544,7 +544,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
544 gtk_dialog_set_default_response(GTK_DIALOG(dialog), 544 gtk_dialog_set_default_response(GTK_DIALOG(dialog),
545 GTK_RESPONSE_CANCEL); 545 GTK_RESPONSE_CANCEL);
546 546
547 label = gtk_label_new("\nSave configuration ?\n"); 547 label = gtk_label_new(_("\nSave configuration ?\n"));
548 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); 548 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
549 gtk_widget_show(label); 549 gtk_widget_show(label);
550 550
@@ -604,7 +604,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data)
604 (user_data)); 604 (user_data));
605 605
606 if (conf_read(fn)) 606 if (conf_read(fn))
607 text_insert_msg("Error", "Unable to load configuration !"); 607 text_insert_msg(_("Error"), _("Unable to load configuration !"));
608 else 608 else
609 display_tree(&rootmenu); 609 display_tree(&rootmenu);
610} 610}
@@ -613,7 +613,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
613{ 613{
614 GtkWidget *fs; 614 GtkWidget *fs;
615 615
616 fs = gtk_file_selection_new("Load file..."); 616 fs = gtk_file_selection_new(_("Load file..."));
617 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), 617 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
618 "clicked", 618 "clicked",
619 G_CALLBACK(load_filename), (gpointer) fs); 619 G_CALLBACK(load_filename), (gpointer) fs);
@@ -632,7 +632,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
632void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data) 632void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data)
633{ 633{
634 if (conf_write(NULL)) 634 if (conf_write(NULL))
635 text_insert_msg("Error", "Unable to save configuration !"); 635 text_insert_msg(_("Error"), _("Unable to save configuration !"));
636 636
637 config_changed = FALSE; 637 config_changed = FALSE;
638} 638}
@@ -647,7 +647,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data)
647 (user_data)); 647 (user_data));
648 648
649 if (conf_write(fn)) 649 if (conf_write(fn))
650 text_insert_msg("Error", "Unable to save configuration !"); 650 text_insert_msg(_("Error"), _("Unable to save configuration !"));
651 651
652 gtk_widget_destroy(GTK_WIDGET(user_data)); 652 gtk_widget_destroy(GTK_WIDGET(user_data));
653} 653}
@@ -656,7 +656,7 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)
656{ 656{
657 GtkWidget *fs; 657 GtkWidget *fs;
658 658
659 fs = gtk_file_selection_new("Save file as..."); 659 fs = gtk_file_selection_new(_("Save file as..."));
660 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), 660 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
661 "clicked", 661 "clicked",
662 G_CALLBACK(store_filename), (gpointer) fs); 662 G_CALLBACK(store_filename), (gpointer) fs);
@@ -740,7 +740,7 @@ on_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data)
740void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) 740void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
741{ 741{
742 GtkWidget *dialog; 742 GtkWidget *dialog;
743 const gchar *intro_text = 743 const gchar *intro_text = _(
744 "Welcome to gkc, the GTK+ graphical kernel configuration tool\n" 744 "Welcome to gkc, the GTK+ graphical kernel configuration tool\n"
745 "for Linux.\n" 745 "for Linux.\n"
746 "For each option, a blank box indicates the feature is disabled, a\n" 746 "For each option, a blank box indicates the feature is disabled, a\n"
@@ -756,7 +756,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
756 "option.\n" 756 "option.\n"
757 "\n" 757 "\n"
758 "Toggling Show Debug Info under the Options menu will show \n" 758 "Toggling Show Debug Info under the Options menu will show \n"
759 "the dependencies, which you can then match by examining other options."; 759 "the dependencies, which you can then match by examining other options.");
760 760
761 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 761 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
762 GTK_DIALOG_DESTROY_WITH_PARENT, 762 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -773,8 +773,8 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)
773{ 773{
774 GtkWidget *dialog; 774 GtkWidget *dialog;
775 const gchar *about_text = 775 const gchar *about_text =
776 "gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n" 776 _("gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"
777 "Based on the source code from Roman Zippel.\n"; 777 "Based on the source code from Roman Zippel.\n");
778 778
779 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 779 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
780 GTK_DIALOG_DESTROY_WITH_PARENT, 780 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -791,9 +791,9 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
791{ 791{
792 GtkWidget *dialog; 792 GtkWidget *dialog;
793 const gchar *license_text = 793 const gchar *license_text =
794 "gkc is released under the terms of the GNU GPL v2.\n" 794 _("gkc is released under the terms of the GNU GPL v2.\n"
795 "For more information, please see the source code or\n" 795 "For more information, please see the source code or\n"
796 "visit http://www.fsf.org/licenses/licenses.html\n"; 796 "visit http://www.fsf.org/licenses/licenses.html\n");
797 797
798 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 798 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
799 GTK_DIALOG_DESTROY_WITH_PARENT, 799 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1579,6 +1579,10 @@ int main(int ac, char *av[])
1579 kconfig_load(); 1579 kconfig_load();
1580#endif 1580#endif
1581 1581
1582 bindtextdomain(PACKAGE, LOCALEDIR);
1583 bind_textdomain_codeset(PACKAGE, "UTF-8");
1584 textdomain(PACKAGE);
1585
1582 /* GTK stuffs */ 1586 /* GTK stuffs */
1583 gtk_set_locale(); 1587 gtk_set_locale();
1584 gtk_init(&ac, &av); 1588 gtk_init(&ac, &av);
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c
new file mode 100644
index 000000000000..1c88d7c6d5a7
--- /dev/null
+++ b/scripts/kconfig/kxgettext.c
@@ -0,0 +1,221 @@
1/*
2 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>, 2005
3 *
4 * Released under the terms of the GNU GPL v2.0
5 */
6
7#include <stdlib.h>
8#include <string.h>
9
10#define LKC_DIRECT_LINK
11#include "lkc.h"
12
13static char *escape(const char* text, char *bf, int len)
14{
15 char *bfp = bf;
16 int multiline = strchr(text, '\n') != NULL;
17
18 *bfp++ = '"';
19 --len;
20
21 if (multiline) {
22 *bfp++ = '"';
23 *bfp++ = '\n';
24 *bfp++ = '"';
25 len -= 3;
26 }
27
28 while (*text != '\0' && len > 1) {
29 if (*text == '"')
30 *bfp++ = '\\';
31 else if (*text == '\n') {
32 *bfp++ = '\\';
33 *bfp++ = 'n';
34 *bfp++ = '"';
35 *bfp++ = '\n';
36 *bfp++ = '"';
37 len -= 5;
38 ++text;
39 goto next;
40 }
41 *bfp++ = *text++;
42next:
43 --len;
44 }
45
46 if (multiline)
47 bfp -= 3;
48
49 *bfp++ = '"';
50 *bfp = '\0';
51
52 return bf;
53}
54
55struct file_line {
56 struct file_line *next;
57 char* file;
58 int lineno;
59};
60
61static struct file_line *file_line__new(char *file, int lineno)
62{
63 struct file_line *self = malloc(sizeof(*self));
64
65 if (self == NULL)
66 goto out;
67
68 self->file = file;
69 self->lineno = lineno;
70 self->next = NULL;
71out:
72 return self;
73}
74
75struct message {
76 const char *msg;
77 const char *option;
78 struct message *next;
79 struct file_line *files;
80};
81
82static struct message *message__list;
83
84static struct message *message__new(const char *msg, char *option, char *file, int lineno)
85{
86 struct message *self = malloc(sizeof(*self));
87
88 if (self == NULL)
89 goto out;
90
91 self->files = file_line__new(file, lineno);
92 if (self->files == NULL)
93 goto out_fail;
94
95 self->msg = strdup(msg);
96 if (self->msg == NULL)
97 goto out_fail_msg;
98
99 self->option = option;
100 self->next = NULL;
101out:
102 return self;
103out_fail_msg:
104 free(self->files);
105out_fail:
106 free(self);
107 self = NULL;
108 goto out;
109}
110
111static struct message *mesage__find(const char *msg)
112{
113 struct message *m = message__list;
114
115 while (m != NULL) {
116 if (strcmp(m->msg, msg) == 0)
117 break;
118 m = m->next;
119 }
120
121 return m;
122}
123
124static int message__add_file_line(struct message *self, char *file, int lineno)
125{
126 int rc = -1;
127 struct file_line *fl = file_line__new(file, lineno);
128
129 if (fl == NULL)
130 goto out;
131
132 fl->next = self->files;
133 self->files = fl;
134 rc = 0;
135out:
136 return rc;
137}
138
139static int message__add(const char *msg, char *option, char *file, int lineno)
140{
141 int rc = 0;
142 char bf[16384];
143 char *escaped = escape(msg, bf, sizeof(bf));
144 struct message *m = mesage__find(escaped);
145
146 if (m != NULL)
147 rc = message__add_file_line(m, file, lineno);
148 else {
149 m = message__new(escaped, option, file, lineno);
150
151 if (m != NULL) {
152 m->next = message__list;
153 message__list = m;
154 } else
155 rc = -1;
156 }
157 return rc;
158}
159
160void menu_build_message_list(struct menu *menu)
161{
162 struct menu *child;
163
164 message__add(menu_get_prompt(menu), NULL,
165 menu->file == NULL ? "Root Menu" : menu->file->name,
166 menu->lineno);
167
168 if (menu->sym != NULL && menu->sym->help != NULL)
169 message__add(menu->sym->help, menu->sym->name,
170 menu->file == NULL ? "Root Menu" : menu->file->name,
171 menu->lineno);
172
173 for (child = menu->list; child != NULL; child = child->next)
174 if (child->prompt != NULL)
175 menu_build_message_list(child);
176}
177
178static void message__print_file_lineno(struct message *self)
179{
180 struct file_line *fl = self->files;
181
182 printf("\n#: %s:%d", fl->file, fl->lineno);
183 fl = fl->next;
184
185 while (fl != NULL) {
186 printf(", %s:%d", fl->file, fl->lineno);
187 fl = fl->next;
188 }
189
190 if (self->option != NULL)
191 printf(", %s:00000", self->option);
192
193 putchar('\n');
194}
195
196static void message__print_gettext_msgid_msgstr(struct message *self)
197{
198 message__print_file_lineno(self);
199
200 printf("msgid %s\n"
201 "msgstr \"\"\n", self->msg);
202}
203
204void menu__xgettext(void)
205{
206 struct message *m = message__list;
207
208 while (m != NULL) {
209 message__print_gettext_msgid_msgstr(m);
210 m = m->next;
211 }
212}
213
214int main(int ac, char **av)
215{
216 conf_parse(av[1]);
217
218 menu_build_message_list(menu_get_root_menu(NULL));
219 menu__xgettext();
220 return 0;
221}
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index b8a67fc9d647..8b84c42b49b5 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -8,6 +8,8 @@
8 8
9#include "expr.h" 9#include "expr.h"
10 10
11#include <libintl.h>
12
11#ifdef __cplusplus 13#ifdef __cplusplus
12extern "C" { 14extern "C" {
13#endif 15#endif
@@ -23,6 +25,12 @@ extern "C" {
23 25
24#define SRCTREE "srctree" 26#define SRCTREE "srctree"
25 27
28#define PACKAGE "linux"
29#define LOCALEDIR "/usr/share/locale"
30
31#define _(text) gettext(text)
32#define N_(text) (text)
33
26int zconfparse(void); 34int zconfparse(void);
27void zconfdump(FILE *out); 35void zconfdump(FILE *out);
28 36
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 730d316fe7fe..e5db10ca9564 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -4,6 +4,8 @@
4 * 4 *
5 * Introduced single menu mode (show all sub-menus in one large tree). 5 * Introduced single menu mode (show all sub-menus in one large tree).
6 * 2002-11-06 Petr Baudis <pasky@ucw.cz> 6 * 2002-11-06 Petr Baudis <pasky@ucw.cz>
7 *
8 * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7 */ 9 */
8 10
9#include <sys/ioctl.h> 11#include <sys/ioctl.h>
@@ -23,7 +25,7 @@
23#include "lkc.h" 25#include "lkc.h"
24 26
25static char menu_backtitle[128]; 27static char menu_backtitle[128];
26static const char mconf_readme[] = 28static const char mconf_readme[] = N_(
27"Overview\n" 29"Overview\n"
28"--------\n" 30"--------\n"
29"Some kernel features may be built directly into the kernel.\n" 31"Some kernel features may be built directly into the kernel.\n"
@@ -156,39 +158,39 @@ static const char mconf_readme[] =
156"\n" 158"\n"
157"Note that this mode can eventually be a little more CPU expensive\n" 159"Note that this mode can eventually be a little more CPU expensive\n"
158"(especially with a larger number of unrolled categories) than the\n" 160"(especially with a larger number of unrolled categories) than the\n"
159"default mode.\n", 161"default mode.\n"),
160menu_instructions[] = 162menu_instructions[] = N_(
161 "Arrow keys navigate the menu. " 163 "Arrow keys navigate the menu. "
162 "<Enter> selects submenus --->. " 164 "<Enter> selects submenus --->. "
163 "Highlighted letters are hotkeys. " 165 "Highlighted letters are hotkeys. "
164 "Pressing <Y> includes, <N> excludes, <M> modularizes features. " 166 "Pressing <Y> includes, <N> excludes, <M> modularizes features. "
165 "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " 167 "Press <Esc><Esc> to exit, <?> for Help, </> for Search. "
166 "Legend: [*] built-in [ ] excluded <M> module < > module capable", 168 "Legend: [*] built-in [ ] excluded <M> module < > module capable"),
167radiolist_instructions[] = 169radiolist_instructions[] = N_(
168 "Use the arrow keys to navigate this window or " 170 "Use the arrow keys to navigate this window or "
169 "press the hotkey of the item you wish to select " 171 "press the hotkey of the item you wish to select "
170 "followed by the <SPACE BAR>. " 172 "followed by the <SPACE BAR>. "
171 "Press <?> for additional information about this option.", 173 "Press <?> for additional information about this option."),
172inputbox_instructions_int[] = 174inputbox_instructions_int[] = N_(
173 "Please enter a decimal value. " 175 "Please enter a decimal value. "
174 "Fractions will not be accepted. " 176 "Fractions will not be accepted. "
175 "Use the <TAB> key to move from the input field to the buttons below it.", 177 "Use the <TAB> key to move from the input field to the buttons below it."),
176inputbox_instructions_hex[] = 178inputbox_instructions_hex[] = N_(
177 "Please enter a hexadecimal value. " 179 "Please enter a hexadecimal value. "
178 "Use the <TAB> key to move from the input field to the buttons below it.", 180 "Use the <TAB> key to move from the input field to the buttons below it."),
179inputbox_instructions_string[] = 181inputbox_instructions_string[] = N_(
180 "Please enter a string value. " 182 "Please enter a string value. "
181 "Use the <TAB> key to move from the input field to the buttons below it.", 183 "Use the <TAB> key to move from the input field to the buttons below it."),
182setmod_text[] = 184setmod_text[] = N_(
183 "This feature depends on another which has been configured as a module.\n" 185 "This feature depends on another which has been configured as a module.\n"
184 "As a result, this feature will be built as a module.", 186 "As a result, this feature will be built as a module."),
185nohelp_text[] = 187nohelp_text[] = N_(
186 "There is no help available for this kernel option.\n", 188 "There is no help available for this kernel option.\n"),
187load_config_text[] = 189load_config_text[] = N_(
188 "Enter the name of the configuration file you wish to load. " 190 "Enter the name of the configuration file you wish to load. "
189 "Accept the name shown to restore the configuration you " 191 "Accept the name shown to restore the configuration you "
190 "last retrieved. Leave blank to abort.", 192 "last retrieved. Leave blank to abort."),
191load_config_help[] = 193load_config_help[] = N_(
192 "\n" 194 "\n"
193 "For various reasons, one may wish to keep several different kernel\n" 195 "For various reasons, one may wish to keep several different kernel\n"
194 "configurations available on a single machine.\n" 196 "configurations available on a single machine.\n"
@@ -198,11 +200,11 @@ load_config_help[] =
198 "to modify that configuration.\n" 200 "to modify that configuration.\n"
199 "\n" 201 "\n"
200 "If you are uncertain, then you have probably never used alternate\n" 202 "If you are uncertain, then you have probably never used alternate\n"
201 "configuration files. You should therefor leave this blank to abort.\n", 203 "configuration files. You should therefor leave this blank to abort.\n"),
202save_config_text[] = 204save_config_text[] = N_(
203 "Enter a filename to which this configuration should be saved " 205 "Enter a filename to which this configuration should be saved "
204 "as an alternate. Leave blank to abort.", 206 "as an alternate. Leave blank to abort."),
205save_config_help[] = 207save_config_help[] = N_(
206 "\n" 208 "\n"
207 "For various reasons, one may wish to keep different kernel\n" 209 "For various reasons, one may wish to keep different kernel\n"
208 "configurations available on a single machine.\n" 210 "configurations available on a single machine.\n"
@@ -212,8 +214,8 @@ save_config_help[] =
212 "configuration options you have selected at that time.\n" 214 "configuration options you have selected at that time.\n"
213 "\n" 215 "\n"
214 "If you are uncertain what all this means then you should probably\n" 216 "If you are uncertain what all this means then you should probably\n"
215 "leave this blank.\n", 217 "leave this blank.\n"),
216search_help[] = 218search_help[] = N_(
217 "\n" 219 "\n"
218 "Search for CONFIG_ symbols and display their relations.\n" 220 "Search for CONFIG_ symbols and display their relations.\n"
219 "Example: search for \"^FOO\"\n" 221 "Example: search for \"^FOO\"\n"
@@ -250,7 +252,7 @@ search_help[] =
250 "Examples: USB => find all CONFIG_ symbols containing USB\n" 252 "Examples: USB => find all CONFIG_ symbols containing USB\n"
251 " ^USB => find all CONFIG_ symbols starting with USB\n" 253 " ^USB => find all CONFIG_ symbols starting with USB\n"
252 " USB$ => find all CONFIG_ symbols ending with USB\n" 254 " USB$ => find all CONFIG_ symbols ending with USB\n"
253 "\n"; 255 "\n");
254 256
255static signed char buf[4096], *bufptr = buf; 257static signed char buf[4096], *bufptr = buf;
256static signed char input_buf[4096]; 258static signed char input_buf[4096];
@@ -305,8 +307,8 @@ static void init_wsize(void)
305 } 307 }
306 308
307 if (rows < 19 || cols < 80) { 309 if (rows < 19 || cols < 80) {
308 fprintf(stderr, "Your display is too small to run Menuconfig!\n"); 310 fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
309 fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); 311 fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
310 exit(1); 312 exit(1);
311 } 313 }
312 314
@@ -526,9 +528,9 @@ static void search_conf(void)
526again: 528again:
527 cprint_init(); 529 cprint_init();
528 cprint("--title"); 530 cprint("--title");
529 cprint("Search Configuration Parameter"); 531 cprint(_("Search Configuration Parameter"));
530 cprint("--inputbox"); 532 cprint("--inputbox");
531 cprint("Enter Keyword"); 533 cprint(_("Enter Keyword"));
532 cprint("10"); 534 cprint("10");
533 cprint("75"); 535 cprint("75");
534 cprint(""); 536 cprint("");
@@ -539,7 +541,7 @@ again:
539 case 0: 541 case 0:
540 break; 542 break;
541 case 1: 543 case 1:
542 show_helptext("Search Configuration", search_help); 544 show_helptext(_("Search Configuration"), search_help);
543 goto again; 545 goto again;
544 default: 546 default:
545 return; 547 return;
@@ -548,7 +550,7 @@ again:
548 sym_arr = sym_re_search(input_buf); 550 sym_arr = sym_re_search(input_buf);
549 res = get_relations_str(sym_arr); 551 res = get_relations_str(sym_arr);
550 free(sym_arr); 552 free(sym_arr);
551 show_textbox("Search Results", str_get(&res), 0, 0); 553 show_textbox(_("Search Results"), str_get(&res), 0, 0);
552 str_free(&res); 554 str_free(&res);
553} 555}
554 556
@@ -721,9 +723,9 @@ static void conf(struct menu *menu)
721 while (1) { 723 while (1) {
722 cprint_init(); 724 cprint_init();
723 cprint("--title"); 725 cprint("--title");
724 cprint("%s", prompt ? prompt : "Main Menu"); 726 cprint("%s", prompt ? prompt : _("Main Menu"));
725 cprint("--menu"); 727 cprint("--menu");
726 cprint(menu_instructions); 728 cprint(_(menu_instructions));
727 cprint("%d", rows); 729 cprint("%d", rows);
728 cprint("%d", cols); 730 cprint("%d", cols);
729 cprint("%d", rows - 10); 731 cprint("%d", rows - 10);
@@ -736,9 +738,9 @@ static void conf(struct menu *menu)
736 cprint(":"); 738 cprint(":");
737 cprint("--- "); 739 cprint("--- ");
738 cprint("L"); 740 cprint("L");
739 cprint(" Load an Alternate Configuration File"); 741 cprint(_(" Load an Alternate Configuration File"));
740 cprint("S"); 742 cprint("S");
741 cprint(" Save Configuration to an Alternate File"); 743 cprint(_(" Save Configuration to an Alternate File"));
742 } 744 }
743 stat = exec_conf(); 745 stat = exec_conf();
744 if (stat < 0) 746 if (stat < 0)
@@ -793,7 +795,7 @@ static void conf(struct menu *menu)
793 if (sym) 795 if (sym)
794 show_help(submenu); 796 show_help(submenu);
795 else 797 else
796 show_helptext("README", mconf_readme); 798 show_helptext("README", _(mconf_readme));
797 break; 799 break;
798 case 3: 800 case 3:
799 if (type == 't') { 801 if (type == 't') {
@@ -849,7 +851,7 @@ static void show_help(struct menu *menu)
849 { 851 {
850 if (sym->name) { 852 if (sym->name) {
851 str_printf(&help, "CONFIG_%s:\n\n", sym->name); 853 str_printf(&help, "CONFIG_%s:\n\n", sym->name);
852 str_append(&help, sym->help); 854 str_append(&help, _(sym->help));
853 str_append(&help, "\n"); 855 str_append(&help, "\n");
854 } 856 }
855 } else { 857 } else {
@@ -886,9 +888,9 @@ static void conf_choice(struct menu *menu)
886 while (1) { 888 while (1) {
887 cprint_init(); 889 cprint_init();
888 cprint("--title"); 890 cprint("--title");
889 cprint("%s", prompt ? prompt : "Main Menu"); 891 cprint("%s", prompt ? prompt : _("Main Menu"));
890 cprint("--radiolist"); 892 cprint("--radiolist");
891 cprint(radiolist_instructions); 893 cprint(_(radiolist_instructions));
892 cprint("15"); 894 cprint("15");
893 cprint("70"); 895 cprint("70");
894 cprint("6"); 896 cprint("6");
@@ -935,17 +937,17 @@ static void conf_string(struct menu *menu)
935 while (1) { 937 while (1) {
936 cprint_init(); 938 cprint_init();
937 cprint("--title"); 939 cprint("--title");
938 cprint("%s", prompt ? prompt : "Main Menu"); 940 cprint("%s", prompt ? prompt : _("Main Menu"));
939 cprint("--inputbox"); 941 cprint("--inputbox");
940 switch (sym_get_type(menu->sym)) { 942 switch (sym_get_type(menu->sym)) {
941 case S_INT: 943 case S_INT:
942 cprint(inputbox_instructions_int); 944 cprint(_(inputbox_instructions_int));
943 break; 945 break;
944 case S_HEX: 946 case S_HEX:
945 cprint(inputbox_instructions_hex); 947 cprint(_(inputbox_instructions_hex));
946 break; 948 break;
947 case S_STRING: 949 case S_STRING:
948 cprint(inputbox_instructions_string); 950 cprint(_(inputbox_instructions_string));
949 break; 951 break;
950 default: 952 default:
951 /* panic? */; 953 /* panic? */;
@@ -958,7 +960,7 @@ static void conf_string(struct menu *menu)
958 case 0: 960 case 0:
959 if (sym_set_string_value(menu->sym, input_buf)) 961 if (sym_set_string_value(menu->sym, input_buf))
960 return; 962 return;
961 show_textbox(NULL, "You have made an invalid entry.", 5, 43); 963 show_textbox(NULL, _("You have made an invalid entry."), 5, 43);
962 break; 964 break;
963 case 1: 965 case 1:
964 show_help(menu); 966 show_help(menu);
@@ -987,10 +989,10 @@ static void conf_load(void)
987 return; 989 return;
988 if (!conf_read(input_buf)) 990 if (!conf_read(input_buf))
989 return; 991 return;
990 show_textbox(NULL, "File does not exist!", 5, 38); 992 show_textbox(NULL, _("File does not exist!"), 5, 38);
991 break; 993 break;
992 case 1: 994 case 1:
993 show_helptext("Load Alternate Configuration", load_config_help); 995 show_helptext(_("Load Alternate Configuration"), load_config_help);
994 break; 996 break;
995 case 255: 997 case 255:
996 return; 998 return;
@@ -1016,10 +1018,10 @@ static void conf_save(void)
1016 return; 1018 return;
1017 if (!conf_write(input_buf)) 1019 if (!conf_write(input_buf))
1018 return; 1020 return;
1019 show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); 1021 show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60);
1020 break; 1022 break;
1021 case 1: 1023 case 1:
1022 show_helptext("Save Alternate Configuration", save_config_help); 1024 show_helptext(_("Save Alternate Configuration"), save_config_help);
1023 break; 1025 break;
1024 case 255: 1026 case 255:
1025 return; 1027 return;
@@ -1040,12 +1042,16 @@ int main(int ac, char **av)
1040 char *mode; 1042 char *mode;
1041 int stat; 1043 int stat;
1042 1044
1045 setlocale(LC_ALL, "");
1046 bindtextdomain(PACKAGE, LOCALEDIR);
1047 textdomain(PACKAGE);
1048
1043 conf_parse(av[1]); 1049 conf_parse(av[1]);
1044 conf_read(NULL); 1050 conf_read(NULL);
1045 1051
1046 sym = sym_lookup("KERNELRELEASE", 0); 1052 sym = sym_lookup("KERNELRELEASE", 0);
1047 sym_calc_value(sym); 1053 sym_calc_value(sym);
1048 sprintf(menu_backtitle, "Linux Kernel v%s Configuration", 1054 sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"),
1049 sym_get_string_value(sym)); 1055 sym_get_string_value(sym));
1050 1056
1051 mode = getenv("MENUCONFIG_MODE"); 1057 mode = getenv("MENUCONFIG_MODE");
@@ -1062,7 +1068,7 @@ int main(int ac, char **av)
1062 do { 1068 do {
1063 cprint_init(); 1069 cprint_init();
1064 cprint("--yesno"); 1070 cprint("--yesno");
1065 cprint("Do you wish to save your new kernel configuration?"); 1071 cprint(_("Do you wish to save your new kernel configuration?"));
1066 cprint("5"); 1072 cprint("5");
1067 cprint("60"); 1073 cprint("60");
1068 stat = exec_conf(); 1074 stat = exec_conf();
@@ -1070,20 +1076,20 @@ int main(int ac, char **av)
1070 1076
1071 if (stat == 0) { 1077 if (stat == 0) {
1072 if (conf_write(NULL)) { 1078 if (conf_write(NULL)) {
1073 fprintf(stderr, "\n\n" 1079 fprintf(stderr, _("\n\n"
1074 "Error during writing of the kernel configuration.\n" 1080 "Error during writing of the kernel configuration.\n"
1075 "Your kernel configuration changes were NOT saved." 1081 "Your kernel configuration changes were NOT saved."
1076 "\n\n"); 1082 "\n\n"));
1077 return 1; 1083 return 1;
1078 } 1084 }
1079 printf("\n\n" 1085 printf(_("\n\n"
1080 "*** End of Linux kernel configuration.\n" 1086 "*** End of Linux kernel configuration.\n"
1081 "*** Execute 'make' to build the kernel or try 'make help'." 1087 "*** Execute 'make' to build the kernel or try 'make help'."
1082 "\n\n"); 1088 "\n\n"));
1083 } else { 1089 } else {
1084 fprintf(stderr, "\n\n" 1090 fprintf(stderr, _("\n\n"
1085 "Your kernel configuration changes were NOT saved." 1091 "Your kernel configuration changes were NOT saved."
1086 "\n\n"); 1092 "\n\n"));
1087 } 1093 }
1088 1094
1089 return 0; 1095 return 0;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 0c13156f3344..8c59b212722d 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -365,9 +365,9 @@ bool menu_is_visible(struct menu *menu)
365const char *menu_get_prompt(struct menu *menu) 365const char *menu_get_prompt(struct menu *menu)
366{ 366{
367 if (menu->prompt) 367 if (menu->prompt)
368 return menu->prompt->text; 368 return _(menu->prompt->text);
369 else if (menu->sym) 369 else if (menu->sym)
370 return menu->sym->name; 370 return _(menu->sym->name);
371 return NULL; 371 return NULL;
372} 372}
373 373
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 0cdbf9dbbd51..4590cd31623f 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -26,8 +26,23 @@
26#include "qconf.moc" 26#include "qconf.moc"
27#include "images.c" 27#include "images.c"
28 28
29#ifdef _
30# undef _
31# define _ qgettext
32#endif
33
29static QApplication *configApp; 34static QApplication *configApp;
30 35
36static inline QString qgettext(const char* str)
37{
38 return QString::fromLocal8Bit(gettext(str));
39}
40
41static inline QString qgettext(const QString& str)
42{
43 return QString::fromLocal8Bit(gettext(str.latin1()));
44}
45
31ConfigSettings::ConfigSettings() 46ConfigSettings::ConfigSettings()
32 : showAll(false), showName(false), showRange(false), showData(false) 47 : showAll(false), showName(false), showRange(false), showData(false)
33{ 48{
@@ -177,7 +192,7 @@ void ConfigItem::updateMenu(void)
177 192
178 sym = menu->sym; 193 sym = menu->sym;
179 prop = menu->prompt; 194 prop = menu->prompt;
180 prompt = menu_get_prompt(menu); 195 prompt = QString::fromLocal8Bit(menu_get_prompt(menu));
181 196
182 if (prop) switch (prop->type) { 197 if (prop) switch (prop->type) {
183 case P_MENU: 198 case P_MENU:
@@ -203,7 +218,7 @@ void ConfigItem::updateMenu(void)
203 if (!sym) 218 if (!sym)
204 goto set_prompt; 219 goto set_prompt;
205 220
206 setText(nameColIdx, sym->name); 221 setText(nameColIdx, QString::fromLocal8Bit(sym->name));
207 222
208 type = sym_get_type(sym); 223 type = sym_get_type(sym);
209 switch (type) { 224 switch (type) {
@@ -213,9 +228,9 @@ void ConfigItem::updateMenu(void)
213 228
214 if (!sym_is_changable(sym) && !list->showAll) { 229 if (!sym_is_changable(sym) && !list->showAll) {
215 setPixmap(promptColIdx, 0); 230 setPixmap(promptColIdx, 0);
216 setText(noColIdx, 0); 231 setText(noColIdx, QString::null);
217 setText(modColIdx, 0); 232 setText(modColIdx, QString::null);
218 setText(yesColIdx, 0); 233 setText(yesColIdx, QString::null);
219 break; 234 break;
220 } 235 }
221 expr = sym_get_tristate_value(sym); 236 expr = sym_get_tristate_value(sym);
@@ -257,6 +272,7 @@ void ConfigItem::updateMenu(void)
257 const char* data; 272 const char* data;
258 273
259 data = sym_get_string_value(sym); 274 data = sym_get_string_value(sym);
275
260#if QT_VERSION >= 300 276#if QT_VERSION >= 300
261 int i = list->mapIdx(dataColIdx); 277 int i = list->mapIdx(dataColIdx);
262 if (i >= 0) 278 if (i >= 0)
@@ -264,9 +280,9 @@ void ConfigItem::updateMenu(void)
264#endif 280#endif
265 setText(dataColIdx, data); 281 setText(dataColIdx, data);
266 if (type == S_STRING) 282 if (type == S_STRING)
267 prompt.sprintf("%s: %s", prompt.latin1(), data); 283 prompt = QString("%1: %2").arg(prompt).arg(data);
268 else 284 else
269 prompt.sprintf("(%s) %s", data, prompt.latin1()); 285 prompt = QString("(%2) %1").arg(prompt).arg(data);
270 break; 286 break;
271 } 287 }
272 if (!sym_has_value(sym) && visible) 288 if (!sym_has_value(sym) && visible)
@@ -343,9 +359,9 @@ void ConfigLineEdit::show(ConfigItem* i)
343{ 359{
344 item = i; 360 item = i;
345 if (sym_get_string_value(item->menu->sym)) 361 if (sym_get_string_value(item->menu->sym))
346 setText(sym_get_string_value(item->menu->sym)); 362 setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym)));
347 else 363 else
348 setText(0); 364 setText(QString::null);
349 Parent::show(); 365 Parent::show();
350 setFocus(); 366 setFocus();
351} 367}
@@ -961,7 +977,7 @@ ConfigMainWindow::ConfigMainWindow(void)
961 delete configSettings; 977 delete configSettings;
962} 978}
963 979
964static QString print_filter(const char *str) 980static QString print_filter(const QString &str)
965{ 981{
966 QRegExp re("[<>&\"\\n]"); 982 QRegExp re("[<>&\"\\n]");
967 QString res = str; 983 QString res = str;
@@ -994,7 +1010,7 @@ static QString print_filter(const char *str)
994 1010
995static void expr_print_help(void *data, const char *str) 1011static void expr_print_help(void *data, const char *str)
996{ 1012{
997 ((QString*)data)->append(print_filter(str)); 1013 reinterpret_cast<QString*>(data)->append(print_filter(str));
998} 1014}
999 1015
1000/* 1016/*
@@ -1009,7 +1025,7 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1009 if (item) 1025 if (item)
1010 menu = ((ConfigItem*)item)->menu; 1026 menu = ((ConfigItem*)item)->menu;
1011 if (!menu) { 1027 if (!menu) {
1012 helpText->setText(NULL); 1028 helpText->setText(QString::null);
1013 return; 1029 return;
1014 } 1030 }
1015 1031
@@ -1019,16 +1035,16 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1019 if (sym) { 1035 if (sym) {
1020 if (menu->prompt) { 1036 if (menu->prompt) {
1021 head += "<big><b>"; 1037 head += "<big><b>";
1022 head += print_filter(menu->prompt->text); 1038 head += print_filter(_(menu->prompt->text));
1023 head += "</b></big>"; 1039 head += "</b></big>";
1024 if (sym->name) { 1040 if (sym->name) {
1025 head += " ("; 1041 head += " (";
1026 head += print_filter(sym->name); 1042 head += print_filter(_(sym->name));
1027 head += ")"; 1043 head += ")";
1028 } 1044 }
1029 } else if (sym->name) { 1045 } else if (sym->name) {
1030 head += "<big><b>"; 1046 head += "<big><b>";
1031 head += print_filter(sym->name); 1047 head += print_filter(_(sym->name));
1032 head += "</b></big>"; 1048 head += "</b></big>";
1033 } 1049 }
1034 head += "<br><br>"; 1050 head += "<br><br>";
@@ -1049,7 +1065,7 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1049 case P_PROMPT: 1065 case P_PROMPT:
1050 case P_MENU: 1066 case P_MENU:
1051 debug += "prompt: "; 1067 debug += "prompt: ";
1052 debug += print_filter(prop->text); 1068 debug += print_filter(_(prop->text));
1053 debug += "<br>"; 1069 debug += "<br>";
1054 break; 1070 break;
1055 case P_DEFAULT: 1071 case P_DEFAULT:
@@ -1088,10 +1104,10 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1088 debug += "<br>"; 1104 debug += "<br>";
1089 } 1105 }
1090 1106
1091 help = print_filter(sym->help); 1107 help = print_filter(_(sym->help));
1092 } else if (menu->prompt) { 1108 } else if (menu->prompt) {
1093 head += "<big><b>"; 1109 head += "<big><b>";
1094 head += print_filter(menu->prompt->text); 1110 head += print_filter(_(menu->prompt->text));
1095 head += "</b></big><br><br>"; 1111 head += "</b></big><br><br>";
1096 if (showDebug) { 1112 if (showDebug) {
1097 if (menu->prompt->visible.expr) { 1113 if (menu->prompt->visible.expr) {
@@ -1111,7 +1127,7 @@ void ConfigMainWindow::loadConfig(void)
1111 QString s = QFileDialog::getOpenFileName(".config", NULL, this); 1127 QString s = QFileDialog::getOpenFileName(".config", NULL, this);
1112 if (s.isNull()) 1128 if (s.isNull())
1113 return; 1129 return;
1114 if (conf_read(s.latin1())) 1130 if (conf_read(QFile::encodeName(s)))
1115 QMessageBox::information(this, "qconf", "Unable to load configuration!"); 1131 QMessageBox::information(this, "qconf", "Unable to load configuration!");
1116 ConfigView::updateListAll(); 1132 ConfigView::updateListAll();
1117} 1133}
@@ -1127,7 +1143,7 @@ void ConfigMainWindow::saveConfigAs(void)
1127 QString s = QFileDialog::getSaveFileName(".config", NULL, this); 1143 QString s = QFileDialog::getSaveFileName(".config", NULL, this);
1128 if (s.isNull()) 1144 if (s.isNull())
1129 return; 1145 return;
1130 if (conf_write(s.latin1())) 1146 if (conf_write(QFile::encodeName(s)))
1131 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 1147 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1132} 1148}
1133 1149
@@ -1372,6 +1388,9 @@ int main(int ac, char** av)
1372 ConfigMainWindow* v; 1388 ConfigMainWindow* v;
1373 const char *name; 1389 const char *name;
1374 1390
1391 bindtextdomain(PACKAGE, LOCALEDIR);
1392 textdomain(PACKAGE);
1393
1375#ifndef LKC_DIRECT_LINK 1394#ifndef LKC_DIRECT_LINK
1376 kconfig_load(); 1395 kconfig_load();
1377#endif 1396#endif