RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / drivers / md / dm-hw-handler.h
blobe0832e6fcf36c0747c06ae3035c12567e80df797
1 /*
2 * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
4 * This file is released under the GPL.
6 * Multipath hardware handler registration.
7 */
9 #ifndef DM_HW_HANDLER_H
10 #define DM_HW_HANDLER_H
12 #include <linux/device-mapper.h>
14 #include "dm-mpath.h"
16 struct hw_handler_type;
17 struct hw_handler {
18 struct hw_handler_type *type;
19 struct mapped_device *md;
20 void *context;
24 * Constructs a hardware handler object, takes custom arguments
26 /* Information about a hardware handler type */
27 struct hw_handler_type {
28 char *name;
29 struct module *module;
31 int (*create) (struct hw_handler *handler, unsigned int argc,
32 char **argv);
33 void (*destroy) (struct hw_handler *hwh);
35 void (*pg_init) (struct hw_handler *hwh, unsigned bypassed,
36 struct dm_path *path);
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);
42 /* Register a hardware handler */
43 int dm_register_hw_handler(struct hw_handler_type *type);
45 /* Unregister a hardware handler */
46 int dm_unregister_hw_handler(struct hw_handler_type *type);
48 /* Returns a registered hardware handler type */
49 struct hw_handler_type *dm_get_hw_handler(const char *name);
51 /* Releases a hardware handler */
52 void dm_put_hw_handler(struct hw_handler_type *hwht);
54 /* Default err function */
55 unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio);
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 */
62 #endif