c8e3d11e24
of the devices we manage. These changes can be due to writes we make ourselves or due to changes made by the control domain. The goal of these changes is to insure that all state transitions can be detected regardless of their source and to allow common device policies (e.g. "onlined" backend devices) to be centralized in the XenBus bus code. sys/xen/xenbus/xenbusvar.h: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbus_if.m: Add a new method for XenBus drivers "localend_changed". This method is invoked whenever a write is detected to a device's XenBus tree. The default implementation of this method is a no-op. sys/xen/xenbus/xenbus_if.m: sys/dev/xen/netfront/netfront.c: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: Change the signature of the "otherend_changed" method. This notification cannot fail, so it should return void. sys/xen/xenbus/xenbusb_back.c: Add "online" device handling to the XenBus Back Bus support code. An online backend device remains active after a front-end detaches as a reconnect is expected to occur in the near future. sys/xen/interface/io/xenbus.h: Add comment block further explaining the meaning and driver responsibilities associated with the XenBus Closed state. sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: sys/xen/xenbus/xenbusb_back.c: sys/xen/xenbus/xenbusb_front.c: sys/xen/xenbus/xenbusb_if.m: o Register a XenStore watch against the local XenBus tree for all devices. o Cache the string length of the path to our local tree. o Allow the xenbus front and back drivers to hook/filter both local and otherend watch processing. o Update the device ivar version of "state" when we detect a XenStore update of that node. sys/dev/xen/control/control.c: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: sys/xen/xenbus/xenbusvar.h: sys/xen/xenstore/xenstorevar.h: Allow clients of the XenStore watch mechanism to attach a single uintptr_t worth of client data to the watch. This removes the need to carefully place client watch data within enclosing objects so that a cast or offsetof calculation can be used to convert from watch to enclosing object. Sponsored by: Spectra Logic Corporation MFC after: 1 week
99 lines
3.1 KiB
C
99 lines
3.1 KiB
C
/*****************************************************************************
|
|
* xenbus.h
|
|
*
|
|
* Xenbus protocol details.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (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.
|
|
*
|
|
* Copyright (C) 2005 XenSource Ltd.
|
|
*/
|
|
|
|
#ifndef _XEN_PUBLIC_IO_XENBUS_H
|
|
#define _XEN_PUBLIC_IO_XENBUS_H
|
|
|
|
/*
|
|
* The state of either end of the Xenbus, i.e. the current communication
|
|
* status of initialisation across the bus. States here imply nothing about
|
|
* the state of the connection between the driver and the kernel's device
|
|
* layers.
|
|
*/
|
|
enum xenbus_state {
|
|
XenbusStateUnknown = 0,
|
|
|
|
/*
|
|
* Initializing: Back-end is initializing.
|
|
*/
|
|
XenbusStateInitialising = 1,
|
|
|
|
/*
|
|
* InitWait: Finished early initialisation but waiting for information
|
|
* from the peer or hotplug scripts.
|
|
*/
|
|
XenbusStateInitWait = 2,
|
|
|
|
/*
|
|
* Initialised: Waiting for a connection from the peer.
|
|
*/
|
|
XenbusStateInitialised = 3,
|
|
|
|
/*
|
|
* Connected: The normal state for a front to backend connection.
|
|
*/
|
|
XenbusStateConnected = 4,
|
|
|
|
/*
|
|
* Closing: The device is being closed due to an error or an unplug event.
|
|
*/
|
|
XenbusStateClosing = 5,
|
|
|
|
/*
|
|
* Closed: No connection exists between front and back end.
|
|
*
|
|
* For backend devices with the "online" attribute, the front can
|
|
* request a reconnect at any time. To handle this transition
|
|
* gracefully, backend devices must reinitialize any XenStore data
|
|
* used to negotiate features with a peer before transitioning to
|
|
* the closed state. When a reconnect request occurs, the
|
|
* XenBus backend support code will automatically transition the
|
|
* backend device from Closed to InitWait, kicking off the ring
|
|
* and feature negotiation process.
|
|
*/
|
|
XenbusStateClosed = 6,
|
|
|
|
/*
|
|
* Reconfiguring: The device is being reconfigured.
|
|
*/
|
|
XenbusStateReconfiguring = 7,
|
|
|
|
XenbusStateReconfigured = 8
|
|
};
|
|
typedef enum xenbus_state XenbusState;
|
|
|
|
#endif /* _XEN_PUBLIC_IO_XENBUS_H */
|
|
|
|
/*
|
|
* Local variables:
|
|
* mode: C
|
|
* c-set-style: "BSD"
|
|
* c-basic-offset: 4
|
|
* tab-width: 4
|
|
* indent-tabs-mode: nil
|
|
* End:
|
|
*/
|