svn commit: trunk/busybox: modutils networking/libiproute

vda at busybox.net vda at busybox.net
Sat Sep 6 14:14:01 UTC 2008


Author: vda
Date: 2008-09-06 07:14:01 -0700 (Sat, 06 Sep 2008)
New Revision: 23333

Log:
modprobe-small: make insmod command line compatible

function                                             old     new   delta
modprobe_main                                        326     435    +109
moderror                                               -      52     +52
process_module                                       577     530     -47



Modified:
   trunk/busybox/modutils/modprobe-small.c
   trunk/busybox/networking/libiproute/ll_proto.c


Changeset:
Modified: trunk/busybox/modutils/modprobe-small.c
===================================================================
--- trunk/busybox/modutils/modprobe-small.c	2008-09-05 15:30:24 UTC (rev 23332)
+++ trunk/busybox/modutils/modprobe-small.c	2008-09-06 14:14:01 UTC (rev 23333)
@@ -599,7 +599,7 @@
 	}
 	free(deps);
 
-	/* insmod -> load it */
+	/* modprobe -> load it */
 	if (!is_rmmod && !strstr(options, "blacklist")) {
 		errno = 0;
 		if (load_module(info->pathname, options) != 0) {
@@ -688,8 +688,10 @@
 	/* Prevent ugly corner cases with no modules at all */
 	modinfo = xzalloc(sizeof(modinfo[0]));
 
-	/* Goto modules directory */
-	xchdir(CONFIG_DEFAULT_MODULES_DIR);
+	if ('i' != applet0) { /* not insmod */
+		/* Goto modules directory */
+		xchdir(CONFIG_DEFAULT_MODULES_DIR);
+	}
 	uname(&uts); /* never fails */
 
 	/* depmod? */
@@ -736,8 +738,10 @@
 		option_mask32 |= OPT_r;
 	}
 
-	/* Goto $VERSION directory */
-	xchdir(uts.release);
+	if ('i' != applet0) { /* not insmod */
+		/* Goto $VERSION directory */
+		xchdir(uts.release);
+	}
 
 #if ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE
 	/* If not rmmod, parse possible module options given on command line.
@@ -758,11 +762,26 @@
 		argv[1] = NULL;
 #endif
 
+	if ('i' == applet0) { /* insmod */
+		size_t len;
+		void *map;
+
+		len = MAXINT(ssize_t);
+		map = xmalloc_xopen_read_close(*argv, &len);
+		if (init_module(map, len,
+			USE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : "")
+			SKIP_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE("")
+				) != 0)
+			bb_error_msg_and_die("cannot insert '%s': %s",
+					*argv, moderror(errno));
+		return 0;
+	}
+
 	/* Try to load modprobe.dep.bb */
 	load_dep_bb();
 
 	/* Load/remove modules.
-	 * Only rmmod loops here, insmod/modprobe has only argv[0] */
+	 * Only rmmod loops here, modprobe has only argv[0] */
 	do {
 		process_module(*argv++, options);
 	} while (*argv);

Modified: trunk/busybox/networking/libiproute/ll_proto.c
===================================================================
--- trunk/busybox/networking/libiproute/ll_proto.c	2008-09-05 15:30:24 UTC (rev 23332)
+++ trunk/busybox/networking/libiproute/ll_proto.c	2008-09-06 14:14:01 UTC (rev 23333)
@@ -20,7 +20,9 @@
 #include <linux/if_ether.h>
 #endif
 
+#if !ENABLE_WERROR
 #warning de-bloat
+#endif
 /* Before re-enabling this, please (1) conditionalize exotic protocols
  * on CONFIG_something, and (2) decouple strings and numbers
  * (use llproto_ids[] = n,n,n..; and llproto_names[] = "loop\0" "pup\0" ...;)




More information about the busybox-cvs mailing list