From: Anthony Liguori <aliguori@us.ibm.com>
To: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>,
Rusty Russell <rusty@rustcorp.com.au>,
xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH 2/2] Update kernel watch API to pass the array of watch arguments to the callback instead of just passing the node.
Date: Mon, 03 Oct 2005 23:45:47 -0500 [thread overview]
Message-ID: <434208FB.4050304@us.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 244 bytes --]
Update kernel watch API to pass the array of watch arguments to the callback
instead of just passing the node.
This allows us to extend watches to have additional arguments (like domids).
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
[-- Attachment #2: 7163_xs_read_watch.diff --]
[-- Type: text/x-patch, Size: 11348 bytes --]
# HG changeset patch
# User anthony@localhost.localdomain
# Node ID 59fc241f36e5679ac52eec2c01c8f82a736c1567
# Parent 355bc8009bb6cf6be5b0474b84984acf1dda23fb
Update kernel watch API to pass the array of watch arguments to the callback
instead of just passing the node.
This allows us to extend watches to have additional arguments (like domids).
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
--- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Mon Oct 3 23:38:00 2005 -0500
@@ -351,7 +351,8 @@
};
/* React to a change in the target key */
-static void watch_target(struct xenbus_watch *watch, const char *node)
+static void watch_target(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
unsigned long long new_target;
int err;
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Mon Oct 3 23:38:00 2005 -0500
@@ -55,7 +55,8 @@
}
/* Front end tells us frame. */
-static void frontend_changed(struct xenbus_watch *watch, const char *node)
+static void frontend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
unsigned long ring_ref;
unsigned int evtchn;
@@ -64,7 +65,7 @@
= container_of(watch, struct backend_info, watch);
/* If other end is gone, delete ourself. */
- if (node && !xenbus_exists(be->frontpath, "")) {
+ if (vec && !xenbus_exists(be->frontpath, "")) {
device_unregister(&be->dev->dev);
return;
}
@@ -143,7 +144,8 @@
We provide event channel and device details to front end.
Frontend supplies shared frame and event channel.
*/
-static void backend_changed(struct xenbus_watch *watch, const char *node)
+static void backend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
int err;
char *p;
@@ -195,7 +197,7 @@
}
/* Pass in NULL node to skip exist test. */
- frontend_changed(&be->watch, NULL);
+ frontend_changed(&be->watch, NULL, 0);
}
}
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Mon Oct 3 23:38:00 2005 -0500
@@ -444,12 +444,16 @@
{ "" }
};
-static void watch_for_status(struct xenbus_watch *watch, const char *node)
+static void watch_for_status(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
struct blkfront_info *info;
unsigned int binfo;
unsigned long sectors, sector_size;
int err;
+ const char *node;
+
+ node = vec[XS_WATCH_PATH];
info = container_of(watch, struct blkfront_info, watch);
node += strlen(watch->node);
@@ -652,8 +656,17 @@
return err;
}
- /* Call once in case entries already there. */
- watch_for_status(&info->watch, info->watch.node);
+ {
+ unsigned int len = max(XS_WATCH_PATH, XS_WATCH_TOKEN) + 1;
+ const char *vec[len];
+
+ vec[XS_WATCH_PATH] = info->watch.node;
+ vec[XS_WATCH_TOKEN] = NULL;
+
+ /* Call once in case entries already there. */
+ watch_for_status(&info->watch, vec, len);
+ }
+
return 0;
}
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c Mon Oct 3 23:38:00 2005 -0500
@@ -59,7 +59,8 @@
}
/* Front end tells us frame. */
-static void frontend_changed(struct xenbus_watch *watch, const char *node)
+static void frontend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
unsigned long ring_ref;
unsigned int evtchn;
@@ -68,7 +69,7 @@
= container_of(watch, struct backend_info, watch);
/* If other end is gone, delete ourself. */
- if (node && !xenbus_exists(be->frontpath, "")) {
+ if (vec && !xenbus_exists(be->frontpath, "")) {
xenbus_rm(be->dev->nodename, "");
device_unregister(&be->dev->dev);
return;
@@ -106,7 +107,8 @@
We provide event channel and device details to front end.
Frontend supplies shared frame and event channel.
*/
-static void backend_changed(struct xenbus_watch *watch, const char *node)
+static void backend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
int err;
char *p;
@@ -129,7 +131,7 @@
}
/* Pass in NULL node to skip exist test. */
- frontend_changed(&be->watch, NULL);
+ frontend_changed(&be->watch, NULL, 0);
}
}
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Mon Oct 3 23:38:00 2005 -0500
@@ -57,7 +57,8 @@
}
/* Front end tells us frame. */
-static void frontend_changed(struct xenbus_watch *watch, const char *node)
+static void frontend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
unsigned long tx_ring_ref, rx_ring_ref;
unsigned int evtchn;
@@ -68,7 +69,7 @@
int i;
/* If other end is gone, delete ourself. */
- if (node && !xenbus_exists(be->frontpath, "")) {
+ if (vec && !xenbus_exists(be->frontpath, "")) {
xenbus_rm(be->dev->nodename, "");
device_unregister(&be->dev->dev);
return;
@@ -126,7 +127,8 @@
We provide event channel and device details to front end.
Frontend supplies shared frame and event channel.
*/
-static void backend_changed(struct xenbus_watch *watch, const char *node)
+static void backend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
int err;
long int handle;
@@ -163,7 +165,7 @@
kobject_hotplug(&dev->dev.kobj, KOBJ_ONLINE);
/* Pass in NULL node to skip exist test. */
- frontend_changed(&be->watch, NULL);
+ frontend_changed(&be->watch, NULL, 0);
}
}
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Mon Oct 3 23:38:00 2005 -0500
@@ -966,7 +966,8 @@
{ "" }
};
-static void watch_for_status(struct xenbus_watch *watch, const char *node)
+static void watch_for_status(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
}
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Mon Oct 3 23:38:00 2005 -0500
@@ -59,7 +59,8 @@
}
-static void frontend_changed(struct xenbus_watch *watch, const char *node)
+static void frontend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
unsigned long ringref;
unsigned int evtchn;
@@ -69,7 +70,7 @@
= container_of(watch, struct backend_info, watch);
/* If other end is gone, delete ourself. */
- if (node && !xenbus_exists(be->frontpath, "")) {
+ if (vec && !xenbus_exists(be->frontpath, "")) {
xenbus_rm(be->dev->nodename, "");
device_unregister(&be->dev->dev);
return;
@@ -142,7 +143,8 @@
}
-static void backend_changed(struct xenbus_watch *watch, const char *node)
+static void backend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
int err;
long int instance;
@@ -166,6 +168,9 @@
be->instance = instance;
if (be->tpmif == NULL) {
+ unsigned int len = max(XS_WATCH_PATH, XS_WATCH_TOKEN) + 1;
+ const char *vec[len];
+
be->tpmif = tpmif_find(be->frontend_id,
instance);
if (IS_ERR(be->tpmif)) {
@@ -175,8 +180,11 @@
return;
}
+ vec[XS_WATCH_PATH] = be->frontpath;
+ vec[XS_WATCH_TOKEN] = NULL;
+
/* Pass in NULL node to skip exist test. */
- frontend_changed(&be->watch, be->frontpath);
+ frontend_changed(&be->watch, vec, len);
}
}
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Mon Oct 3 23:38:00 2005 -0500
@@ -211,12 +211,14 @@
XENBUS support code
**************************************************************/
-static void watch_for_status(struct xenbus_watch *watch, const char *node)
+static void watch_for_status(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
{
struct tpmfront_info *info;
int err;
unsigned long ready;
struct tpm_private *tp = &my_private;
+ const char *node = vec[XS_WATCH_PATH];
info = container_of(watch, struct tpmfront_info, watch);
node += strlen(watch->node);
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Mon Oct 3 23:38:00 2005 -0500
@@ -546,14 +546,16 @@
kfree(root);
}
-static void frontend_changed(struct xenbus_watch *watch, const char *node)
-{
- dev_changed(node, &xenbus_frontend);
-}
-
-static void backend_changed(struct xenbus_watch *watch, const char *node)
-{
- dev_changed(node, &xenbus_backend);
+static void frontend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
+{
+ dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend);
+}
+
+static void backend_changed(struct xenbus_watch *watch,
+ const char **vec, unsigned int len)
+{
+ dev_changed(vec[XS_WATCH_PATH], &xenbus_backend);
}
/* We watch for devices appearing and vanishing. */
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Mon Oct 3 23:38:00 2005 -0500
@@ -551,7 +551,7 @@
vec[XS_WATCH_TOKEN], err);
w = find_watch(vec[XS_WATCH_TOKEN]);
BUG_ON(!w);
- w->callback(w, vec[XS_WATCH_PATH]);
+ w->callback(w, (const char **)vec, num);
kfree(vec);
} else if (vec)
printk(KERN_WARNING "XENBUS xs_read_watch: %li\n",
diff -r 355bc8009bb6 -r 59fc241f36e5 linux-2.6-xen-sparse/include/asm-xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h Mon Oct 3 23:37:48 2005 -0500
+++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h Mon Oct 3 23:38:00 2005 -0500
@@ -33,6 +33,9 @@
#include <linux/device.h>
#include <linux/notifier.h>
#include <asm/semaphore.h>
+
+/* FIXME there's got to be a better way to get at the XS_WATCH macros */
+#include <asm-xen/linux-public/xenstored.h>
/* A xenbus device. */
struct xenbus_device {
@@ -113,7 +116,8 @@
{
struct list_head list;
char *node;
- void (*callback)(struct xenbus_watch *, const char *node);
+ void (*callback)(struct xenbus_watch *,
+ const char **vec, unsigned int len);
};
/* notifer routines for when the xenstore comes up */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2005-10-04 4:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=434208FB.4050304@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=Christian.Limpach@cl.cam.ac.uk \
--cc=rusty@rustcorp.com.au \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.