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] [PATCH] minios: add a blkfront synchronous interface

To: Xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] minios: add a blkfront synchronous interface
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Thu, 5 Jun 2008 11:56:24 +0100
Delivery-date: Thu, 05 Jun 2008 03:56:57 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, Xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
minios: add a blkfront synchronous interface

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r 5603534c62f9 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Tue Jun 03 09:41:19 2008 +0100
+++ b/extras/mini-os/blkfront.c Thu Jun 05 11:53:58 2008 +0100
@@ -323,14 +323,33 @@
     if(notify) notify_remote_via_evtchn(dev->evtchn);
 }
 
-void blkfront_aio_write(struct blkfront_aiocb *aiocbp)
+static void blkfront_aio_cb(struct blkfront_aiocb *aiocbp, int ret)
 {
-    blkfront_aio(aiocbp, 1);
+    aiocbp->data = (void*) 1;
 }
 
-void blkfront_aio_read(struct blkfront_aiocb *aiocbp)
+void blkfront_io(struct blkfront_aiocb *aiocbp, int write)
 {
-    blkfront_aio(aiocbp, 0);
+    unsigned long flags;
+    ASSERT(!aiocbp->aio_cb);
+    aiocbp->aio_cb = blkfront_aio_cb;
+    blkfront_aio(aiocbp, write);
+    aiocbp->data = NULL;
+
+    local_irq_save(flags);
+    DEFINE_WAIT(w);
+    while (1) {
+       blkfront_aio_poll(aiocbp->aio_dev);
+       if (aiocbp->data)
+           break;
+
+       add_waiter(w, blkfront_queue);
+       local_irq_restore(flags);
+       schedule();
+       local_irq_save(flags);
+    }
+    remove_waiter(w);
+    local_irq_restore(flags);
 }
 
 static void blkfront_push_operation(struct blkfront_dev *dev, uint8_t op, 
uint64_t id)
--- a/extras/mini-os/include/blkfront.h Tue Jun 03 09:41:19 2008 +0100
+++ b/extras/mini-os/include/blkfront.h Thu Jun 05 11:53:58 2008 +0100
@@ -29,8 +29,11 @@
 int blkfront_open(struct blkfront_dev *dev);
 #endif
 void blkfront_aio(struct blkfront_aiocb *aiocbp, int write);
-void blkfront_aio_read(struct blkfront_aiocb *aiocbp);
-void blkfront_aio_write(struct blkfront_aiocb *aiocbp);
+#define blkfront_aio_read(aiocbp) blkfront_aio(aiocbp, 0)
+#define blkfront_aio_write(aiocbp) blkfront_aio(aiocbp, 1)
+void blkfront_io(struct blkfront_aiocb *aiocbp, int write);
+#define blkfront_read(aiocbp) blkfront_io(aiocbp, 0)
+#define blkfront_write(aiocbp) blkfront_io(aiocbp, 1)
 void blkfront_aio_push_operation(struct blkfront_aiocb *aiocbp, uint8_t op);
 int blkfront_aio_poll(struct blkfront_dev *dev);
 void blkfront_sync(struct blkfront_dev *dev);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] minios: add a blkfront synchronous interface, Samuel Thibault <=