render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
404507
From 5965fa7d3b6a473b47457f9a21ce0229c3d7464b Mon Sep 17 00:00:00 2001
404507
Message-Id: <5965fa7d3b6a473b47457f9a21ce0229c3d7464b@dist-git>
404507
From: Martin Kletzander <mkletzan@redhat.com>
404507
Date: Wed, 31 Jan 2018 16:32:27 +0100
404507
Subject: [PATCH] util: Remove now-unneeded resctrl functions
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1289368
404507
404507
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
404507
(cherry picked from commit 6328e48713c0730797d82a03d154a00b62625c3a)
404507
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
404507
---
404507
 src/libvirt_private.syms |   2 -
404507
 src/util/virresctrl.c    | 132 -----------------------------------------------
404507
 src/util/virresctrl.h    |  11 ----
404507
 3 files changed, 145 deletions(-)
404507
404507
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
404507
index e0e0046522..02bad6c0ce 100644
404507
--- a/src/libvirt_private.syms
404507
+++ b/src/libvirt_private.syms
404507
@@ -2547,8 +2547,6 @@ virRandomInt;
404507
 # util/virresctrl.h
404507
 virCacheTypeFromString;
404507
 virCacheTypeToString;
404507
-virResctrlGetCacheControlType;
404507
-virResctrlGetCacheInfo;
404507
 virResctrlGetInfo;
404507
 virResctrlInfoGetCache;
404507
 virResctrlInfoNew;
404507
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
404507
index 7ab68c6f74..f122af2050 100644
404507
--- a/src/util/virresctrl.c
404507
+++ b/src/util/virresctrl.c
404507
@@ -358,135 +358,3 @@ virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
404507
     VIR_FREE(*controls);
404507
     goto cleanup;
404507
 }
404507
-
404507
-
404507
-int
404507
-virResctrlGetCacheInfo(unsigned int level,
404507
-                       unsigned long long size,
404507
-                       virCacheType scope,
404507
-                       virResctrlInfoPerCachePtr **controls,
404507
-                       size_t *ncontrols)
404507
-{
404507
-    int ret = -1;
404507
-    char *tmp = NULL;
404507
-    char *path = NULL;
404507
-    char *cbm_mask = NULL;
404507
-    char *type_upper = NULL;
404507
-    unsigned int bits = 0;
404507
-    unsigned int min_cbm_bits = 0;
404507
-    virResctrlInfoPerCachePtr control;
404507
-
404507
-    if (VIR_ALLOC(control) < 0)
404507
-        goto cleanup;
404507
-
404507
-    if (scope != VIR_CACHE_TYPE_BOTH &&
404507
-        virStringToUpper(&type_upper, virCacheTypeToString(scope)) < 0)
404507
-        goto cleanup;
404507
-
404507
-    if (virFileReadValueUint(&control->max_allocation,
404507
-                             SYSFS_RESCTRL_PATH "/info/L%u%s/num_closids",
404507
-                             level,
404507
-                             type_upper ? type_upper : "") < 0)
404507
-        goto cleanup;
404507
-
404507
-    if (virFileReadValueString(&cbm_mask,
404507
-                               SYSFS_RESCTRL_PATH
404507
-                               "/info/L%u%s/cbm_mask",
404507
-                               level,
404507
-                               type_upper ? type_upper: "") < 0)
404507
-        goto cleanup;
404507
-
404507
-    if (virFileReadValueUint(&min_cbm_bits,
404507
-                             SYSFS_RESCTRL_PATH "/info/L%u%s/min_cbm_bits",
404507
-                             level,
404507
-                             type_upper ? type_upper : "") < 0)
404507
-        goto cleanup;
404507
-
404507
-    virStringTrimOptionalNewline(cbm_mask);
404507
-
404507
-    for (tmp = cbm_mask; *tmp != '\0'; tmp++) {
404507
-        if (c_isxdigit(*tmp))
404507
-            bits += count_one_bits(virHexToBin(*tmp));
404507
-    }
404507
-
404507
-    control->granularity = size / bits;
404507
-    if (min_cbm_bits != 1)
404507
-        control->min = min_cbm_bits * control->granularity;
404507
-
404507
-    control->scope = scope;
404507
-
404507
-    if (VIR_APPEND_ELEMENT(*controls, *ncontrols, control) < 0)
404507
-        goto cleanup;
404507
-
404507
-    ret = 0;
404507
-
404507
- cleanup:
404507
-    VIR_FREE(path);
404507
-    VIR_FREE(cbm_mask);
404507
-    VIR_FREE(type_upper);
404507
-    VIR_FREE(control);
404507
-    return ret;
404507
-}
404507
-
404507
-
404507
-static inline int
404507
-virResctrlGetCacheDir(char **path,
404507
-                      const char *prefix,
404507
-                      unsigned int level,
404507
-                      virCacheType type)
404507
-{
404507
-    return virAsprintf(path,
404507
-                       SYSFS_RESCTRL_PATH "%s/L%u%s",
404507
-                       prefix ? prefix : "",
404507
-                       level,
404507
-                       virResctrlTypeToString(type));
404507
-}
404507
-
404507
-
404507
-/*
404507
- * This function tests whether TYPE of cache control is supported or not.
404507
- *
404507
- * Returns 0 if not, 1 if yes and negative value on error.
404507
- */
404507
-static int
404507
-virResctrlGetCacheSupport(unsigned int level, virCacheType type)
404507
-{
404507
-    int ret = -1;
404507
-    char *path = NULL;
404507
-
404507
-    if (virResctrlGetCacheDir(&path, "/info", level, type) < 0)
404507
-        return -1;
404507
-
404507
-    ret = virFileExists(path);
404507
-    VIR_FREE(path);
404507
-    return ret;
404507
-}
404507
-
404507
-
404507
-/*
404507
- * This function tests which TYPE of cache control is supported
404507
- * Return values are:
404507
- *  -1: error
404507
- *   0: none
404507
- *   1: CAT
404507
- *   2: CDP
404507
- */
404507
-int
404507
-virResctrlGetCacheControlType(unsigned int level)
404507
-{
404507
-    int rv = -1;
404507
-
404507
-    rv = virResctrlGetCacheSupport(level, VIR_CACHE_TYPE_BOTH);
404507
-    if (rv < 0)
404507
-        return -1;
404507
-    if (rv)
404507
-        return 1;
404507
-
404507
-    rv = virResctrlGetCacheSupport(level, VIR_CACHE_TYPE_CODE);
404507
-    if (rv < 0)
404507
-        return -1;
404507
-    if (rv)
404507
-        return 2;
404507
-
404507
-    return 0;
404507
-}
404507
diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h
404507
index c7f25c76e1..a81ff687de 100644
404507
--- a/src/util/virresctrl.h
404507
+++ b/src/util/virresctrl.h
404507
@@ -65,15 +65,4 @@ virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
404507
                        size_t *ncontrols,
404507
                        virResctrlInfoPerCachePtr **controls);
404507
 
404507
-/* To be removed */
404507
-int
404507
-virResctrlGetCacheInfo(unsigned int level,
404507
-                       unsigned long long size,
404507
-                       virCacheType scope,
404507
-                       virResctrlInfoPerCachePtr **controls,
404507
-                       size_t *ncontrols);
404507
-
404507
-int
404507
-virResctrlGetCacheControlType(unsigned int level);
404507
-
404507
 #endif /*  __VIR_RESCTRL_H__ */
404507
-- 
404507
2.16.1
404507