From: Ian Jackson Subject: Re: [PATCH 6 of 9] libxl: expose cpu topology as a single list of cpu->{node, core, socket} maps Date: Fri, 27 Jan 2012 18:10:38 +0000 Message-ID: <20258.59550.374377.953444@mariner.uk.xensource.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("[Xen-devel] [PATCH 6 of 9] libxl: expose cpu topology as a single list of cpu->{node, core, socket} maps"): > libxl: expose cpu topology as a single list of cpu->{node,core,socket} maps. > > Rather than the previous tripple list which is more complicated to work with > and harder for language bindings. This is plausible. But: > +#if 0 > static void libxl_cpuarray_rand_init(libxl_cpuarray *p) > { > int i; > @@ -209,6 +210,7 @@ static void libxl_cpuarray_rand_init(lib > p->array[i] = r; > } > } > +#endif You haven't quite finished ? > + for (cpu = 0; cpu < nr; cpu++) { ... > + libxl_cputopology_dispose(&topology[cpu]); > } > > - libxl_topologyinfo_dispose(&topology); > - > + free(topology); This is quite ugly to have out here in the caller. Perhaps we should provide a helper for this, called libxl_cputopology_free or something ? > - libxl_topologyinfo_dispose(&topology); > + for (cpu = 0; cpu < nr_cpus; cpu++) > + libxl_cputopology_dispose(&topology[cpu]); > + free(topology); And here it is again, proving my point :-). > +#define LIBXL_CPUTOPOLOGY_INVALID_ENTRY ~0 ... > +libxl_cputopology = Struct("cputopology", [ > + ("core", uint32), > + ("socket", uint32), > + ("node", uint32), You mean (~(uint32_t)0) I think. The outer ( ) should be included too! Ian.