]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Move function to the right place
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Sat, 31 Dec 2011 13:15:52 +0000 (11:15 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Sat, 31 Dec 2011 13:15:52 +0000 (11:15 -0200)
libkmod/libkmod-module.c
libkmod/libkmod.c

index 8e4a26d68c8916e3471ef32e0a2285d824e050f9..a94c6e290dce867443bbd972553438264df06c15 100644 (file)
@@ -500,6 +500,67 @@ KMOD_EXPORT int kmod_module_unref_list(struct kmod_list *list)
        return 0;
 }
 
+/**
+ * kmod_module_get_filtered_blacklist:
+ * @ctx: kmod library context
+ * @input: list of kmod_module to be filtered with blacklist
+ * @output: where to save the new list
+ *
+ * Given a list @input, this function filter it out with config's blacklist
+ * ans save it in @output.
+ *
+ * Returns: 0 on success or < 0 otherwise. @output is saved with the updated
+ * list.
+ */
+KMOD_EXPORT int kmod_module_get_filtered_blacklist(const struct kmod_ctx *ctx,
+                                               const struct kmod_list *input,
+                                               struct kmod_list **output)
+{
+       const struct kmod_list *li;
+       const struct kmod_list *blacklist;
+
+       if (ctx == NULL || output == NULL)
+               return -ENOENT;
+
+       *output = NULL;
+       if (input == NULL)
+               return 0;
+
+       blacklist = kmod_get_blacklists(ctx);
+       kmod_list_foreach(li, input) {
+               struct kmod_module *mod = li->data;
+               const struct kmod_list *lb;
+               struct kmod_list *node;
+               bool filtered = false;
+
+               kmod_list_foreach(lb, blacklist) {
+                       const char *name = lb->data;
+
+                       if (streq(name, kmod_module_get_name(mod))) {
+                               filtered = true;
+                               break;
+                       }
+               }
+
+               if (filtered)
+                       continue;
+
+               node = kmod_list_append(*output, mod);
+               if (node == NULL)
+                       goto fail;
+
+               *output = node;
+               kmod_module_ref(mod);
+       }
+
+       return 0;
+
+fail:
+       kmod_module_unref_list(*output);
+       *output = NULL;
+       return -ENOMEM;
+}
+
 static const struct kmod_list *module_get_dependencies_noref(const struct kmod_module *mod)
 {
        if (!mod->init.dep) {
index 10905078e21904c4630dabf121f0b2559719958e..163de3ff06882779feabb9eb46c578b1185ff9c5 100644 (file)
@@ -610,62 +610,6 @@ int kmod_lookup_alias_from_commands(struct kmod_ctx *ctx, const char *name,
        return nmatch;
 }
 
-/**
- * kmod_module_get_filtered_blacklist:
- * @ctx: kmod library context
- * @input: list of kmod_module to be filtered with blacklist
- * @output: where to save the new list
- *
- * Given a list @input, this function filter it out with config's blacklist
- * ans save it in @output.
- *
- * Returns: 0 on success or < 0 otherwise. @output is saved with the updated
- * list.
- */
-KMOD_EXPORT int kmod_module_get_filtered_blacklist(const struct kmod_ctx *ctx,
-                                               const struct kmod_list *input,
-                                               struct kmod_list **output)
-{
-       const struct kmod_config *config;
-       const struct kmod_list *li;
-
-       if (ctx == NULL || output == NULL)
-               return -ENOENT;
-
-       *output = NULL;
-       if (input == NULL)
-               return 0;
-
-       config = ctx->config;
-       kmod_list_foreach(li, input) {
-               struct kmod_module *mod = li->data;
-               const struct kmod_list *lb;
-               struct kmod_list *node;
-               bool filtered = false;
-               kmod_list_foreach(lb, config->blacklists) {
-                       const char *name = lb->data;
-                       if (streq(name, kmod_module_get_name(mod))) {
-                               filtered = true;
-                               break;
-                       }
-               }
-               if (filtered)
-                       continue;
-
-               node = kmod_list_append(*output, mod);
-               if (node == NULL)
-                       goto fail;
-               *output = node;
-               kmod_module_ref(mod);
-       }
-       return 0;
-
-fail:
-       kmod_module_unref_list(*output);
-       *output = NULL;
-       return -ENOMEM;
-}
-
 /**
  * kmod_load_resources:
  * @ctx: kmod library context