From 9e78c2a8dec3d4a9d44761b6782bd6194da414c5 Mon Sep 17 00:00:00 2001 From: Christophe Varoqui Date: Sun, 15 Jan 2006 16:20:08 +0100 Subject: [PATCH] [libmultipath] move CHECKINT definition to defaults.h And transform MAX_CHECKINT into a macro. Use that in dict.c to set conf->max_checkint with the same formula we use when we set the in-core default. --- libmultipath/defaults.h | 3 +++ libmultipath/dict.c | 3 ++- multipathd/main.c | 8 ++++---- multipathd/main.h | 2 -- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h index 784263f..ab65492 100644 --- a/libmultipath/defaults.h +++ b/libmultipath/defaults.h @@ -11,6 +11,9 @@ #define DEFAULT_NO_PATH_RETRY NO_PATH_RETRY_UNDEF #define DEFAULT_USER_FRIENDLY_NAMES 0 +#define DEFAULT_CHECKINT 5 +#define MAX_CHECKINT(a) (a << 2) + #define DEFAULT_TARGET "multipath" #define DEFAULT_PIDFILE "/var/run/multipathd.pid" #define DEFAULT_SOCKET "/var/run/multipathd.sock" diff --git a/libmultipath/dict.c b/libmultipath/dict.c index 4c668bf..e0d1718 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -13,6 +13,7 @@ #include "memory.h" #include "pgpolicies.h" #include "blacklist.h" +#include "defaults.h" #include "../libcheckers/checkers.h" @@ -26,7 +27,7 @@ polling_interval_handler(vector strvec) buff = VECTOR_SLOT(strvec, 1); conf->checkint = atoi(buff); - conf->max_checkint = conf->checkint << 2; + conf->max_checkint = MAX_CHECKINT(conf->checkint); return 0; } diff --git a/multipathd/main.c b/multipathd/main.c index 85d1632..292d13d 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1381,8 +1381,8 @@ reconfigure (struct vectors * vecs) conf->verbosity = old->verbosity; if (!conf->checkint) { - conf->checkint = CHECKINT; - conf->max_checkint = MAX_CHECKINT; + conf->checkint = DEFAULT_CHECKINT; + conf->max_checkint = MAX_CHECKINT(conf->checkint); } configure(vecs, 1); free_config(old); @@ -1537,8 +1537,8 @@ child (void * param) * fill the voids left in the config file */ if (!conf->checkint) { - conf->checkint = CHECKINT; - conf->max_checkint = MAX_CHECKINT; + conf->checkint = DEFAULT_CHECKINT; + conf->max_checkint = MAX_CHECKINT(conf->checkint); } if (pidfile_create(DEFAULT_PIDFILE, getpid())) { diff --git a/multipathd/main.h b/multipathd/main.h index a623656..d0cce3a 100644 --- a/multipathd/main.h +++ b/multipathd/main.h @@ -2,9 +2,7 @@ #define MAIN_H #define DAEMON 1 -#define CHECKINT 5 #define MAPGCINT 5 -#define MAX_CHECKINT CHECKINT << 2 int reconfigure (struct vectors *); int ev_add_path (char *, struct vectors *); -- 2.7.4