[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 03 of 11] libxc, libxl: introduce xc_nodemap_t and libxl_nodemap



On Thu, 2012-05-31 at 16:41 +0100, George Dunlap wrote:
> > +int xc_get_max_nodes(xc_interface *xch)
> > +{
> > +    static int max_nodes = 0;
> > +    xc_physinfo_t physinfo;
> > +
> > +    if ( max_nodes )
> > +        return max_nodes;
> > +
> > +    if ( !xc_physinfo(xch,&physinfo) )
> > +        max_nodes = physinfo.max_node_id + 1;
> > +
> > +    return max_nodes;
> What does xc_physinfo() return?  Should this return the error message 
> rather than 0 if it fails?
> 

int xc_get_max_cpus(xc_interface *xch)
{
    static int max_cpus = 0;
    xc_physinfo_t physinfo;

    if ( max_cpus )
        return max_cpus;

    if ( !xc_physinfo(xch, &physinfo) )
        max_cpus = physinfo.max_cpu_id + 1;

    return max_cpus;
}

And I guess the reason for this is this is used (both in libxc and
libxl) in a few places to determine the size of the array that will host
the cpu map. Thus, getting a 0 ensures we do not allocate a random
amount of memory.

Of course it should be more than possible to change it, but going though
all the callers is needed. If you want me to do that, just say it, and I
will perhaps deal with both this "original" and my "variant", right?

Thanks and Regards,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.