|
|
c4b4b8 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
c4b4b8 |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
c4b4b8 |
Date: Fri, 24 Sep 2021 17:59:12 -0500
|
|
|
c4b4b8 |
Subject: [PATCH] libmultipath: pass file and line number to keyword handlers
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
This will make it possible for the keyword handlers to print more useful
|
|
|
c4b4b8 |
warning messages. It will be used by future patches.
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
c4b4b8 |
---
|
|
|
c4b4b8 |
libmultipath/dict.c | 145 +++++++++++++++++++++++++-----------------
|
|
|
c4b4b8 |
libmultipath/parser.c | 3 +-
|
|
|
c4b4b8 |
libmultipath/parser.h | 2 +-
|
|
|
c4b4b8 |
3 files changed, 91 insertions(+), 59 deletions(-)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
|
|
|
c4b4b8 |
index 13698b76..a8872da7 100644
|
|
|
c4b4b8 |
--- a/libmultipath/dict.c
|
|
|
c4b4b8 |
+++ b/libmultipath/dict.c
|
|
|
c4b4b8 |
@@ -28,7 +28,7 @@
|
|
|
c4b4b8 |
#include "dict.h"
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_int(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_int(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
int *int_ptr = (int *)ptr;
|
|
|
c4b4b8 |
char *buff, *eptr;
|
|
|
c4b4b8 |
@@ -57,7 +57,7 @@ set_int(vector strvec, void *ptr)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_uint(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_uint(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
unsigned int *uint_ptr = (unsigned int *)ptr;
|
|
|
c4b4b8 |
char *buff, *eptr, *p;
|
|
|
c4b4b8 |
@@ -89,7 +89,7 @@ set_uint(vector strvec, void *ptr)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_str(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_str(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char **str_ptr = (char **)ptr;
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
@@ -104,7 +104,7 @@ set_str(vector strvec, void *ptr)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_regex(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_regex(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char **str_ptr = (char **)ptr;
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
@@ -119,7 +119,7 @@ set_regex(vector strvec, void *ptr)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_yes_no(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_yes_no(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
int *int_ptr = (int *)ptr;
|
|
|
c4b4b8 |
@@ -138,7 +138,7 @@ set_yes_no(vector strvec, void *ptr)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_yes_no_undef(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_yes_no_undef(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
int *int_ptr = (int *)ptr;
|
|
|
c4b4b8 |
@@ -240,9 +240,10 @@ print_yes_no_undef (char *buff, int len, long v)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_def_handler(option, function) \
|
|
|
c4b4b8 |
static int \
|
|
|
c4b4b8 |
-def_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
c4b4b8 |
+def_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
c4b4b8 |
+ const char *file, int line_nr) \
|
|
|
c4b4b8 |
{ \
|
|
|
c4b4b8 |
- return function (strvec, &conf->option); \
|
|
|
c4b4b8 |
+ return function (strvec, &conf->option, file, line_nr); \
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_def_snprint(option, function) \
|
|
|
c4b4b8 |
@@ -277,12 +278,13 @@ snprint_def_ ## option (struct config *conf, char * buff, int len, \
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_hw_handler(option, function) \
|
|
|
c4b4b8 |
static int \
|
|
|
c4b4b8 |
-hw_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
c4b4b8 |
+hw_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
c4b4b8 |
+ const char *file, int line_nr) \
|
|
|
c4b4b8 |
{ \
|
|
|
c4b4b8 |
struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); \
|
|
|
c4b4b8 |
if (!hwe) \
|
|
|
c4b4b8 |
return 1; \
|
|
|
c4b4b8 |
- return function (strvec, &hwe->option); \
|
|
|
c4b4b8 |
+ return function (strvec, &hwe->option, file, line_nr); \
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_hw_snprint(option, function) \
|
|
|
c4b4b8 |
@@ -296,11 +298,12 @@ snprint_hw_ ## option (struct config *conf, char * buff, int len, \
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_ovr_handler(option, function) \
|
|
|
c4b4b8 |
static int \
|
|
|
c4b4b8 |
-ovr_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
c4b4b8 |
+ovr_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
c4b4b8 |
+ const char *file, int line_nr) \
|
|
|
c4b4b8 |
{ \
|
|
|
c4b4b8 |
if (!conf->overrides) \
|
|
|
c4b4b8 |
return 1; \
|
|
|
c4b4b8 |
- return function (strvec, &conf->overrides->option); \
|
|
|
c4b4b8 |
+ return function (strvec, &conf->overrides->option, file, line_nr); \
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_ovr_snprint(option, function) \
|
|
|
c4b4b8 |
@@ -313,12 +316,13 @@ snprint_ovr_ ## option (struct config *conf, char * buff, int len, \
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_mp_handler(option, function) \
|
|
|
c4b4b8 |
static int \
|
|
|
c4b4b8 |
-mp_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
c4b4b8 |
+mp_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
c4b4b8 |
+ const char *file, int line_nr) \
|
|
|
c4b4b8 |
{ \
|
|
|
c4b4b8 |
struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable); \
|
|
|
c4b4b8 |
if (!mpe) \
|
|
|
c4b4b8 |
return 1; \
|
|
|
c4b4b8 |
- return function (strvec, &mpe->option); \
|
|
|
c4b4b8 |
+ return function (strvec, &mpe->option, file, line_nr); \
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_mp_snprint(option, function) \
|
|
|
c4b4b8 |
@@ -330,9 +334,10 @@ snprint_mp_ ## option (struct config *conf, char * buff, int len, \
|
|
|
c4b4b8 |
return function (buff, len, mpe->option); \
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
-static int checkint_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+static int checkint_handler(struct config *conf, vector strvec,
|
|
|
c4b4b8 |
+ const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
- int rc = set_uint(strvec, &conf->checkint);
|
|
|
c4b4b8 |
+ int rc = set_uint(strvec, &conf->checkint, file, line_nr);
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
if (rc)
|
|
|
c4b4b8 |
return rc;
|
|
|
c4b4b8 |
@@ -355,9 +360,10 @@ declare_def_snprint(reassign_maps, print_yes_no)
|
|
|
c4b4b8 |
declare_def_handler(multipath_dir, set_str)
|
|
|
c4b4b8 |
declare_def_snprint(multipath_dir, print_str)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
-static int def_partition_delim_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+static int def_partition_delim_handler(struct config *conf, vector strvec,
|
|
|
c4b4b8 |
+ const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
- int rc = set_str(strvec, &conf->partition_delim);
|
|
|
c4b4b8 |
+ int rc = set_str(strvec, &conf->partition_delim, file, line_nr);
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
if (rc != 0)
|
|
|
c4b4b8 |
return rc;
|
|
|
c4b4b8 |
@@ -387,13 +393,13 @@ static const char * const find_multipaths_optvals[] = {
|
|
|
c4b4b8 |
};
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-def_find_multipaths_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+def_find_multipaths_handler(struct config *conf, vector strvec,
|
|
|
c4b4b8 |
+ const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char *buff;
|
|
|
c4b4b8 |
int i;
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
- if (set_yes_no_undef(strvec, &conf->find_multipaths) == 0 &&
|
|
|
c4b4b8 |
- conf->find_multipaths != FIND_MULTIPATHS_UNDEF)
|
|
|
c4b4b8 |
+ if (set_yes_no_undef(strvec, &conf->find_multipaths, file, line_nr) == 0 && conf->find_multipaths != FIND_MULTIPATHS_UNDEF)
|
|
|
c4b4b8 |
return 0;
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
buff = set_value(strvec);
|
|
|
c4b4b8 |
@@ -451,7 +457,8 @@ static int snprint_uid_attrs(struct config *conf, char *buff, int len,
|
|
|
c4b4b8 |
return p - buff;
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
-static int uid_attrs_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+static int uid_attrs_handler(struct config *conf, vector strvec,
|
|
|
c4b4b8 |
+ const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char *val;
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
@@ -644,7 +651,8 @@ declare_hw_handler(skip_kpartx, set_yes_no_undef)
|
|
|
c4b4b8 |
declare_hw_snprint(skip_kpartx, print_yes_no_undef)
|
|
|
c4b4b8 |
declare_mp_handler(skip_kpartx, set_yes_no_undef)
|
|
|
c4b4b8 |
declare_mp_snprint(skip_kpartx, print_yes_no_undef)
|
|
|
c4b4b8 |
-static int def_disable_changed_wwids_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+static int def_disable_changed_wwids_handler(struct config *conf, vector strvec,
|
|
|
c4b4b8 |
+ const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
return 0;
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
@@ -675,20 +683,23 @@ declare_def_snprint_defstr(enable_foreign, print_str,
|
|
|
c4b4b8 |
DEFAULT_ENABLE_FOREIGN)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-def_config_dir_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+def_config_dir_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
/* this is only valid in the main config file */
|
|
|
c4b4b8 |
if (conf->processed_main_config)
|
|
|
c4b4b8 |
return 0;
|
|
|
c4b4b8 |
- return set_str(strvec, &conf->config_dir);
|
|
|
c4b4b8 |
+ return set_str(strvec, &conf->config_dir, file, line_nr);
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
declare_def_snprint(config_dir, print_str)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_def_attr_handler(option, function) \
|
|
|
c4b4b8 |
static int \
|
|
|
c4b4b8 |
-def_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
c4b4b8 |
+def_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
c4b4b8 |
+ const char *file, int line_nr) \
|
|
|
c4b4b8 |
{ \
|
|
|
c4b4b8 |
- return function (strvec, &conf->option, &conf->attribute_flags);\
|
|
|
c4b4b8 |
+ return function (strvec, &conf->option, &conf->attribute_flags, \
|
|
|
c4b4b8 |
+ file, line_nr); \
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_def_attr_snprint(option, function) \
|
|
|
c4b4b8 |
@@ -702,12 +713,14 @@ snprint_def_ ## option (struct config *conf, char * buff, int len, \
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_mp_attr_handler(option, function) \
|
|
|
c4b4b8 |
static int \
|
|
|
c4b4b8 |
-mp_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
c4b4b8 |
+mp_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
c4b4b8 |
+ const char *file, int line_nr) \
|
|
|
c4b4b8 |
{ \
|
|
|
c4b4b8 |
struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable); \
|
|
|
c4b4b8 |
if (!mpe) \
|
|
|
c4b4b8 |
return 1; \
|
|
|
c4b4b8 |
- return function (strvec, &mpe->option, &mpe->attribute_flags); \
|
|
|
c4b4b8 |
+ return function (strvec, &mpe->option, &mpe->attribute_flags, \
|
|
|
c4b4b8 |
+ file, line_nr); \
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_mp_attr_snprint(option, function) \
|
|
|
c4b4b8 |
@@ -721,7 +734,7 @@ snprint_mp_ ## option (struct config *conf, char * buff, int len, \
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_mode(vector strvec, void *ptr, int *flags)
|
|
|
c4b4b8 |
+set_mode(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
mode_t mode;
|
|
|
c4b4b8 |
mode_t *mode_ptr = (mode_t *)ptr;
|
|
|
c4b4b8 |
@@ -742,7 +755,7 @@ set_mode(vector strvec, void *ptr, int *flags)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_uid(vector strvec, void *ptr, int *flags)
|
|
|
c4b4b8 |
+set_uid(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
uid_t uid;
|
|
|
c4b4b8 |
uid_t *uid_ptr = (uid_t *)ptr;
|
|
|
c4b4b8 |
@@ -767,7 +780,7 @@ set_uid(vector strvec, void *ptr, int *flags)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_gid(vector strvec, void *ptr, int *flags)
|
|
|
c4b4b8 |
+set_gid(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
gid_t gid;
|
|
|
c4b4b8 |
gid_t *gid_ptr = (gid_t *)ptr;
|
|
|
c4b4b8 |
@@ -834,7 +847,7 @@ declare_mp_attr_handler(gid, set_gid)
|
|
|
c4b4b8 |
declare_mp_attr_snprint(gid, print_gid)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_undef_off_zero(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_undef_off_zero(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
int *int_ptr = (int *)ptr;
|
|
|
c4b4b8 |
@@ -876,7 +889,7 @@ declare_hw_handler(fast_io_fail, set_undef_off_zero)
|
|
|
c4b4b8 |
declare_hw_snprint(fast_io_fail, print_undef_off_zero)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_dev_loss(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_dev_loss(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
unsigned int *uint_ptr = (unsigned int *)ptr;
|
|
|
c4b4b8 |
@@ -919,7 +932,7 @@ declare_hw_handler(eh_deadline, set_undef_off_zero)
|
|
|
c4b4b8 |
declare_hw_snprint(eh_deadline, print_undef_off_zero)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_pgpolicy(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_pgpolicy(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
int *int_ptr = (int *)ptr;
|
|
|
c4b4b8 |
@@ -985,7 +998,8 @@ get_sys_max_fds(int *max_fds)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-max_fds_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+max_fds_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
int r = 0, max_fds;
|
|
|
c4b4b8 |
@@ -1030,7 +1044,7 @@ snprint_max_fds (struct config *conf, char * buff, int len, const void * data)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_rr_weight(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_rr_weight(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
int *int_ptr = (int *)ptr;
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
@@ -1074,7 +1088,7 @@ declare_mp_handler(rr_weight, set_rr_weight)
|
|
|
c4b4b8 |
declare_mp_snprint(rr_weight, print_rr_weight)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_pgfailback(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_pgfailback(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
int *int_ptr = (int *)ptr;
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
@@ -1124,7 +1138,7 @@ declare_mp_handler(pgfailback, set_pgfailback)
|
|
|
c4b4b8 |
declare_mp_snprint(pgfailback, print_pgfailback)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-no_path_retry_helper(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+no_path_retry_helper(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
int *int_ptr = (int *)ptr;
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
@@ -1169,7 +1183,8 @@ declare_mp_handler(no_path_retry, no_path_retry_helper)
|
|
|
c4b4b8 |
declare_mp_snprint(no_path_retry, print_no_path_retry)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-def_log_checker_err_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+def_log_checker_err_handler(struct config *conf, vector strvec,
|
|
|
c4b4b8 |
+ const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
@@ -1243,7 +1258,8 @@ print_reservation_key(char * buff, int len, struct be64 key, uint8_t flags,
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-def_reservation_key_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+def_reservation_key_handler(struct config *conf, vector strvec,
|
|
|
c4b4b8 |
+ const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
return set_reservation_key(strvec, &conf->reservation_key,
|
|
|
c4b4b8 |
&conf->sa_flags,
|
|
|
c4b4b8 |
@@ -1260,7 +1276,8 @@ snprint_def_reservation_key (struct config *conf, char * buff, int len,
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-mp_reservation_key_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+mp_reservation_key_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable);
|
|
|
c4b4b8 |
if (!mpe)
|
|
|
c4b4b8 |
@@ -1281,7 +1298,7 @@ snprint_mp_reservation_key (struct config *conf, char * buff, int len,
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-set_off_int_undef(vector strvec, void *ptr)
|
|
|
c4b4b8 |
+set_off_int_undef(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
int *int_ptr = (int *)ptr;
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
@@ -1422,7 +1439,8 @@ declare_hw_snprint(recheck_wwid, print_yes_no_undef)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-def_uxsock_timeout_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+def_uxsock_timeout_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
unsigned int uxsock_timeout;
|
|
|
c4b4b8 |
char *buff;
|
|
|
c4b4b8 |
@@ -1442,7 +1460,8 @@ def_uxsock_timeout_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-hw_vpd_vendor_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+hw_vpd_vendor_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
int i;
|
|
|
c4b4b8 |
char *buff;
|
|
|
c4b4b8 |
@@ -1482,7 +1501,8 @@ snprint_hw_vpd_vendor(struct config *conf, char * buff, int len,
|
|
|
c4b4b8 |
* blacklist block handlers
|
|
|
c4b4b8 |
*/
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-blacklist_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+blacklist_handler(struct config *conf, vector strvec, const char*file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
if (!conf->blist_devnode)
|
|
|
c4b4b8 |
conf->blist_devnode = vector_alloc();
|
|
|
c4b4b8 |
@@ -1504,7 +1524,8 @@ blacklist_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-blacklist_exceptions_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+blacklist_exceptions_handler(struct config *conf, vector strvec,
|
|
|
c4b4b8 |
+ const char *file, int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
if (!conf->elist_devnode)
|
|
|
c4b4b8 |
conf->elist_devnode = vector_alloc();
|
|
|
c4b4b8 |
@@ -1527,7 +1548,8 @@ blacklist_exceptions_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_ble_handler(option) \
|
|
|
c4b4b8 |
static int \
|
|
|
c4b4b8 |
-ble_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
c4b4b8 |
+ble_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
c4b4b8 |
+ const char *file, int line_nr) \
|
|
|
c4b4b8 |
{ \
|
|
|
c4b4b8 |
char * buff; \
|
|
|
c4b4b8 |
\
|
|
|
c4b4b8 |
@@ -1543,7 +1565,8 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
#define declare_ble_device_handler(name, option, vend, prod) \
|
|
|
c4b4b8 |
static int \
|
|
|
c4b4b8 |
-ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \
|
|
|
c4b4b8 |
+ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec, \
|
|
|
c4b4b8 |
+ const char *file, int line_nr) \
|
|
|
c4b4b8 |
{ \
|
|
|
c4b4b8 |
char * buff; \
|
|
|
c4b4b8 |
\
|
|
|
c4b4b8 |
@@ -1583,13 +1606,15 @@ snprint_ble_simple (struct config *conf, char * buff, int len,
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-ble_device_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+ble_device_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
return alloc_ble_device(conf->blist_device);
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-ble_except_device_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+ble_except_device_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
return alloc_ble_device(conf->elist_device);
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
@@ -1623,7 +1648,8 @@ snprint_bled_product (struct config *conf, char * buff, int len,
|
|
|
c4b4b8 |
* devices block handlers
|
|
|
c4b4b8 |
*/
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-devices_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+devices_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
if (!conf->hwtable)
|
|
|
c4b4b8 |
conf->hwtable = vector_alloc();
|
|
|
c4b4b8 |
@@ -1635,7 +1661,8 @@ devices_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-device_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+device_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
struct hwentry * hwe;
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
@@ -1672,7 +1699,8 @@ declare_hw_snprint(hwhandler, print_str)
|
|
|
c4b4b8 |
* overrides handlers
|
|
|
c4b4b8 |
*/
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-overrides_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+overrides_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
if (!conf->overrides)
|
|
|
c4b4b8 |
conf->overrides = alloc_hwe();
|
|
|
c4b4b8 |
@@ -1689,7 +1717,8 @@ overrides_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
* multipaths block handlers
|
|
|
c4b4b8 |
*/
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-multipaths_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+multipaths_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
if (!conf->mptable)
|
|
|
c4b4b8 |
conf->mptable = vector_alloc();
|
|
|
c4b4b8 |
@@ -1701,7 +1730,8 @@ multipaths_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-multipath_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+multipath_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
struct mpentry * mpe;
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
@@ -1730,7 +1760,8 @@ declare_mp_snprint(alias, print_str)
|
|
|
c4b4b8 |
*/
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
static int
|
|
|
c4b4b8 |
-deprecated_handler(struct config *conf, vector strvec)
|
|
|
c4b4b8 |
+deprecated_handler(struct config *conf, vector strvec, const char *file,
|
|
|
c4b4b8 |
+ int line_nr)
|
|
|
c4b4b8 |
{
|
|
|
c4b4b8 |
char * buff;
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
|
|
|
c4b4b8 |
index 341f2b80..29e8cee0 100644
|
|
|
c4b4b8 |
--- a/libmultipath/parser.c
|
|
|
c4b4b8 |
+++ b/libmultipath/parser.c
|
|
|
c4b4b8 |
@@ -562,7 +562,8 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
|
|
|
c4b4b8 |
goto out;
|
|
|
c4b4b8 |
}
|
|
|
c4b4b8 |
if (keyword->handler) {
|
|
|
c4b4b8 |
- t = keyword->handler(conf, strvec);
|
|
|
c4b4b8 |
+ t = keyword->handler(conf, strvec, file,
|
|
|
c4b4b8 |
+ line_nr);
|
|
|
c4b4b8 |
r += t;
|
|
|
c4b4b8 |
if (t)
|
|
|
c4b4b8 |
condlog(1, "%s line %d, parsing failed: %s",
|
|
|
c4b4b8 |
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
|
|
|
c4b4b8 |
index e8d89607..8b424b7a 100644
|
|
|
c4b4b8 |
--- a/libmultipath/parser.h
|
|
|
c4b4b8 |
+++ b/libmultipath/parser.h
|
|
|
c4b4b8 |
@@ -42,7 +42,7 @@
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
/* keyword definition */
|
|
|
c4b4b8 |
typedef int print_fn(struct config *, char *, int, const void *);
|
|
|
c4b4b8 |
-typedef int handler_fn(struct config *, vector);
|
|
|
c4b4b8 |
+typedef int handler_fn(struct config *, vector, const char *file, int line_nr);
|
|
|
c4b4b8 |
|
|
|
c4b4b8 |
struct keyword {
|
|
|
c4b4b8 |
char *string;
|