summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-09-06 14:14:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-09-06 14:14:01 +0000
commit1c781cc8fffa64ae59438bf653994cf908ba2b35 (patch)
treec0818e38cf4c8862c1ad7bced2c4e0d7dfaef029
parent4acb1b079316765b5896b4b87fc67804384412b2 (diff)
downloadbusybox-w32-1c781cc8fffa64ae59438bf653994cf908ba2b35.tar.gz
busybox-w32-1c781cc8fffa64ae59438bf653994cf908ba2b35.tar.bz2
busybox-w32-1c781cc8fffa64ae59438bf653994cf908ba2b35.zip
modprobe-small: make insmod command line compatible
function old new delta modprobe_main 326 435 +109 moderror - 52 +52 process_module 577 530 -47
-rw-r--r--modutils/modprobe-small.c31
-rw-r--r--networking/libiproute/ll_proto.c2
2 files changed, 27 insertions, 6 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 5e33cdc57..e2bf828b7 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -599,7 +599,7 @@ static void process_module(char *name, const char *cmdline_options)
599 } 599 }
600 free(deps); 600 free(deps);
601 601
602 /* insmod -> load it */ 602 /* modprobe -> load it */
603 if (!is_rmmod && !strstr(options, "blacklist")) { 603 if (!is_rmmod && !strstr(options, "blacklist")) {
604 errno = 0; 604 errno = 0;
605 if (load_module(info->pathname, options) != 0) { 605 if (load_module(info->pathname, options) != 0) {
@@ -688,8 +688,10 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
688 /* Prevent ugly corner cases with no modules at all */ 688 /* Prevent ugly corner cases with no modules at all */
689 modinfo = xzalloc(sizeof(modinfo[0])); 689 modinfo = xzalloc(sizeof(modinfo[0]));
690 690
691 /* Goto modules directory */ 691 if ('i' != applet0) { /* not insmod */
692 xchdir(CONFIG_DEFAULT_MODULES_DIR); 692 /* Goto modules directory */
693 xchdir(CONFIG_DEFAULT_MODULES_DIR);
694 }
693 uname(&uts); /* never fails */ 695 uname(&uts); /* never fails */
694 696
695 /* depmod? */ 697 /* depmod? */
@@ -736,8 +738,10 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
736 option_mask32 |= OPT_r; 738 option_mask32 |= OPT_r;
737 } 739 }
738 740
739 /* Goto $VERSION directory */ 741 if ('i' != applet0) { /* not insmod */
740 xchdir(uts.release); 742 /* Goto $VERSION directory */
743 xchdir(uts.release);
744 }
741 745
742#if ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE 746#if ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE
743 /* If not rmmod, parse possible module options given on command line. 747 /* If not rmmod, parse possible module options given on command line.
@@ -758,11 +762,26 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
758 argv[1] = NULL; 762 argv[1] = NULL;
759#endif 763#endif
760 764
765 if ('i' == applet0) { /* insmod */
766 size_t len;
767 void *map;
768
769 len = MAXINT(ssize_t);
770 map = xmalloc_xopen_read_close(*argv, &len);
771 if (init_module(map, len,
772 USE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : "")
773 SKIP_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE("")
774 ) != 0)
775 bb_error_msg_and_die("cannot insert '%s': %s",
776 *argv, moderror(errno));
777 return 0;
778 }
779
761 /* Try to load modprobe.dep.bb */ 780 /* Try to load modprobe.dep.bb */
762 load_dep_bb(); 781 load_dep_bb();
763 782
764 /* Load/remove modules. 783 /* Load/remove modules.
765 * Only rmmod loops here, insmod/modprobe has only argv[0] */ 784 * Only rmmod loops here, modprobe has only argv[0] */
766 do { 785 do {
767 process_module(*argv++, options); 786 process_module(*argv++, options);
768 } while (*argv); 787 } while (*argv);
diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c
index 0707fe08e..b8268732e 100644
--- a/networking/libiproute/ll_proto.c
+++ b/networking/libiproute/ll_proto.c
@@ -20,7 +20,9 @@
20#include <linux/if_ether.h> 20#include <linux/if_ether.h>
21#endif 21#endif
22 22
23#if !ENABLE_WERROR
23#warning de-bloat 24#warning de-bloat
25#endif
24/* Before re-enabling this, please (1) conditionalize exotic protocols 26/* Before re-enabling this, please (1) conditionalize exotic protocols
25 * on CONFIG_something, and (2) decouple strings and numbers 27 * on CONFIG_something, and (2) decouple strings and numbers
26 * (use llproto_ids[] = n,n,n..; and llproto_names[] = "loop\0" "pup\0" ...;) 28 * (use llproto_ids[] = n,n,n..; and llproto_names[] = "loop\0" "pup\0" ...;)