Skip to contentSkip to conversation

xenfs: implement O_NONBLOCK for /proc/xen/xenbus

PATCH Paolo Bonzini 2 participants 5 messages Jun 24, 2010 – Jul 26, 2010 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

Trivial patch. Tested only in the pvops version.

Paolo

Content-Transfer-Encoding: 7bit
Subject: [PATCH] implement O_NONBLOCK for /proc/xen/xenbus
X-Mercurial-Node: 29260da8baac276184bd4266863c0e69d62b9634
Message-Id: <[email protected]>
User-Agent: Mercurial-patchbomb/1.5.3
Date: Thu, 24 Jun 2010 18:27:53 +0200
From: [email protected]
To: [email protected]

# HG changeset patch
# User Paolo Bonzini <[email protected]> # 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.

drivers/xen/xenbus/xenbus_dev.c +3 -0
@@ -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)
Quoted 1 line

From 976c72e90458a85de543b1024722d16dac5766a1 Mon Sep 17 00:00:00 2001

From: Paolo Bonzini <[email protected]>
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.

---
 drivers/xen/xenfs/xenbus.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/xen/xenfs/xenbus.c +3 -0
index 6c4269b..64b3be4 100644
@@ -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)
Signature · 1 line
1.7.0.1

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 1 line · Paolo Bonzini

Trivial patch. Tested only in the pvops version.

What user do you have for this?

J

#2 lore raw
Quoted 4 lines · Jeremy Fitzhardinge
Quoted 1 line · Paolo Bonzini

Trivial patch. Tested only in the pvops version.

What user do you have for this?

It was reported by internal QE without many details, likely it was found by code inspection or some automated tool. I didn't ask because the patch was easy enough, but I can get more information if you care.

Paolo

#3 lore raw
Quoted 9 lines · Paolo Bonzini
Quoted 4 lines · Jeremy Fitzhardinge
Quoted 1 line · Paolo Bonzini

Trivial patch. Tested only in the pvops version.

What user do you have for this?

It was reported by internal QE without many details, likely it was found by code inspection or some automated tool. I didn't ask because the patch was easy enough, but I can get more information if you care.

It was found by a test (proc01) in LTP to read every entry of the procfs.

Paolo

#4 lore raw
Quoted 5 lines · Paolo Bonzini
Quoted 4 lines · Paolo Bonzini
Quoted 3 lines · Jeremy Fitzhardinge
Quoted 1 line · Paolo Bonzini

Trivial patch. Tested only in the pvops version.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

What user do you have for this?

It was reported by internal QE without many details, likely it was found by code inspection or some automated tool. I didn't ask because the patch was easy enough, but I can get more information if you care.

It was found by a test (proc01) in LTP to read every entry of the procfs.

ping? It's not in linux-2.6.18.hg either.

Paolo