13 #define SERIAL_SIZE 128
14 #define NODE_NAME_SIZE 224
15 #define PATH_STR_SIZE 16
16 #define FILE_NAME_SIZE 256
17 #define CALLOUT_MAX_SIZE 256
18 #define BLK_DEV_SIZE 33
21 #define HOST_NAME_LEN 16
22 #define SLOT_NAME_SIZE 40
24 #define VPD_DATA_SIZE 128
26 #define SCSI_VENDOR_SIZE 9
27 #define SCSI_PRODUCT_SIZE 17
28 #define SCSI_STATE_SIZE 19
29 #define NVME_MODEL_SIZE 41
30 #define NVME_REV_SIZE 9
32 /* This must be the maximum of SCSI and NVME sizes */
33 #define PATH_PRODUCT_SIZE NVME_MODEL_SIZE
34 #define PATH_REV_SIZE NVME_REV_SIZE
36 #define NO_PATH_RETRY_UNDEF 0
37 #define NO_PATH_RETRY_FAIL -1
38 #define NO_PATH_RETRY_QUEUE -2
85 enum queue_without_daemon_states {
86 QUE_NO_DAEMON_OFF = YN_NO,
87 QUE_NO_DAEMON_ON = YN_YES,
97 enum yes_no_undef_states {
103 enum find_multipaths_states {
104 FIND_MULTIPATHS_UNDEF = YNU_UNDEF,
105 FIND_MULTIPATHS_OFF = YNU_NO,
106 FIND_MULTIPATHS_ON = YNU_YES,
107 FIND_MULTIPATHS_GREEDY,
108 FIND_MULTIPATHS_SMART,
109 FIND_MULTIPATHS_STRICT,
110 __FIND_MULTIPATHS_LAST,
114 FLUSH_UNDEF = YNU_UNDEF,
115 FLUSH_DISABLED = YNU_NO,
116 FLUSH_ENABLED = YNU_YES,
119 enum log_checker_err_states {
124 enum user_friendly_names_states {
125 USER_FRIENDLY_NAMES_UNDEF = YNU_UNDEF,
126 USER_FRIENDLY_NAMES_OFF = YNU_NO,
127 USER_FRIENDLY_NAMES_ON = YNU_YES,
130 enum retain_hwhandler_states {
131 RETAIN_HWHANDLER_UNDEF = YNU_UNDEF,
132 RETAIN_HWHANDLER_OFF = YNU_NO,
133 RETAIN_HWHANDLER_ON = YNU_YES,
136 enum detect_prio_states {
137 DETECT_PRIO_UNDEF = YNU_UNDEF,
138 DETECT_PRIO_OFF = YNU_NO,
139 DETECT_PRIO_ON = YNU_YES,
142 enum detect_checker_states {
143 DETECT_CHECKER_UNDEF = YNU_UNDEF,
144 DETECT_CHECKER_OFF = YNU_NO,
145 DETECT_CHECKER_ON = YNU_YES,
148 enum deferred_remove_states {
149 DEFERRED_REMOVE_UNDEF = YNU_UNDEF,
150 DEFERRED_REMOVE_OFF = YNU_NO,
151 DEFERRED_REMOVE_ON = YNU_YES,
152 DEFERRED_REMOVE_IN_PROGRESS,
155 enum skip_kpartx_states {
156 SKIP_KPARTX_UNDEF = YNU_UNDEF,
157 SKIP_KPARTX_OFF = YNU_NO,
158 SKIP_KPARTX_ON = YNU_YES,
161 enum max_sectors_kb_states {
162 MAX_SECTORS_KB_UNDEF = 0,
163 MAX_SECTORS_KB_MIN = 4, /* can't be smaller than page size */
167 SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */
168 SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */
169 SCSI_PROTOCOL_SSA = 2, /* Serial Storage Architecture - Obsolete */
170 SCSI_PROTOCOL_SBP = 3, /* firewire */
171 SCSI_PROTOCOL_SRP = 4, /* Infiniband RDMA */
172 SCSI_PROTOCOL_ISCSI = 5,
173 SCSI_PROTOCOL_SAS = 6,
174 SCSI_PROTOCOL_ADT = 7, /* Media Changers */
175 SCSI_PROTOCOL_ATA = 8,
176 SCSI_PROTOCOL_USB = 9, /* USB Attached SCSI (UAS), and others */
177 SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
180 #define SCSI_INVALID_LUN ~0ULL
182 enum no_undef_states {
187 enum ghost_delay_states {
188 GHOST_DELAY_OFF = NU_NO,
189 GHOST_DELAY_UNDEF = NU_UNDEF,
192 enum initialized_states {
199 * INIT_REMOVED: supposed to be removed from pathvec, but still
200 * mapped by some multipath map because of map reload failure.
204 * INIT_PARTIAL: paths added by update_pathvec_from_dm() will not
205 * be fully initialized. This will be handled when an add or
206 * change uevent is received.
218 enum all_tg_pt_states {
219 ALL_TG_PT_UNDEF = YNU_UNDEF,
220 ALL_TG_PT_OFF = YNU_NO,
221 ALL_TG_PT_ON = YNU_YES,
224 enum vpd_vendor_ids {
227 VPD_VP_ARRAY_SIZE, /* This must remain the last entry */
231 * Multipath treats 0 as undefined for optional config parameters.
232 * Use this for cases where 0 is a valid option for systems multipath
233 * is communicating with
235 enum undefined_off_zero {
241 enum fast_io_fail_states {
242 MP_FAST_IO_FAIL_UNSET = UOZ_UNDEF,
243 MP_FAST_IO_FAIL_OFF = UOZ_OFF,
244 MP_FAST_IO_FAIL_ZERO = UOZ_ZERO,
247 enum eh_deadline_states {
248 EH_DEADLINE_UNSET = UOZ_UNDEF,
249 EH_DEADLINE_OFF = UOZ_OFF,
250 EH_DEADLINE_ZERO = UOZ_ZERO,
253 enum recheck_wwid_states {
254 RECHECK_WWID_UNDEF = YNU_UNDEF,
255 RECHECK_WWID_OFF = YNU_NO,
256 RECHECK_WWID_ON = YNU_YES,
259 struct vpd_vendor_page {
263 extern struct vpd_vendor_page vpd_vendor_pages[VPD_VP_ARRAY_SIZE];
272 enum scsi_protocol proto_id;
277 # define HDIO_GETGEO 0x0301 /* get device geometry */
281 unsigned char sectors;
282 unsigned short cylinders;
288 char dev[FILE_NAME_SIZE];
289 char dev_t[BLK_DEV_SIZE];
290 struct udev_device *udev;
292 struct hd_geometry geom;
293 char wwid[WWID_SIZE];
294 char vendor_id[SCSI_VENDOR_SIZE];
295 char product_id[PATH_PRODUCT_SIZE];
296 char rev[PATH_REV_SIZE];
297 char serial[SERIAL_SIZE];
298 char tgt_node_name[NODE_NAME_SIZE];
300 unsigned long long size;
301 unsigned int checkint;
314 char * uid_attribute;
317 struct checker checker;
318 struct multipath * mpp;
322 int partial_retrigger_delay;
323 unsigned int path_failures;
324 time_t dis_reinstate_time;
325 int disable_reinstate;
326 int san_path_err_forget_rate;
327 time_t io_err_dis_reinstate_time;
328 int io_err_disable_reinstate;
329 int io_err_pathfail_cnt;
330 int io_err_pathfail_starttime;
331 int find_multipaths_timeout;
335 /* configlet pointers */
337 struct gen_path generic_path;
340 typedef int (pgpolicyfn) (struct multipath *, vector);
343 char wwid[WWID_SIZE];
344 char alias_old[WWID_SIZE];
346 pgpolicyfn *pgpolicyfn;
356 int no_path_retry; /* number of retries after all paths are down */
357 int retry_tick; /* remaining times for retries */
358 int disable_queueing;
360 int flush_on_last_del;
363 int retain_hwhandler;
367 int san_path_err_threshold;
368 int san_path_err_forget_rate;
369 int san_path_err_recovery_time;
370 int marginal_path_err_sample_time;
371 int marginal_path_err_rate_threshold;
372 int marginal_path_err_recheck_gap_time;
373 int marginal_path_double_failed_time;
377 int force_udev_reload;
378 int needs_paths_uevent;
380 int ghost_delay_tick;
381 unsigned int dev_loss;
386 unsigned long long size;
389 struct dm_info * dmi;
391 /* configlet pointers */
397 struct mpentry * mpe;
404 unsigned int stat_switchgroup;
405 unsigned int stat_path_failures;
406 unsigned int stat_map_loads;
407 unsigned int stat_total_queueing_time;
408 unsigned int stat_queueing_timeouts;
409 unsigned int stat_map_failures;
411 /* checkers shared data */
414 /* persistent management data*/
416 struct be64 reservation_key;
418 unsigned char prflag;
420 struct gen_multipath generic_mp;
423 static inline int marginal_path_check_enabled(const struct multipath *mpp)
425 return mpp->marginal_path_double_failed_time > 0 &&
426 mpp->marginal_path_err_sample_time > 0 &&
427 mpp->marginal_path_err_recheck_gap_time > 0 &&
428 mpp->marginal_path_err_rate_threshold >= 0;
431 static inline int san_path_check_enabled(const struct multipath *mpp)
433 return mpp->san_path_err_threshold > 0 &&
434 mpp->san_path_err_forget_rate > 0 &&
435 mpp->san_path_err_recovery_time > 0;
445 struct multipath *mpp;
446 struct gen_pathgroup generic_pg;
449 struct adapter_group {
450 char adapter_name[SLOT_NAME_SIZE];
451 struct pathgroup *pgp;
463 struct path * alloc_path (void);
464 struct pathgroup * alloc_pathgroup (void);
465 struct multipath * alloc_multipath (void);
466 void *set_mpp_hwe(struct multipath *mpp, const struct path *pp);
467 void uninitialize_path(struct path *pp);
468 void free_path (struct path *);
469 void free_pathvec (vector vec, enum free_path_mode free_paths);
470 void free_pathgroup (struct pathgroup * pgp, enum free_path_mode free_paths);
471 void free_pgvec (vector pgvec, enum free_path_mode free_paths);
472 void free_multipath (struct multipath *, enum free_path_mode free_paths);
473 void free_multipath_attributes (struct multipath *);
474 void drop_multipath (vector mpvec, char * wwid, enum free_path_mode free_paths);
475 void free_multipathvec (vector mpvec, enum free_path_mode free_paths);
477 struct adapter_group * alloc_adaptergroup(void);
478 struct host_group * alloc_hostgroup(void);
479 void free_adaptergroup(vector adapters);
480 void free_hostgroup(vector hostgroups);
482 int store_adaptergroup(vector adapters, struct adapter_group *agp);
483 int store_hostgroup(vector hostgroupvec, struct host_group *hgp);
485 int store_path (vector pathvec, struct path * pp);
486 int add_pathgroup(struct multipath*, struct pathgroup *);
488 struct multipath * find_mp_by_alias (const struct _vector *mp, const char *alias);
489 struct multipath * find_mp_by_wwid (const struct _vector *mp, const char *wwid);
490 struct multipath * find_mp_by_str (const struct _vector *mp, const char *wwid);
491 struct multipath * find_mp_by_minor (const struct _vector *mp,
494 struct path * find_path_by_devt (const struct _vector *pathvec, const char *devt);
495 struct path * find_path_by_dev (const struct _vector *pathvec, const char *dev);
496 struct path * first_path (const struct multipath *mpp);
498 int pathcount (const struct multipath *, int);
499 int count_active_paths(const struct multipath *);
500 int count_active_pending_paths(const struct multipath *);
501 int pathcmp (const struct pathgroup *, const struct pathgroup *);
502 int add_feature (char **, const char *);
503 int remove_feature (char **, const char *);
505 extern char sysfs_path[PATH_SIZE];
507 #endif /* _STRUCTS_H */