render / rpms / libvirt

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