blob: e0832e6fcf36c0747c06ae3035c12567e80df797 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
16struct hw_handler_type;
17struct hw_handler {
18 struct hw_handler_type *type;
Edward Goggin79eb8852007-05-09 02:32:56 -070019 struct mapped_device *md;
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 void *context;
21};
22
23/*
24 * Constructs a hardware handler object, takes custom arguments
25 */
26/* Information about a hardware handler type */
27struct 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" Sipekc922d5f2006-12-08 02:36:33 -080036 struct dm_path *path);
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 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 */
43int dm_register_hw_handler(struct hw_handler_type *type);
44
45/* Unregister a hardware handler */
46int dm_unregister_hw_handler(struct hw_handler_type *type);
47
48/* Returns a registered hardware handler type */
49struct hw_handler_type *dm_get_hw_handler(const char *name);
50
51/* Releases a hardware handler */
52void dm_put_hw_handler(struct hw_handler_type *hwht);
53
54/* Default err function */
55unsigned 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 */
61
62#endif