18bfff93895f2c2fe6bc0c69622f60b3e593a825
[platform/upstream/multipath-tools.git] / libmultipath / config.h
1 #ifndef _CONFIG_H
2 #define _CONFIG_H
3
4 #include <sys/types.h>
5 #include <stdint.h>
6
7 #define ORIGIN_DEFAULT 0
8 #define ORIGIN_CONFIG  1
9
10 enum devtypes {
11         DEV_NONE,
12         DEV_DEVT,
13         DEV_DEVNODE,
14         DEV_DEVMAP
15 };
16
17 struct hwentry {
18         char * vendor;
19         char * product;
20         char * revision;
21         char * getuid;
22         char * features;
23         char * hwhandler;
24         char * selector;
25         char * checker_name;
26         char * prio_name;
27         char * prio_args;
28         char * alias_prefix;
29
30         int pgpolicy;
31         int pgfailback;
32         int rr_weight;
33         int no_path_retry;
34         int minio;
35         int pg_timeout;
36         int flush_on_last_del;
37         int fast_io_fail;
38         unsigned int dev_loss;
39         char * bl_product;
40 };
41
42 struct mpentry {
43         char * wwid;
44         char * alias;
45         char * getuid;
46         char * selector;
47
48         int pgpolicy;
49         int pgfailback;
50         int rr_weight;
51         int no_path_retry;
52         int minio;
53         int pg_timeout;
54         int flush_on_last_del;
55         int attribute_flags;
56         uid_t uid;
57         gid_t gid;
58         mode_t mode;
59 };
60
61 struct config {
62         int verbosity;
63         int dry_run;
64         int list;
65         int pgpolicy_flag;
66         int with_sysfs;
67         int pgpolicy;
68         enum devtypes dev_type;
69         int minio;
70         int checkint;
71         int max_checkint;
72         int pgfailback;
73         int remove;
74         int rr_weight;
75         int no_path_retry;
76         int user_friendly_names;
77         int pg_timeout;
78         int max_fds;
79         int force_reload;
80         int queue_without_daemon;
81         int daemon;
82         int flush_on_last_del;
83         int attribute_flags;
84         int fast_io_fail;
85         unsigned int dev_loss;
86         uid_t uid;
87         gid_t gid;
88         mode_t mode;
89         uint32_t cookie;
90
91         char * dev;
92         char * sysfs_dir;
93         char * udev_dir;
94         char * multipath_dir;
95         char * selector;
96         char * getuid;
97         char * features;
98         char * hwhandler;
99         char * bindings_file;
100         char * prio_name;
101         char * prio_args;
102         char * checker_name;
103         char * alias_prefix;
104
105         vector keywords;
106         vector mptable;
107         vector hwtable;
108
109         vector blist_devnode;
110         vector blist_wwid;
111         vector blist_device;
112         vector elist_devnode;
113         vector elist_wwid;
114         vector elist_device;
115 };
116
117 struct config * conf;
118
119 struct hwentry * find_hwe (vector hwtable, char * vendor, char * product, char *revision);
120 struct mpentry * find_mpe (char * wwid);
121 char * get_mpe_wwid (char * alias);
122
123 struct hwentry * alloc_hwe (void);
124 struct mpentry * alloc_mpe (void);
125
126 void free_hwe (struct hwentry * hwe);
127 void free_hwtable (vector hwtable);
128 void free_mpe (struct mpentry * mpe);
129 void free_mptable (vector mptable);
130
131 int store_hwe (vector hwtable, struct hwentry *);
132
133 int load_config (char * file);
134 struct config * alloc_config (void);
135 void free_config (struct config * conf);
136
137 #endif