diff options
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/insmod.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index 57a152c01..e55d9fafb 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -81,7 +81,7 @@ | |||
81 | #ifndef MODUTILS_MODULE_H | 81 | #ifndef MODUTILS_MODULE_H |
82 | static const int MODUTILS_MODULE_H = 1; | 82 | static const int MODUTILS_MODULE_H = 1; |
83 | 83 | ||
84 | #ident "$Id: insmod.c,v 1.44 2001/01/27 09:33:38 andersen Exp $" | 84 | #ident "$Id: insmod.c,v 1.45 2001/01/31 19:00:21 kraai Exp $" |
85 | 85 | ||
86 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 86 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
87 | We do not use the kernel headers directly because we do not wish | 87 | We do not use the kernel headers directly because we do not wish |
@@ -287,7 +287,7 @@ int delete_module(const char *); | |||
287 | #ifndef MODUTILS_OBJ_H | 287 | #ifndef MODUTILS_OBJ_H |
288 | static const int MODUTILS_OBJ_H = 1; | 288 | static const int MODUTILS_OBJ_H = 1; |
289 | 289 | ||
290 | #ident "$Id: insmod.c,v 1.44 2001/01/27 09:33:38 andersen Exp $" | 290 | #ident "$Id: insmod.c,v 1.45 2001/01/31 19:00:21 kraai Exp $" |
291 | 291 | ||
292 | /* The relocatable object is manipulated using elfin types. */ | 292 | /* The relocatable object is manipulated using elfin types. */ |
293 | 293 | ||
@@ -1156,7 +1156,7 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, | |||
1156 | /* Don't report an error if the symbol is coming from | 1156 | /* Don't report an error if the symbol is coming from |
1157 | the kernel or some external module. */ | 1157 | the kernel or some external module. */ |
1158 | if (secidx <= SHN_HIRESERVE) | 1158 | if (secidx <= SHN_HIRESERVE) |
1159 | error_msg("%s multiply defined\n", name); | 1159 | error_msg("%s multiply defined", name); |
1160 | return sym; | 1160 | return sym; |
1161 | } | 1161 | } |
1162 | } | 1162 | } |
@@ -1419,7 +1419,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1419 | 1419 | ||
1420 | /* Also check that the parameter was not resolved from the kernel. */ | 1420 | /* Also check that the parameter was not resolved from the kernel. */ |
1421 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1421 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1422 | error_msg("symbol for parameter %s not found\n", p); | 1422 | error_msg("symbol for parameter %s not found", p); |
1423 | return 0; | 1423 | return 0; |
1424 | } | 1424 | } |
1425 | 1425 | ||
@@ -1432,7 +1432,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1432 | str = alloca(strlen(q)); | 1432 | str = alloca(strlen(q)); |
1433 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1433 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1434 | if (*q == '\0') { | 1434 | if (*q == '\0') { |
1435 | error_msg("improperly terminated string argument for %s\n", p); | 1435 | error_msg("improperly terminated string argument for %s", p); |
1436 | return 0; | 1436 | return 0; |
1437 | } else if (*q == '\\') | 1437 | } else if (*q == '\\') |
1438 | switch (*++q) { | 1438 | switch (*++q) { |
@@ -1786,7 +1786,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1786 | p = get_modinfo_value(f, key); | 1786 | p = get_modinfo_value(f, key); |
1787 | key += 5; | 1787 | key += 5; |
1788 | if (p == NULL) { | 1788 | if (p == NULL) { |
1789 | error_msg("invalid parameter %s\n", key); | 1789 | error_msg("invalid parameter %s", key); |
1790 | return 0; | 1790 | return 0; |
1791 | } | 1791 | } |
1792 | 1792 | ||
@@ -1794,7 +1794,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1794 | 1794 | ||
1795 | /* Also check that the parameter was not resolved from the kernel. */ | 1795 | /* Also check that the parameter was not resolved from the kernel. */ |
1796 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1796 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1797 | error_msg("symbol for parameter %s not found\n", key); | 1797 | error_msg("symbol for parameter %s not found", key); |
1798 | return 0; | 1798 | return 0; |
1799 | } | 1799 | } |
1800 | 1800 | ||
@@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1822 | str = alloca(strlen(q)); | 1822 | str = alloca(strlen(q)); |
1823 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1823 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1824 | if (*q == '\0') { | 1824 | if (*q == '\0') { |
1825 | error_msg("improperly terminated string argument for %s\n", | 1825 | error_msg("improperly terminated string argument for %s", |
1826 | key); | 1826 | key); |
1827 | return 0; | 1827 | return 0; |
1828 | } else if (*q == '\\') | 1828 | } else if (*q == '\\') |
@@ -1917,14 +1917,14 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1917 | /* Probably we should do that outside the loop ? */ | 1917 | /* Probably we should do that outside the loop ? */ |
1918 | if (!isdigit(*(p + 1))) { | 1918 | if (!isdigit(*(p + 1))) { |
1919 | error_msg("parameter type 'c' for %s must be followed by" | 1919 | error_msg("parameter type 'c' for %s must be followed by" |
1920 | " the maximum size\n", key); | 1920 | " the maximum size", key); |
1921 | return 0; | 1921 | return 0; |
1922 | } | 1922 | } |
1923 | charssize = strtoul(p + 1, (char **) NULL, 10); | 1923 | charssize = strtoul(p + 1, (char **) NULL, 10); |
1924 | 1924 | ||
1925 | /* Check length */ | 1925 | /* Check length */ |
1926 | if (strlen(str) >= charssize) { | 1926 | if (strlen(str) >= charssize) { |
1927 | error_msg("string too long for %s (max %ld)\n", key, | 1927 | error_msg("string too long for %s (max %ld)", key, |
1928 | charssize - 1); | 1928 | charssize - 1); |
1929 | return 0; | 1929 | return 0; |
1930 | } | 1930 | } |
@@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1953 | break; | 1953 | break; |
1954 | 1954 | ||
1955 | default: | 1955 | default: |
1956 | error_msg("unknown parameter type '%c' for %s\n", *p, key); | 1956 | error_msg("unknown parameter type '%c' for %s", *p, key); |
1957 | return 0; | 1957 | return 0; |
1958 | } | 1958 | } |
1959 | } | 1959 | } |
@@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1972 | 1972 | ||
1973 | case ',': | 1973 | case ',': |
1974 | if (++n > max) { | 1974 | if (++n > max) { |
1975 | error_msg("too many values for %s (max %d)\n", key, max); | 1975 | error_msg("too many values for %s (max %d)", key, max); |
1976 | return 0; | 1976 | return 0; |
1977 | } | 1977 | } |
1978 | ++q; | 1978 | ++q; |
1979 | break; | 1979 | break; |
1980 | 1980 | ||
1981 | default: | 1981 | default: |
1982 | error_msg("invalid argument syntax for %s\n", key); | 1982 | error_msg("invalid argument syntax for %s", key); |
1983 | return 0; | 1983 | return 0; |
1984 | } | 1984 | } |
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | end_of_arg: | 1987 | end_of_arg: |
1988 | if (n < min) { | 1988 | if (n < min) { |
1989 | error_msg("too few values for %s (min %d)\n", key, min); | 1989 | error_msg("too few values for %s (min %d)", key, min); |
1990 | return 0; | 1990 | return 0; |
1991 | } | 1991 | } |
1992 | 1992 | ||
@@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f) | |||
2372 | sym->secidx = SHN_ABS; | 2372 | sym->secidx = SHN_ABS; |
2373 | sym->value = 0; | 2373 | sym->value = 0; |
2374 | } else { | 2374 | } else { |
2375 | error_msg("unresolved symbol %s\n", sym->name); | 2375 | error_msg("unresolved symbol %s", sym->name); |
2376 | ret = 0; | 2376 | ret = 0; |
2377 | } | 2377 | } |
2378 | } | 2378 | } |
@@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
2599 | errmsg = "Unhandled relocation"; | 2599 | errmsg = "Unhandled relocation"; |
2600 | bad_reloc: | 2600 | bad_reloc: |
2601 | if (extsym) { | 2601 | if (extsym) { |
2602 | error_msg("%s of type %ld for %s\n", errmsg, | 2602 | error_msg("%s of type %ld for %s", errmsg, |
2603 | (long) ELFW(R_TYPE) (rel->r_info), | 2603 | (long) ELFW(R_TYPE) (rel->r_info), |
2604 | strtab + extsym->st_name); | 2604 | strtab + extsym->st_name); |
2605 | } else { | 2605 | } else { |
2606 | error_msg("%s of type %ld\n", errmsg, | 2606 | error_msg("%s of type %ld", errmsg, |
2607 | (long) ELFW(R_TYPE) (rel->r_info)); | 2607 | (long) ELFW(R_TYPE) (rel->r_info)); |
2608 | } | 2608 | } |
2609 | ret = 0; | 2609 | ret = 0; |
@@ -2688,25 +2688,25 @@ struct obj_file *obj_load(FILE * fp) | |||
2688 | || f->header.e_ident[EI_MAG1] != ELFMAG1 | 2688 | || f->header.e_ident[EI_MAG1] != ELFMAG1 |
2689 | || f->header.e_ident[EI_MAG2] != ELFMAG2 | 2689 | || f->header.e_ident[EI_MAG2] != ELFMAG2 |
2690 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { | 2690 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { |
2691 | error_msg("not an ELF file\n"); | 2691 | error_msg("not an ELF file"); |
2692 | return NULL; | 2692 | return NULL; |
2693 | } | 2693 | } |
2694 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM | 2694 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM |
2695 | || f->header.e_ident[EI_DATA] != ELFDATAM | 2695 | || f->header.e_ident[EI_DATA] != ELFDATAM |
2696 | || f->header.e_ident[EI_VERSION] != EV_CURRENT | 2696 | || f->header.e_ident[EI_VERSION] != EV_CURRENT |
2697 | || !MATCH_MACHINE(f->header.e_machine)) { | 2697 | || !MATCH_MACHINE(f->header.e_machine)) { |
2698 | error_msg("ELF file not for this architecture\n"); | 2698 | error_msg("ELF file not for this architecture"); |
2699 | return NULL; | 2699 | return NULL; |
2700 | } | 2700 | } |
2701 | if (f->header.e_type != ET_REL) { | 2701 | if (f->header.e_type != ET_REL) { |
2702 | error_msg("ELF file not a relocatable object\n"); | 2702 | error_msg("ELF file not a relocatable object"); |
2703 | return NULL; | 2703 | return NULL; |
2704 | } | 2704 | } |
2705 | 2705 | ||
2706 | /* Read the section headers. */ | 2706 | /* Read the section headers. */ |
2707 | 2707 | ||
2708 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { | 2708 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { |
2709 | error_msg("section header size mismatch: %lu != %lu\n", | 2709 | error_msg("section header size mismatch: %lu != %lu", |
2710 | (unsigned long) f->header.e_shentsize, | 2710 | (unsigned long) f->header.e_shentsize, |
2711 | (unsigned long) sizeof(ElfW(Shdr))); | 2711 | (unsigned long) sizeof(ElfW(Shdr))); |
2712 | return NULL; | 2712 | return NULL; |
@@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp) | |||
2759 | 2759 | ||
2760 | #if SHT_RELM == SHT_REL | 2760 | #if SHT_RELM == SHT_REL |
2761 | case SHT_RELA: | 2761 | case SHT_RELA: |
2762 | error_msg("RELA relocations not supported on this architecture\n"); | 2762 | error_msg("RELA relocations not supported on this architecture"); |
2763 | return NULL; | 2763 | return NULL; |
2764 | #else | 2764 | #else |
2765 | case SHT_REL: | 2765 | case SHT_REL: |
2766 | error_msg("REL relocations not supported on this architecture\n"); | 2766 | error_msg("REL relocations not supported on this architecture"); |
2767 | return NULL; | 2767 | return NULL; |
2768 | #endif | 2768 | #endif |
2769 | 2769 | ||
@@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2776 | break; | 2776 | break; |
2777 | } | 2777 | } |
2778 | 2778 | ||
2779 | error_msg("can't handle sections of type %ld\n", | 2779 | error_msg("can't handle sections of type %ld", |
2780 | (long) sec->header.sh_type); | 2780 | (long) sec->header.sh_type); |
2781 | return NULL; | 2781 | return NULL; |
2782 | } | 2782 | } |
@@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2805 | ElfW(Sym) * sym; | 2805 | ElfW(Sym) * sym; |
2806 | 2806 | ||
2807 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { | 2807 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { |
2808 | error_msg("symbol size mismatch: %lu != %lu\n", | 2808 | error_msg("symbol size mismatch: %lu != %lu", |
2809 | (unsigned long) sec->header.sh_entsize, | 2809 | (unsigned long) sec->header.sh_entsize, |
2810 | (unsigned long) sizeof(ElfW(Sym))); | 2810 | (unsigned long) sizeof(ElfW(Sym))); |
2811 | return NULL; | 2811 | return NULL; |
@@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2837 | 2837 | ||
2838 | case SHT_RELM: | 2838 | case SHT_RELM: |
2839 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { | 2839 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { |
2840 | error_msg("relocation entry size mismatch: %lu != %lu\n", | 2840 | error_msg("relocation entry size mismatch: %lu != %lu", |
2841 | (unsigned long) sec->header.sh_entsize, | 2841 | (unsigned long) sec->header.sh_entsize, |
2842 | (unsigned long) sizeof(ElfW(RelM))); | 2842 | (unsigned long) sizeof(ElfW(RelM))); |
2843 | return NULL; | 2843 | return NULL; |
@@ -2949,11 +2949,11 @@ extern int insmod_main( int argc, char **argv) | |||
2949 | if (m_filename[0] == '\0' | 2949 | if (m_filename[0] == '\0' |
2950 | || ((fp = fopen(m_filename, "r")) == NULL)) | 2950 | || ((fp = fopen(m_filename, "r")) == NULL)) |
2951 | { | 2951 | { |
2952 | error_msg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); | 2952 | error_msg("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); |
2953 | return EXIT_FAILURE; | 2953 | return EXIT_FAILURE; |
2954 | } | 2954 | } |
2955 | } else | 2955 | } else |
2956 | error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); | 2956 | error_msg_and_die("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); |
2957 | } else | 2957 | } else |
2958 | memcpy(m_filename, argv[optind], strlen(argv[optind])); | 2958 | memcpy(m_filename, argv[optind], strlen(argv[optind])); |
2959 | 2959 | ||
@@ -2976,7 +2976,7 @@ extern int insmod_main( int argc, char **argv) | |||
2976 | m_version = old_get_module_version(f, m_strversion); | 2976 | m_version = old_get_module_version(f, m_strversion); |
2977 | if (m_version == -1) { | 2977 | if (m_version == -1) { |
2978 | error_msg("couldn't find the kernel version the module was " | 2978 | error_msg("couldn't find the kernel version the module was " |
2979 | "compiled for\n"); | 2979 | "compiled for"); |
2980 | goto out; | 2980 | goto out; |
2981 | } | 2981 | } |
2982 | } | 2982 | } |
@@ -2985,12 +2985,12 @@ extern int insmod_main( int argc, char **argv) | |||
2985 | if (flag_force_load) { | 2985 | if (flag_force_load) { |
2986 | error_msg("Warning: kernel-module version mismatch\n" | 2986 | error_msg("Warning: kernel-module version mismatch\n" |
2987 | "\t%s was compiled for kernel version %s\n" | 2987 | "\t%s was compiled for kernel version %s\n" |
2988 | "\twhile this kernel is version %s\n", | 2988 | "\twhile this kernel is version %s", |
2989 | m_filename, m_strversion, k_strversion); | 2989 | m_filename, m_strversion, k_strversion); |
2990 | } else { | 2990 | } else { |
2991 | error_msg("kernel-module version mismatch\n" | 2991 | error_msg("kernel-module version mismatch\n" |
2992 | "\t%s was compiled for kernel version %s\n" | 2992 | "\t%s was compiled for kernel version %s\n" |
2993 | "\twhile this kernel is version %s.\n", | 2993 | "\twhile this kernel is version %s.", |
2994 | m_filename, m_strversion, k_strversion); | 2994 | m_filename, m_strversion, k_strversion); |
2995 | goto out; | 2995 | goto out; |
2996 | } | 2996 | } |
@@ -3006,7 +3006,7 @@ extern int insmod_main( int argc, char **argv) | |||
3006 | goto out; | 3006 | goto out; |
3007 | k_crcs = new_is_kernel_checksummed(); | 3007 | k_crcs = new_is_kernel_checksummed(); |
3008 | #else | 3008 | #else |
3009 | error_msg("Not configured to support new kernels\n"); | 3009 | error_msg("Not configured to support new kernels"); |
3010 | goto out; | 3010 | goto out; |
3011 | #endif | 3011 | #endif |
3012 | } else { | 3012 | } else { |
@@ -3015,7 +3015,7 @@ extern int insmod_main( int argc, char **argv) | |||
3015 | goto out; | 3015 | goto out; |
3016 | k_crcs = old_is_kernel_checksummed(); | 3016 | k_crcs = old_is_kernel_checksummed(); |
3017 | #else | 3017 | #else |
3018 | error_msg("Not configured to support old kernels\n"); | 3018 | error_msg("Not configured to support old kernels"); |
3019 | goto out; | 3019 | goto out; |
3020 | #endif | 3020 | #endif |
3021 | } | 3021 | } |
@@ -3072,10 +3072,10 @@ extern int insmod_main( int argc, char **argv) | |||
3072 | m_addr = create_module(m_name, m_size); | 3072 | m_addr = create_module(m_name, m_size); |
3073 | if (m_addr==-1) switch (errno) { | 3073 | if (m_addr==-1) switch (errno) { |
3074 | case EEXIST: | 3074 | case EEXIST: |
3075 | error_msg("A module named %s already exists\n", m_name); | 3075 | error_msg("A module named %s already exists", m_name); |
3076 | goto out; | 3076 | goto out; |
3077 | case ENOMEM: | 3077 | case ENOMEM: |
3078 | error_msg("Can't allocate kernel memory for module; needed %lu bytes\n", | 3078 | error_msg("Can't allocate kernel memory for module; needed %lu bytes", |
3079 | m_size); | 3079 | m_size); |
3080 | goto out; | 3080 | goto out; |
3081 | default: | 3081 | default: |