--- xen-2.0b/linux-2.6.9-xen0/drivers/xen/blkfront/blkfront.c	2004-11-05 10:47:03.000000000 +0000
+++ xen-2.0/linux-2.6.9-xen0/drivers/xen/blkfront/blkfront.c	2004-11-09 15:14:39.225356736 +0000
@@ -102,14 +102,6 @@
 #define BLKIF_RING_FULL (((req_prod - resp_cons) == BLKIF_RING_SIZE) || \
                          (blkif_state != BLKIF_STATE_CONNECTED))
 
-static inline void translate_req_to_mfn(blkif_request_t *xreq,
-                                        blkif_request_t *req);
-
-static inline void translate_req_to_pfn(blkif_request_t *xreq,
-                                        blkif_request_t *req);
-
-static inline void flush_requests(void);
-
 static void kick_pending_request_queues(void);
 
 int __init xlblk_init(void);
@@ -137,11 +129,62 @@
 }
 
 
-/**************************  KERNEL VERSION 2.6  **************************/
+/************************  COMMON CODE  (inlined)  ************************/
 
+/* Kernel-specific definitions used in the common code */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-
 #define DISABLE_SCATTERGATHER() 
+#else
+#define DISABLE_SCATTERGATHER() (sg_operation = -1)
+#endif
+
+static inline void translate_req_to_pfn(blkif_request_t *xreq,
+                                        blkif_request_t *req)
+{
+    int i;
+
+    xreq->operation     = req->operation;
+    xreq->nr_segments   = req->nr_segments;
+    xreq->device        = req->device;
+    /* preserve id */
+    xreq->sector_number = req->sector_number;
+
+    for ( i = 0; i < req->nr_segments; i++ ){
+        xreq->frame_and_sects[i] = machine_to_phys(req->frame_and_sects[i]);
+    }
+}
+
+static inline void translate_req_to_mfn(blkif_request_t *xreq,
+                                        blkif_request_t *req)
+{
+    int i;
+
+    xreq->operation     = req->operation;
+    xreq->nr_segments   = req->nr_segments;
+    xreq->device        = req->device;
+    xreq->id            = req->id;   /* copy id (unlike above) */
+    xreq->sector_number = req->sector_number;
+
+    for ( i = 0; i < req->nr_segments; i++ ){
+        xreq->frame_and_sects[i] = phys_to_machine(req->frame_and_sects[i]);
+    }
+}
+
+
+static inline void flush_requests(void)
+{
+    DISABLE_SCATTERGATHER();
+    wmb(); /* Ensure that the frontend can see the requests. */
+    blk_ring->req_prod = req_prod;
+    notify_via_evtchn(blkif_evtchn);
+}
+
+
+
+
+/**************************  KERNEL VERSION 2.6  **************************/
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 
 __initcall(xlblk_init);
 
@@ -468,8 +511,6 @@
 static int nr_pending;
 
 
-#define DISABLE_SCATTERGATHER() (sg_operation = -1)
-
 #define blkif_io_lock io_request_lock
 
 /*============================================================================*/
@@ -1009,49 +1050,6 @@
 /*****************************  COMMON CODE  *******************************/
 
 
-static inline void translate_req_to_pfn(blkif_request_t *xreq,
-                                        blkif_request_t *req)
-{
-    int i;
-
-    xreq->operation     = req->operation;
-    xreq->nr_segments   = req->nr_segments;
-    xreq->device        = req->device;
-    /* preserve id */
-    xreq->sector_number = req->sector_number;
-
-    for ( i = 0; i < req->nr_segments; i++ ){
-        xreq->frame_and_sects[i] = machine_to_phys(req->frame_and_sects[i]);
-    }
-}
-
-static inline void translate_req_to_mfn(blkif_request_t *xreq,
-                                        blkif_request_t *req)
-{
-    int i;
-
-    xreq->operation     = req->operation;
-    xreq->nr_segments   = req->nr_segments;
-    xreq->device        = req->device;
-    xreq->id            = req->id;   /* copy id (unlike above) */
-    xreq->sector_number = req->sector_number;
-
-    for ( i = 0; i < req->nr_segments; i++ ){
-        xreq->frame_and_sects[i] = phys_to_machine(req->frame_and_sects[i]);
-    }
-}
-
-
-
-static inline void flush_requests(void)
-{
-    DISABLE_SCATTERGATHER();
-    wmb(); /* Ensure that the frontend can see the requests. */
-    blk_ring->req_prod = req_prod;
-    notify_via_evtchn(blkif_evtchn);
-}
-
-
 void blkif_control_send(blkif_request_t *req, blkif_response_t *rsp)
 {
     unsigned long flags, id;

