/****************************************************************************** * Talks to Xen Store to figure out what devices we have (backend half). * * Copyright (C) 2005 Rusty Russell, IBM Corporation * Copyright (C) 2005 Mike Wray, Hewlett-Packard * Copyright (C) 2005, 2006 XenSource Ltd * Copyright (C) 2007 Solarflare Communications, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation; or, when distributed * separately from the Linux kernel or incorporated into other * software packages, subject to the following license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #define pr_fmt(fmt) … #define DPRINTK(fmt, ...) … #include <linux/kernel.h> #include <linux/err.h> #include <linux/string.h> #include <linux/ctype.h> #include <linux/fcntl.h> #include <linux/mm.h> #include <linux/notifier.h> #include <linux/export.h> #include <linux/semaphore.h> #include <asm/page.h> #include <asm/xen/hypervisor.h> #include <asm/hypervisor.h> #include <xen/xenbus.h> #include <xen/features.h> #include "xenbus.h" /* backend/<type>/<fe-uuid>/<id> => <type>-<fe-domid>-<id> */ static int backend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) { … } static int xenbus_uevent_backend(const struct device *dev, struct kobj_uevent_env *env) { … } /* backend/<typename>/<frontend-uuid>/<name> */ static int xenbus_probe_backend_unit(struct xen_bus_type *bus, const char *dir, const char *type, const char *name) { … } /* backend/<typename>/<frontend-domid> */ static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type, const char *domid) { … } static bool frontend_will_handle(struct xenbus_watch *watch, const char *path, const char *token) { … } static void frontend_changed(struct xenbus_watch *watch, const char *path, const char *token) { … } static struct xen_bus_type xenbus_backend = …; static void backend_changed(struct xenbus_watch *watch, const char *path, const char *token) { … } static struct xenbus_watch be_watch = …; static int read_frontend_details(struct xenbus_device *xendev) { … } int xenbus_dev_is_online(struct xenbus_device *dev) { … } EXPORT_SYMBOL_GPL(…); int __xenbus_register_backend(struct xenbus_driver *drv, struct module *owner, const char *mod_name) { … } EXPORT_SYMBOL_GPL(…); static int backend_probe_and_watch(struct notifier_block *notifier, unsigned long event, void *data) { … } static int backend_reclaim_memory(struct device *dev, void *data) { … } /* * Returns 0 always because we are using shrinker to only detect memory * pressure. */ static unsigned long backend_shrink_memory_count(struct shrinker *shrinker, struct shrink_control *sc) { … } static int __init xenbus_probe_backend_init(void) { … } subsys_initcall(xenbus_probe_backend_init);