Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 9 | #ifndef DM_HW_HANDLER_H |
| 10 | #define DM_HW_HANDLER_H |
| 11 | |
| 12 | #include <linux/device-mapper.h> |
| 13 | |
| 14 | #include "dm-mpath.h" |
| 15 | |
| 16 | struct hw_handler_type; |
| 17 | struct hw_handler { |
| 18 | struct hw_handler_type *type; |
Edward Goggin | 79eb885 | 2007-05-09 02:32:56 -0700 | [diff] [blame] | 19 | struct mapped_device *md; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | void *context; |
| 21 | }; |
| 22 | |
| 23 | /* |
| 24 | * Constructs a hardware handler object, takes custom arguments |
| 25 | */ |
| 26 | /* Information about a hardware handler type */ |
| 27 | struct hw_handler_type { |
| 28 | char *name; |
| 29 | struct module *module; |
| 30 | |
| 31 | int (*create) (struct hw_handler *handler, unsigned int argc, |
| 32 | char **argv); |
| 33 | void (*destroy) (struct hw_handler *hwh); |
| 34 | |
| 35 | void (*pg_init) (struct hw_handler *hwh, unsigned bypassed, |
Josef "Jeff" Sipek | c922d5f | 2006-12-08 02:36:33 -0800 | [diff] [blame] | 36 | struct dm_path *path); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | unsigned (*error) (struct hw_handler *hwh, struct bio *bio); |
| 38 | int (*status) (struct hw_handler *hwh, status_type_t type, |
| 39 | char *result, unsigned int maxlen); |
| 40 | }; |
| 41 | |
| 42 | /* Register a hardware handler */ |
| 43 | int dm_register_hw_handler(struct hw_handler_type *type); |
| 44 | |
| 45 | /* Unregister a hardware handler */ |
| 46 | int dm_unregister_hw_handler(struct hw_handler_type *type); |
| 47 | |
| 48 | /* Returns a registered hardware handler type */ |
| 49 | struct hw_handler_type *dm_get_hw_handler(const char *name); |
| 50 | |
| 51 | /* Releases a hardware handler */ |
| 52 | void dm_put_hw_handler(struct hw_handler_type *hwht); |
| 53 | |
| 54 | /* Default err function */ |
| 55 | unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio); |
| 56 | |
| 57 | /* Error flags for err and dm_pg_init_complete */ |
| 58 | #define MP_FAIL_PATH 1 |
| 59 | #define MP_BYPASS_PG 2 |
| 60 | #define MP_ERROR_IO 4 /* Don't retry this I/O */ |
Dave Wysochanski | c9e4558 | 2007-10-19 22:47:53 +0100 | [diff] [blame] | 61 | #define MP_RETRY 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | |
| 63 | #endif |