0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef DM_PATH_SELECTOR_H
0013 #define DM_PATH_SELECTOR_H
0014
0015 #include <linux/device-mapper.h>
0016
0017 #include "dm-mpath.h"
0018
0019
0020
0021
0022
0023 struct path_selector_type;
0024 struct path_selector {
0025 struct path_selector_type *type;
0026 void *context;
0027 };
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #define DM_PS_USE_HR_TIMER 0x00000001
0041 #define dm_ps_use_hr_timer(type) ((type)->features & DM_PS_USE_HR_TIMER)
0042
0043
0044 struct path_selector_type {
0045 char *name;
0046 struct module *module;
0047
0048 unsigned int features;
0049 unsigned int table_args;
0050 unsigned int info_args;
0051
0052
0053
0054
0055 int (*create) (struct path_selector *ps, unsigned argc, char **argv);
0056 void (*destroy) (struct path_selector *ps);
0057
0058
0059
0060
0061
0062 int (*add_path) (struct path_selector *ps, struct dm_path *path,
0063 int argc, char **argv, char **error);
0064
0065
0066
0067
0068
0069 struct dm_path *(*select_path) (struct path_selector *ps,
0070 size_t nr_bytes);
0071
0072
0073
0074
0075 void (*fail_path) (struct path_selector *ps, struct dm_path *p);
0076
0077
0078
0079
0080 int (*reinstate_path) (struct path_selector *ps, struct dm_path *p);
0081
0082
0083
0084
0085
0086 int (*status) (struct path_selector *ps, struct dm_path *path,
0087 status_type_t type, char *result, unsigned int maxlen);
0088
0089 int (*start_io) (struct path_selector *ps, struct dm_path *path,
0090 size_t nr_bytes);
0091 int (*end_io) (struct path_selector *ps, struct dm_path *path,
0092 size_t nr_bytes, u64 start_time);
0093 };
0094
0095
0096 int dm_register_path_selector(struct path_selector_type *type);
0097
0098
0099 int dm_unregister_path_selector(struct path_selector_type *type);
0100
0101
0102 struct path_selector_type *dm_get_path_selector(const char *name);
0103
0104
0105 void dm_put_path_selector(struct path_selector_type *pst);
0106
0107 #endif