diff options
| author | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-01-28 11:19:35 -0500 |
|---|---|---|
| committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-02-19 03:51:17 -0500 |
| commit | 5c3ead8c72788d36d34c9f1689fb529d1339b405 (patch) | |
| tree | fe6cfc38c3a210ad403970c59c001e5b746b8053 /scripts | |
| parent | cb80514d9c517cc1d101ef304529a0e9b76b4468 (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.c | 124 |
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? */ |
| 22 | static int all_versions = 0; | 22 | static int all_versions = 0; |
| 23 | 23 | ||
| 24 | void | 24 | void fatal(const char *fmt, ...) |
| 25 | fatal(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 | ||
| 38 | void | 37 | void warn(const char *fmt, ...) |
| 39 | warn(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 | ||
| 60 | static struct module *modules; | 58 | static struct module *modules; |
| 61 | 59 | ||
| 62 | struct module * | 60 | static struct module *find_module(char *modname) |
| 63 | find_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 | ||
| 73 | struct module * | 70 | static struct module *new_module(char *modname) |
| 74 | new_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 | |
| 128 | struct symbol * | 124 | **/ |
| 129 | alloc_symbol(const char *name, unsigned int weak, struct symbol *next) | 125 | static 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 | 138 | static void new_symbol(const char *name, struct module *module, | |
| 142 | void | 139 | unsigned int *crc) |
| 143 | new_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 | ||
| 157 | struct symbol * | 153 | static struct symbol *find_symbol(const char *name) |
| 158 | find_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 |
| 175 | void | 170 | * CRC, in this case just update the CRC |
| 176 | add_exported_symbol(const char *name, struct module *module, unsigned int *crc) | 171 | **/ |
| 172 | static 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 | ||
| 190 | void * | 187 | void *grab_file(const char *filename, unsigned long *size) |
| 191 | grab_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 | **/ |
| 215 | char* | 211 | char* get_next_line(unsigned long *pos, void *file, unsigned long size) |
| 216 | get_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 | ||
| 246 | void | 241 | void release_file(void *file, unsigned long size) |
| 247 | release_file(void *file, unsigned long size) | ||
| 248 | { | 242 | { |
| 249 | munmap(file, size); | 243 | munmap(file, size); |
| 250 | } | 244 | } |
| 251 | 245 | ||
| 252 | void | 246 | static void parse_elf(struct elf_info *info, const char *filename) |
| 253 | parse_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 | ||
| 321 | void | 314 | static void parse_elf_finish(struct elf_info *info) |
| 322 | parse_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 | ||
| 330 | void | 322 | static void handle_modversions(struct module *mod, struct elf_info *info, |
| 331 | handle_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 | ||
| 400 | int | 391 | static int is_vmlinux(const char *modname) |
| 401 | is_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 | /** |
