if (dhwe->checker_name && !(hwe->checker_name = set_param_str(dhwe->checker_name)))
goto out;
+ if (dhwe->prio_name && !(hwe->prio_name = set_param_str(dhwe->prio_name)))
+ goto out;
+
hwe->pgpolicy = dhwe->pgpolicy;
hwe->pgfailback = dhwe->pgfailback;
hwe->rr_weight = dhwe->rr_weight;
hwe->no_path_retry = dhwe->no_path_retry;
hwe->minio = dhwe->minio;
- hwe->prio = dhwe->prio;
if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product)))
goto out;
conf->minio = 1000;
conf->max_fds = 0;
conf->bindings_file = DEFAULT_BINDINGS_FILE;
+ conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR);
/*
* read the config file
/*
* fill the voids left in the config file
*/
- if (conf->multipath_dir == NULL)
- conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR);
-
if (conf->hwtable == NULL) {
conf->hwtable = vector_alloc();
!conf->hwhandler)
goto out;
- if (!conf->prio)
- conf->prio = prio_default();
+ if (!conf->prio_name)
+ conf->prio_name = set_default(DEFAULT_PRIO);
if (!conf->checker_name)
conf->checker_name = set_default(DEFAULT_CHECKER);
int no_path_retry;
int minio;
int pg_timeout;
- struct prio * prio;
char * bl_product;
};
int pgpolicy_flag;
int with_sysfs;
int pgpolicy;
- struct prio * prio;
enum devtypes dev_type;
int minio;
int checkint;
char * features;
char * hwhandler;
char * bindings_file;
+ char * prio_name;
char * checker_name;
vector keywords;
static int
def_prio_handler(vector strvec)
{
- char * buff;
+ conf->prio_name = set_value(strvec);
- buff = set_value(strvec);
- if (!buff)
+ if (!conf->prio_name)
return 1;
- conf->prio = prio_lookup(buff);
- FREE(buff);
return 0;
}
hw_prio_handler(vector strvec)
{
struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable);
- char * buff;
-
+
if (!hwe)
return 1;
- buff = set_value(strvec);
- if (!buff)
+ hwe->prio_name = set_value(strvec);
+
+ if (!hwe->prio_name)
return 1;
-
- hwe->prio = prio_lookup(buff);
- FREE(buff);
+
return 0;
}
{
struct hwentry * hwe = (struct hwentry *)data;
- if (!hwe->prio)
+ if (!hwe->prio_name)
return 0;
- if (hwe->prio == conf->prio)
+ if (!strcmp(hwe->prio_name, conf->prio_name))
return 0;
- return snprintf(buff, len, "%s", prio_name(hwe->prio));
+ return snprintf(buff, len, "%s", hwe->prio_name);
}
static int
static int
snprint_def_prio (char * buff, int len, void * data)
{
- if (!conf->prio)
+ if (!conf->prio_name)
return 0;
- return snprintf(buff, len, "%s", prio_name(conf->prio));
+ if (strlen(conf->prio_name) == strlen(DEFAULT_PRIO) &&
+ !strcmp(conf->prio_name, DEFAULT_PRIO))
+ return 0;
+
+ return snprintf(buff, len, "%s", conf->prio_name);
}
static int
struct hwentry * hwe = default_hw;
while (hwe->vendor) {
- hwe->prio = prio_lookup(hwe->prio_name);
r += store_hwe(hw, hwe);
hwe++;
}
if (!strncmp(name, p->name, PRIO_NAME_LEN))
return p;
}
- p = add_prio(name);
- if (p)
- return p;
- return prio_default();
+ return add_prio(name);
}
struct prio * add_prio (char * name)
{
return p->name;
}
-
-struct prio * prio_default (void)
-{
- return prio_lookup(DEFAULT_PRIO);
-}
struct prio * prio_lookup (char *);
int prio_getprio (struct prio *, struct path *);
char * prio_name (struct prio *);
-struct prio * prio_default (void);
#endif /* _PRIO_H */
extern int
select_prio (struct path * pp)
{
- if (pp->hwe && pp->hwe->prio) {
- pp->prio = pp->hwe->prio;
+ if (pp->hwe && pp->hwe->prio_name) {
+ pp->prio = prio_lookup(pp->hwe->prio_name);
condlog(3, "%s: prio = %s (controller setting)",
- pp->dev, prio_name(pp->prio));
+ pp->dev, pp->hwe->prio_name);
return 0;
}
- if (conf->prio) {
- pp->prio = conf->prio;
+ if (conf->prio_name) {
+ pp->prio = prio_lookup(conf->prio_name);
condlog(3, "%s: prio = %s (config file default)",
- pp->dev, prio_name(pp->prio));
+ pp->dev, conf->prio_name);
return 0;
}
- pp->prio = prio_default();
+ pp->prio = prio_lookup(DEFAULT_PRIO);
condlog(3, "%s: prio = %s (internal default)",
- pp->dev, prio_name(pp->prio));
+ pp->dev, DEFAULT_PRIO);
return 0;
}