[Libvir] [PATCH] (for discussion) DHCP host mappings using 3 arrays API

Richard W.M. Jones rjones at redhat.com
Mon Feb 25 17:28:05 UTC 2008


On Mon, Feb 25, 2008 at 04:49:00PM +0000, Richard W.M. Jones wrote:
[...]

Thanks to Jim for pointing me in the right direction here.  If you try
this patch you'll need to insert memset() calls at the two places
indicated below.  That fixes all the problems I can see and it appears
to all work fine now.

Rich.

> +static int
> +remoteNetworkNumOfDHCPHostMappings (virNetworkPtr network)
> +{
> +    remote_network_num_of_dhcp_host_mappings_args args;
> +    remote_network_num_of_dhcp_host_mappings_ret ret;
> +    GET_NETWORK_PRIVATE (network->conn, -1);
> +
> +    make_nonnull_network (&args.net, network);
> +

  memset (&ret, 0, sizeof ret);

> +    if (call (network->conn, priv, 0, REMOTE_PROC_NETWORK_NUM_OF_DHCP_HOST_MAPPINGS,
> +              (xdrproc_t) xdr_remote_network_num_of_dhcp_host_mappings_args, (char *) &args,
> +              (xdrproc_t) xdr_remote_network_num_of_dhcp_host_mappings_ret, (char *) &ret) == -1)
> +        return -1;
> +
> +    return ret.num;
> +}
> +
> +
> +static int
> +remoteNetworkListDHCPHostMappings (virNetworkPtr network,
> +                                   char **const hwaddrs,
> +                                   char **const ipaddrs,
> +                                   char **const hostnames,
> +                                   int maxmappings)
> +{
> +    remote_network_list_dhcp_host_mappings_args args;
> +    remote_network_list_dhcp_host_mappings_ret ret;
> +    int i;
> +    GET_NETWORK_PRIVATE (network->conn, -1);
> +
> +    make_nonnull_network (&args.net, network);
> +    args.maxmappings = maxmappings;
> +

  memset (&ret, 0, sizeof ret);

> +    if (call (network->conn, priv, 0, REMOTE_PROC_NETWORK_LIST_DHCP_HOST_MAPPINGS,
> +              (xdrproc_t) xdr_remote_network_list_dhcp_host_mappings_args, (char *) &args,
> +              (xdrproc_t) xdr_remote_network_list_dhcp_host_mappings_ret, (char *) &ret) == -1)
> +        return -1;


-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the libvir-list mailing list