[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] This patch implements select() functionality on /dev/vtpm and fixes some
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 801ffcaa450b4c16a6ab8ddd5d49617fcaa93e7f # Parent 1fd8bd3591183c55d234c2588679358aec0109ba This patch implements select() functionality on /dev/vtpm and fixes some other problems. Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx> diff -r 1fd8bd359118 -r 801ffcaa450b linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Wed Oct 12 08:31:53 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Wed Oct 12 08:33:03 2005 @@ -17,6 +17,7 @@ #include <linux/types.h> #include <linux/list.h> #include <linux/miscdevice.h> +#include <linux/poll.h> #include <asm/uaccess.h> #include <asm-xen/xenbus.h> #include <asm-xen/xen-public/grant_table.h> @@ -680,9 +681,14 @@ } static unsigned int -vtpm_op_poll(struct file *file, struct poll_table_struct *pst) -{ - return 0; +vtpm_op_poll(struct file *file, struct poll_table_struct *pts) +{ + unsigned int flags = POLLOUT | POLLWRNORM; + poll_wait(file, &dataex.wait_queue, pts); + if (!list_empty(&dataex.pending_pak)) { + flags |= POLLIN | POLLRDNORM; + } + return flags; } static struct file_operations vtpm_ops = { diff -r 1fd8bd359118 -r 801ffcaa450b linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Wed Oct 12 08:31:53 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Wed Oct 12 08:33:03 2005 @@ -39,6 +39,7 @@ #include <linux/interrupt.h> #include <linux/init.h> #include <linux/tpmfe.h> +#include <linux/err.h> #include <asm/semaphore.h> #include <asm/io.h> @@ -372,7 +373,7 @@ info->watch.callback = watch_for_status; err = register_xenbus_watch(&info->watch); if (err) { - message = "registering watch on backend"; + xenbus_dev_error(dev, err, "registering watch on backend"); goto destroy_tpmring; } @@ -398,6 +399,8 @@ int err; struct tpmfront_info *info; int handle; + int len = max(XS_WATCH_PATH, XS_WATCH_TOKEN) + 1; + const char *vec[len]; err = xenbus_scanf(NULL, dev->nodename, "handle", "%i", &handle); @@ -426,6 +429,10 @@ dev->data = NULL; return err; } + + vec[XS_WATCH_PATH] = info->watch.node; + vec[XS_WATCH_TOKEN] = NULL; + watch_for_status(&info->watch, vec, len); return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |