diff options
Diffstat (limited to 'drivers/xen/xenbus')
-rw-r--r-- | drivers/xen/xenbus/xenbus_client.c | 3 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 55 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.h | 4 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_xs.c | 1 |
4 files changed, 42 insertions, 21 deletions
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c index 9678b3e98c6..92a1ef80a28 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -136,7 +136,6 @@ EXPORT_SYMBOL_GPL(xenbus_watch_pathfmt); /** * xenbus_switch_state * @dev: xenbus device - * @xbt: transaction handle * @state: new state * * Advertise in the store a change of the given driver to the given new_state. @@ -267,7 +266,7 @@ EXPORT_SYMBOL_GPL(xenbus_dev_error); * @fmt: error message format * * Equivalent to xenbus_dev_error(dev, err, fmt, args), followed by - * xenbus_switch_state(dev, NULL, XenbusStateClosing) to schedule an orderly + * xenbus_switch_state(dev, XenbusStateClosing) to schedule an orderly * closedown of this driver and its peer. */ diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 7f24a98a446..773d1cf2328 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -40,6 +40,7 @@ #include <linux/ctype.h> #include <linux/fcntl.h> #include <linux/mm.h> +#include <linux/proc_fs.h> #include <linux/notifier.h> #include <linux/kthread.h> #include <linux/mutex.h> @@ -55,7 +56,10 @@ #include "xenbus_comms.h" #include "xenbus_probe.h" + int xen_store_evtchn; +EXPORT_SYMBOL(xen_store_evtchn); + struct xenstore_domain_interface *xen_store_interface; static unsigned long xen_store_mfn; @@ -99,15 +103,15 @@ static int xenbus_uevent(struct device *_dev, struct kobj_uevent_env *env) } /* device/<type>/<id> => <type>-<id> */ -static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename) +static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) { nodename = strchr(nodename, '/'); - if (!nodename || strlen(nodename + 1) >= BUS_ID_SIZE) { + if (!nodename || strlen(nodename + 1) >= XEN_BUS_ID_SIZE) { printk(KERN_WARNING "XENBUS: bad frontend %s\n", nodename); return -EINVAL; } - strlcpy(bus_id, nodename + 1, BUS_ID_SIZE); + strlcpy(bus_id, nodename + 1, XEN_BUS_ID_SIZE); if (!strchr(bus_id, '/')) { printk(KERN_WARNING "XENBUS: bus_id %s no slash\n", bus_id); return -EINVAL; @@ -166,6 +170,9 @@ static int read_backend_details(struct xenbus_device *xendev) return read_otherend_details(xendev, "backend-id", "backend"); } +static struct device_attribute xenbus_dev_attrs[] = { + __ATTR_NULL +}; /* Bus type for frontend drivers. */ static struct xen_bus_type xenbus_frontend = { @@ -174,12 +181,13 @@ static struct xen_bus_type xenbus_frontend = { .get_bus_id = frontend_bus_id, .probe = xenbus_probe_frontend, .bus = { - .name = "xen", - .match = xenbus_match, - .uevent = xenbus_uevent, - .probe = xenbus_dev_probe, - .remove = xenbus_dev_remove, - .shutdown = xenbus_dev_shutdown, + .name = "xen", + .match = xenbus_match, + .uevent = xenbus_uevent, + .probe = xenbus_dev_probe, + .remove = xenbus_dev_remove, + .shutdown = xenbus_dev_shutdown, + .dev_attrs = xenbus_dev_attrs, }, }; @@ -460,6 +468,7 @@ int xenbus_probe_node(struct xen_bus_type *bus, const char *type, const char *nodename) { + char devname[XEN_BUS_ID_SIZE]; int err; struct xenbus_device *xendev; size_t stringlen; @@ -494,10 +503,12 @@ int xenbus_probe_node(struct xen_bus_type *bus, xendev->dev.bus = &bus->bus; xendev->dev.release = xenbus_dev_release; - err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename); + err = bus->get_bus_id(devname, xendev->nodename); if (err) goto fail; + dev_set_name(&xendev->dev, devname); + /* Register with generic device framework. */ err = device_register(&xendev->dev); if (err) @@ -611,7 +622,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) { int exists, rootlen; struct xenbus_device *dev; - char type[BUS_ID_SIZE]; + char type[XEN_BUS_ID_SIZE]; const char *p, *root; if (char_count(node, '/') < 2) @@ -625,8 +636,8 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) /* backend/<type>/... or device/<type>/... */ p = strchr(node, '/') + 1; - snprintf(type, BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p); - type[BUS_ID_SIZE-1] = '\0'; + snprintf(type, XEN_BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p); + type[XEN_BUS_ID_SIZE-1] = '\0'; rootlen = strsep_len(node, '/', bus->levels); if (rootlen < 0) @@ -674,7 +685,7 @@ static int suspend_dev(struct device *dev, void *data) err = drv->suspend(xdev); if (err) printk(KERN_WARNING - "xenbus: suspend %s failed: %i\n", dev->bus_id, err); + "xenbus: suspend %s failed: %i\n", dev_name(dev), err); return 0; } @@ -695,7 +706,7 @@ static int suspend_cancel_dev(struct device *dev, void *data) if (err) printk(KERN_WARNING "xenbus: suspend_cancel %s failed: %i\n", - dev->bus_id, err); + dev_name(dev), err); return 0; } @@ -717,7 +728,7 @@ static int resume_dev(struct device *dev, void *data) if (err) { printk(KERN_WARNING "xenbus: resume (talk_to_otherend) %s failed: %i\n", - dev->bus_id, err); + dev_name(dev), err); return err; } @@ -728,7 +739,7 @@ static int resume_dev(struct device *dev, void *data) if (err) { printk(KERN_WARNING "xenbus: resume %s failed: %i\n", - dev->bus_id, err); + dev_name(dev), err); return err; } } @@ -737,7 +748,7 @@ static int resume_dev(struct device *dev, void *data) if (err) { printk(KERN_WARNING "xenbus_probe: resume (watch_otherend) %s failed: " - "%d.\n", dev->bus_id, err); + "%d.\n", dev_name(dev), err); return err; } @@ -849,6 +860,14 @@ static int __init xenbus_probe_init(void) if (!xen_initial_domain()) xenbus_probe(NULL); +#ifdef CONFIG_XEN_COMPAT_XENFS + /* + * Create xenfs mountpoint in /proc for compatibility with + * utilities that expect to find "xenbus" under "/proc/xen". + */ + proc_mkdir("xen", NULL); +#endif + return 0; out_unreg_back: diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h index e09b19415a4..6c5e3185a6a 100644 --- a/drivers/xen/xenbus/xenbus_probe.h +++ b/drivers/xen/xenbus/xenbus_probe.h @@ -34,6 +34,8 @@ #ifndef _XENBUS_PROBE_H #define _XENBUS_PROBE_H +#define XEN_BUS_ID_SIZE 20 + #ifdef CONFIG_XEN_BACKEND extern void xenbus_backend_suspend(int (*fn)(struct device *, void *)); extern void xenbus_backend_resume(int (*fn)(struct device *, void *)); @@ -52,7 +54,7 @@ struct xen_bus_type { char *root; unsigned int levels; - int (*get_bus_id)(char bus_id[BUS_ID_SIZE], const char *nodename); + int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); int (*probe)(const char *type, const char *dir); struct bus_type bus; }; diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 7f2f91c0e11..e325eab4724 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c @@ -184,6 +184,7 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) return ret; } +EXPORT_SYMBOL(xenbus_dev_request_and_reply); /* Send message to xs, get kmalloc'ed reply. ERR_PTR() on error. */ static void *xs_talkv(struct xenbus_transaction t, |