From: Lucas De Marchi Date: Mon, 12 Dec 2011 15:49:27 +0000 (-0200) Subject: Rename kmod_loaded_get_list() to kmod_module_new_from_loaded() X-Git-Tag: v1~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a102e262e61de9a7655210aceb24d2024e9ceeda;p=thirdparty%2Fkmod.git Rename kmod_loaded_get_list() to kmod_module_new_from_loaded() Be consistent with other similar functions already present and improve documentation. --- diff --git a/libkmod/libkmod-loaded.c b/libkmod/libkmod-loaded.c index 5f9a38af..f628707f 100644 --- a/libkmod/libkmod-loaded.c +++ b/libkmod/libkmod-loaded.c @@ -34,16 +34,19 @@ * 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; diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h index 3a13b9fc..f0830f3f 100644 --- a/libkmod/libkmod.h +++ b/libkmod/libkmod.h @@ -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); diff --git a/libkmod/libkmod.sym b/libkmod/libkmod.sym index f383331a..4bff5669 100644 --- a/libkmod/libkmod.sym +++ b/libkmod/libkmod.sym @@ -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; diff --git a/test/test-loaded.c b/test/test-loaded.c index 5f3dc587..6bb16a75 100644 --- a/test/test-loaded.c +++ b/test/test-loaded.c @@ -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); diff --git a/test/test-rmmod.c b/test/test-rmmod.c index c57a0a74..0bb06f4c 100644 --- a/test/test-rmmod.c +++ b/test/test-rmmod.c @@ -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); diff --git a/tools/kmod-lsmod.c b/tools/kmod-lsmod.c index 4f75fd4e..8b5b1ee2 100644 --- a/tools/kmod-lsmod.c +++ b/tools/kmod-lsmod.c @@ -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));