linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix modules.builtin.alias.bin creation
@ 2021-05-11 18:06 Lucas De Marchi
  2021-05-11 18:06 ` [PATCH 1/3] Fix return value doc for kmod_module_get_info() Lucas De Marchi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lucas De Marchi @ 2021-05-11 18:06 UTC (permalink / raw)
  To: linux-modules; +Cc: Peter Kjellerstedt

When modules.builtin.modinfo is not present we shouldn't really write
an empty index. And when it is present, we shouln't truncate the file.

By differentiating empty index from 0-sized index, libkmod will later
know if it should fallback to the old modules.builtin index or if it
will give up searching for the module.

Lucas De Marchi (3):
  Fix return value doc for kmod_module_get_info()
  depmod: fix modules.builtin.alias.bin output
  testsuite: update gitignore

 libkmod/libkmod-module.c               | 2 +-
 testsuite/module-playground/.gitignore | 2 +-
 tools/depmod.c                         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] Fix return value doc for kmod_module_get_info()
  2021-05-11 18:06 [PATCH 0/3] Fix modules.builtin.alias.bin creation Lucas De Marchi
@ 2021-05-11 18:06 ` Lucas De Marchi
  2021-05-11 18:06 ` [PATCH 2/3] depmod: fix modules.builtin.alias.bin output Lucas De Marchi
  2021-05-11 18:06 ` [PATCH 3/3] testsuite: update gitignore Lucas De Marchi
  2 siblings, 0 replies; 4+ messages in thread
From: Lucas De Marchi @ 2021-05-11 18:06 UTC (permalink / raw)
  To: linux-modules; +Cc: Peter Kjellerstedt

We don't return 0 on success, we return the number of elements we added
to the list.
---
 libkmod/libkmod-module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 76a6dc3..b6320cc 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -2277,7 +2277,7 @@ list_error:
  *
  * After use, free the @list by calling kmod_module_info_free_list().
  *
- * Returns: 0 on success or < 0 otherwise.
+ * Returns: number of entries in @list on success or < 0 otherwise.
  */
 KMOD_EXPORT int kmod_module_get_info(const struct kmod_module *mod, struct kmod_list **list)
 {
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] depmod: fix modules.builtin.alias.bin output
  2021-05-11 18:06 [PATCH 0/3] Fix modules.builtin.alias.bin creation Lucas De Marchi
  2021-05-11 18:06 ` [PATCH 1/3] Fix return value doc for kmod_module_get_info() Lucas De Marchi
@ 2021-05-11 18:06 ` Lucas De Marchi
  2021-05-11 18:06 ` [PATCH 3/3] testsuite: update gitignore Lucas De Marchi
  2 siblings, 0 replies; 4+ messages in thread
From: Lucas De Marchi @ 2021-05-11 18:06 UTC (permalink / raw)
  To: linux-modules; +Cc: Peter Kjellerstedt

Due to wrong documentation on kmod_module_get_info() we ended up
checking for 0 as return. Check for > 0 to decided if we want to write
the index to the file, otherwise we would output a 0-sized index on
success.
---
 tools/depmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/depmod.c b/tools/depmod.c
index 170a1d8..eb810b8 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -2457,7 +2457,7 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out)
 
 out:
 	/* do not bother writing the index if we are going to discard it */
-	if (!ret)
+	if (ret > 0)
 		index_write(idx, out);
 
 	if (builtin)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] testsuite: update gitignore
  2021-05-11 18:06 [PATCH 0/3] Fix modules.builtin.alias.bin creation Lucas De Marchi
  2021-05-11 18:06 ` [PATCH 1/3] Fix return value doc for kmod_module_get_info() Lucas De Marchi
  2021-05-11 18:06 ` [PATCH 2/3] depmod: fix modules.builtin.alias.bin output Lucas De Marchi
@ 2021-05-11 18:06 ` Lucas De Marchi
  2 siblings, 0 replies; 4+ messages in thread
From: Lucas De Marchi @ 2021-05-11 18:06 UTC (permalink / raw)
  To: linux-modules; +Cc: Peter Kjellerstedt

---
 testsuite/module-playground/.gitignore | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuite/module-playground/.gitignore b/testsuite/module-playground/.gitignore
index fca12f3..6d9c7b1 100644
--- a/testsuite/module-playground/.gitignore
+++ b/testsuite/module-playground/.gitignore
@@ -1,4 +1,3 @@
-*o.cmd
 *.ko
 !mod-simple-*.ko
 !cache/*.ko
@@ -8,6 +7,7 @@
 *.mod
 *.a
 *.cmd
+*.o.d
 
 modules.order
 Module.symvers
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-11 18:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 18:06 [PATCH 0/3] Fix modules.builtin.alias.bin creation Lucas De Marchi
2021-05-11 18:06 ` [PATCH 1/3] Fix return value doc for kmod_module_get_info() Lucas De Marchi
2021-05-11 18:06 ` [PATCH 2/3] depmod: fix modules.builtin.alias.bin output Lucas De Marchi
2021-05-11 18:06 ` [PATCH 3/3] testsuite: update gitignore Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).