1/* $OpenBSD: mpathvar.h,v 1.10 2019/09/27 23:07:42 krw Exp $ */
2
3/*
4 * Copyright (c) 2010 David Gwynne <dlg@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef _SCSI_MPATHVAR_H
20#define _SCSI_MPATHVAR_H
21
22struct mpath_group;
23
24struct mpath_ops {
25 char op_name[16];
26 int (*op_checksense)(struct scsi_xfer *);
27 void (*op_status)(struct scsi_link *);
28};
29
30#define MPATH_SENSE_DECLINED 0 /* path driver declined to interpret sense */
31#define MPATH_SENSE_FAILOVER 1 /* sense says controllers have failed over */
32
33#define MPATH_S_UNKNOWN -1
34#define MPATH_S_ACTIVE 0
35#define MPATH_S_PASSIVE 1
36
37struct mpath_path {
38 /* the path driver must set these */
39 struct scsi_xshandler p_xsh;
40 struct scsi_link *p_link;
41 int p_gid;
42
43 /* the following are private to mpath.c */
44 TAILQ_ENTRY(mpath_path) p_entry;
45 struct mpath_group *p_group;
46 int p_state;
47};
48
49int mpath_path_probe(struct scsi_link *);
50int mpath_path_attach(struct mpath_path *, u_int,
51 const struct mpath_ops *);
52void mpath_path_status(struct mpath_path *, int);
53int mpath_path_detach(struct mpath_path *);
54
55void mpath_start(struct mpath_path *, struct scsi_xfer *);
56
57struct device *mpath_bootdv(struct device *);
58
59#endif /* _SCSI_MPATHVAR_H */