mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
util: virHostMem*Parameters: split out non-Linux stubs
Repeat the whole function header instead of mixing #ifdefs in the code. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
c927b2e85a
commit
d8c9584aed
@ -354,16 +354,16 @@ virHostMemParametersAreAllSupported(virTypedParameterPtr params,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
int
|
int
|
||||||
virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
|
virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
|
||||||
int nparams G_GNUC_UNUSED,
|
int nparams G_GNUC_UNUSED,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virCheckFlags(0, -1);
|
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (virTypedParamsValidate(params, nparams,
|
if (virTypedParamsValidate(params, nparams,
|
||||||
VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN,
|
VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN,
|
||||||
VIR_TYPED_PARAM_UINT,
|
VIR_TYPED_PARAM_UINT,
|
||||||
@ -383,13 +383,21 @@ virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
int
|
||||||
|
virHostMemSetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
|
||||||
|
int nparams G_GNUC_UNUSED,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||||
_("node set memory parameters not implemented"
|
_("node set memory parameters not implemented"
|
||||||
" on this platform"));
|
" on this platform"));
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
static int
|
static int
|
||||||
@ -434,14 +442,12 @@ virHostMemGetParameterValue(const char *field,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NODE_MEMORY_PARAMETERS_NUM 8
|
#define NODE_MEMORY_PARAMETERS_NUM 8
|
||||||
|
#ifdef __linux__
|
||||||
int
|
int
|
||||||
virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
|
virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
|
||||||
int *nparams G_GNUC_UNUSED,
|
int *nparams G_GNUC_UNUSED,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
|
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
unsigned int pages_to_scan;
|
unsigned int pages_to_scan;
|
||||||
unsigned int sleep_millisecs;
|
unsigned int sleep_millisecs;
|
||||||
unsigned int merge_across_nodes;
|
unsigned int merge_across_nodes;
|
||||||
@ -453,6 +459,8 @@ virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
|
|||||||
size_t i;
|
size_t i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
|
||||||
|
|
||||||
if ((*nparams) == 0) {
|
if ((*nparams) == 0) {
|
||||||
*nparams = NODE_MEMORY_PARAMETERS_NUM;
|
*nparams = NODE_MEMORY_PARAMETERS_NUM;
|
||||||
return 0;
|
return 0;
|
||||||
@ -569,13 +577,21 @@ virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
int
|
||||||
|
virHostMemGetParameters(virTypedParameterPtr params G_GNUC_UNUSED,
|
||||||
|
int *nparams G_GNUC_UNUSED,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
|
||||||
|
|
||||||
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||||
_("node get memory parameters not implemented"
|
_("node get memory parameters not implemented"
|
||||||
" on this platform"));
|
" on this platform"));
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
Loading…
x
Reference in New Issue
Block a user