aboutsummaryrefslogtreecommitdiff
path: root/modutils/modutils-24.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-12 14:21:29 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-12 14:21:29 +0000
commit51056b382a003146c879c9d50552d344f298d957 (patch)
tree42aed2019625f9b050301b3baf0d0e81b0da4f4b /modutils/modutils-24.c
parentf1df35c40bfba65f5923db11719326b7e9bbc7ad (diff)
downloadbusybox-w32-51056b382a003146c879c9d50552d344f298d957.tar.gz
busybox-w32-51056b382a003146c879c9d50552d344f298d957.tar.bz2
busybox-w32-51056b382a003146c879c9d50552d344f298d957.zip
modutils: small optimization
function old new delta bb_init_module_24 4570 4565 -5
Diffstat (limited to 'modutils/modutils-24.c')
-rw-r--r--modutils/modutils-24.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c
index 24bc6b446..4b0e78687 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)
3774 unsigned long m_size; 3774 unsigned long m_size;
3775 ElfW(Addr) m_addr; 3775 ElfW(Addr) m_addr;
3776 struct obj_file *f; 3776 struct obj_file *f;
3777 struct utsname uts;
3778 int exit_status = EXIT_FAILURE; 3777 int exit_status = EXIT_FAILURE;
3779 int m_has_modinfo;
3780 char *m_name; 3778 char *m_name;
3781#if ENABLE_FEATURE_INSMOD_VERSION_CHECKING 3779#if ENABLE_FEATURE_INSMOD_VERSION_CHECKING
3782 char m_strversion[STRVERSIONLEN]; 3780 int m_has_modinfo;
3783 int m_version, m_crcs;
3784#endif 3781#endif
3785 char *image; 3782 char *image;
3786 size_t image_size = 64 * 1024 * 1024; 3783 size_t image_size = 64 * 1024 * 1024;
3787 3784
3788 uname(&uts);
3789
3790 /* Load module into memory and unzip if compressed */ 3785 /* Load module into memory and unzip if compressed */
3791 image = xmalloc_open_zipped_read_close(m_filename, &image_size); 3786 image = xmalloc_open_zipped_read_close(m_filename, &image_size);
3792 if (!image) 3787 if (!image)
@@ -3798,19 +3793,22 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
3798 3793
3799 f = obj_load(image, image_size, LOADBITS); 3794 f = obj_load(image, image_size, LOADBITS);
3800 3795
3801 m_has_modinfo = (get_modinfo_value(f, "kernel_version") != NULL);
3802
3803#if ENABLE_FEATURE_INSMOD_VERSION_CHECKING 3796#if ENABLE_FEATURE_INSMOD_VERSION_CHECKING
3804 /* Version correspondence? */ 3797 /* Version correspondence? */
3798 m_has_modinfo = (get_modinfo_value(f, "kernel_version") != NULL);
3805 if (!flag_quiet) { 3799 if (!flag_quiet) {
3800 char m_strversion[STRVERSIONLEN];
3801 struct utsname uts;
3802
3806 if (m_has_modinfo) { 3803 if (m_has_modinfo) {
3807 m_version = new_get_module_version(f, m_strversion); 3804 int m_version = new_get_module_version(f, m_strversion);
3808 if (m_version == -1) { 3805 if (m_version == -1) {
3809 bb_error_msg_and_die("cannot find the kernel version the module was " 3806 bb_error_msg_and_die("cannot find the kernel version "
3810 "compiled for"); 3807 "the module was compiled for");
3811 } 3808 }
3812 } 3809 }
3813 3810
3811 uname(&uts);
3814 if (strncmp(uts.release, m_strversion, STRVERSIONLEN) != 0) { 3812 if (strncmp(uts.release, m_strversion, STRVERSIONLEN) != 0) {
3815 bb_error_msg("%skernel-module version mismatch\n" 3813 bb_error_msg("%skernel-module version mismatch\n"
3816 "\t%s was compiled for kernel version %s\n" 3814 "\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)
3821 goto out; 3819 goto out;
3822 } 3820 }
3823 } 3821 }
3824 k_crcs = 0;
3825#endif 3822#endif
3826 3823
3827 if (query_module(NULL, 0, NULL, 0, NULL)) 3824 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)
3830 k_crcs = new_is_kernel_checksummed(); 3827 k_crcs = new_is_kernel_checksummed();
3831 3828
3832#if ENABLE_FEATURE_INSMOD_VERSION_CHECKING 3829#if ENABLE_FEATURE_INSMOD_VERSION_CHECKING
3833 m_crcs = 0; 3830 {
3834 if (m_has_modinfo) 3831 int m_crcs = 0;
3835 m_crcs = new_is_module_checksummed(f); 3832 if (m_has_modinfo)
3836 3833 m_crcs = new_is_module_checksummed(f);
3837 if (m_crcs != k_crcs) 3834 if (m_crcs != k_crcs)
3838 obj_set_symbol_compare(f, ncv_strcmp, ncv_symbol_hash); 3835 obj_set_symbol_compare(f, ncv_strcmp, ncv_symbol_hash);
3836 }
3839#endif 3837#endif
3840 3838
3841 /* Let the module know about the kernel symbols. */ 3839 /* Let the module know about the kernel symbols. */