[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/7] remote generator: Rename virNodeGetCellsFreeMemory parameters to common pattern



On Mon, May 23, 2011 at 07:36:05PM +0200, Matthias Bolte wrote:
> This allows to remove some special case code from the generator.
> ---
>  daemon/remote_generator.pl   |    3 +--
>  src/remote/remote_driver.c   |    8 ++++----
>  src/remote/remote_protocol.x |    4 ++--
>  src/remote_protocol-structs  |    8 ++++----
>  4 files changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
> index b23e3b1..2da0f2e 100755
> --- a/daemon/remote_generator.pl
> +++ b/daemon/remote_generator.pl
> @@ -505,17 +505,16 @@ elsif ($opt_b) {
>                      $single_ret_by_ref = 0;
>                      $single_ret_as_list = 1;
>                      $single_ret_list_name = $1;
> +                    $single_ret_list_max_var = "max$1";
>                      $single_ret_list_max_define = $2;
>  
>                      my $conn = shift(@args_list);
>  
>                      if ($call->{ProcName} eq "NodeGetCellsFreeMemory") {
>                          $single_ret_check = " <= 0";
> -                        $single_ret_list_max_var = "maxCells";
>                          unshift(@args_list, "(unsigned long long *)ret->$1.$1_val");
>                      } else {
>                          $single_ret_check = " < 0";
> -                        $single_ret_list_max_var = "max$1";
>                          unshift(@args_list, "ret->$1.$1_val");
>                      }
>  
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 69b888d..fb542c5 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -1715,7 +1715,7 @@ remoteNodeGetCellsFreeMemory(virConnectPtr conn,
>      }
>  
>      args.startCell = startCell;
> -    args.maxCells = maxCells;
> +    args.maxcells = maxCells;
>  
>      memset (&ret, 0, sizeof ret);
>      if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY,
> @@ -1723,12 +1723,12 @@ remoteNodeGetCellsFreeMemory(virConnectPtr conn,
>                (xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *)&ret) == -1)
>          goto done;
>  
> -    for (i = 0 ; i < ret.freeMems.freeMems_len ; i++)
> -        freeMems[i] = ret.freeMems.freeMems_val[i];
> +    for (i = 0 ; i < ret.cells.cells_len ; i++)
> +        freeMems[i] = ret.cells.cells_val[i];
>  
>      xdr_free((xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *) &ret);
>  
> -    rv = ret.freeMems.freeMems_len;
> +    rv = ret.cells.cells_len;
>  
>  done:
>      remoteDriverUnlock(priv);
> diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
> index 9df86da..3e9bd5c 100644
> --- a/src/remote/remote_protocol.x
> +++ b/src/remote/remote_protocol.x
> @@ -442,11 +442,11 @@ struct remote_get_capabilities_ret {
>  
>  struct remote_node_get_cells_free_memory_args {
>      int startCell;
> -    int maxCells;
> +    int maxcells;
>  };
>  
>  struct remote_node_get_cells_free_memory_ret {
> -    hyper freeMems<REMOTE_NODE_MAX_CELLS>;
> +    hyper cells<REMOTE_NODE_MAX_CELLS>;
>  };
>  
>  struct remote_node_get_free_memory_ret {
> diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
> index 414b4d5..5491f73 100644
> --- a/src/remote_protocol-structs
> +++ b/src/remote_protocol-structs
> @@ -153,13 +153,13 @@ struct remote_get_capabilities_ret {
>  };
>  struct remote_node_get_cells_free_memory_args {
>          int                        startCell;
> -        int                        maxCells;
> +        int                        maxcells;
>  };
>  struct remote_node_get_cells_free_memory_ret {
>          struct {
> -                u_int              freeMems_len;
> -                int64_t *          freeMems_val;
> -        } freeMems;
> +                u_int              cells_len;
> +                int64_t *          cells_val;
> +        } cells;
>  };
>  struct remote_node_get_free_memory_ret {
>          int64_t                    freeMem;

ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]