All of lore.kernel.org
 help / color / mirror / Atom feed
* xenfs: implement O_NONBLOCK for /proc/xen/xenbus
@ 2010-06-24 16:32 Paolo Bonzini
  2010-06-26 16:10 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2010-06-24 16:32 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 57 bytes --]

Trivial patch.  Tested only in the pvops version.

Paolo

[-- Attachment #2: 0001-xenbus-implement-O_NONBLOCK.patch.2.6.18-xen --]
[-- Type: text/plain, Size: 1209 bytes --]

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 <pbonzini@redhat.com>
# 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 <pbonzini@redhat.com>

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)



[-- Attachment #3: 0001-xenbus-implement-O_NONBLOCK.patch.pvops --]
[-- Type: text/plain, Size: 1006 bytes --]

>From 976c72e90458a85de543b1024722d16dac5766a1 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
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 <pbonzini@redhat.com>
---
 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


[-- Attachment #4: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-26  9:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-24 16:32 xenfs: implement O_NONBLOCK for /proc/xen/xenbus Paolo Bonzini
2010-06-26 16:10 ` Jeremy Fitzhardinge
2010-06-28  7:53   ` Paolo Bonzini
2010-07-02 11:28     ` Paolo Bonzini
2010-07-26  9:33       ` Paolo Bonzini

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.