From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: xenfs: implement O_NONBLOCK for /proc/xen/xenbus Date: Thu, 24 Jun 2010 18:32:31 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080707080907040805090406" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------080707080907040805090406 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Trivial patch. Tested only in the pvops version. Paolo --------------080707080907040805090406 Content-Type: text/plain; name="0001-xenbus-implement-O_NONBLOCK.patch.2.6.18-xen" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-xenbus-implement-O_NONBLOCK.patch.2.6.18-xen" Content-Transfer-Encoding: 7bit Subject: [PATCH] implement O_NONBLOCK for /proc/xen/xenbus X-Mercurial-Node: 29260da8baac276184bd4266863c0e69d62b9634 Message-Id: <29260da8baac276184bd.1277396873@yakj.usersys.redhat.com> User-Agent: Mercurial-patchbomb/1.5.3 Date: Thu, 24 Jun 2010 18:27:53 +0200 From: pbonzini@redhat.com To: pbonzini@redhat.com # HG changeset patch # User Paolo Bonzini # Date 1277396822 -7200 # Node ID 29260da8baac276184bd4266863c0e69d62b9634 # Parent f66d155ce457dab7a191bc199e878c07c2d2aead implement O_NONBLOCK for /proc/xen/xenbus This patch implements O_NONBLOCK for /proc/xen/xenbus. It is a simple matter of returning -EAGAIN instead of waiting on a queue. Signed-off-by: Paolo Bonzini diff --git a/drivers/xen/xenbus/xenbus_dev.c b/drivers/xen/xenbus/xenbus_dev.c --- a/drivers/xen/xenbus/xenbus_dev.c +++ b/drivers/xen/xenbus/xenbus_dev.c @@ -104,6 +104,9 @@ mutex_lock(&u->reply_mutex); while (list_empty(&u->read_buffers)) { mutex_unlock(&u->reply_mutex); + if (filp->f_flags & O_NONBLOCK) + return -EAGAIN; + ret = wait_event_interruptible(u->read_waitq, !list_empty(&u->read_buffers)); if (ret) --------------080707080907040805090406 Content-Type: text/plain; name="0001-xenbus-implement-O_NONBLOCK.patch.pvops" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-xenbus-implement-O_NONBLOCK.patch.pvops" >>From 976c72e90458a85de543b1024722d16dac5766a1 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 23 Jun 2010 18:30:15 +0200 Subject: [PATCH] implement O_NONBLOCK for /proc/xen/xenbus This patch implements O_NONBLOCK for /proc/xen/xenbus. It is a simple matter of returning -EAGAIN instead of waiting on a queue. Signed-off-by: Paolo Bonzini --- drivers/xen/xenfs/xenbus.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/xen/xenfs/xenbus.c b/drivers/xen/xenfs/xenbus.c index 6c4269b..64b3be4 100644 --- a/drivers/xen/xenfs/xenbus.c +++ b/drivers/xen/xenfs/xenbus.c @@ -123,6 +123,9 @@ static ssize_t xenbus_file_read(struct file *filp, mutex_lock(&u->reply_mutex); while (list_empty(&u->read_buffers)) { mutex_unlock(&u->reply_mutex); + if (filp->f_flags & O_NONBLOCK) + return -EAGAIN; + ret = wait_event_interruptible(u->read_waitq, !list_empty(&u->read_buffers)); if (ret) -- 1.7.0.1 --------------080707080907040805090406 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------080707080907040805090406--