[libvirt] [PATCH 30/47] vircgroup: extract virCgroupV1GetMemoryStat
Ján Tomko
jtomko at redhat.com
Tue Sep 25 10:00:26 UTC 2018
On Tue, Sep 18, 2018 at 05:45:51PM +0200, Pavel Hrdina wrote:
>Signed-off-by: Pavel Hrdina <phrdina at 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 at redhat.com>
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180925/6cab1eb8/attachment-0001.sig>
More information about the libvir-list
mailing list