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] change tools cpumaps to uint8_t

To: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] change tools cpumaps to uint8_t
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Thu, 28 Oct 2010 15:25:16 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 28 Oct 2010 07:25:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <51ed06fc352e979e6f2a.1288255274@nehalem1>
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: <51ed06fc352e979e6f2a.1288255274@nehalem1>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Looks nice. Thanks for doing this.
> @@ -74,27 +69,15 @@
>  {
>      int err = 0;
>      xc_cpupoolinfo_t *info = NULL;
> -    int local_size;
> -    int cpumap_size;
> -    int size;
> +    size_t local_size;
>      DECLARE_SYSCTL;
>      DECLARE_HYPERCALL_BUFFER(uint8_t, local);
>  
> -    local_size = get_cpumap_size(xch);
> -    if (!local_size)
> -    {
> -        PERROR("Could not get number of cpus");
> -        return NULL;
> -    }
> -
> -    local = xc_hypercall_buffer_alloc(xch, local, local_size);
> +    local = xc_cpumap_hypercall_buffer_alloc(xch, local, local_size);
>      if ( local == NULL ) {
>          PERROR("Could not allocate locked memory for xc_cpupool_getinfo");
>          return NULL;
>      }

I'm not that keen on this interface change, I think get_cpumap_size +
xc_hypercall_buffer_alloc was fine as it was.

More importantly I really don't like hiding the taking of the pointer on
the size parameter being hidden inside the macro.

[...]
>      info->cpupool_id = sysctl.u.cpupool_op.cpupool_id;
>      info->sched_id = sysctl.u.cpupool_op.sched_id;
>      info->n_dom = sysctl.u.cpupool_op.n_dom;
> -    bitmap_byte_to_64(info->cpumap, local, local_size * 8);
> +    bcopy(local, info->cpumap, local_size);

bcopy is deprecated, should use memcpy (several times).

Rest looks good, lots of magic numbers disappear ;-)

Ian.



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

<Prev in Thread] Current Thread [Next in Thread>