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

[Xen-devel] Re: [Qemu-devel] [PATCH V6 02/15] xen: Support new libxc calls from xen unstable.



On Mon, 15 Nov 2010, Alexander Graf wrote:
> > /*
> > - * tweaks needed to build with different xen versions
> > - *  0x00030205 -> 3.1.0
> > - *  0x00030207 -> 3.2.0
> > - *  0x00030208 -> unstable
> > + * We don't support Xen prior to 3.3.0.
> >  */
> > -#include <xen/xen-compat.h>
> > -#if __XEN_LATEST_INTERFACE_VERSION__ < 0x00030205
> > -# define evtchn_port_or_error_t int
> > -#endif
> > -#if __XEN_LATEST_INTERFACE_VERSION__ < 0x00030207
> > -# define xc_map_foreign_pages xc_map_foreign_batch
> > -#endif
> > -#if __XEN_LATEST_INTERFACE_VERSION__ < 0x00030208
> > -# define xen_mb()  mb()
> > -# define xen_rmb() rmb()
> > -# define xen_wmb() wmb()
> > +
> > +/* Xen unstable */
> > +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 410
> > +typedef int qemu_xc_interface;
> > +#  define XC_HANDLER_INITIAL_VALUE               -1
> > +#  define xc_fd(xen_xc)                          xen_xc
> > +#  define xc_interface_open(l, dl, f)            xc_interface_open()
> > +#  define xc_gnttab_open(xc)                     xc_gnttab_open()
> > +#  define xc_gnttab_map_grant_ref(xc, gnt, domid, ref, flags) \
> > +    xc_gnttab_map_grant_ref(gnt, domid, ref, flags)
> > +#  define xc_gnttab_map_grant_refs(xc, gnt, count, domids, refs, flags) \
> > +    xc_gnttab_map_grant_refs(gnt, count, domids, refs, flags)
> > +#  define xc_gnttab_munmap(xc, gnt, pages, niov) xc_gnttab_munmap(gnt, 
> > pages, niov)
> > +#  define xc_gnttab_close(xc, dev)               xc_gnttab_close(dev)
> 
> All these defines are very icky. In my patchset I replace all those libxc 
> calls by indirect calls through a struct anyways. Maybe it'd make sense to 
> integrate that part into your series already.
> 
> That way you could make this whole compat stuff a lot cleaner. You could use 
> static inline functions to create wrappers to the real calls and just assign 
> those as callbacks in the dispatch struct.
> 
> In general, I'd disagree to the preprocessor approach here. If you're not 
> going with the libxc dispatch struct patch, I'd at least like to see all 
> those converted to static inline functions called with different names 
> internally.
> 
 
Yeah, I am not a fan of preprocessor magic as well, it is probably worth
investigating the indirect calls approach, surely would be easier to
read.

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


 


Rackspace

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