* Add functions to list all modules known by modules.dep
* provide 1:1 compatibility with module-init-tools's modprobe
- - dump configuration
+ - dump modules.alias and modules.symbols
+
+* Add docs to kmod_config_* functions
* Add manpages: copy them from module-init-tools and make the necessary changes
install "echo bli"
install "echo bla"
+* kmod doesn't dump the configuration as is in the config files. Instead it
+ dumps the configuration as it was parsed. Therefore, comments and file names
+ are not dumped, but on the good side we know what the exact configuration
+ kmod is using. We did this because if we only want to know the entire content
+ of configuration files, it's enough to use find(1) in modprobe.d directories
+
depmod
------
#include "libkmod.h"
#include "libkmod-array.h"
+#include "macro.h"
static int log_priority = LOG_CRIT;
static int use_syslog = 0;
static int show_config(struct kmod_ctx *ctx)
{
- ERR("TODO - config is missing in kmod.\n");
- /*
- * needs:
- * struct kmod_list *kmod_get_config(struct kmod_ctx *ctx);
- * kmod_config_get_type() {alias,options,blacklist,install,remove,softdeps}
- * kmod_config_get_key()
- * kmod_config_get_value()
- * kmod_config_unref_list()
- */
- return -ENOENT;
+ struct config_iterators {
+ const char *name;
+ struct kmod_config_iter *(*get_iter)(const struct kmod_ctx *ctx);
+ } ci[] = {
+ { "blacklist", kmod_config_get_blacklists },
+ { "install", kmod_config_get_install_commands },
+ { "remove", kmod_config_get_remove_commands },
+ { "alias", kmod_config_get_aliases },
+ { "option", kmod_config_get_options },
+ { "softdep", kmod_config_get_softdeps },
+ };
+ size_t i;
+
+ for (i = 0; i < ARRAY_SIZE(ci); i++) {
+ struct kmod_config_iter *iter = ci[i].get_iter(ctx);
+
+ if (iter == NULL)
+ continue;
+
+ while (kmod_config_iter_next(iter)) {
+ const char *val;
+
+ printf("%s %s", ci[i].name,
+ kmod_config_iter_get_key(iter));
+ val = kmod_config_iter_get_value(iter);
+ if (val != NULL) {
+ putchar(' ');
+ puts(val);
+ } else
+ putchar('\n');
+ }
+
+ kmod_config_iter_free_iter(iter);
+ }
+
+ return 0;
}
static int show_modversions(struct kmod_ctx *ctx, const char *filename)