From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: Xen-devel@lists.xensource.com
Subject: [PATCH] minios: add a blkfront synchronous interface
Date: Thu, 5 Jun 2008 11:56:24 +0100 [thread overview]
Message-ID: <20080605105624.GF4341@implementation.uk.xensource.com> (raw)
minios: add a blkfront synchronous interface
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
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);
reply other threads:[~2008-06-05 10:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080605105624.GF4341@implementation.uk.xensource.com \
--to=samuel.thibault@eu.citrix.com \
--cc=Xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.