]> xenbits.xensource.com Git - xen.git/commitdiff
blktap2: Fix build with gcc3. Cannot handle defining a function which
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 28 May 2009 10:01:00 +0000 (11:01 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 28 May 2009 10:01:00 +0000 (11:01 +0100)
is passed a struct-by-value which is not yet fully defined. Thus
defining a request struct which contains a pointer to a function which
is passed-by-value an instance of that request structure is
impossible. We work around it by defining the function poiinter as
void* and then casting in one place.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/blktap2/drivers/tapdisk-interface.c
tools/blktap2/drivers/tapdisk.h

index 58366d0a0bbe72c24ee8ecc00bb6cd1cba0473da..fedb17a3aa4f897e1c4ee75f9b05d91268969d41 100644 (file)
@@ -213,7 +213,7 @@ td_forward_request(td_request_t treq)
 void
 td_complete_request(td_request_t treq, int res)
 {
-       treq.cb(treq, res);
+       ((td_callback_t)treq.cb)(treq, res);
 }
 
 void
index 487c50fbf6d6b634e3761592ff1ab6dfa2fc1965..1147ab3580a98c21f956047ad81ee2552a6ff155 100644 (file)
@@ -104,11 +104,6 @@ typedef struct td_request            td_request_t;
 typedef struct td_driver_handle      td_driver_t;
 typedef struct td_image_handle       td_image_t;
 
-/* 
- * Prototype of the callback to activate as requests complete.
- */
-typedef void (*td_callback_t)(td_request_t, int);
-
 struct td_disk_id {
        char                        *name;
        int                          drivertype;
@@ -130,7 +125,7 @@ struct td_request {
 
        td_image_t                  *image;
 
-       td_callback_t                cb;
+       void * /*td_callback_t*/     cb;
        void                        *cb_data;
 
        uint64_t                     id;
@@ -138,6 +133,11 @@ struct td_request {
        void                        *private;
 };
 
+/* 
+ * Prototype of the callback to activate as requests complete.
+ */
+typedef void (*td_callback_t)(td_request_t, int);
+
 /* 
  * Structure describing the interface to a virtual disk implementation.
  * See note at the top of this file describing this interface.