Commit d768281e97a403815467102bc4b677f6c425a42b

Authored by Ken'ichi Ohmichi
Committed by Linus Torvalds
1 parent fd59d231f8

add-vmcore: cleanup the coding style according to Andrew's comments

[1/3] Cleanup the coding style according to Andrew's comments:
http://lists.infradead.org/pipermail/kexec/2007-August/000522.html
- vmcoreinfo_append_str() should have suitable __attribute__s so that
  the compiler can check its use.
- vmcoreinfo_max_size should have size_t.
- Use get_seconds() instead of xtime.tv_sec.
- Use init_uts_ns.name.release instead of UTS_RELEASE.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 15 additions and 13 deletions Side-by-side Diff

include/linux/kexec.h
... ... @@ -123,18 +123,20 @@
123 123 void crash_save_cpu(struct pt_regs *regs, int cpu);
124 124 void crash_save_vmcoreinfo(void);
125 125 void arch_crash_save_vmcoreinfo(void);
126   -void vmcoreinfo_append_str(const char *fmt, ...);
  126 +void vmcoreinfo_append_str(const char *fmt, ...)
  127 + __attribute__ ((format (printf, 1, 2)));
127 128 unsigned long paddr_vmcoreinfo_note(void);
128 129  
129 130 #define SYMBOL(name) \
130 131 vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
131 132 #define SIZE(name) \
132   - vmcoreinfo_append_str("SIZE(%s)=%d\n", #name, sizeof(struct name))
  133 + vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
  134 + (unsigned long)sizeof(struct name))
133 135 #define OFFSET(name, field) \
134   - vmcoreinfo_append_str("OFFSET(%s.%s)=%d\n", #name, #field, \
135   - &(((struct name *)0)->field))
  136 + vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
  137 + (unsigned long)&(((struct name *)0)->field))
136 138 #define LENGTH(name, value) \
137   - vmcoreinfo_append_str("LENGTH(%s)=%d\n", #name, value)
  139 + vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
138 140 #define CONFIG(name) \
139 141 vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
140 142  
... ... @@ -177,8 +179,8 @@
177 179 typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
178 180 extern note_buf_t *crash_notes;
179 181 extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
180   -extern unsigned int vmcoreinfo_size;
181   -extern unsigned int vmcoreinfo_max_size;
  182 +extern size_t vmcoreinfo_size;
  183 +extern size_t vmcoreinfo_max_size;
182 184  
183 185  
184 186 #else /* !CONFIG_KEXEC */
... ... @@ -38,8 +38,8 @@
38 38 /* vmcoreinfo stuff */
39 39 unsigned char vmcoreinfo_data[VMCOREINFO_BYTES];
40 40 u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
41   -unsigned int vmcoreinfo_size = 0;
42   -unsigned int vmcoreinfo_max_size = sizeof(vmcoreinfo_data);
  41 +size_t vmcoreinfo_size;
  42 +size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data);
43 43  
44 44 /* Location of the reserved area for the crash kernel */
45 45 struct resource crashk_res = {
... ... @@ -1153,7 +1153,7 @@
1153 1153 if (!vmcoreinfo_size)
1154 1154 return;
1155 1155  
1156   - vmcoreinfo_append_str("CRASHTIME=%d", xtime.tv_sec);
  1156 + vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds());
1157 1157  
1158 1158 buf = (u32 *)vmcoreinfo_note;
1159 1159  
... ... @@ -1195,8 +1195,8 @@
1195 1195  
1196 1196 static int __init crash_save_vmcoreinfo_init(void)
1197 1197 {
1198   - vmcoreinfo_append_str("OSRELEASE=%s\n", UTS_RELEASE);
1199   - vmcoreinfo_append_str("PAGESIZE=%d\n", PAGE_SIZE);
  1198 + vmcoreinfo_append_str("OSRELEASE=%s\n", init_uts_ns.name.release);
  1199 + vmcoreinfo_append_str("PAGESIZE=%ld\n", PAGE_SIZE);
1200 1200  
1201 1201 SYMBOL(init_uts_ns);
1202 1202 SYMBOL(node_online_map);
... ... @@ -66,7 +66,7 @@
66 66 {
67 67 return sprintf(page, "%lx %x\n",
68 68 paddr_vmcoreinfo_note(),
69   - vmcoreinfo_max_size);
  69 + (unsigned int)vmcoreinfo_max_size);
70 70 }
71 71 KERNEL_ATTR_RO(vmcoreinfo);
72 72