mpathvar.h 1.9 KB

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