dm-hw-handler.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. struct mapped_device *md;
  16. void *context;
  17. };
  18. /*
  19. * Constructs a hardware handler object, takes custom arguments
  20. */
  21. /* Information about a hardware handler type */
  22. struct hw_handler_type {
  23. char *name;
  24. struct module *module;
  25. int (*create) (struct hw_handler *handler, unsigned int argc,
  26. char **argv);
  27. void (*destroy) (struct hw_handler *hwh);
  28. void (*pg_init) (struct hw_handler *hwh, unsigned bypassed,
  29. struct dm_path *path);
  30. unsigned (*error) (struct hw_handler *hwh, struct bio *bio);
  31. int (*status) (struct hw_handler *hwh, status_type_t type,
  32. char *result, unsigned int maxlen);
  33. };
  34. /* Register a hardware handler */
  35. int dm_register_hw_handler(struct hw_handler_type *type);
  36. /* Unregister a hardware handler */
  37. int dm_unregister_hw_handler(struct hw_handler_type *type);
  38. /* Returns a registered hardware handler type */
  39. struct hw_handler_type *dm_get_hw_handler(const char *name);
  40. /* Releases a hardware handler */
  41. void dm_put_hw_handler(struct hw_handler_type *hwht);
  42. /* Default err function */
  43. unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio);
  44. /* Error flags for err and dm_pg_init_complete */
  45. #define MP_FAIL_PATH 1
  46. #define MP_BYPASS_PG 2
  47. #define MP_ERROR_IO 4 /* Don't retry this I/O */
  48. #endif