[libvirt PATCH 2/2] util: remove unused virKModConfig method

Daniel P. Berrangé berrange at redhat.com
Thu Jun 18 15:42:46 UTC 2020


Using virKModConfig would not simplify any existing code.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/libvirt_private.syms |  1 -
 src/util/virkmod.c       | 19 -------------------
 src/util/virkmod.h       |  1 -
 tests/virkmodtest.c      | 29 -----------------------------
 4 files changed, 50 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 7509916dfd..691b5bc5bc 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2402,7 +2402,6 @@ virKeycodeValueTranslate;
 
 
 # util/virkmod.h
-virKModConfig;
 virKModIsBlacklisted;
 virKModLoad;
 virKModUnload;
diff --git a/src/util/virkmod.c b/src/util/virkmod.c
index 59cec69816..4400245906 100644
--- a/src/util/virkmod.c
+++ b/src/util/virkmod.c
@@ -59,25 +59,6 @@ doRmmod(const char *module, char **errbuf)
     return 0;
 }
 
-/**
- * virKModConfig:
- *
- * Get the current kernel module configuration
- *
- * Returns NULL on failure or a pointer to the output which
- * must be VIR_FREE()'d by the caller
- */
-char *
-virKModConfig(void)
-{
-    char *outbuf = NULL;
-
-    if (doModprobe("-c", NULL, &outbuf, NULL) < 0)
-        return NULL;
-
-    return outbuf;
-}
-
 
 /**
  * virKModLoad:
diff --git a/src/util/virkmod.h b/src/util/virkmod.h
index 605da74416..3bb161df52 100644
--- a/src/util/virkmod.h
+++ b/src/util/virkmod.h
@@ -23,7 +23,6 @@
 
 #include "internal.h"
 
-char *virKModConfig(void);
 char *virKModLoad(const char *)
     ATTRIBUTE_NONNULL(1);
 char *virKModUnload(const char *)
diff --git a/tests/virkmodtest.c b/tests/virkmodtest.c
index 2906ad992e..3ba8c542d1 100644
--- a/tests/virkmodtest.c
+++ b/tests/virkmodtest.c
@@ -31,33 +31,6 @@
 
 # define VIR_FROM_THIS VIR_FROM_NONE
 
-static int
-testKModConfig(const void *args G_GNUC_UNUSED)
-{
-    int ret = -1;
-    char *outbuf = NULL;
-
-    /* This will return the contents of a 'modprobe -c' which can differ
-     * from machine to machine - be happy that we get something.
-     */
-    outbuf = virKModConfig();
-    if (!outbuf) {
-        if (virFileIsExecutable(MODPROBE)) {
-            fprintf(stderr, "Failed to get config\n");
-        } else {
-            /* modprobe doesn't exist, do not claim error. */
-            ret = 0;
-        }
-        goto cleanup;
-    }
-    ret = 0;
-
- cleanup:
-    VIR_FREE(outbuf);
-    return ret;
-}
-
-
 static int
 checkOutput(virBufferPtr buf, const char *exp_cmd)
 {
@@ -141,8 +114,6 @@ mymain(void)
 {
     int ret = 0;
 
-    if (virTestRun("config", testKModConfig, NULL) < 0)
-        ret = -1;
     if (virTestRun("load", testKModLoad, NULL) < 0)
         ret = -1;
     if (virTestRun("unload", testKModUnload, NULL) < 0)
-- 
2.24.1




More information about the libvir-list mailing list