The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/cam/ctl/ctl_ha.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2003-2009 Silicon Graphics International Corp.
    5  * Copyright (c) 2011 Spectra Logic Corporation
    6  * Copyright (c) 2015 Alexander Motin <mav@FreeBSD.org>
    7  * All rights reserved.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions, and the following disclaimer,
   14  *    without modification.
   15  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
   16  *    substantially similar to the "NO WARRANTY" disclaimer below
   17  *    ("Disclaimer") and any redistribution must be conditioned upon
   18  *    including a substantially similar Disclaimer requirement for further
   19  *    binary redistribution.
   20  *
   21  * NO WARRANTY
   22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
   25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   26  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   30  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
   31  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   32  * POSSIBILITY OF SUCH DAMAGES.
   33  *
   34  * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_ha.h#1 $
   35  * $FreeBSD$
   36  */
   37 
   38 #ifndef _CTL_HA_H_
   39 #define _CTL_HA_H_
   40 
   41 /*
   42  * CTL High Availability Modes:
   43  *
   44  * CTL_HA_MODE_ACT_STBY:  Commands are serialized to the master side.
   45  *                        No media access commands on slave side (Standby).
   46  * CTL_HA_MODE_SER_ONLY:  Commands are serialized to the master side.
   47  *                        Media can be accessed on both sides.
   48  * CTL_HA_MODE_XFER:      Commands and data are forwarded to the
   49  *                        master side for execution.
   50  */
   51 typedef enum {
   52         CTL_HA_MODE_ACT_STBY,
   53         CTL_HA_MODE_SER_ONLY,
   54         CTL_HA_MODE_XFER
   55 } ctl_ha_mode;
   56 
   57 /*
   58  * Communication channel IDs for various system components.  This is to
   59  * make sure one CTL instance talks with another, one ZFS instance talks
   60  * with another, etc.
   61  */
   62 typedef enum {
   63         CTL_HA_CHAN_CTL,
   64         CTL_HA_CHAN_DATA,
   65         CTL_HA_CHAN_MAX
   66 } ctl_ha_channel;
   67 
   68 /*
   69  * HA communication event notification.  These are events generated by the
   70  * HA communication subsystem.
   71  *
   72  * CTL_HA_EVT_MSG_RECV:         Message received by the other node.
   73  * CTL_HA_EVT_LINK_CHANGE:      Communication channel status changed.
   74  */
   75 typedef enum {
   76         CTL_HA_EVT_NONE,
   77         CTL_HA_EVT_MSG_RECV,
   78         CTL_HA_EVT_LINK_CHANGE,
   79         CTL_HA_EVT_MAX
   80 } ctl_ha_event;
   81 
   82 typedef enum {
   83         CTL_HA_STATUS_WAIT,
   84         CTL_HA_STATUS_SUCCESS,
   85         CTL_HA_STATUS_ERROR,
   86         CTL_HA_STATUS_INVALID,
   87         CTL_HA_STATUS_DISCONNECT,
   88         CTL_HA_STATUS_BUSY,
   89         CTL_HA_STATUS_MAX
   90 } ctl_ha_status;
   91 
   92 typedef enum {
   93         CTL_HA_DT_CMD_READ,
   94         CTL_HA_DT_CMD_WRITE,
   95 } ctl_ha_dt_cmd;
   96 
   97 struct ctl_ha_dt_req;
   98 
   99 typedef void (*ctl_ha_dt_cb)(struct ctl_ha_dt_req *);
  100 
  101 struct ctl_ha_dt_req {
  102         ctl_ha_dt_cmd   command;
  103         void            *context;
  104         ctl_ha_dt_cb    callback;
  105         int             ret;
  106         uint32_t        size;
  107         uint8_t         *local;
  108         uint8_t         *remote;
  109         TAILQ_ENTRY(ctl_ha_dt_req)       links;
  110 };
  111 
  112 struct ctl_softc;
  113 ctl_ha_status ctl_ha_msg_init(struct ctl_softc *softc);
  114 void ctl_ha_msg_shutdown(struct ctl_softc *softc);
  115 ctl_ha_status ctl_ha_msg_destroy(struct ctl_softc *softc);
  116 
  117 typedef void (*ctl_evt_handler)(ctl_ha_channel channel, ctl_ha_event event,
  118                                 int param);
  119 void ctl_ha_register_evthandler(ctl_ha_channel channel,
  120                                 ctl_evt_handler handler);
  121 
  122 ctl_ha_status ctl_ha_msg_register(ctl_ha_channel channel,
  123     ctl_evt_handler handler);
  124 ctl_ha_status ctl_ha_msg_recv(ctl_ha_channel channel, void *addr,
  125     size_t len, int wait);
  126 ctl_ha_status ctl_ha_msg_send(ctl_ha_channel channel, const void *addr,
  127     size_t len, int wait);
  128 ctl_ha_status ctl_ha_msg_send2(ctl_ha_channel channel, const void *addr,
  129     size_t len, const void *addr2, size_t len2, int wait);
  130 ctl_ha_status ctl_ha_msg_abort(ctl_ha_channel channel);
  131 ctl_ha_status ctl_ha_msg_deregister(ctl_ha_channel channel);
  132 
  133 struct ctl_ha_dt_req * ctl_dt_req_alloc(void);
  134 void ctl_dt_req_free(struct ctl_ha_dt_req *req);
  135 ctl_ha_status ctl_dt_single(struct ctl_ha_dt_req *req);
  136 
  137 typedef enum {
  138         CTL_HA_LINK_OFFLINE     = 0x00,
  139         CTL_HA_LINK_UNKNOWN     = 0x01,
  140         CTL_HA_LINK_ONLINE      = 0x02
  141 } ctl_ha_link_state;
  142 
  143 #endif /* _CTL_HA_H_ */

Cache object: bdc6a43eda68279a6e36bbf44b685ed6


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.