svn commit: trunk/busybox: include modutils

vda at busybox.net vda at busybox.net
Sat Nov 22 18:29:01 UTC 2008


Author: vda
Date: 2008-11-22 10:29:01 -0800 (Sat, 22 Nov 2008)
New Revision: 24123

Log:
insmod: clarify module_name / file_name distinction



Modified:
   trunk/busybox/include/usage.h
   trunk/busybox/modutils/insmod.c
   trunk/busybox/modutils/modutils-24.c
   trunk/busybox/modutils/modutils.h


Changeset:
Modified: trunk/busybox/include/usage.h
===================================================================
--- trunk/busybox/include/usage.h	2008-11-22 17:15:56 UTC (rev 24122)
+++ trunk/busybox/include/usage.h	2008-11-22 18:29:01 UTC (rev 24123)
@@ -1864,8 +1864,12 @@
      "\ninotifyd waits for PROG to exit." \
      "\nWhen x event happens for all FILEs, inotifyd exits" \
 
+/* 2.6 style insmod has no options and required filename
+ * (not module name - .ko can't be omitted) */
 #define insmod_trivial_usage \
-	USE_FEATURE_2_4_MODULES("[OPTION]... ") "MODULE [symbol=value]..."
+	USE_FEATURE_2_4_MODULES("[OPTION]... MODULE ") \
+	SKIP_FEATURE_2_4_MODULES("FILE ") \
+	"[symbol=value]..."
 #define insmod_full_usage "\n\n" \
        "Load the specified kernel modules into the kernel" \
 	USE_FEATURE_2_4_MODULES( "\n" \

Modified: trunk/busybox/modutils/insmod.c
===================================================================
--- trunk/busybox/modutils/insmod.c	2008-11-22 17:15:56 UTC (rev 24122)
+++ trunk/busybox/modutils/insmod.c	2008-11-22 18:29:01 UTC (rev 24123)
@@ -16,9 +16,17 @@
 	char *filename;
 	int rc;
 
+	/* Compat note:
+	 * 2.6 style insmod has no options and required filename
+	 * (not module name - .ko can't be omitted).
+	 * 2.4 style insmod can take module name without .ko
+	 * and performs module search in default directories
+	 * or in $MODPATH.
+	 */
+
 	USE_FEATURE_2_4_MODULES(
 		getopt32(argv, INSMOD_OPTS INSMOD_ARGS);
-		argv += optind-1;
+		argv += optind - 1;
 	);
 
 	filename = *++argv;

Modified: trunk/busybox/modutils/modutils-24.c
===================================================================
--- trunk/busybox/modutils/modutils-24.c	2008-11-22 17:15:56 UTC (rev 24122)
+++ trunk/busybox/modutils/modutils-24.c	2008-11-22 18:29:01 UTC (rev 24123)
@@ -3810,7 +3810,7 @@
 }
 #endif
 
-int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options UNUSED_PARAM)
+int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
 {
 	int k_crcs;
 	unsigned long m_size;
@@ -3906,13 +3906,13 @@
 
 	m_addr = create_module(m_name, m_size);
 	if (m_addr == (ElfW(Addr))(-1)) switch (errno) {
-		case EEXIST:
-			bb_error_msg_and_die("a module named %s already exists", m_name);
-		case ENOMEM:
-			bb_error_msg_and_die("can't allocate kernel memory for module; needed %lu bytes",
-					m_size);
-		default:
-			bb_perror_msg_and_die("create_module: %s", m_name);
+	case EEXIST:
+		bb_error_msg_and_die("a module named %s already exists", m_name);
+	case ENOMEM:
+		bb_error_msg_and_die("can't allocate kernel memory for module; needed %lu bytes",
+				m_size);
+	default:
+		bb_perror_msg_and_die("create_module: %s", m_name);
 	}
 
 #if !LOADBITS

Modified: trunk/busybox/modutils/modutils.h
===================================================================
--- trunk/busybox/modutils/modutils.h	2008-11-22 17:15:56 UTC (rev 24122)
+++ trunk/busybox/modutils/modutils.h	2008-11-22 18:29:01 UTC (rev 24123)
@@ -23,7 +23,7 @@
 llist_t *llist_find(llist_t *first, const char *str) FAST_FUNC;
 void replace(char *s, char what, char with) FAST_FUNC;
 char *replace_underscores(char *s) FAST_FUNC;
-int string_to_llist(char *string, llist_t **llist, const char *delim) FAST_FUNC ;
+int string_to_llist(char *string, llist_t **llist, const char *delim) FAST_FUNC;
 char *filename2modname(const char *filename, char *modname) FAST_FUNC;
 char *parse_cmdline_module_options(char **argv) FAST_FUNC;
 




More information about the busybox-cvs mailing list