提交 da1b1932 编写于 作者: P Peter Krempa

qemuAgentFSInfoFormatParams: Remove pointless returned value

The only caller doesn't check the value and also there are no real
errors to report anyways.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 bc6dc8ce
...@@ -22709,24 +22709,20 @@ qemuDomainGetGuestInfoCheckSupport(unsigned int *types) ...@@ -22709,24 +22709,20 @@ qemuDomainGetGuestInfoCheckSupport(unsigned int *types)
*types = *types & supportedGuestInfoTypes; *types = *types & supportedGuestInfoTypes;
} }
/* Returns: 0 on success static void
* -1 otherwise
*/
static int
qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo, qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
int nfs, int nfs,
virDomainDefPtr vmdef, virDomainDefPtr vmdef,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *maxparams) int *nparams, int *maxparams)
{ {
int ret = -1;
size_t i, j; size_t i, j;
/* FIXME: get disk target */ /* FIXME: get disk target */
if (virTypedParamsAddUInt(params, nparams, maxparams, if (virTypedParamsAddUInt(params, nparams, maxparams,
"fs.count", nfs) < 0) "fs.count", nfs) < 0)
goto cleanup; return;
for (i = 0; i < nfs; i++) { for (i = 0; i < nfs; i++) {
char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
...@@ -22734,17 +22730,17 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo, ...@@ -22734,17 +22730,17 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
"fs.%zu.name", i); "fs.%zu.name", i);
if (virTypedParamsAddString(params, nparams, maxparams, if (virTypedParamsAddString(params, nparams, maxparams,
param_name, fsinfo[i]->name) < 0) param_name, fsinfo[i]->name) < 0)
goto cleanup; return;
g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
"fs.%zu.mountpoint", i); "fs.%zu.mountpoint", i);
if (virTypedParamsAddString(params, nparams, maxparams, if (virTypedParamsAddString(params, nparams, maxparams,
param_name, fsinfo[i]->mountpoint) < 0) param_name, fsinfo[i]->mountpoint) < 0)
goto cleanup; return;
g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
"fs.%zu.fstype", i); "fs.%zu.fstype", i);
if (virTypedParamsAddString(params, nparams, maxparams, if (virTypedParamsAddString(params, nparams, maxparams,
param_name, fsinfo[i]->fstype) < 0) param_name, fsinfo[i]->fstype) < 0)
goto cleanup; return;
/* disk usage values are not returned by older guest agents, so /* disk usage values are not returned by older guest agents, so
* only add the params if the value is set */ * only add the params if the value is set */
...@@ -22753,20 +22749,20 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo, ...@@ -22753,20 +22749,20 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
if (fsinfo[i]->total_bytes != -1 && if (fsinfo[i]->total_bytes != -1 &&
virTypedParamsAddULLong(params, nparams, maxparams, virTypedParamsAddULLong(params, nparams, maxparams,
param_name, fsinfo[i]->total_bytes) < 0) param_name, fsinfo[i]->total_bytes) < 0)
goto cleanup; return;
g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
"fs.%zu.used-bytes", i); "fs.%zu.used-bytes", i);
if (fsinfo[i]->used_bytes != -1 && if (fsinfo[i]->used_bytes != -1 &&
virTypedParamsAddULLong(params, nparams, maxparams, virTypedParamsAddULLong(params, nparams, maxparams,
param_name, fsinfo[i]->used_bytes) < 0) param_name, fsinfo[i]->used_bytes) < 0)
goto cleanup; return;
g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
"fs.%zu.disk.count", i); "fs.%zu.disk.count", i);
if (virTypedParamsAddUInt(params, nparams, maxparams, if (virTypedParamsAddUInt(params, nparams, maxparams,
param_name, fsinfo[i]->ndisks) < 0) param_name, fsinfo[i]->ndisks) < 0)
goto cleanup; return;
for (j = 0; j < fsinfo[i]->ndisks; j++) { for (j = 0; j < fsinfo[i]->ndisks; j++) {
virDomainDiskDefPtr diskdef = NULL; virDomainDiskDefPtr diskdef = NULL;
qemuAgentDiskInfoPtr d = fsinfo[i]->disks[j]; qemuAgentDiskInfoPtr d = fsinfo[i]->disks[j];
...@@ -22782,7 +22778,7 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo, ...@@ -22782,7 +22778,7 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
if (diskdef->dst && if (diskdef->dst &&
virTypedParamsAddString(params, nparams, maxparams, virTypedParamsAddString(params, nparams, maxparams,
param_name, diskdef->dst) < 0) param_name, diskdef->dst) < 0)
goto cleanup; return;
} }
g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
...@@ -22790,22 +22786,19 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo, ...@@ -22790,22 +22786,19 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
if (d->serial && if (d->serial &&
virTypedParamsAddString(params, nparams, maxparams, virTypedParamsAddString(params, nparams, maxparams,
param_name, d->serial) < 0) param_name, d->serial) < 0)
goto cleanup; return;
g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
"fs.%zu.disk.%zu.device", i, j); "fs.%zu.disk.%zu.device", i, j);
if (d->devnode && if (d->devnode &&
virTypedParamsAddString(params, nparams, maxparams, virTypedParamsAddString(params, nparams, maxparams,
param_name, d->devnode) < 0) param_name, d->devnode) < 0)
goto cleanup; return;
} }
} }
ret = nfs;
cleanup:
return ret;
} }
static int static int
qemuDomainGetGuestInfo(virDomainPtr dom, qemuDomainGetGuestInfo(virDomainPtr dom,
unsigned int types, unsigned int types,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册