xref: /openbsd/sys/scsi/mpathvar.h (revision 3d8817e4)
1 /*	$OpenBSD: mpathvar.h,v 1.1 2011/04/05 14:25:42 dlg 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 _SYS_SCSI_MPATH_H_
20 #define _SYS_SCSI_MPATH_H_
21 
22 struct mpath_dev;
23 struct mpath_group;
24 
25 struct mpath_ops {
26 	char	op_name[16];
27 	void	(*op_start)(struct scsi_xfer *);
28 	int	(*op_checksense)(struct scsi_xfer *);
29 	int	(*op_online)(struct scsi_link *);
30 	int	(*op_offline)(struct scsi_link *);
31 };
32 
33 struct mpath_path {
34 	/* the path driver must set these */
35 	struct scsi_xshandler	 p_xsh;
36 	struct scsi_link	*p_link;
37 	struct mpath_ops	*p_ops;
38 	int			 p_gid;
39 
40 	/* the follwoing are private to mpath.c */
41 	TAILQ_ENTRY(mpath_path)	 p_entry;
42 	struct mpath_dev	*p_dev;
43 	int			 p_state;
44 };
45 
46 int			 mpath_path_probe(struct scsi_link *);
47 int			 mpath_path_attach(struct mpath_path *);
48 void			 mpath_path_state(struct mpath_path *, int);
49 int			 mpath_path_detach(struct mpath_path *);
50 
51 void			 mpath_start(struct mpath_path *, struct scsi_xfer *);
52 
53 struct device		*mpath_bootdv(struct device *);
54 
55 #endif /* _SYS_SCSI_MPATH_H_ */
56