Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

modpost: use bool type where appropriate

Use 'bool' to clarify that the valid value is true or false.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

+37 -38
+28 -28
scripts/mod/modpost.c
··· 23 23 #include "../../include/linux/license.h" 24 24 25 25 /* Are we using CONFIG_MODVERSIONS? */ 26 - static int modversions; 26 + static bool modversions; 27 27 /* Is CONFIG_MODULE_SRCVERSION_ALL set? */ 28 - static int all_versions; 28 + static bool all_versions; 29 29 /* If we are modposting external module set to 1 */ 30 - static int external_module; 30 + static bool external_module; 31 31 /* Only warn about unresolved symbols */ 32 - static int warn_unresolved; 32 + static bool warn_unresolved; 33 33 /* How a symbol is exported */ 34 34 static int sec_mismatch_count; 35 - static int sec_mismatch_warn_only = true; 35 + static bool sec_mismatch_warn_only = true; 36 36 /* ignore missing files */ 37 - static int ignore_missing_files; 37 + static bool ignore_missing_files; 38 38 /* If set to 1, only warn (instead of error) about missing ns imports */ 39 - static int allow_missing_ns_imports; 39 + static bool allow_missing_ns_imports; 40 40 41 41 static bool error_occurred; 42 42 ··· 202 202 struct symbol { 203 203 struct symbol *next; 204 204 struct module *module; 205 - unsigned int crc; 206 - int crc_valid; 207 205 char *namespace; 208 - unsigned int weak:1; 209 - unsigned int is_static:1; /* 1 if symbol is not global */ 206 + unsigned int crc; 207 + bool crc_valid; 208 + bool weak; 209 + bool is_static; /* true if symbol is not global */ 210 210 enum export export; /* Type of export */ 211 211 char name[]; 212 212 }; ··· 230 230 * Allocate a new symbols for use in the hash of exported symbols or 231 231 * the list of unresolved symbols per module 232 232 **/ 233 - static struct symbol *alloc_symbol(const char *name, unsigned int weak, 233 + static struct symbol *alloc_symbol(const char *name, bool weak, 234 234 struct symbol *next) 235 235 { 236 236 struct symbol *s = NOFAIL(malloc(sizeof(*s) + strlen(name) + 1)); ··· 239 239 strcpy(s->name, name); 240 240 s->weak = weak; 241 241 s->next = next; 242 - s->is_static = 1; 242 + s->is_static = true; 243 243 return s; 244 244 } 245 245 ··· 250 250 unsigned int hash; 251 251 252 252 hash = tdb_hash(name) % SYMBOL_HASH_SIZE; 253 - symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]); 253 + symbolhash[hash] = alloc_symbol(name, false, symbolhash[hash]); 254 254 255 255 return symbolhash[hash]; 256 256 } ··· 424 424 return; 425 425 426 426 s->crc = crc; 427 - s->crc_valid = 1; 427 + s->crc_valid = true; 428 428 } 429 429 430 430 static void *grab_file(const char *filename, size_t *size) ··· 721 721 sym_add_exported(name, mod, export); 722 722 } 723 723 if (strcmp(symname, "init_module") == 0) 724 - mod->has_init = 1; 724 + mod->has_init = true; 725 725 if (strcmp(symname, "cleanup_module") == 0) 726 - mod->has_cleanup = 1; 726 + mod->has_cleanup = true; 727 727 break; 728 728 } 729 729 } ··· 2058 2058 sym->st_name)); 2059 2059 2060 2060 if (s) 2061 - s->is_static = 0; 2061 + s->is_static = false; 2062 2062 } 2063 2063 } 2064 2064 ··· 2078 2078 * the automatic versioning doesn't pick it up, but it's really 2079 2079 * important anyhow */ 2080 2080 if (modversions) 2081 - mod->unres = alloc_symbol("module_layout", 0, mod->unres); 2081 + mod->unres = alloc_symbol("module_layout", false, mod->unres); 2082 2082 } 2083 2083 2084 2084 static void read_symbols_from_files(const char *filename) ··· 2310 2310 if (s->module->seen) 2311 2311 continue; 2312 2312 2313 - s->module->seen = 1; 2313 + s->module->seen = true; 2314 2314 p = strrchr(s->module->name, '/'); 2315 2315 if (p) 2316 2316 p++; ··· 2427 2427 mod = find_module(modname); 2428 2428 if (!mod) { 2429 2429 mod = new_module(modname); 2430 - mod->from_dump = 1; 2430 + mod->from_dump = true; 2431 2431 } 2432 2432 s = sym_add_exported(symname, mod, export_no(export)); 2433 - s->is_static = 0; 2433 + s->is_static = false; 2434 2434 sym_set_crc(symname, crc); 2435 2435 sym_update_namespace(symname, namespace); 2436 2436 } ··· 2508 2508 while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) { 2509 2509 switch (opt) { 2510 2510 case 'e': 2511 - external_module = 1; 2511 + external_module = true; 2512 2512 break; 2513 2513 case 'i': 2514 2514 *dump_read_iter = ··· 2517 2517 dump_read_iter = &(*dump_read_iter)->next; 2518 2518 break; 2519 2519 case 'm': 2520 - modversions = 1; 2520 + modversions = true; 2521 2521 break; 2522 2522 case 'n': 2523 - ignore_missing_files = 1; 2523 + ignore_missing_files = true; 2524 2524 break; 2525 2525 case 'o': 2526 2526 dump_write = optarg; 2527 2527 break; 2528 2528 case 'a': 2529 - all_versions = 1; 2529 + all_versions = true; 2530 2530 break; 2531 2531 case 'T': 2532 2532 files_source = optarg; 2533 2533 break; 2534 2534 case 'w': 2535 - warn_unresolved = 1; 2535 + warn_unresolved = true; 2536 2536 break; 2537 2537 case 'E': 2538 2538 sec_mismatch_warn_only = false; 2539 2539 break; 2540 2540 case 'N': 2541 - allow_missing_ns_imports = 1; 2541 + allow_missing_ns_imports = true; 2542 2542 break; 2543 2543 case 'd': 2544 2544 missing_namespace_deps = optarg;
+6 -5
scripts/mod/modpost.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 + #include <stdbool.h> 2 3 #include <stdio.h> 3 4 #include <stdlib.h> 4 5 #include <stdarg.h> ··· 114 113 struct module *next; 115 114 int gpl_compatible; 116 115 struct symbol *unres; 117 - int from_dump; /* 1 if module was loaded from *.symvers */ 118 - int is_vmlinux; 119 - int seen; 120 - int has_init; 121 - int has_cleanup; 116 + bool from_dump; /* true if module was loaded from *.symvers */ 117 + bool is_vmlinux; 118 + bool seen; 119 + bool has_init; 120 + bool has_cleanup; 122 121 struct buffer dev_table_buf; 123 122 char srcversion[25]; 124 123 // Missing namespace dependencies
+3 -5
scripts/mod/sumversion.c
··· 290 290 return 1; 291 291 } 292 292 /* Check whether the file is a static library or not */ 293 - static int is_static_library(const char *objfile) 293 + static bool is_static_library(const char *objfile) 294 294 { 295 295 int len = strlen(objfile); 296 - if (objfile[len - 2] == '.' && objfile[len - 1] == 'a') 297 - return 1; 298 - else 299 - return 0; 296 + 297 + return objfile[len - 2] == '.' && objfile[len - 1] == 'a'; 300 298 } 301 299 302 300 /* We have dir/file.o. Open dir/.file.o.cmd, look for source_ and deps_ line