From 825f85acfc44d02a1956ebd60db53c3614781f84 Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Mon, 30 May 2011 20:12:18 +0200 Subject: [PATCH] Use common parameter order for remote(De)SerializeTypedParameters We commonly use "value, length" order, let's stick to this. --- daemon/remote.c | 40 +++++++++++++++++++------------------- src/remote/remote_driver.c | 40 +++++++++++++++++++------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 3f13247910..1897be8b50 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -528,8 +528,8 @@ cleanup: static int remoteSerializeTypedParameters(virTypedParameterPtr params, int nparams, - u_int *ret_params_len, - remote_typed_param **ret_params_val) + remote_typed_param **ret_params_val, + u_int *ret_params_len) { int i; int rv = -1; @@ -590,8 +590,8 @@ cleanup: /* Helper to deserialize typed parameters. */ static virTypedParameterPtr -remoteDeserializeTypedParameters(u_int args_params_len, - remote_typed_param *args_params_val, +remoteDeserializeTypedParameters(remote_typed_param *args_params_val, + u_int args_params_len, int limit, int *nparams) { @@ -694,8 +694,8 @@ remoteDispatchDomainGetSchedulerParameters(struct qemud_server *server ATTRIBUTE goto cleanup; if (remoteSerializeTypedParameters(params, nparams, - &ret->params.params_len, - &ret->params.params_val) < 0) + &ret->params.params_val, + &ret->params.params_len) < 0) goto cleanup; rv = 0; @@ -747,8 +747,8 @@ remoteDispatchDomainGetSchedulerParametersFlags(struct qemud_server *server ATTR goto cleanup; if (remoteSerializeTypedParameters(params, nparams, - &ret->params.params_len, - &ret->params.params_val) < 0) + &ret->params.params_val, + &ret->params.params_len) < 0) goto cleanup; rv = 0; @@ -787,8 +787,8 @@ remoteDispatchDomainSetSchedulerParameters(struct qemud_server *server ATTRIBUTE nparams = args->params.params_len; - if ((params = remoteDeserializeTypedParameters(args->params.params_len, - args->params.params_val, + if ((params = remoteDeserializeTypedParameters(args->params.params_val, + args->params.params_len, REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX, &nparams)) == NULL) goto cleanup; @@ -829,8 +829,8 @@ remoteDispatchDomainSetSchedulerParametersFlags(struct qemud_server *server ATTR goto cleanup; } - if ((params = remoteDeserializeTypedParameters(args->params.params_len, - args->params.params_val, + if ((params = remoteDeserializeTypedParameters(args->params.params_val, + args->params.params_len, REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX, &nparams)) == NULL) goto cleanup; @@ -1369,8 +1369,8 @@ remoteDispatchDomainSetMemoryParameters(struct qemud_server *server flags = args->flags; - if ((params = remoteDeserializeTypedParameters(args->params.params_len, - args->params.params_val, + if ((params = remoteDeserializeTypedParameters(args->params.params_val, + args->params.params_len, REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX, &nparams)) == NULL) goto cleanup; @@ -1443,8 +1443,8 @@ remoteDispatchDomainGetMemoryParameters(struct qemud_server *server } if (remoteSerializeTypedParameters(params, nparams, - &ret->params.params_len, - &ret->params.params_val) < 0) + &ret->params.params_val, + &ret->params.params_len) < 0) goto cleanup; success: @@ -1484,8 +1484,8 @@ remoteDispatchDomainSetBlkioParameters(struct qemud_server *server flags = args->flags; - if ((params = remoteDeserializeTypedParameters(args->params.params_len, - args->params.params_val, + if ((params = remoteDeserializeTypedParameters(args->params.params_val, + args->params.params_len, REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX, &nparams)) == NULL) goto cleanup; @@ -1558,8 +1558,8 @@ remoteDispatchDomainGetBlkioParameters(struct qemud_server *server } if (remoteSerializeTypedParameters(params, nparams, - &ret->params.params_len, - &ret->params.params_val) < 0) + &ret->params.params_val, + &ret->params.params_len) < 0) goto cleanup; success: diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index d6bf7c3c54..4817686590 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1783,8 +1783,8 @@ done: static int remoteSerializeTypedParameters(virTypedParameterPtr params, int nparams, - u_int *args_params_len, - remote_typed_param **args_params_val) + remote_typed_param **args_params_val, + u_int *args_params_len) { int i; int rv = -1; @@ -1845,8 +1845,8 @@ cleanup: /* Helper to deserialize typed parameters. */ static int -remoteDeserializeTypedParameters(u_int ret_params_len, - remote_typed_param *ret_params_val, +remoteDeserializeTypedParameters(remote_typed_param *ret_params_val, + u_int ret_params_len, int limit, virTypedParameterPtr params, int *nparams) @@ -1928,8 +1928,8 @@ remoteDomainSetMemoryParameters (virDomainPtr domain, args.flags = flags; if (remoteSerializeTypedParameters(params, nparams, - &args.params.params_len, - &args.params.params_val) < 0) { + &args.params.params_val, + &args.params.params_len) < 0) { xdr_free ((xdrproc_t) xdr_remote_domain_set_memory_parameters_args, (char *) &args); goto done; @@ -1978,8 +1978,8 @@ remoteDomainGetMemoryParameters (virDomainPtr domain, goto cleanup; } - if (remoteDeserializeTypedParameters(ret.params.params_len, - ret.params.params_val, + if (remoteDeserializeTypedParameters(ret.params.params_val, + ret.params.params_len, REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX, params, nparams) < 0) @@ -2012,8 +2012,8 @@ remoteDomainSetBlkioParameters (virDomainPtr domain, args.flags = flags; if (remoteSerializeTypedParameters(params, nparams, - &args.params.params_len, - &args.params.params_val) < 0) { + &args.params.params_val, + &args.params.params_len) < 0) { xdr_free ((xdrproc_t) xdr_remote_domain_set_blkio_parameters_args, (char *) &args); goto done; @@ -2062,8 +2062,8 @@ remoteDomainGetBlkioParameters (virDomainPtr domain, goto cleanup; } - if (remoteDeserializeTypedParameters(ret.params.params_len, - ret.params.params_val, + if (remoteDeserializeTypedParameters(ret.params.params_val, + ret.params.params_len, REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX, params, nparams) < 0) @@ -2450,8 +2450,8 @@ remoteDomainGetSchedulerParameters (virDomainPtr domain, (xdrproc_t) xdr_remote_domain_get_scheduler_parameters_ret, (char *) &ret) == -1) goto done; - if (remoteDeserializeTypedParameters(ret.params.params_len, - ret.params.params_val, + if (remoteDeserializeTypedParameters(ret.params.params_val, + ret.params.params_len, REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX, params, nparams) < 0) @@ -2489,8 +2489,8 @@ remoteDomainGetSchedulerParametersFlags (virDomainPtr domain, (xdrproc_t) xdr_remote_domain_get_scheduler_parameters_flags_ret, (char *) &ret) == -1) goto done; - if (remoteDeserializeTypedParameters(ret.params.params_len, - ret.params.params_val, + if (remoteDeserializeTypedParameters(ret.params.params_val, + ret.params.params_len, REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX, params, nparams) < 0) @@ -2518,8 +2518,8 @@ remoteDomainSetSchedulerParameters (virDomainPtr domain, make_nonnull_domain (&args.dom, domain); if (remoteSerializeTypedParameters(params, nparams, - &args.params.params_len, - &args.params.params_val) < 0) { + &args.params.params_val, + &args.params.params_len) < 0) { xdr_free ((xdrproc_t) xdr_remote_domain_set_scheduler_parameters_args, (char *) &args); goto done; @@ -2554,8 +2554,8 @@ remoteDomainSetSchedulerParametersFlags(virDomainPtr domain, args.flags = flags; if (remoteSerializeTypedParameters(params, nparams, - &args.params.params_len, - &args.params.params_val) < 0) { + &args.params.params_val, + &args.params.params_len) < 0) { xdr_free ((xdrproc_t) xdr_remote_domain_set_scheduler_parameters_flags_args, (char *) &args); goto done; -- GitLab