ia64/xen-unstable

changeset 9338:056e571ce462

Add poll() support to xenbus device file.

From: Gerd Hoffmann
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Mar 20 12:00:58 2006 +0100 (2006-03-20)
parents cf89e8f0831b
children a8b1d4fad72d
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Mon Mar 20 09:56:54 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Mon Mar 20 12:00:58 2006 +0100
     1.3 @@ -36,6 +36,7 @@
     1.4  #include <linux/notifier.h>
     1.5  #include <linux/wait.h>
     1.6  #include <linux/fs.h>
     1.7 +#include <linux/poll.h>
     1.8  
     1.9  #include "xenbus_comms.h"
    1.10  
    1.11 @@ -207,11 +208,22 @@ static int xenbus_dev_release(struct ino
    1.12  	return 0;
    1.13  }
    1.14  
    1.15 +static unsigned int xenbus_dev_poll(struct file *file, poll_table *wait)
    1.16 +{
    1.17 +	struct xenbus_dev_data *u = file->private_data;
    1.18 +
    1.19 +	poll_wait(file, &u->read_waitq, wait);
    1.20 +	if (u->read_cons != u->read_prod)
    1.21 +		return POLLIN | POLLRDNORM;
    1.22 +	return 0;
    1.23 +}
    1.24 +
    1.25  static struct file_operations xenbus_dev_file_ops = {
    1.26  	.read = xenbus_dev_read,
    1.27  	.write = xenbus_dev_write,
    1.28  	.open = xenbus_dev_open,
    1.29  	.release = xenbus_dev_release,
    1.30 +	.poll = xenbus_dev_poll,
    1.31  };
    1.32  
    1.33  static int __init