From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH 04 of 11] libxl: expand the libxl_{cpu, node}map API a bit Date: Thu, 31 May 2012 16:51:01 +0100 Message-ID: <4FC79365.406@eu.citrix.com> References: <2cc22366943347deab77.1338466269@Solace> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <2cc22366943347deab77.1338466269@Solace> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Dario Faggioli Cc: Andre Przywara , Ian Campbell , Stefano Stabellini , Juergen Gross , Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 31/05/12 13:11, Dario Faggioli wrote: > By adding copying and *_is_full/*_is_empty facilities. > > Signed-off-by: Dario Faggioli > > diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c > --- a/tools/libxl/libxl_utils.c > +++ b/tools/libxl/libxl_utils.c > @@ -505,6 +505,35 @@ static int libxl_map_alloc(libxl_ctx *ct > return 0; > } > > +static void libxl_map_copy(struct libxl_map *dptr, > + const struct libxl_map *sptr) > +{ > + int sz; > + > + sz = dptr->size = sptr->size; > + memcpy(dptr->map, sptr->map, sz * sizeof(*dptr->map)); > +} > + > +int libxl_map_is_full(struct libxl_map *map) > +{ > + int i; > + > + for (i = 0; i< map->size; i++) > + if (map->map[i] != (uint8_t)-1) > + return -1; > + return 0; > +} Why are you returning -1 and 0 for false and true, rather than 0 and 1? None of the other libxl "_is_" functions (e.g., libxl_is_stubom()) do that. -George