dm-hw-handler.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
  3. *
  4. * This file is released under the GPL.
  5. *
  6. * Multipath hardware handler registration.
  7. */
  8. #ifndef DM_HW_HANDLER_H
  9. #define DM_HW_HANDLER_H
  10. #include <linux/device-mapper.h>
  11. #include "dm-mpath.h"
  12. struct hw_handler_type;
  13. struct hw_handler {
  14. struct hw_handler_type *type;
  15. void *context;
  16. };
  17. /*
  18. * Constructs a hardware handler object, takes custom arguments
  19. */
  20. /* Information about a hardware handler type */
  21. struct hw_handler_type {
  22. char *name;
  23. struct module *module;
  24. int (*create) (struct hw_handler *handler, unsigned int argc,
  25. char **argv);
  26. void (*destroy) (struct hw_handler *hwh);
  27. void (*pg_init) (struct hw_handler *hwh, unsigned bypassed,
  28. struct path *path);
  29. unsigned (*error) (struct hw_handler *hwh, struct bio *bio);
  30. int (*status) (struct hw_handler *hwh, status_type_t type,
  31. char *result, unsigned int maxlen);
  32. };
  33. /* Register a hardware handler */
  34. int dm_register_hw_handler(struct hw_handler_type *type);
  35. /* Unregister a hardware handler */
  36. int dm_unregister_hw_handler(struct hw_handler_type *type);
  37. /* Returns a registered hardware handler type */
  38. struct hw_handler_type *dm_get_hw_handler(const char *name);
  39. /* Releases a hardware handler */
  40. void dm_put_hw_handler(struct hw_handler_type *hwht);
  41. /* Default err function */
  42. unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio);
  43. /* Error flags for err and dm_pg_init_complete */
  44. #define MP_FAIL_PATH 1
  45. #define MP_BYPASS_PG 2
  46. #define MP_ERROR_IO 4 /* Don't retry this I/O */
  47. #endif