[PATCH] modprobe does not print out dependee module falures.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a failure occurs loading a dependee module, an error for this is
not printed, but an incorrect error is printed for each dependent
module. This patch changes this.

Matthew W.S. Bell
From 204caa740325024dd77918bd62dea452594a9b97 Mon Sep 17 00:00:00 2001
From: Matthew W. S. Bell <matthew@xxxxxxxxxxxxxx>
Date: Fri, 29 Jan 2010 21:14:20 +0000
Subject: [PATCH 1/2] Whitespace

---
 config_filter.c |    2 +-
 index.c         |    4 ++--
 list.h          |    4 ++--
 logging.h       |    2 +-
 modinfo.c       |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/config_filter.c b/config_filter.c
index 7d5bbe5..406ed33 100644
--- a/config_filter.c
+++ b/config_filter.c
@@ -41,7 +41,7 @@ int config_filter(const char *name)
 		if (strlen(name) >= strlen(*p) &&
 		    streq(*p, strchr(name, 0) - strlen(*p)))
 		    return 0;
- 	}
+	}
 
 	return 1;
 }
diff --git a/index.c b/index.c
index d656c0f..3a7a278 100644
--- a/index.c
+++ b/index.c
@@ -189,8 +189,8 @@ static int index__haschildren(const struct index_node *node)
  */
 static uint32_t index_write__node(const struct index_node *node, FILE *out)
 {
- 	uint32_t *child_offs = NULL;
- 	int child_count = 0;
+	uint32_t *child_offs = NULL;
+	int child_count = 0;
 	long offset;
 	
 	if (!node)
diff --git a/list.h b/list.h
index 95ca43c..d9bf739 100644
--- a/list.h
+++ b/list.h
@@ -213,7 +213,7 @@ static inline void list_splice_init(struct list_head *list,
  */
 #define list_for_each_prev(pos, head) \
 	for (pos = (head)->prev; pos != (head); pos = pos->prev)
-        	
+
 /**
  * list_for_each_safe	-	iterate over a list safe against removal of list entry
  * @pos:	the &struct list_head to use as a loop counter.
@@ -245,7 +245,7 @@ static inline void list_splice_init(struct list_head *list,
 #define list_for_each_entry_safe(pos, n, head, member)			\
 	for (pos = list_entry((head)->next, typeof(*pos), member),	\
 		n = list_entry(pos->member.next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
+	     &pos->member != (head);					\
 	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
 
 #endif
diff --git a/logging.h b/logging.h
index fb11df0..7b363a7 100644
--- a/logging.h
+++ b/logging.h
@@ -33,7 +33,7 @@ static inline void grammar(const char *cmd,
 #define NOFAIL(ptr)  do_nofail((ptr), __FILE__, __LINE__, #ptr)
 
 #define nofail_asprintf(ptr, ...)				\
-	do { if (asprintf((ptr), __VA_ARGS__) < 0) 		\
+	do { if (asprintf((ptr), __VA_ARGS__) < 0)		\
 		do_nofail(NULL, __FILE__, __LINE__, #ptr);	\
 	} while(0)
 
diff --git a/modinfo.c b/modinfo.c
index c2d733f..5720875 100644
--- a/modinfo.c
+++ b/modinfo.c
@@ -26,7 +26,7 @@
 struct param
 {
 	struct param *next;
-	const char *name; 	/* Terminated by a colon */
+	const char *name;	/* Terminated by a colon */
 	const char *param;
 	const char *type;
 };
-- 
1.6.5

From 41af452d15bf9dfdd0fa10b4ebb92e13c7b2d534 Mon Sep 17 00:00:00 2001
From: Matthew W. S. Bell <matthew@xxxxxxxxxxxxxx>
Date: Fri, 29 Jan 2010 21:15:14 +0000
Subject: [PATCH 2/2] Print error on load failure of dependee module. Don't print error of
 dependee module as that of parent module.

---
 modprobe.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modprobe.c b/modprobe.c
index 6743759..e52d927 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -50,6 +50,7 @@
 #include "testing.h"
 
 int use_binary_indexes = 1; /* default to enabled. */
+int all = 0;
 
 extern long init_module(void *, unsigned long, const char *);
 extern long delete_module(const char *, unsigned int);
@@ -1206,10 +1207,10 @@ static int insmod(struct list_head *list,
 		f &= ~mit_first_time;
 		f &= ~mit_ignore_commands;
 		if ((rc = insmod(list, NOFAIL(strdup("")), NULL,
-		       options, commands, "", warn, f)) != 0) {
+		                 options, commands, "", warn, f)) != 0) {
 			error("Error inserting %s (%s): %s\n",
 				mod->modname, mod->filename,
-				insert_moderror(errno));
+				"Loading module dependency failed.");
 			goto out_optstring;
 		}
 	}
@@ -1279,7 +1280,7 @@ static int insmod(struct list_head *list,
 		}
 		/* don't warn noisely if we're loading multiple aliases. */
 		/* one of the aliases may try to use hardware we don't have. */
-		if ((error != warn) || (verbose))
+		if (!all || verbose)
 			error("Error inserting %s (%s): %s\n",
 			      mod->modname, mod->filename,
 			      insert_moderror(errno));
@@ -1548,7 +1549,6 @@ int main(int argc, char *argv[])
 	int opt;
 	int dump_config = 0;
 	int list_only = 0;
-	int all = 0;
 	int dump_modver = 0;
 	unsigned int i, num_modules;
 	char *type = NULL;
-- 
1.6.5

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux