On Fri, 2009-12-18 at 10:30 +0000, Daniel P. Berrange wrote:
On Thu, Dec 17, 2009 at 05:41:45PM -0500, Adam Litke wrote:
> Use a dynamically sized xdr_array to pass memory stats on the wire. This
> supports the addition of future memory stats and reduces the message size since
> only supported statistics are returned.
>
> Signed-off-by: Adam Litke <agl(a)us.ibm.com>
> To: libvirt list <libvir-list(a)redhat.com>
> Cc: Daniel Veillard <veillard(a)redhat.com>
> Cc: Daniel P. Berrange <berrange(a)redhat.com>
> ---
> daemon/remote.c | 56 ++++++++++++++++++++++++++++++++++++++++++
> src/remote/remote_driver.c | 44 ++++++++++++++++++++++++++++++++-
> src/remote/remote_protocol.c | 35 ++++++++++++++++++++++++++
> src/remote/remote_protocol.h | 25 ++++++++++++++++++
> src/remote/remote_protocol.x | 18 ++++++++++++-
> 5 files changed, 176 insertions(+), 2 deletions(-)
>
> +struct remote_domain_memory_stats_ret {
> + u_int len;
> + struct remote_domain_memory_stat *stats;
> +};
> +typedef struct remote_domain_memory_stats_ret remote_domain_memory_stats_ret;
> +
> +struct remote_domain_memory_stats_ret {
> + u_int len;
> + remote_domain_memory_stat<REMOTE_DOMAIN_MEMORY_STATS_MAX>;
> +};
Something odd happened in the RPC generated code here, because rpcgen
should create you an explicit length field without you needing one. I
think it is because I forgot the param name on the array in the
example I gave you. Basically it should work just like the existing
'struct remote_domain_get_scheduler_parameters_ret' definition
I explicitly added the len parameter because I need to return the number
of elements actually updated back to the remote caller (see
remoteDomainMemoryStats). Is there another way to extract this data
using xdr without my explicit variable?
struct remote_domain_memory_stats_ret {
remote_domain_memory_stat stats<REMOTE_DOMAIN_MEMORY_STATS_MAX>;
};
Daniel
--
Thanks,
Adam