Skip to contentSkip to conversation

Module cleanups

PATCH In review Andreas Färber 4 participants 6 messages Jul 15, 2014

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 module: Simplify module_load()

In reply to Andreas Färber

The file path is not used for error reporting, so we can free it directly after use.

---
 util/module.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
util/module.c +2 -4
index 214effb..9fd3030 100644
@@ -202,18 +202,16 @@ static void module_load(module_init_type type)
         for (i = 0; i < ARRAY_SIZE(dirs); i++) {
             fname = g_strdup_printf("%s/%s%s", dirs[i], *mp, HOST_DSOSUF);
             ret = module_load_file(fname);
+            g_free(fname);
+            fname = NULL;
             /* Try loading until loaded a module file */
             if (!ret) {
                 break;
             }
-            g_free(fname);
-            fname = NULL;
         }
         if (ret == -ENOENT) {
             fprintf(stderr, "Can't find module: %s\n", *mp);
         }
-
-        g_free(fname);
     }
 
     for (i = 0; i < ARRAY_SIZE(dirs); i++) {
Signature · 1 line
1.8.4.5
#0 lore raw

cover Module cleanups

Hello,

This mini-series resolves an error message emitted when a module is absent. It was prompted by a downstream user bug report about the new message.

Proposing this for rc2 as Peter would like to keep the rc3 delta low.

Regards,
Andreas

Andreas Färber (2):
module: Simplify module_load()
module: Don't complain when a module is absent

 util/module.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
Signature · 1 line
1.8.4.5
#2 lore raw

PATCH 2/2 module: Don't complain when a module is absent

The current implementation depends on a configure-time generated list of block modules. When any of them is absent, module_load() emits a warning.

This is suboptimal because extracting code to modules was mainly done to allow separate packaging of modules with intrusive dependencies. Absence of optional packages then leads to absence of modules and an error message, which users may recognize as new and report as error.

Cc Fam Zheng <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Michael Tokarev <[email protected]>
---
 util/module.c | 3 ---
 1 file changed, 3 deletions(-)
util/module.c +0 -3
index 9fd3030..4bd4a94 100644
@@ -209,9 +209,6 @@ static void module_load(module_init_type type)
                 break;
             }
         }
-        if (ret == -ENOENT) {
-            fprintf(stderr, "Can't find module: %s\n", *mp);
-        }
     }
 
     for (i = 0; i < ARRAY_SIZE(dirs); i++) {
Signature · 1 line
1.8.4.5
Reviewed-by on the v1 series
#3 lore raw
In reply to Andreas Färber
Quoted 10 lines · Andreas Färber

Hello,

This mini-series resolves an error message emitted when a module is absent. It was prompted by a downstream user bug report about the new message.

Proposing this for rc2 as Peter would like to keep the rc3 delta low.

Regards,
Andreas

Quoted 6 lines

Andreas Färber (2):
module: Simplify module_load()
module: Don't complain when a module is absent

 util/module.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Both patches look good to me.

#4 lore raw

Il 15/07/2014 17:39, Fam Zheng ha scritto:

Quoted 15 lines · Andreas Färber
Quoted 14 lines

Hello,

This mini-series resolves an error message emitted when a module is absent. It was prompted by a downstream user bug report about the new message.

Proposing this for rc2 as Peter would like to keep the rc3 delta low.

Regards,
Andreas

Andreas Färber (2):
module: Simplify module_load()
module: Don't complain when a module is absent

Quoted 7 lines
Quoted 2 lines
 util/module.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Both patches look good to me.

Thanks, queued for -rc3.

Paolo

#5 lore raw
In reply to Andreas Färber
Quoted 8 lines · Andreas Färber

This mini-series resolves an error message emitted when a module is absent. It was prompted by a downstream user bug report about the new message.

Proposing this for rc2 as Peter would like to keep the rc3 delta low.

Regards,
Andreas

Quoted 6 lines

Andreas Färber (2):
module: Simplify module_load()
module: Don't complain when a module is absent

 util/module.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

I hadn't realized the changes were this minor; it's missed the rc2 boat but 9 lines of change are no problem for rc3.

thanks
-- PMM