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

Re: [Xen-devel] [PATCH QEMU-XEN v3 1/8] xen: Switch to libxenevtchn interface for compat shims.



On Wed, 2015-10-07 at 15:36 +0100, Andrew Cooper wrote:
> On 07/10/15 15:15, Ian Campbell wrote:
> > To simplify things for the <= 4.0.0 support we wrap the int fd in a
> > malloc(sizeof int) such that the handle is always a pointer. This
> > leads to less typedef headaches and the need for
> > XC_HANDLER_INITIAL_VALUE etc for these interfaces.
> > 
> > <snip>
> > 
> > diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h
> > index 5923290..5700c1b 100644
> > --- a/include/hw/xen/xen_common.h
> > +++ b/include/hw/xen/xen_common.h
> > @@ -39,17 +39,37 @@ static inline void *xc_map_foreign_bulk(int
> > xc_handle, uint32_t dom, int prot,
> >  #if CONFIG_XEN_CTRL_INTERFACE_VERSION < 410
> >  
> >  typedef int XenXC;
> > -typedef int XenEvtchn;
> > +typedef int xenevtchn_handle;
> >  typedef int XenGnttab;
> >  
> >  #  define XC_INTERFACE_FMT "%i"
> >  #  define XC_HANDLER_INITIAL_VALUE    -1
> >  
> > -static inline XenEvtchn xen_xc_evtchn_open(void *logger,
> > -                                           unsigned int open_flags)
> > +static inline xenevtchn_handle *xenevtchn_open(void *logger,
> > +                                          unsigned int
> > open_flags)
> > +{
> > +    int *h = malloc(sizeof h);
> 
> This allocates the size of a pointer, not the size of an int, as the
> patch description states.

Indeed, thanks.

I'll have done the exact same thing in a bunch of subsequent patches, no
need to comment on them all ;-)

> As this is compatibility code, it might be better just to use
> "sizeof(int)" directly, as stated in the "pre 4.1 note" in xenctrl.h



_______________________________________________
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®.