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

[Xen-devel] Re: PV drivers for HVM guests

To: Gerd Hoffmann <kraxel@xxxxxxx>
Subject: [Xen-devel] Re: PV drivers for HVM guests
From: Andi Kleen <ak@xxxxxxx>
Date: 04 Oct 2006 17:54:07 +0200
Cc: Ky Srinivasan <ksrinivasan@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 04 Oct 2006 08:54:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <452394E3.6030000@xxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <45229025.E57C.0030.0@xxxxxxxxxx> <C14927CD.2084%Keir.Fraser@xxxxxxxxxxxx> <20061004081551.GC6274@xxxxxxxxxxxxxxxxxx> <452394E3.6030000@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Gerd Hoffmann <kraxel@xxxxxxx> writes:

> Muli Ben-Yehuda wrote:
> >> A shim layer (i.e., a set of compat macros) that avoids ifdef'ing
> >> the core driver code is definitely the way to go.
> > 
> > FWIW, neither option has a chance of being accepted upstream.
> 
> Exactly thats why a shim layer is the way to go (if possible, doesn't
> work for all changes but for most).  Did that that quite some time while
> maintaining the v4l subsystem.  Making driver source code use the
> 2.6.latest conventions and have some compat.h header file full of stuff
> like this ...
> 
>   #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,xx)
>   # define foo gryyz
>   #endif
> 
> or (better if possible as it catches distro backports, which does happen
> now and then for compiling recent drivers on old distro kernels).
> 
>   #ifndef bar
>   # define bar xyzzy
>   #endif
> 
> nicely separates out the compat bits.  It makes the code more readable
> and also is less work when submitting code upstream.

I hate to point out the obvious, but often when calls get renamed upstream
it is actually because the semantics changed subtly (the point of the rename
was to enforce a audit and proper fix of the driver)  Typically then
using define bar xyz is then not the right thing to do. 

Especially when you do

#define oldfunctionname newfunctionname

without any translation you very likely have a bug.

A shim layer can be the right thing to do still, but you have to be very
careful to not miss such a semantics change.

-Andi

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