/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Client-facing interface for the Xenbus driver. In other words, the
* interface between the Xenbus and the device-specific code, be it the
* frontend or the backend of that driver.
*
* Copyright (C) 2005 XenSource Ltd
*
* This file may be 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,
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef XPV_HVM_DRIVER
#include <sys/xpv_support.h>
#include <sys/hypervisor.h>
#else
#include <sys/hypervisor.h>
#include <sys/evtchn_impl.h>
#endif
int
struct xenbus_watch *watch,
void (*callback)(struct xenbus_watch *,
const char **, unsigned int))
{
int err;
if (err) {
}
return (err);
}
int
void (*callback)(struct xenbus_watch *,
const char **, unsigned int))
{
int err;
char *state;
if (err)
return (err);
}
/*
* Returns 0 on success, -1 if no change was made, or an errno on failure. We
* check whether the state is currently set to the given value, and if not,
* then the state is set. We don't want to unconditionally write the given
* state, because we don't want to fire watches unnecessarily. Furthermore, if
* the node has gone, we don't write to it, as the device will be tearing down,
* and we don't want to resurrect that directory.
*
* XXPV: not clear that this is still safe if two threads are racing to update
* the state?
*/
int
{
int current_state;
int err;
/* XXPV: is this really the right thing to do? */
return (0);
if (err)
return (err);
err = -1;
if (err)
}
return (err);
}
/*
* Return the path to the error node for the given device, or NULL on failure.
* If the value returned is non-NULL, then it is the caller's to kmem_free.
*/
static char *
{
char *path_buffer;
1, KM_SLEEP);
return (path_buffer);
}
static void
{
int ret;
unsigned int len;
if (path_buffer == NULL) {
printf("xenbus: failed to write error node for %s (%s)\n",
goto fail;
}
printf("xenbus: failed to write error node for %s (%s)\n",
goto fail;
}
fail:
if (printf_buffer)
if (path_buffer)
}
void
{
}
void
{
}
/* Clear any error. */
void
{
printf("xenbus: failed to clear error node for %s\n",
else
}
}
int
{
if (err < 0)
return (err);
}
int
{
int err;
if (err)
return (err);
}
{
if (err)
return (result);
}
/*
* Local variables:
* c-file-style: "solaris"
* indent-tabs-mode: t
* c-indent-level: 8
* c-basic-offset: 8
* tab-width: 8
* End:
*/