WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 1 of 4] Support getting topology info in libxl

To: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 1 of 4] Support getting topology info in libxl
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Wed, 8 Dec 2010 10:51:23 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 08 Dec 2010 02:54:11 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <37fdfe90e0c26bfac22e.1290755424@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <37fdfe90e0c26bfac22e.1290755424@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, 2010-11-26 at 07:10 +0000, Juergen Gross wrote:

> diff -r 79b71c77907b -r 37fdfe90e0c2 tools/libxl/libxl.h
> --- a/tools/libxl/libxl.h       Wed Nov 24 10:20:03 2010 +0000
> +++ b/tools/libxl/libxl.h       Thu Nov 25 09:29:43 2010 +0100
> @@ -148,6 +148,13 @@
>      uint8_t *map;
>  } libxl_cpumap;
>  void libxl_cpumap_destroy(libxl_cpumap *map);
> +
> +typedef struct {
> +    uint32_t entries;
> +    uint32_t *array;
> +} libxl_cpuarray;
> +#define LIBXL_CPUARRAY_INVENTRY  ~0

This looked at first glance like you had misspelled INVENTORY. Perhaps
LIBXL_CPUARRAY_INVALID_ENTRY?

> +void libxl_cpuarray_destroy(libxl_cpuarray *array);
>  
>  typedef enum {
>      XENFV = 1,
> @@ -464,6 +471,7 @@
>  int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button);
>  
>  int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo);
> +libxl_topologyinfo *libxl_get_topologyinfo(libxl_ctx *ctx);

The idiom in libxl is for such functions to take a pointer to the
structure to fill in and return a status code, e.g.
        int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info)
e..g libxl_get_physinfo()

This is useful since the caller doesn't always need to manage the
dynamic allocation of the info structure e.g, it can use a stack
variable for temporary stuff or nest inside another structure etc.

Both the error path of libxl_get_topologyinfo and output_topologyinfo()
from patch 2/4 leak the info structure which is an error which goes away
with this change.

The IDL stuff and the python bits look fine to me.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel