virHostMemGet(Stats|Parameters): Remove unused 'flags'

The utility functions which get memory stats don't actually use the
flags. Remove the argument and move the 'virCheckFlags' to driver
implementation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa committed 2026-05-14 12:13:09 +02:00
1 parent e8ad1aec1d
commit f4b5da14b6
8 files changed
+46 -40

No files matched your search

+9 -3
View File
@@ -1160,10 +1160,12 @@ bhyveNodeGetMemoryStats(virConnectPtr conn,
int *nparams,
unsigned int flags)
{
virCheckFlags(0, -1);
if (virNodeGetMemoryStatsEnsureACL(conn) < 0)
return -1;
return virHostMemGetStats(cellNum, params, nparams, flags);
return virHostMemGetStats(cellNum, params, nparams);
}
static int
@@ -1375,10 +1377,12 @@ bhyveNodeGetMemoryParameters(virConnectPtr conn,
int *nparams,
unsigned int flags)
{
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
if (virNodeGetMemoryParametersEnsureACL(conn) < 0)
return -1;
return virHostMemGetParameters(params, nparams, flags);
return virHostMemGetParameters(params, nparams);
}
static int
@@ -1387,10 +1391,12 @@ bhyveNodeSetMemoryParameters(virConnectPtr conn,
int nparams,
unsigned int flags)
{
virCheckFlags(0, -1);
if (virNodeSetMemoryParametersEnsureACL(conn) < 0)
return -1;
return virHostMemSetParameters(params, nparams, flags);
return virHostMemSetParameters(params, nparams);
}
static char *
+3 -1
View File
@@ -2304,10 +2304,12 @@ chNodeGetMemoryStats(virConnectPtr conn,
int *nparams,
unsigned int flags)
{
virCheckFlags(0, -1);
if (virNodeGetMemoryStatsEnsureACL(conn) < 0)
return -1;
return virHostMemGetStats(cellNum, params, nparams, flags);
return virHostMemGetStats(cellNum, params, nparams);
}
static int
+9 -3
View File
@@ -4803,10 +4803,12 @@ lxcNodeGetMemoryStats(virConnectPtr conn,
int *nparams,
unsigned int flags)
{
virCheckFlags(0, -1);
if (virNodeGetMemoryStatsEnsureACL(conn) < 0)
return -1;
return virHostMemGetStats(cellNum, params, nparams, flags);
return virHostMemGetStats(cellNum, params, nparams);
}
@@ -4844,10 +4846,12 @@ lxcNodeGetMemoryParameters(virConnectPtr conn,
int *nparams,
unsigned int flags)
{
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
if (virNodeGetMemoryParametersEnsureACL(conn) < 0)
return -1;
return virHostMemGetParameters(params, nparams, flags);
return virHostMemGetParameters(params, nparams);
}
@@ -4857,10 +4861,12 @@ lxcNodeSetMemoryParameters(virConnectPtr conn,
int nparams,
unsigned int flags)
{
virCheckFlags(0, -1);
if (virNodeSetMemoryParametersEnsureACL(conn) < 0)
return -1;
return virHostMemSetParameters(params, nparams, flags);
return virHostMemSetParameters(params, nparams);
}
+3 -1
View File
@@ -1862,7 +1862,9 @@ openvzNodeGetMemoryStats(virConnectPtr conn G_GNUC_UNUSED,
int *nparams,
unsigned int flags)
{
return virHostMemGetStats(cellNum, params, nparams, flags);
virCheckFlags(0, -1);
return virHostMemGetStats(cellNum, params, nparams);
}
+9 -3
View File
@@ -16406,10 +16406,12 @@ qemuNodeGetMemoryStats(virConnectPtr conn,
int *nparams,
unsigned int flags)
{
virCheckFlags(0, -1);
if (virNodeGetMemoryStatsEnsureACL(conn) < 0)
return -1;
return virHostMemGetStats(cellNum, params, nparams, flags);
return virHostMemGetStats(cellNum, params, nparams);
}
@@ -16447,10 +16449,12 @@ qemuNodeGetMemoryParameters(virConnectPtr conn,
int *nparams,
unsigned int flags)
{
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
if (virNodeGetMemoryParametersEnsureACL(conn) < 0)
return -1;
return virHostMemGetParameters(params, nparams, flags);
return virHostMemGetParameters(params, nparams);
}
@@ -16460,10 +16464,12 @@ qemuNodeSetMemoryParameters(virConnectPtr conn,
int nparams,
unsigned int flags)
{
virCheckFlags(0, -1);
if (virNodeSetMemoryParametersEnsureACL(conn) < 0)
return -1;
return virHostMemSetParameters(params, nparams, flags);
return virHostMemSetParameters(params, nparams);
}
+7 -22
View File
@@ -248,11 +248,8 @@ virHostMemGetStatsLinux(FILE *meminfo,
int
virHostMemGetStats(int cellNum G_GNUC_UNUSED,
virNodeMemoryStatsPtr params G_GNUC_UNUSED,
int *nparams G_GNUC_UNUSED,
unsigned int flags)
int *nparams G_GNUC_UNUSED)
{
virCheckFlags(0, -1);
#ifdef __linux__
{
int ret;
@@ -356,14 +353,11 @@ virHostMemParametersAreAllSupported(virTypedParameterPtr params,
#ifdef __linux__
int
virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
int nparams G_GNUC_UNUSED,
unsigned int flags)
virHostMemSetParameters(virTypedParameterPtr params,
int nparams)
{
size_t i;
virCheckFlags(0, -1);
if (virTypedParamsValidate(params, nparams,
VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN,
VIR_TYPED_PARAM_UINT,
@@ -387,11 +381,8 @@ virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
#else
int
virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
int nparams G_GNUC_UNUSED,
unsigned int flags)
int nparams G_GNUC_UNUSED)
{
virCheckFlags(0, -1);
virReportError(VIR_ERR_NO_SUPPORT, "%s",
_("node set memory parameters not implemented on this platform"));
return -1;
@@ -443,9 +434,8 @@ virHostMemGetParameterValue(const char *field,
#define NODE_MEMORY_PARAMETERS_NUM 8
#ifdef __linux__
int
virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
int *nparams G_GNUC_UNUSED,
unsigned int flags)
virHostMemGetParameters(virTypedParameterPtr params,
int *nparams)
{
unsigned int pages_to_scan;
unsigned int sleep_millisecs;
@@ -458,8 +448,6 @@ virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
size_t i;
int ret;
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
if ((*nparams) == 0) {
*nparams = NODE_MEMORY_PARAMETERS_NUM;
return 0;
@@ -580,11 +568,8 @@ virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
#else
int
virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
int *nparams G_GNUC_UNUSED,
unsigned int flags)
int *nparams G_GNUC_UNUSED)
{
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
virReportError(VIR_ERR_NO_SUPPORT, "%s",
_("node get memory parameters not implemented on this platform"));
return -1;
+3 -6
View File
@@ -25,8 +25,7 @@
int virHostMemGetStats(int cellNum,
virNodeMemoryStatsPtr params,
int *nparams,
unsigned int flags);
int *nparams);
int virHostMemGetCellsFree(unsigned long long *freeMems,
int startCell,
int maxCells);
@@ -34,12 +33,10 @@ int virHostMemGetInfo(unsigned long long *mem,
unsigned long long *freeMem);
int virHostMemGetParameters(virTypedParameterPtr params,
int *nparams,
unsigned int flags);
int *nparams);
int virHostMemSetParameters(virTypedParameterPtr params,
int nparams,
unsigned int flags);
int nparams);
int virHostMemGetFreePages(unsigned int npages,
unsigned int *pages,
+3 -1
View File
@@ -1981,10 +1981,12 @@ vzNodeGetMemoryStats(virConnectPtr conn,
int *nparams,
unsigned int flags)
{
virCheckFlags(0, -1);
if (virNodeGetMemoryStatsEnsureACL(conn) < 0)
return -1;
return virHostMemGetStats(cellNum, params, nparams, flags);
return virHostMemGetStats(cellNum, params, nparams);
}
static int