diff options
author | Denis Vlasenko | 2009-04-12 14:21:29 +0000 |
---|---|---|
committer | Denis Vlasenko | 2009-04-12 14:21:29 +0000 |
commit | 51056b382a003146c879c9d50552d344f298d957 (patch) | |
tree | 42aed2019625f9b050301b3baf0d0e81b0da4f4b /modutils | |
parent | f1df35c40bfba65f5923db11719326b7e9bbc7ad (diff) | |
download | busybox-51056b382a003146c879c9d50552d344f298d957.zip busybox-51056b382a003146c879c9d50552d344f298d957.tar.gz |
modutils: small optimization
function old new delta
bb_init_module_24 4570 4565 -5
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/modutils-24.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c index 24bc6b4..4b0e786 100644 --- a/modutils/modutils-24.c +++ b/modutils/modutils-24.c @@ -3774,19 +3774,14 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options) unsigned long m_size; ElfW(Addr) m_addr; struct obj_file *f; - struct utsname uts; int exit_status = EXIT_FAILURE; - int m_has_modinfo; char *m_name; #if ENABLE_FEATURE_INSMOD_VERSION_CHECKING - char m_strversion[STRVERSIONLEN]; - int m_version, m_crcs; + int m_has_modinfo; #endif char *image; size_t image_size = 64 * 1024 * 1024; - uname(&uts); - /* Load module into memory and unzip if compressed */ image = xmalloc_open_zipped_read_close(m_filename, &image_size); if (!image) @@ -3798,19 +3793,22 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options) f = obj_load(image, image_size, LOADBITS); - m_has_modinfo = (get_modinfo_value(f, "kernel_version") != NULL); - #if ENABLE_FEATURE_INSMOD_VERSION_CHECKING /* Version correspondence? */ + m_has_modinfo = (get_modinfo_value(f, "kernel_version") != NULL); if (!flag_quiet) { + char m_strversion[STRVERSIONLEN]; + struct utsname uts; + if (m_has_modinfo) { - m_version = new_get_module_version(f, m_strversion); + int m_version = new_get_module_version(f, m_strversion); if (m_version == -1) { - bb_error_msg_and_die("cannot find the kernel version the module was " - "compiled for"); + bb_error_msg_and_die("cannot find the kernel version " + "the module was compiled for"); } } + uname(&uts); if (strncmp(uts.release, m_strversion, STRVERSIONLEN) != 0) { bb_error_msg("%skernel-module version mismatch\n" "\t%s was compiled for kernel version %s\n" @@ -3821,7 +3819,6 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options) goto out; } } - k_crcs = 0; #endif if (query_module(NULL, 0, NULL, 0, NULL)) @@ -3830,12 +3827,13 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options) k_crcs = new_is_kernel_checksummed(); #if ENABLE_FEATURE_INSMOD_VERSION_CHECKING - m_crcs = 0; - if (m_has_modinfo) - m_crcs = new_is_module_checksummed(f); - - if (m_crcs != k_crcs) - obj_set_symbol_compare(f, ncv_strcmp, ncv_symbol_hash); + { + int m_crcs = 0; + if (m_has_modinfo) + m_crcs = new_is_module_checksummed(f); + if (m_crcs != k_crcs) + obj_set_symbol_compare(f, ncv_strcmp, ncv_symbol_hash); + } #endif /* Let the module know about the kernel symbols. */ |