[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Modify to assume transactions
# HG changeset patch # User cl349@xxxxxxxxxxxxxxxxxxxx # Node ID c352c388aaecad70730737757533ba9840c0417f # Parent aa8776c44b6548a9d9c0363879e04bf127f0d7ae Modify to assume transactions Signed-off-by: Rusty Russel <rusty@xxxxxxxxxxxxxxx> Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx> diff -r aa8776c44b65 -r c352c388aaec linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Tue Jul 26 17:16:55 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Tue Jul 26 17:18:11 2005 @@ -220,8 +220,16 @@ return err; } -/* FIXME: When all tools use transactions, we can ignore events on - * subpaths. */ +static unsigned int char_count(const char *str, char c) +{ + unsigned int i, ret = 0; + + for (i = 0; str[i]; i++) + if (str[i] == c) + ret++; + return ret; +} + static void dev_changed(struct xenbus_watch *watch, const char *node) { char busid[BUS_ID_SIZE]; @@ -231,28 +239,26 @@ char *type; /* Node is of form device/<type>/<identifier>[/...] */ + if (char_count(node, '/') != 3) + return; + type = strchr(node, '/'); - if (!type) - return; type++; - typelen = strcspn(type, "/"); - if (!typelen) - return; idlen = strcspn(type + typelen + 1, "/"); - if (!idlen) - return; if (typelen + strlen("-") + idlen + 1 > BUS_ID_SIZE) { printk("Device for node %s is too big!\n", node); return; } + /* Does it exist? */ + exists = xenbus_exists(node, ""); + /* Create it with a / so we can see if it exists. */ - sprintf(busid, "%.*s/%.*s", typelen, type, idlen, type + typelen + 1); - exists = xenbus_exists("device", busid); - busid[typelen] = '-'; + sprintf(busid, "%.*s-%.*s", typelen, type, idlen, type + typelen + 1); dev = xenbus_device_find(busid); + printk("xenbus: device %s %s\n", busid, dev ? "exists" : "new"); if (dev && !exists) { printk("xenbus: Unregistering device %s\n", busid); /* FIXME: free? */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |