Skip to contentSkip to conversation

README: Indicate cython requirements

PATCH In review Laura Abbott 2 participants 7 messages Sep 28, 2015 – Sep 30, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 README: Indicate cython requirements

The recommended flags require cython be installed to compile successfully. Note this in the documentation.

---
 README | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
README +2 -1
index b977e1f..4933268 100644
@@ -63,7 +63,8 @@ Hacking
 =======
 
 Run 'bootstrap' script before configure. If you want to accept the recommended
-flags, you just need to run 'bootstrap-configure'.
+flags, you just need to run 'bootstrap-configure'. Note that the recommended
+flags require cython be installed to compile successfully.
 
 Make sure to read the CODING-STYLE file and the other READMEs: libkmod/README
 and testsuite/README.
Signature · 1 line
2.4.3
#1 lore raw

PATCH v2 2/5 modprobe: Update error message when path is missing

Currently, modprobe fails with no output by default if the search paths it tries are missing:

$ modprobe -S notakernel dm-crypt
$
$ modprobe -S notakernel lkjjweiojo
$

This is fairly cryptic and not at all obvious there is a problem unless the error code is checked or verbose flags are used. Update the error message to indicate a problem and print out the directory that failed.

---
 libkmod/libkmod-internal.h | 2 --
 libkmod/libkmod.h          | 1 +
 tools/modprobe.c           | 7 +++----
 3 files changed, 4 insertions(+), 6 deletions(-)
libkmod/libkmod-internal.h +0 -2
index 3e9839d..4d9db6b 100644
@@ -85,8 +85,6 @@ struct kmod_list *kmod_list_append_list(struct kmod_list *list1, struct kmod_lis
 		container_of(list_entry->node.prev, struct kmod_list, node)))
 
 /* libkmod.c */
-const char *kmod_get_dirname(const struct kmod_ctx *ctx) __attribute__((nonnull(1)));
-
 int kmod_lookup_alias_from_config(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3)));
 int kmod_lookup_alias_from_symbols_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3)));
 int kmod_lookup_alias_from_aliases_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3)));
libkmod/libkmod.h +1 -0
index fe53a59..f9e33c6 100644
@@ -51,6 +51,7 @@ void kmod_set_log_priority(struct kmod_ctx *ctx, int priority);
 void *kmod_get_userdata(const struct kmod_ctx *ctx);
 void kmod_set_userdata(struct kmod_ctx *ctx, const void *userdata);
 
+const char *kmod_get_dirname(const struct kmod_ctx *ctx);
 
 /*
  * Management of libkmod's resources
tools/modprobe.c +3 -4
index 3ba8f52..43605cc 100644
@@ -489,11 +489,10 @@ static int insmod(struct kmod_ctx *ctx, const char *alias,
 						const char *options) = NULL;
 
 	err = kmod_module_new_from_lookup(ctx, alias, &list);
-	if (err < 0)
-		return err;
 
-	if (list == NULL) {
-		LOG("Module %s not found.\n", alias);
+	if (list == NULL || err < 0) {
+		LOG("Module %s not found in directory %s\n", alias,
+			ctx ? kmod_get_dirname(ctx) : "(missing)");
 		return -ENOENT;
 	}
 
Signature · 1 line
2.4.3
#3 lore raw

PATCH v2 3/5 Change default log level

In reply to Laura Abbott

The default log level is currently LOG_ERR. Tools can override this default but there is a non-trivial amount of setup that needs to happen before the log level can be changed. Since tools may want to use the warn level for things such as deprecated flags, change the default to LOG_WARNING to ensure messages get printed.

---
 tools/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/log.c +1 -1
index e29a150..3317a35 100644
@@ -29,7 +29,7 @@
 #define PRIO_MAX_SIZE 32
 
 static bool log_use_syslog;
-static int log_priority = LOG_ERR;
+static int log_priority = LOG_WARNING;
 
 static const char *prio_to_str(char buf[static PRIO_MAX_SIZE], int prio)
 {
Signature · 1 line
2.4.3
#4 lore raw

PATCH v2 4/5 depmod: Remove unprinted debug messages

In reply to Laura Abbott

In between the start of the program and the call to log_setup_kmod_log, the only messages that will be printed are the ones at or above the global default level. Debug messages in this range will never be printed so remove them.

---
 tools/depmod.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
tools/depmod.c +1 -4
index 2a08b6e..348735f 100644
@@ -2498,11 +2498,8 @@ static int do_depmod(int argc, char *argv[])
 		if (out == stdout)
 			goto done;
 		/* ignore up-to-date errors (< 0) */
-		if (depfile_up_to_date(cfg.dirname) == 1) {
-			DBG("%s/modules.dep is up to date!\n", cfg.dirname);
+		if (depfile_up_to_date(cfg.dirname) == 1)
 			goto done;
-		}
-		DBG("%s/modules.dep is outdated, do -a\n", cfg.dirname);
 		all = 1;
 	}
 
Signature · 1 line
2.4.3
#5 lore raw

PATCH v2 5/5 depmod: Don't fall back to uname on bad version

In reply to Laura Abbott

Currently, if a value that doesn't match a kernel version ("%u.%u") is passed in, depmod silently falls back to using uname. Rather than try and work around the caller passing bad data, just exit out instead.

---
 tools/depmod.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/depmod.c +5 -1
index 348735f..a585d47 100644
@@ -2476,7 +2476,11 @@ static int do_depmod(int argc, char *argv[])
 		}
 	}
 
-	if (optind < argc && is_version_number(argv[optind])) {
+	if (optind < argc) {
+		if (!is_version_number(argv[optind])) {
+			ERR("Bad version passed %s\n", argv[optind]);
+			goto cmdline_failed;
+		}
 		cfg.kversion = argv[optind];
 		optind++;
 	} else {
Signature · 1 line
2.4.3
#6 lore raw
In reply to Laura Abbott

Hi Laura,

thank you for the patches, they are all applied.

Lucas De Marchi

Quoted 28 lines · Laura Abbott

The recommended flags require cython be installed to compile successfully. Note this in the documentation.

---
 README | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
README +2 -2
index b977e1f..4933268 100644
@@ -63,7 +63,8 @@ Hacking
 =======
 
 Run 'bootstrap' script before configure. If you want to accept the recommended
-flags, you just need to run 'bootstrap-configure'.
+flags, you just need to run 'bootstrap-configure'. Note that the recommended
+flags require cython be installed to compile successfully.
 
 Make sure to read the CODING-STYLE file and the other READMEs: libkmod/README
 and testsuite/README.
--

2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Lucas De Marchi
#2 lore raw

Re: [PATCHv2 2/5] modprobe: Update error message when path is missing

In reply to Laura Abbott
Quoted 37 lines · Laura Abbott

Currently, modprobe fails with no output by default if the search paths it tries are missing:

$ modprobe -S notakernel dm-crypt
$
$ modprobe -S notakernel lkjjweiojo
$

This is fairly cryptic and not at all obvious there is a problem unless the error code is checked or verbose flags are used. Update the error message to indicate a problem and print out the directory that failed.

---
 libkmod/libkmod-internal.h | 2 --
 libkmod/libkmod.h          | 1 +
 tools/modprobe.c           | 7 +++----
 3 files changed, 4 insertions(+), 6 deletions(-)
libkmod/libkmod-internal.h +0 -2
index 3e9839d..4d9db6b 100644
@@ -85,8 +85,6 @@ struct kmod_list *kmod_list_append_list(struct kmod_list *list1, struct kmod_lis
                container_of(list_entry->node.prev, struct kmod_list, node)))
 
 /* libkmod.c */
-const char *kmod_get_dirname(const struct kmod_ctx *ctx) __attribute__((nonnull(1)));
-
 int kmod_lookup_alias_from_config(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3)));
 int kmod_lookup_alias_from_symbols_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3)));
 int kmod_lookup_alias_from_aliases_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3)));
libkmod/libkmod.h +0 -0
index fe53a59..f9e33c6 100644

libkmod/libkmod.h void kmod_set_log_priority(struct kmod_ctx *ctx, int priority); · line 54

Quoted 4 lines
libkmod/libkmod.h +1 -0
@@ -51,6 +51,7 @@ void kmod_set_log_priority(struct kmod_ctx *ctx, int priority);
 void *kmod_get_userdata(const struct kmod_ctx *ctx);
 void kmod_set_userdata(struct kmod_ctx *ctx, const void *userdata);
 
+const char *kmod_get_dirname(const struct kmod_ctx *ctx);

I also added a patch to make sure this function is exported in the library. Otherwise we limit its usage to the internal tools and it doesn't fail since we statically link the tools with libkmod:
https://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/?id=f7f28510244e22c3676cea40f55dbed6338005f3

Lucas De Marchi