]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Rename kmod_loaded_get_list() to kmod_module_new_from_loaded()
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Mon, 12 Dec 2011 15:49:27 +0000 (13:49 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Mon, 12 Dec 2011 15:50:19 +0000 (13:50 -0200)
Be consistent with other similar functions already present and improve
documentation.

libkmod/libkmod-loaded.c
libkmod/libkmod.h
libkmod/libkmod.sym
test/test-loaded.c
test/test-rmmod.c
tools/kmod-lsmod.c

index 5f9a38aff87127b5bfa29fed8aaae598b4c6caee..f628707fd0222ae45d0a89632eeb21d5750a48dc 100644 (file)
  * SECTION:libkmod-loaded
  * @short_description: currently loaded modules
  *
- * Information about currently loaded modules, as reported by Linux kernel
+ * Information about currently loaded modules, as reported by Linux kernel.
+ * These information are not cached by libkmod and are always read from /sys
+ * and /proc/modules.
  */
 
 /**
- * kmod_loaded_get_list:
+ * kmod_module_new_from_loaded:
  * @ctx: kmod library context
  * @list: where to save the list of loaded modules
  *
  * Get a list of all modules currently loaded in kernel. It uses /proc/modules
- * to get a list of loaded modules and create kmod_module objects that are put
+ * to get the names of loaded modules and to create kmod_module objects by
+ * calling kmod_module_new_from_name() in each of them. They are put are put
  * in @list in no particular order.
  *
  * All the returned modules get their refcount incremented (or are created if
@@ -52,7 +55,7 @@
  *
  * Returns: 0 on success or < 0 on error.
  */
-KMOD_EXPORT int kmod_loaded_get_list(struct kmod_ctx *ctx,
+KMOD_EXPORT int kmod_module_new_from_loaded(struct kmod_ctx *ctx,
                                                struct kmod_list **list)
 {
        struct kmod_list *l = NULL;
index 3a13b9fcd1e9008982bdfb78057c923d2d2f9fe1..f0830f3ffd71ed73be6b8fcf3f7ca1764943fc32 100644 (file)
@@ -66,8 +66,6 @@ struct kmod_list *kmod_list_prev(const struct kmod_list *first_entry,
                list_entry != NULL; \
                list_entry = kmod_list_next(first_entry, list_entry))
 
-int kmod_loaded_get_list(struct kmod_ctx *ctx, struct kmod_list **list);
-
 enum kmod_remove {
        KMOD_REMOVE_FORCE = O_TRUNC,
        KMOD_REMOVE_NOWAIT = O_NONBLOCK,
@@ -92,6 +90,7 @@ int kmod_module_new_from_path(struct kmod_ctx *ctx, const char *path,
                                                struct kmod_module **mod);
 int kmod_module_new_from_lookup(struct kmod_ctx *ctx, const char *alias,
                                                struct kmod_list **list);
+int kmod_module_new_from_loaded(struct kmod_ctx *ctx, struct kmod_list **list);
 
 struct kmod_module *kmod_module_ref(struct kmod_module *mod);
 struct kmod_module *kmod_module_unref(struct kmod_module *mod);
index f383331a748e73274ca074f7a6bb107e2bd6b51b..4bff56694e3ef1956b17ebf2290a05c976f0f201 100644 (file)
@@ -11,7 +11,6 @@ global:
        kmod_unref;
        kmod_list_next;
        kmod_list_prev;
-       kmod_loaded_get_list;
 
        kmod_load_resources;
        kmod_unload_resources;
@@ -19,6 +18,7 @@ global:
        kmod_module_new_from_name;
        kmod_module_new_from_path;
        kmod_module_new_from_lookup;
+       kmod_module_new_from_loaded;
        kmod_module_ref;
        kmod_module_unref;
        kmod_module_unref_list;
index 5f3dc587818f0549f88b566c663d56c56cd86303..6bb16a75dd16c76c853a6f0a0d75050178ff2bc6 100644 (file)
@@ -20,7 +20,7 @@ int main(int argc, char *argv[])
 
        printf("libkmod version %s\n", VERSION);
 
-       err = kmod_loaded_get_list(ctx, &list);
+       err = kmod_module_new_from_loaded(ctx, &list);
        if (err < 0) {
                fprintf(stderr, "%s\n", strerror(-err));
                kmod_unref(ctx);
index c57a0a7453e6c26368443416f1b0d3a7e90e526d..0bb06f4cbf143d1dc21594e43d6cc7b08dd23cfd 100644 (file)
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
 
        printf("libkmod version %s\n", VERSION);
 
-       err = kmod_loaded_get_list(ctx, &list);
+       err = kmod_module_new_from_loaded(ctx, &list);
        if (err < 0) {
                fprintf(stderr, "%s\n", strerror(-err));
                kmod_unref(ctx);
index 4f75fd4e0272ed991c4e878ba70de8159417ac92..8b5b1ee24087053eef9ba27e1f6d6ecc07db6f3d 100644 (file)
@@ -42,7 +42,7 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
-       err = kmod_loaded_get_list(ctx, &list);
+       err = kmod_module_new_from_loaded(ctx, &list);
        if (err < 0) {
                fprintf(stderr, "Error: could not get list of modules: %s\n",
                        strerror(-err));