xenbus_probe.c revision 843e19887f64dde75055cf8842fc4db2171eff45
843e19887f64dde75055cf8842fc4db2171eff45johnlev * CDDL HEADER START
843e19887f64dde75055cf8842fc4db2171eff45johnlev * The contents of this file are subject to the terms of the
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Common Development and Distribution License (the "License").
843e19887f64dde75055cf8842fc4db2171eff45johnlev * You may not use this file except in compliance with the License.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
843e19887f64dde75055cf8842fc4db2171eff45johnlev * See the License for the specific language governing permissions
843e19887f64dde75055cf8842fc4db2171eff45johnlev * and limitations under the License.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * When distributing Covered Code, include this CDDL HEADER in each
843e19887f64dde75055cf8842fc4db2171eff45johnlev * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * If applicable, add the following below this CDDL HEADER, with the
843e19887f64dde75055cf8842fc4db2171eff45johnlev * fields enclosed by brackets "[]" replaced with your own identifying
843e19887f64dde75055cf8842fc4db2171eff45johnlev * information: Portions Copyright [yyyy] [name of copyright owner]
843e19887f64dde75055cf8842fc4db2171eff45johnlev * CDDL HEADER END
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Use is subject to license terms.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Talks to Xen Store to figure out what devices we have.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Copyright (C) 2005 Rusty Russell, IBM Corporation
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Copyright (C) 2005 Mike Wray, Hewlett-Packard
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Copyright (C) 2005 XenSource Ltd
843e19887f64dde75055cf8842fc4db2171eff45johnlev * This file may be distributed separately from the Linux kernel, or
843e19887f64dde75055cf8842fc4db2171eff45johnlev * incorporated into other software packages, subject to the following license:
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Permission is hereby granted, free of charge, to any person obtaining a copy
843e19887f64dde75055cf8842fc4db2171eff45johnlev * of this source file (the "Software"), to deal in the Software without
843e19887f64dde75055cf8842fc4db2171eff45johnlev * restriction, including without limitation the rights to use, copy, modify,
843e19887f64dde75055cf8842fc4db2171eff45johnlev * merge, publish, distribute, sublicense, and/or sell copies of the Software,
843e19887f64dde75055cf8842fc4db2171eff45johnlev * and to permit persons to whom the Software is furnished to do so, subject to
843e19887f64dde75055cf8842fc4db2171eff45johnlev * the following conditions:
843e19887f64dde75055cf8842fc4db2171eff45johnlev * The above copyright notice and this permission notice shall be included in
843e19887f64dde75055cf8842fc4db2171eff45johnlev * all copies or substantial portions of the Software.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
843e19887f64dde75055cf8842fc4db2171eff45johnlev * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
843e19887f64dde75055cf8842fc4db2171eff45johnlev * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
843e19887f64dde75055cf8842fc4db2171eff45johnlev * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
843e19887f64dde75055cf8842fc4db2171eff45johnlev * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
843e19887f64dde75055cf8842fc4db2171eff45johnlev * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
843e19887f64dde75055cf8842fc4db2171eff45johnlev * IN THE SOFTWARE.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#pragma ident "%Z%%M% %I% %E% SMI"
843e19887f64dde75055cf8842fc4db2171eff45johnlev id_node, "%i", &xendev->otherend_id, path_node, NULL,
843e19887f64dde75055cf8842fc4db2171eff45johnlev "reading other end details from %s", xendev->nodename);
843e19887f64dde75055cf8842fc4db2171eff45johnlev xenbus_dev_fatal(xendev, X_ENOENT, "missing other end from %s",
843e19887f64dde75055cf8842fc4db2171eff45johnlev return (0);
843e19887f64dde75055cf8842fc4db2171eff45johnlev return (read_otherend_details(xendev, "backend-id", "backend"));
843e19887f64dde75055cf8842fc4db2171eff45johnlev return (read_otherend_details(xendev, "frontend-id", "frontend"));
843e19887f64dde75055cf8842fc4db2171eff45johnlev kmem_free((void *)dev->otherend, strlen(dev->otherend) + 1);
843e19887f64dde75055cf8842fc4db2171eff45johnlev/*ARGSUSED2*/
843e19887f64dde75055cf8842fc4db2171eff45johnlevotherend_changed(struct xenbus_watch *watch, const char **vec, unsigned int len)
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Protect us against watches firing on old details when the otherend
843e19887f64dde75055cf8842fc4db2171eff45johnlev * details change, say immediately after a resume.
843e19887f64dde75055cf8842fc4db2171eff45johnlev strncmp(dev->otherend, vec[XS_WATCH_PATH], strlen(dev->otherend))) {
843e19887f64dde75055cf8842fc4db2171eff45johnlev state, dev->otherend_watch.node, vec[XS_WATCH_PATH]);
843e19887f64dde75055cf8842fc4db2171eff45johnlev return (xenbus_watch_path2(dev, dev->otherend, "state",
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Local variables:
843e19887f64dde75055cf8842fc4db2171eff45johnlev * c-file-style: "solaris"
843e19887f64dde75055cf8842fc4db2171eff45johnlev * indent-tabs-mode: t
843e19887f64dde75055cf8842fc4db2171eff45johnlev * c-indent-level: 8
843e19887f64dde75055cf8842fc4db2171eff45johnlev * c-basic-offset: 8
843e19887f64dde75055cf8842fc4db2171eff45johnlev * tab-width: 8