Linux 2.6.19-rc1
[linux-2.6/next.git] / drivers / md / dm-hw-handler.h
blob15f5629e231ad93fbab9424815c1495655b242fc
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 void *context;
23 * Constructs a hardware handler object, takes custom arguments
25 /* Information about a hardware handler type */
26 struct hw_handler_type {
27 char *name;
28 struct module *module;
30 int (*create) (struct hw_handler *handler, unsigned int argc,
31 char **argv);
32 void (*destroy) (struct hw_handler *hwh);
34 void (*pg_init) (struct hw_handler *hwh, unsigned bypassed,
35 struct path *path);
36 unsigned (*error) (struct hw_handler *hwh, struct bio *bio);
37 int (*status) (struct hw_handler *hwh, status_type_t type,
38 char *result, unsigned int maxlen);
41 /* Register a hardware handler */
42 int dm_register_hw_handler(struct hw_handler_type *type);
44 /* Unregister a hardware handler */
45 int dm_unregister_hw_handler(struct hw_handler_type *type);
47 /* Returns a registered hardware handler type */
48 struct hw_handler_type *dm_get_hw_handler(const char *name);
50 /* Releases a hardware handler */
51 void dm_put_hw_handler(struct hw_handler_type *hwht);
53 /* Default err function */
54 unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio);
56 /* Error flags for err and dm_pg_init_complete */
57 #define MP_FAIL_PATH 1
58 #define MP_BYPASS_PG 2
59 #define MP_ERROR_IO 4 /* Don't retry this I/O */
61 #endif