Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: Devel

[PATCH 12/19] libxl: Add a gc to libxl_get_cpu_topology

 

 

Xen devel RSS feed   Index | Next | Previous | View Threaded


ian.jackson at eu

Jun 8, 2012, 10:34 AM

Post #1 of 2 (55 views)
Permalink
[PATCH 12/19] libxl: Add a gc to libxl_get_cpu_topology

In the next patch we are going to change the definition of NOGC to
require a local variable libxl__gc *gc.

libxl_get_cpu_topology doesn't have one but does use NOGC.
Fix this by:
- introducing an `out' label
- replacing the only call to `return' with a suitable assignment
to ret and a `goto out'.
- adding uses of GC_INIT and GC_FREE.

Signed-off-by: Ian Jackson <ian.jackson [at] eu>
---
tools/libxl/libxl.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 7de026b..2a31528 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -3202,6 +3202,7 @@ int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)

libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr)
{
+ GC_INIT(ctx);
xc_topologyinfo_t tinfo;
DECLARE_HYPERCALL_BUFFER(xc_cpu_to_core_t, coremap);
DECLARE_HYPERCALL_BUFFER(xc_cpu_to_socket_t, socketmap);
@@ -3214,7 +3215,8 @@ libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr)
if (max_cpus == 0)
{
LIBXL__LOG(ctx, XTL_ERROR, "Unable to determine number of CPUS");
- return NULL;
+ ret = NULL;
+ goto out;
}

coremap = xc_hypercall_buffer_alloc
@@ -3259,6 +3261,8 @@ fail:

if (ret)
*nr = max_cpus;
+ out:
+ GC_FREE;
return ret;
}

--
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


Ian.Campbell at citrix

Jun 13, 2012, 5:59 AM

Post #2 of 2 (45 views)
Permalink
Re: [PATCH 12/19] libxl: Add a gc to libxl_get_cpu_topology [In reply to]

On Fri, 2012-06-08 at 18:34 +0100, Ian Jackson wrote:
> In the next patch we are going to change the definition of NOGC to
> require a local variable libxl__gc *gc.
>
> libxl_get_cpu_topology doesn't have one but does use NOGC.
> Fix this by:
> - introducing an `out' label
> - replacing the only call to `return' with a suitable assignment
> to ret and a `goto out'.
> - adding uses of GC_INIT and GC_FREE.
>
> Signed-off-by: Ian Jackson <ian.jackson [at] eu>

Acked-by: Ian Campbell <ian.campbell [at] citrix>

> ---
> tools/libxl/libxl.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 7de026b..2a31528 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -3202,6 +3202,7 @@ int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
>
> libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr)
> {
> + GC_INIT(ctx);
> xc_topologyinfo_t tinfo;
> DECLARE_HYPERCALL_BUFFER(xc_cpu_to_core_t, coremap);
> DECLARE_HYPERCALL_BUFFER(xc_cpu_to_socket_t, socketmap);
> @@ -3214,7 +3215,8 @@ libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr)
> if (max_cpus == 0)
> {
> LIBXL__LOG(ctx, XTL_ERROR, "Unable to determine number of CPUS");
> - return NULL;
> + ret = NULL;
> + goto out;
> }
>
> coremap = xc_hypercall_buffer_alloc
> @@ -3259,6 +3261,8 @@ fail:
>
> if (ret)
> *nr = max_cpus;
> + out:
> + GC_FREE;
> return ret;
> }
>



_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel

Xen devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.