[PATCH kmod 2/3] Add KMOD_NEW_IGNORE_CMDLINE

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

 



This can be passed to kmod_new_flags() to disable loading configuration
from /proc/cmdline

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
---
 libkmod/libkmod-config.c   | 3 ++-
 libkmod/libkmod-internal.h | 2 +-
 libkmod/libkmod.c          | 2 +-
 libkmod/libkmod.h          | 4 +++-
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index e24dab1..600d666 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -949,7 +949,8 @@ int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **p_config,
 		free(cf);
 	}
 
-	kmod_config_parse_kcmdline(config);
+	if (!(options & KMOD_NEW_IGNORE_CMDLINE))
+		kmod_config_parse_kcmdline(config);
 
 	return 0;
 
diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h
index 26a7e28..1d0bd92 100644
--- a/libkmod/libkmod-internal.h
+++ b/libkmod/libkmod-internal.h
@@ -132,7 +132,7 @@ struct kmod_config {
 	struct kmod_list *paths;
 };
 
-int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **config, const char * const *config_paths) __attribute__((nonnull(1, 2,3)));
+int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **config, const char * const *config_paths, enum kmod_new_flags options) __attribute__((nonnull(1, 2,3)));
 void kmod_config_free(struct kmod_config *config) __attribute__((nonnull(1)));
 const char *kmod_blacklist_get_modname(const struct kmod_list *l) __attribute__((nonnull(1)));
 const char *kmod_alias_get_name(const struct kmod_list *l) __attribute__((nonnull(1)));
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 279b35d..126a66c 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -317,7 +317,7 @@ KMOD_EXPORT struct kmod_ctx *kmod_new_flags(const char *dirname,
 
 	if (config_paths == NULL)
 		config_paths = default_config_paths;
-	err = kmod_config_new(ctx, &ctx->config, config_paths);
+	err = kmod_config_new(ctx, &ctx->config, config_paths, options);
 	if (err < 0) {
 		ERR(ctx, "could not create config\n");
 		goto fail;
diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h
index 72cd7a2..29637dd 100644
--- a/libkmod/libkmod.h
+++ b/libkmod/libkmod.h
@@ -30,7 +30,9 @@
 extern "C" {
 #endif
 
-enum kmod_new_flags {};
+enum kmod_new_flags {
+	KMOD_NEW_IGNORE_CMDLINE = 0x00001,
+};
 
 /*
  * kmod_ctx
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature


[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