* @nparams: pointer to number of memory parameters
* @flags: currently unused, for future extension
*
- * Get the memory parameters, the @params array will be filled with the values
+ * Get all memory parameters, the @params array will be filled with the values
* equal to the number of parameters suggested by @nparams
*
* As the value of @nparams is dynamic, call the API setting @nparams to 0 and
virDispatchError(NULL);
return -1;
}
- if ((nparams == NULL) || (*nparams < 0)) {
+ if ((nparams == NULL) || (*nparams < 0) ||
+ (params == NULL && *nparams != 0)) {
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
* @nparams: pointer to number of blkio parameters
* @flags: currently unused, for future extension
*
- * Get the blkio parameters, the @params array will be filled with the values
- * equal to the number of parameters suggested by @nparams
+ * Get all blkio parameters, the @params array will be filled with the values
+ * equal to the number of parameters suggested by @nparams.
+ * See virDomainGetMemoryParameters for an equivalent usage example.
*
* This function requires privileged access to the hypervisor. This function
* expects the caller to allocate the @params.
virDispatchError(NULL);
return -1;
}
- if ((nparams == NULL) || (*nparams < 0)) {
+ if ((nparams == NULL) || (*nparams < 0) ||
+ (params == NULL && *nparams != 0)) {
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
ret = 0;
goto cleanup;
}
- if ((*nparams) != LXC_NB_MEM_PARAM) {
+ if ((*nparams) < LXC_NB_MEM_PARAM) {
lxcError(VIR_ERR_INVALID_ARG,
"%s", _("Invalid parameter count"));
goto cleanup;
goto cleanup;
}
- for (i = 0; i < *nparams; i++) {
+ for (i = 0; i < LXC_NB_MEM_PARAM; i++) {
virMemoryParameterPtr param = ¶ms[i];
val = 0;
param->value.ul = 0;
}
}
+ *nparams = LXC_NB_MEM_PARAM;
ret = 0;
cleanup:
goto cleanup;
}
- if ((*nparams) != QEMU_NB_MEM_PARAM) {
+ if ((*nparams) < QEMU_NB_MEM_PARAM) {
qemuReportError(VIR_ERR_INVALID_ARG,
"%s", _("Invalid parameter count"));
goto cleanup;
goto cleanup;
}
- for (i = 0; i < *nparams; i++) {
+ for (i = 0; i < QEMU_NB_MEM_PARAM; i++) {
virMemoryParameterPtr param = ¶ms[i];
val = 0;
param->value.ul = 0;
}
}
+ *nparams = QEMU_NB_MEM_PARAM;
ret = 0;
cleanup: