*/
#include <sys/types.h>
#include <pwd.h>
-
+#include <string.h>
#include "checkers.h"
#include "vector.h"
#include "hwtable.h"
char * buff;
buff = set_value(strvec);
- if (sscanf(buff, "%u", &conf->dev_loss) != 1)
+ if (!buff)
+ return 1;
+
+ if (strlen(buff) == 8 && !strcmp(buff, "infinity"))
+ conf->dev_loss = MAX_DEV_LOSS_TMO;
+ else if (sscanf(buff, "%u", &conf->dev_loss) != 1)
conf->dev_loss = 0;
FREE(buff);
struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable);
buff = set_value(strvec);
- if (sscanf(buff, "%u", &hwe->dev_loss) != 1)
+ if (!buff)
+ return 1;
+
+ if (strlen(buff) == 8 && !strcmp(buff, "infinity"))
+ hwe->dev_loss = MAX_DEV_LOSS_TMO;
+ else if (sscanf(buff, "%u", &hwe->dev_loss) != 1)
hwe->dev_loss = 0;
FREE(buff);
struct hwentry * hwe = (struct hwentry *)data;
if (!hwe->fast_io_fail)
return 0;
+ if (hwe->fast_io_fail == conf->fast_io_fail)
+ return 0;
if (hwe->fast_io_fail == -1)
return snprintf(buff, len, "off");
return snprintf(buff, len, "%d", hwe->fast_io_fail);
struct hwentry * hwe = (struct hwentry *)data;
if (!hwe->dev_loss)
return 0;
+ if (hwe->dev_loss == conf->dev_loss)
+ return 0;
+ if (hwe->dev_loss >= MAX_DEV_LOSS_TMO)
+ return snprintf(buff, len, "infinity");
+
return snprintf(buff, len, "%u", hwe->dev_loss);
}
{
if (!conf->dev_loss)
return 0;
+ if (conf->dev_loss >= MAX_DEV_LOSS_TMO)
+ return snprintf(buff, len, "infinity");
return snprintf(buff, len, "%u", conf->dev_loss);
}