On Tue, Sep 18, 2018 at 05:45:51PM +0200, Pavel Hrdina wrote:
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/util/vircgroup.c | 67 +++-------------------------------
src/util/vircgroupbackend.h | 10 ++++++
src/util/vircgroupv1.c | 71 +++++++++++++++++++++++++++++++++++++
3 files changed, 85 insertions(+), 63 deletions(-)
@@ -246,6 +255,7 @@ struct _virCgroupBackend {
virCgroupGetBlkioDeviceWriteBpsCB getBlkioDeviceWriteBps;
virCgroupSetMemoryCB setMemory;
+ virCgroupGetMemoryStatCB getMemoryStat;
};
typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr;
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index 3235ef3d2d..cfe29649fb 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -1403,6 +1403,76 @@ virCgroupV1SetMemory(virCgroupPtr group,
}
+static int
+virCgroupV1GetMemoryStat(virCgroupPtr group,
+ unsigned long long *cache,
+ unsigned long long *activeAnon,
+ unsigned long long *inactiveAnon,
+ unsigned long long *activeFile,
+ unsigned long long *inactiveFile,
+ unsigned long long *unevictable)
+{
Original:
- int ret = -1;
- char *stat = NULL;
New:
+ VIR_AUTOFREE(char *) stat = NULL;
+ char *line = NULL;
+ unsigned long long cacheVal = 0;
+ unsigned long long activeAnonVal = 0;
+ unsigned long long inactiveAnonVal = 0;
+ unsigned long long activeFileVal = 0;
+ unsigned long long inactiveFileVal = 0;
+ unsigned long long unevictableVal = 0;
+
With the VIR_AUTOFREE conversion separated:
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano