aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-01-28 11:19:35 -0500
committerSam Ravnborg <sam@mars.ravnborg.org>2006-02-19 03:51:17 -0500
commit5c3ead8c72788d36d34c9f1689fb529d1339b405 (patch)
treefe6cfc38c3a210ad403970c59c001e5b746b8053 /scripts
parentcb80514d9c517cc1d101ef304529a0e9b76b4468 (diff)
kbuild: apply CodingStyle to modpost.c
Just some light CodingStyle updates - no functional changes. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/modpost.c124
1 files changed, 54 insertions, 70 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index a3c57ec7d54a..4a2f2e38d27f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -21,8 +21,7 @@ int have_vmlinux = 0;
21/* Is CONFIG_MODULE_SRCVERSION_ALL set? */ 21/* Is CONFIG_MODULE_SRCVERSION_ALL set? */
22static int all_versions = 0; 22static int all_versions = 0;
23 23
24void 24void fatal(const char *fmt, ...)
25fatal(const char *fmt, ...)
26{ 25{
27 va_list arglist; 26 va_list arglist;
28 27
@@ -35,8 +34,7 @@ fatal(const char *fmt, ...)
35 exit(1); 34 exit(1);
36} 35}
37 36
38void 37void warn(const char *fmt, ...)
39warn(const char *fmt, ...)
40{ 38{
41 va_list arglist; 39 va_list arglist;
42 40
@@ -59,8 +57,7 @@ void *do_nofail(void *ptr, const char *expr)
59 57
60static struct module *modules; 58static struct module *modules;
61 59
62struct module * 60static struct module *find_module(char *modname)
63find_module(char *modname)
64{ 61{
65 struct module *mod; 62 struct module *mod;
66 63
@@ -70,8 +67,7 @@ find_module(char *modname)
70 return mod; 67 return mod;
71} 68}
72 69
73struct module * 70static struct module *new_module(char *modname)
74new_module(char *modname)
75{ 71{
76 struct module *mod; 72 struct module *mod;
77 char *p, *s; 73 char *p, *s;
@@ -122,11 +118,12 @@ static inline unsigned int tdb_hash(const char *name)
122 return (1103515243 * value + 12345); 118 return (1103515243 * value + 12345);
123} 119}
124 120
125/* Allocate a new symbols for use in the hash of exported symbols or 121/**
126 * the list of unresolved symbols per module */ 122 * Allocate a new symbols for use in the hash of exported symbols or
127 123 * the list of unresolved symbols per module
128struct symbol * 124 **/
129alloc_symbol(const char *name, unsigned int weak, struct symbol *next) 125static struct symbol *alloc_symbol(const char *name, unsigned int weak,
126 struct symbol *next)
130{ 127{
131 struct symbol *s = NOFAIL(malloc(sizeof(*s) + strlen(name) + 1)); 128 struct symbol *s = NOFAIL(malloc(sizeof(*s) + strlen(name) + 1));
132 129
@@ -138,9 +135,8 @@ alloc_symbol(const char *name, unsigned int weak, struct symbol *next)
138} 135}
139 136
140/* For the hash of exported symbols */ 137/* For the hash of exported symbols */
141 138static void new_symbol(const char *name, struct module *module,
142void 139 unsigned int *crc)
143new_symbol(const char *name, struct module *module, unsigned int *crc)
144{ 140{
145 unsigned int hash; 141 unsigned int hash;
146 struct symbol *new; 142 struct symbol *new;
@@ -154,8 +150,7 @@ new_symbol(const char *name, struct module *module, unsigned int *crc)
154 } 150 }
155} 151}
156 152
157struct symbol * 153static struct symbol *find_symbol(const char *name)
158find_symbol(const char *name)
159{ 154{
160 struct symbol *s; 155 struct symbol *s;
161 156
@@ -170,10 +165,12 @@ find_symbol(const char *name)
170 return NULL; 165 return NULL;
171} 166}
172 167
173/* Add an exported symbol - it may have already been added without a 168/**
174 * CRC, in this case just update the CRC */ 169 * Add an exported symbol - it may have already been added without a
175void 170 * CRC, in this case just update the CRC
176add_exported_symbol(const char *name, struct module *module, unsigned int *crc) 171 **/
172static void add_exported_symbol(const char *name, struct module *module,
173 unsigned int *crc)
177{ 174{
178 struct symbol *s = find_symbol(name); 175 struct symbol *s = find_symbol(name);
179 176
@@ -187,8 +184,7 @@ add_exported_symbol(const char *name, struct module *module, unsigned int *crc)
187 } 184 }
188} 185}
189 186
190void * 187void *grab_file(const char *filename, unsigned long *size)
191grab_file(const char *filename, unsigned long *size)
192{ 188{
193 struct stat st; 189 struct stat st;
194 void *map; 190 void *map;
@@ -207,13 +203,12 @@ grab_file(const char *filename, unsigned long *size)
207 return map; 203 return map;
208} 204}
209 205
210/* 206/**
211 Return a copy of the next line in a mmap'ed file. 207 * Return a copy of the next line in a mmap'ed file.
212 spaces in the beginning of the line is trimmed away. 208 * spaces in the beginning of the line is trimmed away.
213 Return a pointer to a static buffer. 209 * Return a pointer to a static buffer.
214*/ 210 **/
215char* 211char* get_next_line(unsigned long *pos, void *file, unsigned long size)
216get_next_line(unsigned long *pos, void *file, unsigned long size)
217{ 212{
218 static char line[4096]; 213 static char line[4096];
219 int skip = 1; 214 int skip = 1;
@@ -243,14 +238,12 @@ get_next_line(unsigned long *pos, void *file, unsigned long size)
243 return NULL; 238 return NULL;
244} 239}
245 240
246void 241void release_file(void *file, unsigned long size)
247release_file(void *file, unsigned long size)
248{ 242{
249 munmap(file, size); 243 munmap(file, size);
250} 244}
251 245
252void 246static void parse_elf(struct elf_info *info, const char *filename)
253parse_elf(struct elf_info *info, const char *filename)
254{ 247{
255 unsigned int i; 248 unsigned int i;
256 Elf_Ehdr *hdr = info->hdr; 249 Elf_Ehdr *hdr = info->hdr;
@@ -318,8 +311,7 @@ parse_elf(struct elf_info *info, const char *filename)
318 fatal("%s is truncated.\n", filename); 311 fatal("%s is truncated.\n", filename);
319} 312}
320 313
321void 314static void parse_elf_finish(struct elf_info *info)
322parse_elf_finish(struct elf_info *info)
323{ 315{
324 release_file(info->hdr, info->size); 316 release_file(info->hdr, info->size);
325} 317}
@@ -327,9 +319,8 @@ parse_elf_finish(struct elf_info *info)
327#define CRC_PFX "__crc_" 319#define CRC_PFX "__crc_"
328#define KSYMTAB_PFX "__ksymtab_" 320#define KSYMTAB_PFX "__ksymtab_"
329 321
330void 322static void handle_modversions(struct module *mod, struct elf_info *info,
331handle_modversions(struct module *mod, struct elf_info *info, 323 Elf_Sym *sym, const char *symname)
332 Elf_Sym *sym, const char *symname)
333{ 324{
334 unsigned int crc; 325 unsigned int crc;
335 326
@@ -397,8 +388,7 @@ handle_modversions(struct module *mod, struct elf_info *info,
397 } 388 }
398} 389}
399 390
400int 391static int is_vmlinux(const char *modname)
401is_vmlinux(const char *modname)
402{ 392{
403 const char *myname; 393 const char *myname;
404 394
@@ -410,7 +400,9 @@ is_vmlinux(const char *modname)
410 return strcmp(myname, "vmlinux") == 0; 400 return strcmp(myname, "vmlinux") == 0;
411} 401}
412 402
413/* Parse tag=value strings from .modinfo section */ 403/**