34 #define DPRINTK(fmt, args...) \
35 pr_debug("xenbus_probe (%s:%d) " fmt ".\n", \
36 __func__, __LINE__, ##args)
38 #include <linux/kernel.h>
40 #include <linux/string.h>
41 #include <linux/ctype.h>
42 #include <linux/fcntl.h>
45 #include <linux/export.h>
48 #include <asm/pgtable.h>
49 #include <asm/xen/hypervisor.h>
50 #include <asm/hypervisor.h>
58 static int backend_bus_id(
char bus_id[
XEN_BUS_ID_SIZE],
const char *nodename)
64 type =
strchr(nodename,
'/');
69 if (!typelen || type[typelen] !=
'/')
72 devid =
strrchr(nodename,
'/') + 1;
75 "frontend",
NULL, &frontend,
88 if (
snprintf(bus_id, XEN_BUS_ID_SIZE,
"%.*s-%i-%s",
89 typelen, type, domid, devid) >= XEN_BUS_ID_SIZE)
94 static int xenbus_uevent_backend(
struct device *
dev,
106 xdev = to_xenbus_device(dev);
123 drv = to_xenbus_driver(dev->
driver);
125 return drv->
uevent(xdev, env);
132 static int xenbus_probe_backend_unit(
struct xen_bus_type *bus,
152 static int xenbus_probe_backend(
struct xen_bus_type *bus,
const char *type,
158 unsigned int i, dir_n = 0;
172 for (i = 0; i < dir_n; i++) {
173 err = xenbus_probe_backend_unit(bus, nodename, type, dir[i]);
183 const char **vec,
unsigned int len)
191 .get_bus_id = backend_bus_id,
192 .probe = xenbus_probe_backend,
193 .otherend_changed = frontend_changed,
195 .name =
"xen-backend",
197 .uevent = xenbus_uevent_backend,
206 const char **vec,
unsigned int len)
215 .callback = backend_changed,
218 static int read_frontend_details(
struct xenbus_device *xendev)
243 static int backend_probe_and_watch(
struct notifier_block *notifier,
254 static int __init xenbus_probe_backend_init(
void)