Re: [-mm patch] kernel/kexec.c: make code static
Hi Adrian, Maneesh, Maneesh Soni wrote: > On Mon, Sep 10, 2007 at 02:20:40PM +0200, Adrian Bunk wrote: >> On Mon, Sep 10, 2007 at 11:55:49AM +0900, Ken'ichi Ohmichi wrote: >>> Hi Adrian, >>> >>> >>> 2007/09/09 22:25:16 +0200, Adrian Bunk <[EMAIL PROTECTED]> wrote: On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: > ... > Changes since 2.6.23-rc3-mm1: > ... > +add-vmcoreinfo.patch > ... > misc > ... This patch makes the following needlessly global code static: - vmcoreinfo_data[] - vmcoreinfo_size - vmcoreinfo_append_str() >>> The kernel compiling fails with your patch because architecture-specific >>> function should access the above data/function: >>> >>> # make >>> [snip] >>> arch/ia64/kernel/machine_kexec.c: In function 'arch_crash_save_vmcoreinfo': >>> arch/ia64/kernel/machine_kexec.c:134: error: implicit declaration of function 'SYMBOL' >>> arch/ia64/kernel/machine_kexec.c:135: error: implicit declaration of function 'LENGTH' >>> arch/ia64/kernel/machine_kexec.c:139: error: implicit declaration of function 'SIZE' >>> arch/ia64/kernel/machine_kexec.c:139: error: 'node_memblk_s' undeclared (first use in this function) >>> arch/ia64/kernel/machine_kexec.c:139: error: (Each undeclared identifier is reported only once >>> arch/ia64/kernel/machine_kexec.c:139: error: for each function it appears in.) >>> arch/ia64/kernel/machine_kexec.c:140: error: implicit declaration of function 'OFFSET' >>> arch/ia64/kernel/machine_kexec.c:140: error: 'start_paddr' undeclared (first use in this function) >>> arch/ia64/kernel/machine_kexec.c:141: error: 'size' undeclared (first use in this function) >>> arch/ia64/kernel/machine_kexec.c:144: error: implicit declaration of function 'CONFIG' >>> arch/ia64/kernel/machine_kexec.c:144: error: 'PGTABLE_3' undeclared (first use in this function) >>> make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1 >>> make: *** [arch/ia64/kernel] Error 2 >>> # >> Thanks, I missed this. >> >> That's 80% my fault and 20% the fault of the usage of generic names SYMBOL/SIZE/OFFSET/LENGTH/CONFIG making it impossible to grep for them (and namespace conflicts quite possible). I understand your motivation. It is better to change these names as you said. >> Can we get these #define's properly prefixed (e.g. KEXEC_SYMBOL etc.) so that other people will not repeat my mistake and namespace conflicts will be prevented? >> > > CRASH_DUMP_ or VMCORE_ should be a better prefix as the dump filtering > functionality not directly related to kexec. I think that VMCOREINFO_ is a better prefix, because these macros are for writing the information to the vmcoreinfo data. Thanks Ken'ichi Ohmichi - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [-mm patch] kernel/kexec.c: make code static
Hi Adrian, Maneesh, Maneesh Soni wrote: On Mon, Sep 10, 2007 at 02:20:40PM +0200, Adrian Bunk wrote: On Mon, Sep 10, 2007 at 11:55:49AM +0900, Ken'ichi Ohmichi wrote: Hi Adrian, 2007/09/09 22:25:16 +0200, Adrian Bunk [EMAIL PROTECTED] wrote: On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: ... Changes since 2.6.23-rc3-mm1: ... +add-vmcoreinfo.patch ... misc ... This patch makes the following needlessly global code static: - vmcoreinfo_data[] - vmcoreinfo_size - vmcoreinfo_append_str() The kernel compiling fails with your patch because architecture-specific function should access the above data/function: # make [snip] arch/ia64/kernel/machine_kexec.c: In function 'arch_crash_save_vmcoreinfo': arch/ia64/kernel/machine_kexec.c:134: error: implicit declaration of function 'SYMBOL' arch/ia64/kernel/machine_kexec.c:135: error: implicit declaration of function 'LENGTH' arch/ia64/kernel/machine_kexec.c:139: error: implicit declaration of function 'SIZE' arch/ia64/kernel/machine_kexec.c:139: error: 'node_memblk_s' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:139: error: (Each undeclared identifier is reported only once arch/ia64/kernel/machine_kexec.c:139: error: for each function it appears in.) arch/ia64/kernel/machine_kexec.c:140: error: implicit declaration of function 'OFFSET' arch/ia64/kernel/machine_kexec.c:140: error: 'start_paddr' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:141: error: 'size' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:144: error: implicit declaration of function 'CONFIG' arch/ia64/kernel/machine_kexec.c:144: error: 'PGTABLE_3' undeclared (first use in this function) make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1 make: *** [arch/ia64/kernel] Error 2 # Thanks, I missed this. That's 80% my fault and 20% the fault of the usage of generic names SYMBOL/SIZE/OFFSET/LENGTH/CONFIG making it impossible to grep for them (and namespace conflicts quite possible). I understand your motivation. It is better to change these names as you said. Can we get these #define's properly prefixed (e.g. KEXEC_SYMBOL etc.) so that other people will not repeat my mistake and namespace conflicts will be prevented? CRASH_DUMP_ or VMCORE_ should be a better prefix as the dump filtering functionality not directly related to kexec. I think that VMCOREINFO_ is a better prefix, because these macros are for writing the information to the vmcoreinfo data. Thanks Ken'ichi Ohmichi - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [-mm patch] kernel/kexec.c: make code static
On Mon, Sep 10, 2007 at 02:20:40PM +0200, Adrian Bunk wrote: > On Mon, Sep 10, 2007 at 11:55:49AM +0900, Ken'ichi Ohmichi wrote: > > > > Hi Adrian, > > > > > > 2007/09/09 22:25:16 +0200, Adrian Bunk <[EMAIL PROTECTED]> wrote: > > >On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: > > >>... > > >> Changes since 2.6.23-rc3-mm1: > > >>... > > >> +add-vmcoreinfo.patch > > >>... > > >> misc > > >>... > > > > > >This patch makes the following needlessly global code static: > > >- vmcoreinfo_data[] > > >- vmcoreinfo_size > > >- vmcoreinfo_append_str() > > > > The kernel compiling fails with your patch because architecture-specific > > function should access the above data/function: > > > > # make > > [snip] > > arch/ia64/kernel/machine_kexec.c: In function 'arch_crash_save_vmcoreinfo': > > arch/ia64/kernel/machine_kexec.c:134: error: implicit declaration of > > function 'SYMBOL' > > arch/ia64/kernel/machine_kexec.c:135: error: implicit declaration of > > function 'LENGTH' > > arch/ia64/kernel/machine_kexec.c:139: error: implicit declaration of > > function 'SIZE' > > arch/ia64/kernel/machine_kexec.c:139: error: 'node_memblk_s' undeclared > > (first use in this function) > > arch/ia64/kernel/machine_kexec.c:139: error: (Each undeclared identifier is > > reported only once > > arch/ia64/kernel/machine_kexec.c:139: error: for each function it appears > > in.) > > arch/ia64/kernel/machine_kexec.c:140: error: implicit declaration of > > function 'OFFSET' > > arch/ia64/kernel/machine_kexec.c:140: error: 'start_paddr' undeclared > > (first use in this function) > > arch/ia64/kernel/machine_kexec.c:141: error: 'size' undeclared (first use > > in this function) > > arch/ia64/kernel/machine_kexec.c:144: error: implicit declaration of > > function 'CONFIG' > > arch/ia64/kernel/machine_kexec.c:144: error: 'PGTABLE_3' undeclared (first > > use in this function) > > make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1 > > make: *** [arch/ia64/kernel] Error 2 > > # > > Thanks, I missed this. > > That's 80% my fault and 20% the fault of the usage of generic names > SYMBOL/SIZE/OFFSET/LENGTH/CONFIG making it impossible to grep for them > (and namespace conflicts quite possible). > > Can we get these #define's properly prefixed (e.g. KEXEC_SYMBOL etc.) so > that other people will not repeat my mistake and namespace conflicts > will be prevented? > CRASH_DUMP_ or VMCORE_ should be a better prefix as the dump filtering functionality not directly related to kexec. Thanks Maneesh -- Maneesh Soni Linux Technology Center, IBM India Systems and Technology Lab, Bangalore, India - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [-mm patch] kernel/kexec.c: make code static
On Mon, Sep 10, 2007 at 11:55:49AM +0900, Ken'ichi Ohmichi wrote: > > Hi Adrian, > > > 2007/09/09 22:25:16 +0200, Adrian Bunk <[EMAIL PROTECTED]> wrote: > >On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: > >>... > >> Changes since 2.6.23-rc3-mm1: > >>... > >> +add-vmcoreinfo.patch > >>... > >> misc > >>... > > > >This patch makes the following needlessly global code static: > >- vmcoreinfo_data[] > >- vmcoreinfo_size > >- vmcoreinfo_append_str() > > The kernel compiling fails with your patch because architecture-specific > function should access the above data/function: > > # make > [snip] > arch/ia64/kernel/machine_kexec.c: In function 'arch_crash_save_vmcoreinfo': > arch/ia64/kernel/machine_kexec.c:134: error: implicit declaration of function > 'SYMBOL' > arch/ia64/kernel/machine_kexec.c:135: error: implicit declaration of function > 'LENGTH' > arch/ia64/kernel/machine_kexec.c:139: error: implicit declaration of function > 'SIZE' > arch/ia64/kernel/machine_kexec.c:139: error: 'node_memblk_s' undeclared > (first use in this function) > arch/ia64/kernel/machine_kexec.c:139: error: (Each undeclared identifier is > reported only once > arch/ia64/kernel/machine_kexec.c:139: error: for each function it appears in.) > arch/ia64/kernel/machine_kexec.c:140: error: implicit declaration of function > 'OFFSET' > arch/ia64/kernel/machine_kexec.c:140: error: 'start_paddr' undeclared (first > use in this function) > arch/ia64/kernel/machine_kexec.c:141: error: 'size' undeclared (first use in > this function) > arch/ia64/kernel/machine_kexec.c:144: error: implicit declaration of function > 'CONFIG' > arch/ia64/kernel/machine_kexec.c:144: error: 'PGTABLE_3' undeclared (first > use in this function) > make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1 > make: *** [arch/ia64/kernel] Error 2 > # Thanks, I missed this. That's 80% my fault and 20% the fault of the usage of generic names SYMBOL/SIZE/OFFSET/LENGTH/CONFIG making it impossible to grep for them (and namespace conflicts quite possible). Can we get these #define's properly prefixed (e.g. KEXEC_SYMBOL etc.) so that other people will not repeat my mistake and namespace conflicts will be prevented? > Thanks > Ken'ichi Ohmichi TIA Adrian -- "Is there not promise of rain?" Ling Tan asked suddenly out of the darkness. There had been need of rain for many days. "Only a promise," Lao Er said. Pearl S. Buck - Dragon Seed - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [-mm patch] kernel/kexec.c: make code static
On Mon, Sep 10, 2007 at 11:55:49AM +0900, Ken'ichi Ohmichi wrote: Hi Adrian, 2007/09/09 22:25:16 +0200, Adrian Bunk [EMAIL PROTECTED] wrote: On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: ... Changes since 2.6.23-rc3-mm1: ... +add-vmcoreinfo.patch ... misc ... This patch makes the following needlessly global code static: - vmcoreinfo_data[] - vmcoreinfo_size - vmcoreinfo_append_str() The kernel compiling fails with your patch because architecture-specific function should access the above data/function: # make [snip] arch/ia64/kernel/machine_kexec.c: In function 'arch_crash_save_vmcoreinfo': arch/ia64/kernel/machine_kexec.c:134: error: implicit declaration of function 'SYMBOL' arch/ia64/kernel/machine_kexec.c:135: error: implicit declaration of function 'LENGTH' arch/ia64/kernel/machine_kexec.c:139: error: implicit declaration of function 'SIZE' arch/ia64/kernel/machine_kexec.c:139: error: 'node_memblk_s' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:139: error: (Each undeclared identifier is reported only once arch/ia64/kernel/machine_kexec.c:139: error: for each function it appears in.) arch/ia64/kernel/machine_kexec.c:140: error: implicit declaration of function 'OFFSET' arch/ia64/kernel/machine_kexec.c:140: error: 'start_paddr' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:141: error: 'size' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:144: error: implicit declaration of function 'CONFIG' arch/ia64/kernel/machine_kexec.c:144: error: 'PGTABLE_3' undeclared (first use in this function) make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1 make: *** [arch/ia64/kernel] Error 2 # Thanks, I missed this. That's 80% my fault and 20% the fault of the usage of generic names SYMBOL/SIZE/OFFSET/LENGTH/CONFIG making it impossible to grep for them (and namespace conflicts quite possible). Can we get these #define's properly prefixed (e.g. KEXEC_SYMBOL etc.) so that other people will not repeat my mistake and namespace conflicts will be prevented? Thanks Ken'ichi Ohmichi TIA Adrian -- Is there not promise of rain? Ling Tan asked suddenly out of the darkness. There had been need of rain for many days. Only a promise, Lao Er said. Pearl S. Buck - Dragon Seed - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [-mm patch] kernel/kexec.c: make code static
On Mon, Sep 10, 2007 at 02:20:40PM +0200, Adrian Bunk wrote: On Mon, Sep 10, 2007 at 11:55:49AM +0900, Ken'ichi Ohmichi wrote: Hi Adrian, 2007/09/09 22:25:16 +0200, Adrian Bunk [EMAIL PROTECTED] wrote: On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: ... Changes since 2.6.23-rc3-mm1: ... +add-vmcoreinfo.patch ... misc ... This patch makes the following needlessly global code static: - vmcoreinfo_data[] - vmcoreinfo_size - vmcoreinfo_append_str() The kernel compiling fails with your patch because architecture-specific function should access the above data/function: # make [snip] arch/ia64/kernel/machine_kexec.c: In function 'arch_crash_save_vmcoreinfo': arch/ia64/kernel/machine_kexec.c:134: error: implicit declaration of function 'SYMBOL' arch/ia64/kernel/machine_kexec.c:135: error: implicit declaration of function 'LENGTH' arch/ia64/kernel/machine_kexec.c:139: error: implicit declaration of function 'SIZE' arch/ia64/kernel/machine_kexec.c:139: error: 'node_memblk_s' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:139: error: (Each undeclared identifier is reported only once arch/ia64/kernel/machine_kexec.c:139: error: for each function it appears in.) arch/ia64/kernel/machine_kexec.c:140: error: implicit declaration of function 'OFFSET' arch/ia64/kernel/machine_kexec.c:140: error: 'start_paddr' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:141: error: 'size' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:144: error: implicit declaration of function 'CONFIG' arch/ia64/kernel/machine_kexec.c:144: error: 'PGTABLE_3' undeclared (first use in this function) make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1 make: *** [arch/ia64/kernel] Error 2 # Thanks, I missed this. That's 80% my fault and 20% the fault of the usage of generic names SYMBOL/SIZE/OFFSET/LENGTH/CONFIG making it impossible to grep for them (and namespace conflicts quite possible). Can we get these #define's properly prefixed (e.g. KEXEC_SYMBOL etc.) so that other people will not repeat my mistake and namespace conflicts will be prevented? CRASH_DUMP_ or VMCORE_ should be a better prefix as the dump filtering functionality not directly related to kexec. Thanks Maneesh -- Maneesh Soni Linux Technology Center, IBM India Systems and Technology Lab, Bangalore, India - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [-mm patch] kernel/kexec.c: make code static
Hi Adrian, 2007/09/09 22:25:16 +0200, Adrian Bunk <[EMAIL PROTECTED]> wrote: >On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: >>... >> Changes since 2.6.23-rc3-mm1: >>... >> +add-vmcoreinfo.patch >>... >> misc >>... > >This patch makes the following needlessly global code static: >- vmcoreinfo_data[] >- vmcoreinfo_size >- vmcoreinfo_append_str() The kernel compiling fails with your patch because architecture-specific function should access the above data/function: # make [snip] arch/ia64/kernel/machine_kexec.c: In function 'arch_crash_save_vmcoreinfo': arch/ia64/kernel/machine_kexec.c:134: error: implicit declaration of function 'SYMBOL' arch/ia64/kernel/machine_kexec.c:135: error: implicit declaration of function 'LENGTH' arch/ia64/kernel/machine_kexec.c:139: error: implicit declaration of function 'SIZE' arch/ia64/kernel/machine_kexec.c:139: error: 'node_memblk_s' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:139: error: (Each undeclared identifier is reported only once arch/ia64/kernel/machine_kexec.c:139: error: for each function it appears in.) arch/ia64/kernel/machine_kexec.c:140: error: implicit declaration of function 'OFFSET' arch/ia64/kernel/machine_kexec.c:140: error: 'start_paddr' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:141: error: 'size' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:144: error: implicit declaration of function 'CONFIG' arch/ia64/kernel/machine_kexec.c:144: error: 'PGTABLE_3' undeclared (first use in this function) make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1 make: *** [arch/ia64/kernel] Error 2 # Thanks Ken'ichi Ohmichi - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[-mm patch] kernel/kexec.c: make code static
On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: >... > Changes since 2.6.23-rc3-mm1: >... > +add-vmcoreinfo.patch >... > misc >... This patch makes the following needlessly global code static: - vmcoreinfo_data[] - vmcoreinfo_size - vmcoreinfo_append_str() Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> --- include/linux/kexec.h | 14 --- kernel/kexec.c| 52 +- 2 files changed, 32 insertions(+), 34 deletions(-) e6dbb01497c12aa69b47914da4db1cfd23e9813e diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 99f2d6f..7cce357 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -123,21 +123,8 @@ int kexec_should_crash(struct task_struct *); void crash_save_cpu(struct pt_regs *regs, int cpu); void crash_save_vmcoreinfo(void); void arch_crash_save_vmcoreinfo(void); -void vmcoreinfo_append_str(const char *fmt, ...); unsigned long paddr_vmcoreinfo_note(void); -#define SYMBOL(name) \ - vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)) -#define SIZE(name) \ - vmcoreinfo_append_str("SIZE(%s)=%d\n", #name, sizeof(struct name)) -#define OFFSET(name, field) \ - vmcoreinfo_append_str("OFFSET(%s.%s)=%d\n", #name, #field, \ - &(((struct name *)0)->field)) -#define LENGTH(name, value) \ - vmcoreinfo_append_str("LENGTH(%s)=%d\n", #name, value) -#define CONFIG(name) \ - vmcoreinfo_append_str("CONFIG_%s=y\n", #name) - extern struct kimage *kexec_image; extern struct kimage *kexec_crash_image; @@ -177,7 +164,6 @@ extern struct resource crashk_res; typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; extern note_buf_t *crash_notes; extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; -extern unsigned int vmcoreinfo_size; extern unsigned int vmcoreinfo_max_size; diff --git a/kernel/kexec.c b/kernel/kexec.c index af2c035..c84a387 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -36,9 +36,9 @@ note_buf_t* crash_notes; /* vmcoreinfo stuff */ -unsigned char vmcoreinfo_data[VMCOREINFO_BYTES]; +static unsigned char vmcoreinfo_data[VMCOREINFO_BYTES]; u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; -unsigned int vmcoreinfo_size = 0; +static unsigned int vmcoreinfo_size = 0; unsigned int vmcoreinfo_max_size = sizeof(vmcoreinfo_data); /* Location of the reserved area for the crash kernel */ @@ -49,6 +49,36 @@ struct resource crashk_res = { .flags = IORESOURCE_BUSY | IORESOURCE_MEM }; +#define SYMBOL(name) \ + vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)) +#define SIZE(name) \ + vmcoreinfo_append_str("SIZE(%s)=%d\n", #name, sizeof(struct name)) +#define OFFSET(name, field) \ + vmcoreinfo_append_str("OFFSET(%s.%s)=%d\n", #name, #field, \ + &(((struct name *)0)->field)) +#define LENGTH(name, value) \ + vmcoreinfo_append_str("LENGTH(%s)=%d\n", #name, value) +#define CONFIG(name) \ + vmcoreinfo_append_str("CONFIG_%s=y\n", #name) + +static void vmcoreinfo_append_str(const char *fmt, ...) +{ + va_list args; + char buf[0x50]; + int r; + + va_start(args, fmt); + r = vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + if (r + vmcoreinfo_size > vmcoreinfo_max_size) + r = vmcoreinfo_max_size - vmcoreinfo_size; + + memcpy(_data[vmcoreinfo_size], buf, r); + + vmcoreinfo_size += r; +} + int kexec_should_crash(struct task_struct *p) { if (in_interrupt() || !p->pid || is_global_init(p) || panic_on_oops) @@ -1163,24 +1193,6 @@ void crash_save_vmcoreinfo(void) final_note(buf); } -void vmcoreinfo_append_str(const char *fmt, ...) -{ - va_list args; - char buf[0x50]; - int r; - - va_start(args, fmt); - r = vsnprintf(buf, sizeof(buf), fmt, args); - va_end(args); - - if (r + vmcoreinfo_size > vmcoreinfo_max_size) - r = vmcoreinfo_max_size - vmcoreinfo_size; - - memcpy(_data[vmcoreinfo_size], buf, r); - - vmcoreinfo_size += r; -} - /* * provide an empty default implementation here -- architecture * code may override this - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[-mm patch] kernel/kexec.c: make code static
On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: ... Changes since 2.6.23-rc3-mm1: ... +add-vmcoreinfo.patch ... misc ... This patch makes the following needlessly global code static: - vmcoreinfo_data[] - vmcoreinfo_size - vmcoreinfo_append_str() Signed-off-by: Adrian Bunk [EMAIL PROTECTED] --- include/linux/kexec.h | 14 --- kernel/kexec.c| 52 +- 2 files changed, 32 insertions(+), 34 deletions(-) e6dbb01497c12aa69b47914da4db1cfd23e9813e diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 99f2d6f..7cce357 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -123,21 +123,8 @@ int kexec_should_crash(struct task_struct *); void crash_save_cpu(struct pt_regs *regs, int cpu); void crash_save_vmcoreinfo(void); void arch_crash_save_vmcoreinfo(void); -void vmcoreinfo_append_str(const char *fmt, ...); unsigned long paddr_vmcoreinfo_note(void); -#define SYMBOL(name) \ - vmcoreinfo_append_str(SYMBOL(%s)=%lx\n, #name, (unsigned long)name) -#define SIZE(name) \ - vmcoreinfo_append_str(SIZE(%s)=%d\n, #name, sizeof(struct name)) -#define OFFSET(name, field) \ - vmcoreinfo_append_str(OFFSET(%s.%s)=%d\n, #name, #field, \ - (((struct name *)0)-field)) -#define LENGTH(name, value) \ - vmcoreinfo_append_str(LENGTH(%s)=%d\n, #name, value) -#define CONFIG(name) \ - vmcoreinfo_append_str(CONFIG_%s=y\n, #name) - extern struct kimage *kexec_image; extern struct kimage *kexec_crash_image; @@ -177,7 +164,6 @@ extern struct resource crashk_res; typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; extern note_buf_t *crash_notes; extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; -extern unsigned int vmcoreinfo_size; extern unsigned int vmcoreinfo_max_size; diff --git a/kernel/kexec.c b/kernel/kexec.c index af2c035..c84a387 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -36,9 +36,9 @@ note_buf_t* crash_notes; /* vmcoreinfo stuff */ -unsigned char vmcoreinfo_data[VMCOREINFO_BYTES]; +static unsigned char vmcoreinfo_data[VMCOREINFO_BYTES]; u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; -unsigned int vmcoreinfo_size = 0; +static unsigned int vmcoreinfo_size = 0; unsigned int vmcoreinfo_max_size = sizeof(vmcoreinfo_data); /* Location of the reserved area for the crash kernel */ @@ -49,6 +49,36 @@ struct resource crashk_res = { .flags = IORESOURCE_BUSY | IORESOURCE_MEM }; +#define SYMBOL(name) \ + vmcoreinfo_append_str(SYMBOL(%s)=%lx\n, #name, (unsigned long)name) +#define SIZE(name) \ + vmcoreinfo_append_str(SIZE(%s)=%d\n, #name, sizeof(struct name)) +#define OFFSET(name, field) \ + vmcoreinfo_append_str(OFFSET(%s.%s)=%d\n, #name, #field, \ + (((struct name *)0)-field)) +#define LENGTH(name, value) \ + vmcoreinfo_append_str(LENGTH(%s)=%d\n, #name, value) +#define CONFIG(name) \ + vmcoreinfo_append_str(CONFIG_%s=y\n, #name) + +static void vmcoreinfo_append_str(const char *fmt, ...) +{ + va_list args; + char buf[0x50]; + int r; + + va_start(args, fmt); + r = vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + if (r + vmcoreinfo_size vmcoreinfo_max_size) + r = vmcoreinfo_max_size - vmcoreinfo_size; + + memcpy(vmcoreinfo_data[vmcoreinfo_size], buf, r); + + vmcoreinfo_size += r; +} + int kexec_should_crash(struct task_struct *p) { if (in_interrupt() || !p-pid || is_global_init(p) || panic_on_oops) @@ -1163,24 +1193,6 @@ void crash_save_vmcoreinfo(void) final_note(buf); } -void vmcoreinfo_append_str(const char *fmt, ...) -{ - va_list args; - char buf[0x50]; - int r; - - va_start(args, fmt); - r = vsnprintf(buf, sizeof(buf), fmt, args); - va_end(args); - - if (r + vmcoreinfo_size vmcoreinfo_max_size) - r = vmcoreinfo_max_size - vmcoreinfo_size; - - memcpy(vmcoreinfo_data[vmcoreinfo_size], buf, r); - - vmcoreinfo_size += r; -} - /* * provide an empty default implementation here -- architecture * code may override this - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [-mm patch] kernel/kexec.c: make code static
Hi Adrian, 2007/09/09 22:25:16 +0200, Adrian Bunk [EMAIL PROTECTED] wrote: On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote: ... Changes since 2.6.23-rc3-mm1: ... +add-vmcoreinfo.patch ... misc ... This patch makes the following needlessly global code static: - vmcoreinfo_data[] - vmcoreinfo_size - vmcoreinfo_append_str() The kernel compiling fails with your patch because architecture-specific function should access the above data/function: # make [snip] arch/ia64/kernel/machine_kexec.c: In function 'arch_crash_save_vmcoreinfo': arch/ia64/kernel/machine_kexec.c:134: error: implicit declaration of function 'SYMBOL' arch/ia64/kernel/machine_kexec.c:135: error: implicit declaration of function 'LENGTH' arch/ia64/kernel/machine_kexec.c:139: error: implicit declaration of function 'SIZE' arch/ia64/kernel/machine_kexec.c:139: error: 'node_memblk_s' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:139: error: (Each undeclared identifier is reported only once arch/ia64/kernel/machine_kexec.c:139: error: for each function it appears in.) arch/ia64/kernel/machine_kexec.c:140: error: implicit declaration of function 'OFFSET' arch/ia64/kernel/machine_kexec.c:140: error: 'start_paddr' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:141: error: 'size' undeclared (first use in this function) arch/ia64/kernel/machine_kexec.c:144: error: implicit declaration of function 'CONFIG' arch/ia64/kernel/machine_kexec.c:144: error: 'PGTABLE_3' undeclared (first use in this function) make[1]: *** [arch/ia64/kernel/machine_kexec.o] Error 1 make: *** [arch/ia64/kernel] Error 2 # Thanks Ken'ichi Ohmichi - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/