return NULL;
}
-int checker_init (struct checker * c)
+int checker_init (struct checker * c, void ** mpctxt_addr)
{
+ c->mpcontext = mpctxt_addr;
return c->init(c);
}
char name[CHECKER_NAME_LEN];
char message[CHECKER_MSG_LEN]; /* comm with callers */
void * context; /* store for persistent data */
+ void ** mpcontext; /* store for persistent data
+ shared multipath-wide */
int (*check)(struct checker *);
int (*init)(struct checker *); /* to allocate the context */
void (*free)(struct checker *); /* to free the context */
#define MSG(c, a) snprintf((c)->message, CHECKER_MSG_LEN, a);
-int checker_init (struct checker *);
+int checker_init (struct checker *, void **);
void checker_put (struct checker *);
void checker_reset (struct checker * c);
void checker_set_fd (struct checker *, int);
{
struct checker * c = &pp->checker;
+ if (!pp->mpp)
+ return 0;
+
if (!checker_selected(c)) {
select_checker(pp);
if (!checker_selected(c))
return 1;
checker_set_fd(c, pp->fd);
- if (checker_init(c))
+ if (checker_init(c, &pp->mpp->mpcontext))
return 1;
}
pp->state = checker_check(c);
mpp = (struct multipath *)MALLOC(sizeof(struct multipath));
- if (mpp)
+ if (mpp) {
mpp->bestpg = 1;
-
+ mpp->mpcontext = NULL;
+ }
return mpp;
}
free_pathvec(mpp->paths, free_paths);
free_pgvec(mpp->pg, free_paths);
+ FREE_PTR(mpp->mpcontext);
FREE(mpp);
}
unsigned int stat_map_loads;
unsigned int stat_total_queueing_time;
unsigned int stat_queueing_timeouts;
+
+ /* checkers shared data */
+ void * mpcontext;
};
struct pathgroup {