diff options
Diffstat (limited to 'modutils/insmod.c')
-rw-r--r-- | modutils/insmod.c | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index 0963225..0b12c69 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -78,7 +78,7 @@ #ifndef MODUTILS_MODULE_H #define MODUTILS_MODULE_H 1 -#ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $" +#ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $" /* This file contains the structures used by the 2.0 and 2.1 kernels. We do not use the kernel headers directly because we do not wish @@ -284,7 +284,7 @@ int delete_module(const char *); #ifndef MODUTILS_OBJ_H #define MODUTILS_OBJ_H 1 -#ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $" +#ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $" /* The relocatable object is manipulated using elfin types. */ @@ -1157,7 +1157,7 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, /* Don't report an error if the symbol is coming from the kernel or some external module. */ if (secidx <= SHN_HIRESERVE) - errorMsg("%s multiply defined\n", name); + error_msg("%s multiply defined\n", name); return sym; } } @@ -1420,7 +1420,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) /* Also check that the parameter was not resolved from the kernel. */ if (sym == NULL || sym->secidx > SHN_HIRESERVE) { - errorMsg("symbol for parameter %s not found\n", p); + error_msg("symbol for parameter %s not found\n", p); return 0; } @@ -1433,7 +1433,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) str = alloca(strlen(q)); for (r = str, q++; *q != '"'; ++q, ++r) { if (*q == '\0') { - errorMsg("improperly terminated string argument for %s\n", p); + error_msg("improperly terminated string argument for %s\n", p); return 0; } else if (*q == '\\') switch (*++q) { @@ -1562,7 +1562,7 @@ static int old_get_kernel_symbols(const char *m_name) nks = get_kernel_syms(NULL); if (nks < 0) { - errorMsg("get_kernel_syms: %s: %s\n", m_name, strerror(errno)); + error_msg("get_kernel_syms: %s: %s\n", m_name, strerror(errno)); return 0; } @@ -1743,7 +1743,7 @@ old_init_module(const char *m_name, struct obj_file *f, m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN : 0), &routines, symtab); if (ret) - errorMsg("init_module: %s: %s\n", m_name, strerror(errno)); + error_msg("init_module: %s: %s\n", m_name, strerror(errno)); free(image); free(symtab); @@ -1786,7 +1786,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) p = get_modinfo_value(f, key); key += 5; if (p == NULL) { - errorMsg("invalid parameter %s\n", key); + error_msg("invalid parameter %s\n", key); return 0; } @@ -1794,7 +1794,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) /* Also check that the parameter was not resolved from the kernel. */ if (sym == NULL || sym->secidx > SHN_HIRESERVE) { - errorMsg("symbol for parameter %s not found\n", key); + error_msg("symbol for parameter %s not found\n", key); return 0; } @@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) str = alloca(strlen(q)); for (r = str, q++; *q != '"'; ++q, ++r) { if (*q == '\0') { - errorMsg("improperly terminated string argument for %s\n", + error_msg("improperly terminated string argument for %s\n", key); return 0; } else if (*q == '\\') @@ -1916,7 +1916,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) /* Get the size of each member */ /* Probably we should do that outside the loop ? */ if (!isdigit(*(p + 1))) { - errorMsg("parameter type 'c' for %s must be followed by" + error_msg("parameter type 'c' for %s must be followed by" " the maximum size\n", key); return 0; } @@ -1924,7 +1924,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) /* Check length */ if (strlen(str) >= charssize) { - errorMsg("string too long for %s (max %ld)\n", key, + error_msg("string too long for %s (max %ld)\n", key, charssize - 1); return 0; } @@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) break; default: - errorMsg("unknown parameter type '%c' for %s\n", *p, key); + error_msg("unknown parameter type '%c' for %s\n", *p, key); return 0; } } @@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) case ',': if (++n > max) { - errorMsg("too many values for %s (max %d)\n", key, max); + error_msg("too many values for %s (max %d)\n", key, max); return 0; } ++q; break; default: - errorMsg("invalid argument syntax for %s\n", key); + error_msg("invalid argument syntax for %s\n", key); return 0; } } end_of_arg: if (n < min) { - errorMsg("too few values for %s (min %d)\n", key, min); + error_msg("too few values for %s (min %d)\n", key, min); return 0; } @@ -2055,7 +2055,7 @@ static int new_get_kernel_symbols(void) module_names = xrealloc(module_names, bufsize = ret); goto retry_modules_load; } - errorMsg("QM_MODULES: %s\n", strerror(errno)); + error_msg("QM_MODULES: %s\n", strerror(errno)); return 0; } @@ -2074,7 +2074,7 @@ static int new_get_kernel_symbols(void) /* The module was removed out from underneath us. */ continue; } - errorMsg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno)); + error_msg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno)); return 0; } @@ -2089,7 +2089,7 @@ static int new_get_kernel_symbols(void) /* The module was removed out from underneath us. */ continue; default: - errorMsg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno)); + error_msg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno)); return 0; } } @@ -2114,7 +2114,7 @@ static int new_get_kernel_symbols(void) syms = xrealloc(syms, bufsize = ret); goto retry_kern_sym_load; } - errorMsg("kernel: QM_SYMBOLS: %s\n", strerror(errno)); + error_msg("kernel: QM_SYMBOLS: %s\n", strerror(errno)); return 0; } nksyms = nsyms = ret; @@ -2295,7 +2295,7 @@ new_init_module(const char *m_name, struct obj_file *f, ret = new_sys_init_module(m_name, (struct new_module *) image); if (ret) - errorMsg("init_module: %s: %s\n", m_name, strerror(errno)); + error_msg("init_module: %s: %s\n", m_name, strerror(errno)); free(image); @@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f) sym->secidx = SHN_ABS; sym->value = 0; } else { - errorMsg("unresolved symbol %s\n", sym->name); + error_msg("unresolved symbol %s\n", sym->name); ret = 0; } } @@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base) errmsg = "Unhandled relocation"; bad_reloc: if (extsym) { - errorMsg("%s of type %ld for %s\n", errmsg, + error_msg("%s of type %ld for %s\n", errmsg, (long) ELFW(R_TYPE) (rel->r_info), strtab + extsym->st_name); } else { - errorMsg("%s of type %ld\n", errmsg, + error_msg("%s of type %ld\n", errmsg, (long) ELFW(R_TYPE) (rel->r_info)); } ret = 0; @@ -2680,7 +2680,7 @@ struct obj_file *obj_load(FILE * fp) fseek(fp, 0, SEEK_SET); if (fread(&f->header, sizeof(f->header), 1, fp) != 1) { - errorMsg("error reading ELF header: %s\n", strerror(errno)); + error_msg("error reading ELF header: %s\n", strerror(errno)); return NULL; } @@ -2688,25 +2688,25 @@ struct obj_file *obj_load(FILE * fp) || f->header.e_ident[EI_MAG1] != ELFMAG1 || f->header.e_ident[EI_MAG2] != ELFMAG2 || f->header.e_ident[EI_MAG3] != ELFMAG3) { - errorMsg("not an ELF file\n"); + error_msg("not an ELF file\n"); return NULL; } if (f->header.e_ident[EI_CLASS] != ELFCLASSM || f->header.e_ident[EI_DATA] != ELFDATAM || f->header.e_ident[EI_VERSION] != EV_CURRENT || !MATCH_MACHINE(f->header.e_machine)) { - errorMsg("ELF file not for this architecture\n"); + error_msg("ELF file not for this architecture\n"); return NULL; } if (f->header.e_type != ET_REL) { - errorMsg("ELF file not a relocatable object\n"); + error_msg("ELF file not a relocatable object\n"); return NULL; } /* Read the section headers. */ if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { - errorMsg("section header size mismatch: %lu != %lu\n", + error_msg("section header size mismatch: %lu != %lu\n", (unsigned long) f->header.e_shentsize, (unsigned long) sizeof(ElfW(Shdr))); return NULL; @@ -2719,7 +2719,7 @@ struct obj_file *obj_load(FILE * fp) section_headers = alloca(sizeof(ElfW(Shdr)) * shnum); fseek(fp, f->header.e_shoff, SEEK_SET); if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) { - errorMsg("error reading ELF section headers: %s\n", strerror(errno)); + error_msg("error reading ELF section headers: %s\n", strerror(errno)); return NULL; } @@ -2749,7 +2749,7 @@ struct obj_file *obj_load(FILE * fp) sec->contents = xmalloc(sec->header.sh_size); fseek(fp, sec->header.sh_offset, SEEK_SET); if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) { - errorMsg("error reading ELF section data: %s\n", strerror(errno)); + error_msg("error reading ELF section data: %s\n", strerror(errno)); return NULL; } } else { @@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp) #if SHT_RELM == SHT_REL case SHT_RELA: - errorMsg("RELA relocations not supported on this architecture\n"); + error_msg("RELA relocations not supported on this architecture\n"); return NULL; #else case SHT_REL: - errorMsg("REL relocations not supported on this architecture\n"); + error_msg("REL relocations not supported on this architecture\n"); return NULL; #endif @@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp) break; } - errorMsg("can't handle sections of type %ld\n", + error_msg("can't handle sections of type %ld\n", (long) sec->header.sh_type); return NULL; } @@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp) ElfW(Sym) * sym; if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { - errorMsg("symbol size mismatch: %lu != %lu\n", + error_msg("symbol size mismatch: %lu != %lu\n", (unsigned long) sec->header.sh_entsize, (unsigned long) sizeof(ElfW(Sym))); return NULL; @@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp) case SHT_RELM: if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { - errorMsg("relocation entry size mismatch: %lu != %lu\n", + error_msg("relocation entry size mismatch: %lu != %lu\n", (unsigned long) sec->header.sh_entsize, (unsigned long) sizeof(ElfW(RelM))); return NULL; @@ -2937,17 +2937,17 @@ extern int insmod_main( int argc, char **argv) /* Get a filedesc for the module */ if ((fp = fopen(*argv, "r")) == NULL) { /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ - if (recursiveAction(_PATH_MODULES, TRUE, FALSE, FALSE, + if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE, findNamedModule, 0, m_fullName) == FALSE) { if (m_filename[0] == '\0' || ((fp = fopen(m_filename, "r")) == NULL)) { - errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); + error_msg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); return EXIT_FAILURE; } } else - fatalError("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); + error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); } else memcpy(m_filename, *argv, strlen(*argv)); @@ -2971,7 +2971,7 @@ extern int insmod_main( int argc, char **argv) } else { m_version = old_get_module_version(f, m_strversion); if (m_version == -1) { - errorMsg("couldn't find the kernel version the module was " + error_msg("couldn't find the kernel version the module was " "compiled for\n"); goto out; } @@ -2979,12 +2979,12 @@ extern int insmod_main( int argc, char **argv) if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) { if (flag_force_load) { - errorMsg("Warning: kernel-module version mismatch\n" + error_msg("Warning: kernel-module version mismatch\n" "\t%s was compiled for kernel version %s\n" "\twhile this kernel is version %s\n", m_filename, m_strversion, k_strversion); } else { - errorMsg("kernel-module version mismatch\n" + error_msg("kernel-module version mismatch\n" "\t%s was compiled for kernel version %s\n" "\twhile this kernel is version %s.\n", m_filename, m_strversion, k_strversion); @@ -3002,7 +3002,7 @@ extern int insmod_main( int argc, char **argv) goto out; k_crcs = new_is_kernel_checksummed(); #else - errorMsg("Not configured to support new kernels\n"); + error_msg("Not configured to support new kernels\n"); goto out; #endif } else { @@ -3011,7 +3011,7 @@ extern int insmod_main( int argc, char **argv) goto out; k_crcs = old_is_kernel_checksummed(); #else - errorMsg("Not configured to support old kernels\n"); + error_msg("Not configured to support old kernels\n"); goto out; #endif } @@ -3068,14 +3068,14 @@ extern int insmod_main( int argc, char **argv) case 0: break; case EEXIST: - errorMsg("A module named %s already exists\n", m_name); + error_msg("A module named %s already exists\n", m_name); goto out; case ENOMEM: - errorMsg("Can't allocate kernel memory for module; needed %lu bytes\n", + error_msg("Can't allocate kernel memory for module; needed %lu bytes\n", m_size); goto out; default: - errorMsg("create_module: %s: %s\n", m_name, strerror(errno)); + error_msg("create_module: %s: %s\n", m_name, strerror(errno)); goto out; } |