提交 8a47ed29 编写于 作者: E Eric Blake 提交者: Daniel Veillard

remote: consolidate typed parameter handling

* src/remote/remote_protocol.x (remote_typed_param_value)
(remote_typed_param):  New types.
(remote_sched_param_value, remote_sched_param)
(remote_blkio_param_value, remote_blkio_param)
(remote_memory_param_value, remote_memory_param): Delete.
(remote_domain_get_scheduler_parameters_ret)
(remote_domain_set_scheduler_parameters_args)
(remote_domain_set_scheduler_parameters_flags_args)
(remote_domain_set_blkio_parameters_args)
(remote_domain_get_blkio_parameters_ret)
(remote_domain_set_memory_parameters_args)
(remote_domain_get_memory_parameters_ret): Update clients.
* src/remote_protocol-structs: Likewise.
* src/remote/remote_driver.c (remoteSerializeTypedParameters)
(remoteDeserializeTypedParameters): New functions.
(remoteDomainSetMemoryParameters)
(remoteDomainGetMemoryParameters, remoteDomainSetBlkioParameters)
(remoteDomainGetBlkioParameters)
(remoteDomainGetSchedulerParameters)
(remoteDomainSetSchedulerParameters)
(remoteDomainSetSchedulerParametersFlags): Update clients.
* daemon/remote.c (remoteSerializeTypedParameters)
(remoteDeserializeTypedParameters): New functions.
(remoteDispatchDomainGetSchedulerParameters)
(remoteDispatchDomainSetSchedulerParameters)
(remoteDispatchDomainSetSchedulerParametersFlags)
(remoteDispatchDomainSetMemoryParameters)
(remoteDispatchDomainGetMemoryParameters)
(remoteDispatchDomainSetBlkioParameters)
(remoteDispatchDomainGetBlkioParameters): Update clients.
上级 163e5f04
此差异已折叠。
此差异已折叠。
......@@ -296,67 +296,27 @@ struct remote_vcpu_info {
int cpu;
};
/* Wire encoding of virDomainSchedParameter.
/* Wire encoding of virTypedParameter.
* Note the enum (type) which must remain binary compatible.
*/
union remote_sched_param_value switch (int type) {
case VIR_DOMAIN_SCHED_FIELD_INT:
union remote_typed_param_value switch (int type) {
case VIR_TYPED_PARAM_INT:
int i;
case VIR_DOMAIN_SCHED_FIELD_UINT:
case VIR_TYPED_PARAM_UINT:
unsigned int ui;
case VIR_DOMAIN_SCHED_FIELD_LLONG:
case VIR_TYPED_PARAM_LLONG:
hyper l;
case VIR_DOMAIN_SCHED_FIELD_ULLONG:
case VIR_TYPED_PARAM_ULLONG:
unsigned hyper ul;
case VIR_DOMAIN_SCHED_FIELD_DOUBLE:
case VIR_TYPED_PARAM_DOUBLE:
double d;
case VIR_DOMAIN_SCHED_FIELD_BOOLEAN:
case VIR_TYPED_PARAM_BOOLEAN:
int b;
};
struct remote_sched_param {
struct remote_typed_param {
remote_nonnull_string field;
remote_sched_param_value value;
};
union remote_blkio_param_value switch (int type) {
case VIR_DOMAIN_BLKIO_PARAM_INT:
int i;
case VIR_DOMAIN_BLKIO_PARAM_UINT:
unsigned int ui;
case VIR_DOMAIN_BLKIO_PARAM_LLONG:
hyper l;
case VIR_DOMAIN_BLKIO_PARAM_ULLONG:
unsigned hyper ul;
case VIR_DOMAIN_BLKIO_PARAM_DOUBLE:
double d;
case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN:
int b;
};
struct remote_blkio_param {
remote_nonnull_string field;
remote_blkio_param_value value;
};
union remote_memory_param_value switch (int type) {
case VIR_DOMAIN_MEMORY_PARAM_INT:
int i;
case VIR_DOMAIN_MEMORY_PARAM_UINT:
unsigned int ui;
case VIR_DOMAIN_MEMORY_PARAM_LLONG:
hyper l;
case VIR_DOMAIN_MEMORY_PARAM_ULLONG:
unsigned hyper ul;
case VIR_DOMAIN_MEMORY_PARAM_DOUBLE:
double d;
case VIR_DOMAIN_MEMORY_PARAM_BOOLEAN:
int b;
};
struct remote_memory_param {
remote_nonnull_string field;
remote_memory_param_value value;
remote_typed_param_value value;
};
/*----- Calls. -----*/
......@@ -471,23 +431,23 @@ struct remote_domain_get_scheduler_parameters_args {
};
struct remote_domain_get_scheduler_parameters_ret {
remote_sched_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
remote_typed_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
};
struct remote_domain_set_scheduler_parameters_args {
remote_nonnull_domain dom;
remote_sched_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
remote_typed_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
};
struct remote_domain_set_scheduler_parameters_flags_args {
remote_nonnull_domain dom;
remote_sched_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
remote_typed_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
unsigned int flags;
};
struct remote_domain_set_blkio_parameters_args {
remote_nonnull_domain dom;
remote_blkio_param params<REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX>;
remote_typed_param params<REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX>;
unsigned int flags;
};
......@@ -498,13 +458,13 @@ struct remote_domain_get_blkio_parameters_args {
};
struct remote_domain_get_blkio_parameters_ret {
remote_blkio_param params<REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX>;
remote_typed_param params<REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX>;
int nparams;
};
struct remote_domain_set_memory_parameters_args {
remote_nonnull_domain dom;
remote_memory_param params<REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX>;
remote_typed_param params<REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX>;
unsigned int flags;
};
......@@ -515,7 +475,7 @@ struct remote_domain_get_memory_parameters_args {
};
struct remote_domain_get_memory_parameters_ret {
remote_memory_param params<REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX>;
remote_typed_param params<REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX>;
int nparams;
};
......
......@@ -56,7 +56,7 @@ struct remote_vcpu_info {
uint64_t cpu_time;
int cpu;
};
struct remote_sched_param_value {
struct remote_typed_param_value {
int type;
union {
int i;
......@@ -65,41 +65,11 @@ struct remote_sched_param_value {
uint64_t ul;
double d;
int b;
} remote_sched_param_value_u;
} remote_typed_param_value_u;
};
struct remote_sched_param {
struct remote_typed_param {
remote_nonnull_string field;
remote_sched_param_value value;
};
struct remote_blkio_param_value {
int type;
union {
int i;
u_int ui;
int64_t l;
uint64_t ul;
double d;
int b;
} remote_blkio_param_value_u;
};
struct remote_blkio_param {
remote_nonnull_string field;
remote_blkio_param_value value;
};
struct remote_memory_param_value {
int type;
union {
int i;
u_int ui;
int64_t l;
uint64_t ul;
double d;
int b;
} remote_memory_param_value_u;
};
struct remote_memory_param {
remote_nonnull_string field;
remote_memory_param_value value;
remote_typed_param_value value;
};
struct remote_open_args {
remote_string name;
......@@ -178,21 +148,21 @@ struct remote_domain_get_scheduler_parameters_args {
struct remote_domain_get_scheduler_parameters_ret {
struct {
u_int params_len;
remote_sched_param * params_val;
remote_typed_param * params_val;
} params;
};
struct remote_domain_set_scheduler_parameters_args {
remote_nonnull_domain dom;
struct {
u_int params_len;
remote_sched_param * params_val;
remote_typed_param * params_val;
} params;
};
struct remote_domain_set_scheduler_parameters_flags_args {
remote_nonnull_domain dom;
struct {
u_int params_len;
remote_sched_param * params_val;
remote_typed_param * params_val;
} params;
u_int flags;
};
......@@ -200,7 +170,7 @@ struct remote_domain_set_blkio_parameters_args {
remote_nonnull_domain dom;
struct {
u_int params_len;
remote_blkio_param * params_val;
remote_typed_param * params_val;
} params;
u_int flags;
};
......@@ -212,7 +182,7 @@ struct remote_domain_get_blkio_parameters_args {
struct remote_domain_get_blkio_parameters_ret {
struct {
u_int params_len;
remote_blkio_param * params_val;
remote_typed_param * params_val;
} params;
int nparams;
};
......@@ -220,7 +190,7 @@ struct remote_domain_set_memory_parameters_args {
remote_nonnull_domain dom;
struct {
u_int params_len;
remote_memory_param * params_val;
remote_typed_param * params_val;
} params;
u_int flags;
};
......@@ -232,7 +202,7 @@ struct remote_domain_get_memory_parameters_args {
struct remote_domain_get_memory_parameters_ret {
struct {
u_int params_len;
remote_memory_param * params_val;
remote_typed_param * params_val;
} params;
int nparams;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册