1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
|
#ifndef CONFIG_H_INCLUDED
#define CONFIG_H_INCLUDED
#include <sys/types.h>
#include <stdint.h>
#include <urcu.h>
#include <inttypes.h>
#include "byteorder.h"
#include "globals.h"
#define ORIGIN_DEFAULT 0
#define ORIGIN_CONFIG 1
enum devtypes {
DEV_NONE,
DEV_DEVT,
DEV_DEVNODE,
DEV_DEVMAP,
DEV_UEVENT
};
enum mpath_cmds {
CMD_NONE,
CMD_CREATE,
CMD_DRY_RUN,
CMD_LIST_SHORT,
CMD_LIST_LONG,
CMD_VALID_PATH,
CMD_REMOVE_WWID,
CMD_RESET_WWIDS,
CMD_ADD_WWID,
CMD_USABLE_PATHS,
CMD_DUMP_CONFIG,
CMD_FLUSH_ONE,
CMD_FLUSH_ALL,
};
enum force_reload_types {
FORCE_RELOAD_NONE,
FORCE_RELOAD_YES,
FORCE_RELOAD_WEAK,
};
#define PCE_INVALID -1
struct pcentry {
int type;
int fast_io_fail;
unsigned int dev_loss;
int eh_deadline;
};
struct hwentry {
char * vendor;
char * product;
char * revision;
char * uid_attribute;
char * features;
char * hwhandler;
char * selector;
char * checker_name;
char * prio_name;
char * prio_args;
char * alias_prefix;
int pgpolicy;
int pgfailback;
int rr_weight;
int no_path_retry;
int minio;
int minio_rq;
int flush_on_last_del;
int fast_io_fail;
unsigned int dev_loss;
int eh_deadline;
int user_friendly_names;
int retain_hwhandler;
int detect_prio;
int detect_checker;
int detect_pgpolicy;
int detect_pgpolicy_use_tpg;
int deferred_remove;
int delay_watch_checks;
int delay_wait_checks;
int san_path_err_threshold;
int san_path_err_forget_rate;
int san_path_err_recovery_time;
int marginal_path_err_sample_time;
int marginal_path_err_rate_threshold;
int marginal_path_err_recheck_gap_time;
int marginal_path_double_failed_time;
int purge_disconnected;
int skip_kpartx;
int max_sectors_kb;
int ghost_delay;
int all_tg_pt;
int vpd_vendor_id;
int recheck_wwid;
char * bl_product;
vector pctable;
};
struct mpentry {
char * wwid;
char * alias;
char * uid_attribute;
char * selector;
char * features;
char * prio_name;
char * prio_args;
int prkey_source;
struct be64 reservation_key;
uint8_t sa_flags;
int pgpolicy;
int pgfailback;
int rr_weight;
int no_path_retry;
int minio;
int minio_rq;
int flush_on_last_del;
int attribute_flags;
int user_friendly_names;
int deferred_remove;
int delay_watch_checks;
int delay_wait_checks;
int san_path_err_threshold;
int san_path_err_forget_rate;
int san_path_err_recovery_time;
int marginal_path_err_sample_time;
int marginal_path_err_rate_threshold;
int marginal_path_err_recheck_gap_time;
int marginal_path_double_failed_time;
int purge_disconnected;
int skip_kpartx;
int max_sectors_kb;
int ghost_delay;
uid_t uid;
gid_t gid;
mode_t mode;
};
struct config {
struct rcu_head rcu;
int verbosity;
int pgpolicy_flag;
int pgpolicy;
int minio;
int minio_rq;
unsigned int checkint;
unsigned int max_checkint;
unsigned int adjust_int;
int pgfailback;
int rr_weight;
int no_path_retry;
int user_friendly_names;
int bindings_read_only;
int max_fds;
int force_reload;
int queue_without_daemon;
int checker_timeout;
int flush_on_last_del;
int attribute_flags;
int fast_io_fail;
unsigned int dev_loss;
int eh_deadline;
int max_retries;
int log_checker_err;
int allow_queueing;
int allow_usb_devices;
int find_multipaths;
uid_t uid;
gid_t gid;
mode_t mode;
int reassign_maps;
int retain_hwhandler;
int detect_prio;
int detect_checker;
int detect_pgpolicy;
int detect_pgpolicy_use_tpg;
int force_sync;
int deferred_remove;
int processed_main_config;
int delay_watch_checks;
int delay_wait_checks;
int san_path_err_threshold;
int san_path_err_forget_rate;
int san_path_err_recovery_time;
int marginal_path_err_sample_time;
int marginal_path_err_rate_threshold;
int marginal_path_err_recheck_gap_time;
int marginal_path_double_failed_time;
int purge_disconnected;
int uxsock_timeout;
int strict_timing;
int retrigger_tries;
int retrigger_delay;
int uev_wait_timeout;
int skip_kpartx;
int remove_retries;
int max_sectors_kb;
int ghost_delay;
int find_multipaths_timeout;
int marginal_pathgroups;
int skip_delegate;
unsigned int sequence_nr;
int recheck_wwid;
int auto_resize;
char * selector;
struct vector_s uid_attrs;
char * uid_attribute;
char * features;
char * hwhandler;
char * prio_name;
char * prio_args;
char * checker_name;
char * alias_prefix;
char * partition_delim;
int prkey_source;
int all_tg_pt;
struct be64 reservation_key;
uint8_t sa_flags;
vector keywords;
vector mptable;
vector hwtable;
struct hwentry *overrides;
vector blist_devnode;
vector blist_wwid;
vector blist_device;
vector blist_property;
vector blist_protocol;
vector elist_devnode;
vector elist_wwid;
vector elist_device;
vector elist_property;
vector elist_protocol;
char *enable_foreign;
};
/**
* extern variable: udev
*
* A &struct udev instance used by libmultipath. libmultipath expects
* a valid, initialized &struct udev in this variable.
* An application can define this variable itself, in which case
* the applications's instance will take precedence.
* The application can initialize and destroy this variable by
* calling libmultipath_init() and libmultipath_exit(), respectively,
* whether or not it defines the variable itself.
* An application can initialize udev with udev_new() before calling
* libmultipath_init(), e.g. if it has to make libudev calls before
* libmultipath calls. If an application wants to keep using the
* udev variable after calling libmultipath_exit(), it should have taken
* an additional reference on it beforehand. This is the case e.g.
* after initializing udev with udev_new().
*/
extern struct udev *udev;
/**
* libmultipath_init() - library initialization
*
* This function initializes libmultipath data structures.
* It is light-weight; some other initializations, like device-mapper
* initialization, are done lazily when the respective functionality
* is required.
*
* Clean up by libmultipath_exit() when the program terminates.
* It is an error to call libmultipath_init() after libmultipath_exit().
* Return: 0 on success, 1 on failure.
*/
int libmultipath_init(void);
/**
* libmultipath_exit() - library un-initialization
*
* This function un-initializes libmultipath data structures.
* It is recommended to call this function at program exit.
* If the application also calls dm_lib_exit(), it should do so
* after libmultipath_exit().
*
* Calls to libmultipath_init() after libmultipath_exit() will fail
* (in other words, libmultipath can't be re-initialized).
* Any other libmultipath calls after libmultipath_exit() may cause
* undefined behavior.
*/
void libmultipath_exit(void);
int find_hwe (const struct vector_s *hwtable,
const char * vendor, const char * product, const char *revision,
vector result);
struct mpentry * find_mpe (vector mptable, char * wwid);
const char *get_mpe_wwid (const struct vector_s *mptable, const char *alias);
struct hwentry * alloc_hwe (void);
struct mpentry * alloc_mpe (void);
struct pcentry * alloc_pce (void);
void free_hwe (struct hwentry * hwe);
void free_hwtable (vector hwtable);
void free_mpe (struct mpentry * mpe);
void free_mptable (vector mptable);
int store_hwe (vector hwtable, struct hwentry *);
struct config *load_config (const char *file);
void free_config (struct config * conf);
int init_config(const char *file);
void uninit_config(void);
struct config *libmp_get_multipath_config(void);
void libmp_put_multipath_config(void *);
int parse_uid_attrs(char *uid_attrs, struct config *conf);
const char *get_uid_attribute_by_attrs(const struct config *conf,
const char *path_dev);
#endif
|