diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-05-25 17:41:59 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-05-25 17:41:59 +0000 |
commit | 63f69d0bb9c36924b8afe22498730212ca785d49 (patch) | |
tree | 574bcb886f2ea2597efdfd226e38d13e1dc97a1c /package/utils | |
parent | 7a13084797abc30a14b584902b9984a4f55696d2 (diff) | |
download | upstream-63f69d0bb9c36924b8afe22498730212ca785d49.tar.gz upstream-63f69d0bb9c36924b8afe22498730212ca785d49.tar.bz2 upstream-63f69d0bb9c36924b8afe22498730212ca785d49.zip |
busybox: remove obsolete insmod patches
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 40850
Diffstat (limited to 'package/utils')
-rw-r--r-- | package/utils/busybox/patches/470-insmod_search.patch | 137 | ||||
-rw-r--r-- | package/utils/busybox/patches/910-insmod-q-flag.patch | 33 |
2 files changed, 0 insertions, 170 deletions
diff --git a/package/utils/busybox/patches/470-insmod_search.patch b/package/utils/busybox/patches/470-insmod_search.patch deleted file mode 100644 index 7f0188fc82..0000000000 --- a/package/utils/busybox/patches/470-insmod_search.patch +++ /dev/null @@ -1,137 +0,0 @@ ---- a/modutils/Config.src -+++ b/modutils/Config.src -@@ -247,7 +247,7 @@ config FEATURE_MODUTILS_SYMBOLS - config DEFAULT_MODULES_DIR - string "Default directory containing modules" - default "/lib/modules" -- depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO -+ depends on DEPMOD || INSMOD || MODPROBE || MODPROBE_SMALL || MODINFO - help - Directory that contains kernel modules. - Defaults to "/lib/modules" ---- a/modutils/insmod.c -+++ b/modutils/insmod.c -@@ -11,6 +11,106 @@ - - #include "libbb.h" - #include "modutils.h" -+#include <sys/utsname.h> -+#ifndef CONFIG_FEATURE_2_4_MODULES -+#include <sys/mman.h> -+#include <asm/unistd.h> -+#include <sys/syscall.h> -+#endif -+ -+static char *g_filename = NULL; -+ -+static int FAST_FUNC check_module_name_match(const char *filename, struct stat *statbuf, -+ void *userdata, int depth) -+{ -+ char *fullname = (char *) userdata; -+ char *tmp; -+ -+ if (fullname[0] == '\0') -+ return FALSE; -+ -+ tmp = bb_get_last_path_component_nostrip(filename); -+ if (strcmp(tmp, fullname) == 0) { -+ /* Stop searching if we find a match */ -+ g_filename = xstrdup(filename); -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ -+static int find_module(char *filename) -+{ -+ char *module_dir, real_module_dir[FILENAME_MAX]; -+ int len, slen, ret = ENOENT, k_version; -+ struct utsname myuname; -+ const char *suffix = ".ko"; -+ struct stat st; -+ -+ /* check the kernel version */ -+ if (uname(&myuname) != 0) -+ return EINVAL; -+ -+ k_version = myuname.release[0] - '0'; -+ -+ if (k_version < 2 || k_version > 9) -+ return EINVAL; -+ -+ if (k_version == 2) { -+ int k_patchlevel = myuname.release[2] - '0'; -+ if (k_patchlevel <= 4) -+#if ENABLE_FEATURE_2_4_MODULES -+ suffix = ".o"; -+#else -+ return EINVAL; -+#endif -+ } -+ -+ len = strlen(filename); -+ slen = strlen(suffix); -+ -+ /* check for suffix and absolute path first */ -+ if ((len < slen + 2) || (strcmp(filename + len - slen, suffix) != 0)) { -+ filename = xasprintf("%s%s", filename, suffix); -+ } else { -+ filename = strdup(filename); -+ if ((stat(filename, &st) == 0) && S_ISREG(st.st_mode)) { -+ g_filename = filename; -+ return 0; -+ } -+ free(filename); -+ return ENOENT; -+ } -+ -+ /* next: scan /lib/modules/<release> */ -+ /* Jump through hoops in case /lib/modules/`uname -r` -+ * is a symlink. We do not want recursive_action to -+ * follow symlinks, but we do want to follow the -+ * /lib/modules/`uname -r` dir, So resolve it ourselves -+ * if it is a link... */ -+ module_dir = concat_path_file(CONFIG_DEFAULT_MODULES_DIR, myuname.release); -+ if (realpath(module_dir, real_module_dir) != NULL) { -+ free(module_dir); -+ module_dir = real_module_dir; -+ } -+ -+ recursive_action(module_dir, ACTION_RECURSE, -+ check_module_name_match, 0, filename, 0); -+ -+ /* Check if we have a complete path */ -+ if (g_filename == NULL) -+ goto done; -+ -+ if ((stat(g_filename, &st) == 0) && S_ISREG(st.st_mode)) -+ ret = 0; -+ else -+ free(g_filename); -+ -+done: -+ free(filename); -+ -+ return ret; -+} - - /* 2.6 style insmod has no options and required filename - * (not module name - .ko can't be omitted) */ -@@ -58,9 +158,15 @@ int insmod_main(int argc UNUSED_PARAM, c - if (!filename) - bb_show_usage(); - -- rc = bb_init_module(filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0)); -+ rc = find_module(filename); -+ if (rc || (g_filename == NULL)) -+ goto done; -+ -+ rc = bb_init_module(g_filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0)); - if (rc) - bb_error_msg("can't insert '%s': %s", filename, moderror(rc)); -+ free (g_filename); - -+done: - return rc; - } diff --git a/package/utils/busybox/patches/910-insmod-q-flag.patch b/package/utils/busybox/patches/910-insmod-q-flag.patch deleted file mode 100644 index 6002f20f1b..0000000000 --- a/package/utils/busybox/patches/910-insmod-q-flag.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/modutils/insmod.c -+++ b/modutils/insmod.c -@@ -139,7 +139,7 @@ int insmod_main(int argc, char **argv) M - int insmod_main(int argc UNUSED_PARAM, char **argv) - { - char *filename; -- int rc; -+ int rc, opt; - - /* Compat note: - * 2.6 style insmod has no options and required filename -@@ -149,10 +149,8 @@ int insmod_main(int argc UNUSED_PARAM, c - * or in $MODPATH. - */ - -- IF_FEATURE_2_4_MODULES( -- getopt32(argv, INSMOD_OPTS INSMOD_ARGS); -- argv += optind - 1; -- ); -+ opt = getopt32(argv, INSMOD_OPTS, NULL, NULL); -+ argv += optind - 1; - - filename = *++argv; - if (!filename) -@@ -163,7 +161,7 @@ int insmod_main(int argc UNUSED_PARAM, c - goto done; - - rc = bb_init_module(g_filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0)); -- if (rc) -+ if (rc && !(opt & INSMOD_OPT_SILENT)) - bb_error_msg("can't insert '%s': %s", filename, moderror(rc)); - free (g_filename); - |