|
|
ebef98 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
ebef98 |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
ebef98 |
Date: Fri, 24 Sep 2021 17:59:12 -0500
|
|
|
ebef98 |
Subject: [PATCH] libmultipath: pass file and line number to keyword handlers
|
|
|
ebef98 |
|
|
|
ebef98 |
This will make it possible for the keyword handlers to print more useful
|
|
|
ebef98 |
warning messages. It will be used by future patches.
|
|
|
ebef98 |
|
|
|
ebef98 |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
ebef98 |
---
|
|
|
ebef98 |
libmultipath/dict.c | 143 +++++++++++++++++++++++++-----------------
|
|
|
ebef98 |
libmultipath/parser.c | 3 +-
|
|
|
ebef98 |
libmultipath/parser.h | 2 +-
|
|
|
ebef98 |
3 files changed, 90 insertions(+), 58 deletions(-)
|
|
|
ebef98 |
|
|
|
ebef98 |
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
|
|
|
ebef98 |
index 7a727389..eb2c44c0 100644
|
|
|
ebef98 |
--- a/libmultipath/dict.c
|
|
|
ebef98 |
+++ b/libmultipath/dict.c
|
|
|
ebef98 |
@@ -29,7 +29,7 @@
|
|
|
ebef98 |
#include "strbuf.h"
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_int(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_int(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
int *int_ptr = (int *)ptr;
|
|
|
ebef98 |
char *buff, *eptr;
|
|
|
ebef98 |
@@ -58,7 +58,7 @@ set_int(vector strvec, void *ptr)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_uint(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_uint(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
unsigned int *uint_ptr = (unsigned int *)ptr;
|
|
|
ebef98 |
char *buff, *eptr, *p;
|
|
|
ebef98 |
@@ -90,7 +90,7 @@ set_uint(vector strvec, void *ptr)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_str(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_str(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char **str_ptr = (char **)ptr;
|
|
|
ebef98 |
|
|
|
ebef98 |
@@ -105,7 +105,7 @@ set_str(vector strvec, void *ptr)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_yes_no(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_yes_no(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
int *int_ptr = (int *)ptr;
|
|
|
ebef98 |
@@ -124,7 +124,7 @@ set_yes_no(vector strvec, void *ptr)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_yes_no_undef(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_yes_no_undef(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
int *int_ptr = (int *)ptr;
|
|
|
ebef98 |
@@ -187,9 +187,10 @@ static int print_yes_no_undef(struct strbuf *buff, long v)
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_def_handler(option, function) \
|
|
|
ebef98 |
static int \
|
|
|
ebef98 |
-def_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
ebef98 |
+def_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
ebef98 |
+ const char *file, int line_nr) \
|
|
|
ebef98 |
{ \
|
|
|
ebef98 |
- return function (strvec, &conf->option); \
|
|
|
ebef98 |
+ return function (strvec, &conf->option, file, line_nr); \
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_def_snprint(option, function) \
|
|
|
ebef98 |
@@ -224,12 +225,13 @@ snprint_def_ ## option (struct config *conf, struct strbuf *buff, \
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_hw_handler(option, function) \
|
|
|
ebef98 |
static int \
|
|
|
ebef98 |
-hw_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
ebef98 |
+hw_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
ebef98 |
+ const char *file, int line_nr) \
|
|
|
ebef98 |
{ \
|
|
|
ebef98 |
struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); \
|
|
|
ebef98 |
if (!hwe) \
|
|
|
ebef98 |
return 1; \
|
|
|
ebef98 |
- return function (strvec, &hwe->option); \
|
|
|
ebef98 |
+ return function (strvec, &hwe->option, file, line_nr); \
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_hw_snprint(option, function) \
|
|
|
ebef98 |
@@ -243,11 +245,12 @@ snprint_hw_ ## option (struct config *conf, struct strbuf *buff, \
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_ovr_handler(option, function) \
|
|
|
ebef98 |
static int \
|
|
|
ebef98 |
-ovr_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
ebef98 |
+ovr_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
ebef98 |
+ const char *file, int line_nr) \
|
|
|
ebef98 |
{ \
|
|
|
ebef98 |
if (!conf->overrides) \
|
|
|
ebef98 |
return 1; \
|
|
|
ebef98 |
- return function (strvec, &conf->overrides->option); \
|
|
|
ebef98 |
+ return function (strvec, &conf->overrides->option, file, line_nr); \
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_ovr_snprint(option, function) \
|
|
|
ebef98 |
@@ -260,12 +263,13 @@ snprint_ovr_ ## option (struct config *conf, struct strbuf *buff, \
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_mp_handler(option, function) \
|
|
|
ebef98 |
static int \
|
|
|
ebef98 |
-mp_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
ebef98 |
+mp_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
ebef98 |
+ const char *file, int line_nr) \
|
|
|
ebef98 |
{ \
|
|
|
ebef98 |
struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable); \
|
|
|
ebef98 |
if (!mpe) \
|
|
|
ebef98 |
return 1; \
|
|
|
ebef98 |
- return function (strvec, &mpe->option); \
|
|
|
ebef98 |
+ return function (strvec, &mpe->option, file, line_nr); \
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_mp_snprint(option, function) \
|
|
|
ebef98 |
@@ -277,9 +281,10 @@ snprint_mp_ ## option (struct config *conf, struct strbuf *buff, \
|
|
|
ebef98 |
return function(buff, mpe->option); \
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
-static int checkint_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+static int checkint_handler(struct config *conf, vector strvec,
|
|
|
ebef98 |
+ const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
- int rc = set_uint(strvec, &conf->checkint);
|
|
|
ebef98 |
+ int rc = set_uint(strvec, &conf->checkint, file, line_nr);
|
|
|
ebef98 |
|
|
|
ebef98 |
if (rc)
|
|
|
ebef98 |
return rc;
|
|
|
ebef98 |
@@ -302,9 +307,10 @@ declare_def_snprint(reassign_maps, print_yes_no)
|
|
|
ebef98 |
declare_def_handler(multipath_dir, set_str)
|
|
|
ebef98 |
declare_def_snprint(multipath_dir, print_str)
|
|
|
ebef98 |
|
|
|
ebef98 |
-static int def_partition_delim_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+static int def_partition_delim_handler(struct config *conf, vector strvec,
|
|
|
ebef98 |
+ const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
- int rc = set_str(strvec, &conf->partition_delim);
|
|
|
ebef98 |
+ int rc = set_str(strvec, &conf->partition_delim, file, line_nr);
|
|
|
ebef98 |
|
|
|
ebef98 |
if (rc != 0)
|
|
|
ebef98 |
return rc;
|
|
|
ebef98 |
@@ -334,13 +340,13 @@ static const char * const find_multipaths_optvals[] = {
|
|
|
ebef98 |
};
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-def_find_multipaths_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+def_find_multipaths_handler(struct config *conf, vector strvec,
|
|
|
ebef98 |
+ const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char *buff;
|
|
|
ebef98 |
int i;
|
|
|
ebef98 |
|
|
|
ebef98 |
- if (set_yes_no_undef(strvec, &conf->find_multipaths) == 0 &&
|
|
|
ebef98 |
- conf->find_multipaths != FIND_MULTIPATHS_UNDEF)
|
|
|
ebef98 |
+ if (set_yes_no_undef(strvec, &conf->find_multipaths, file, line_nr) == 0 && conf->find_multipaths != FIND_MULTIPATHS_UNDEF)
|
|
|
ebef98 |
return 0;
|
|
|
ebef98 |
|
|
|
ebef98 |
buff = set_value(strvec);
|
|
|
ebef98 |
@@ -396,7 +402,8 @@ static int snprint_uid_attrs(struct config *conf, struct strbuf *buff,
|
|
|
ebef98 |
return total;
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
-static int uid_attrs_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+static int uid_attrs_handler(struct config *conf, vector strvec,
|
|
|
ebef98 |
+ const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char *val;
|
|
|
ebef98 |
|
|
|
ebef98 |
@@ -597,7 +604,8 @@ declare_hw_handler(skip_kpartx, set_yes_no_undef)
|
|
|
ebef98 |
declare_hw_snprint(skip_kpartx, print_yes_no_undef)
|
|
|
ebef98 |
declare_mp_handler(skip_kpartx, set_yes_no_undef)
|
|
|
ebef98 |
declare_mp_snprint(skip_kpartx, print_yes_no_undef)
|
|
|
ebef98 |
-static int def_disable_changed_wwids_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+static int def_disable_changed_wwids_handler(struct config *conf, vector strvec,
|
|
|
ebef98 |
+ const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
return 0;
|
|
|
ebef98 |
}
|
|
|
ebef98 |
@@ -629,20 +637,23 @@ declare_def_snprint_defstr(enable_foreign, print_str,
|
|
|
ebef98 |
DEFAULT_ENABLE_FOREIGN)
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-def_config_dir_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+def_config_dir_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
/* this is only valid in the main config file */
|
|
|
ebef98 |
if (conf->processed_main_config)
|
|
|
ebef98 |
return 0;
|
|
|
ebef98 |
- return set_str(strvec, &conf->config_dir);
|
|
|
ebef98 |
+ return set_str(strvec, &conf->config_dir, file, line_nr);
|
|
|
ebef98 |
}
|
|
|
ebef98 |
declare_def_snprint(config_dir, print_str)
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_def_attr_handler(option, function) \
|
|
|
ebef98 |
static int \
|
|
|
ebef98 |
-def_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
ebef98 |
+def_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
ebef98 |
+ const char *file, int line_nr) \
|
|
|
ebef98 |
{ \
|
|
|
ebef98 |
- return function (strvec, &conf->option, &conf->attribute_flags);\
|
|
|
ebef98 |
+ return function (strvec, &conf->option, &conf->attribute_flags, \
|
|
|
ebef98 |
+ file, line_nr); \
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_def_attr_snprint(option, function) \
|
|
|
ebef98 |
@@ -655,12 +666,14 @@ snprint_def_ ## option (struct config *conf, struct strbuf *buff, \
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_mp_attr_handler(option, function) \
|
|
|
ebef98 |
static int \
|
|
|
ebef98 |
-mp_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
ebef98 |
+mp_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
ebef98 |
+ const char *file, int line_nr) \
|
|
|
ebef98 |
{ \
|
|
|
ebef98 |
struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable); \
|
|
|
ebef98 |
if (!mpe) \
|
|
|
ebef98 |
return 1; \
|
|
|
ebef98 |
- return function (strvec, &mpe->option, &mpe->attribute_flags); \
|
|
|
ebef98 |
+ return function (strvec, &mpe->option, &mpe->attribute_flags, \
|
|
|
ebef98 |
+ file, line_nr); \
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_mp_attr_snprint(option, function) \
|
|
|
ebef98 |
@@ -673,7 +686,7 @@ snprint_mp_ ## option (struct config *conf, struct strbuf *buff, \
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_mode(vector strvec, void *ptr, int *flags)
|
|
|
ebef98 |
+set_mode(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
mode_t mode;
|
|
|
ebef98 |
mode_t *mode_ptr = (mode_t *)ptr;
|
|
|
ebef98 |
@@ -694,7 +707,7 @@ set_mode(vector strvec, void *ptr, int *flags)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_uid(vector strvec, void *ptr, int *flags)
|
|
|
ebef98 |
+set_uid(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
uid_t uid;
|
|
|
ebef98 |
uid_t *uid_ptr = (uid_t *)ptr;
|
|
|
ebef98 |
@@ -719,7 +732,7 @@ set_uid(vector strvec, void *ptr, int *flags)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_gid(vector strvec, void *ptr, int *flags)
|
|
|
ebef98 |
+set_gid(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
gid_t gid;
|
|
|
ebef98 |
gid_t *gid_ptr = (gid_t *)ptr;
|
|
|
ebef98 |
@@ -786,7 +799,7 @@ declare_mp_attr_handler(gid, set_gid)
|
|
|
ebef98 |
declare_mp_attr_snprint(gid, print_gid)
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_undef_off_zero(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_undef_off_zero(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
int *int_ptr = (int *)ptr;
|
|
|
ebef98 |
@@ -827,7 +840,7 @@ declare_hw_handler(fast_io_fail, set_undef_off_zero)
|
|
|
ebef98 |
declare_hw_snprint(fast_io_fail, print_undef_off_zero)
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_dev_loss(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_dev_loss(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
unsigned int *uint_ptr = (unsigned int *)ptr;
|
|
|
ebef98 |
@@ -870,7 +883,7 @@ declare_hw_handler(eh_deadline, set_undef_off_zero)
|
|
|
ebef98 |
declare_hw_snprint(eh_deadline, print_undef_off_zero)
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_pgpolicy(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_pgpolicy(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
int *int_ptr = (int *)ptr;
|
|
|
ebef98 |
@@ -936,7 +949,8 @@ get_sys_max_fds(int *max_fds)
|
|
|
ebef98 |
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-max_fds_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+max_fds_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
int r = 0, max_fds;
|
|
|
ebef98 |
@@ -981,7 +995,7 @@ snprint_max_fds (struct config *conf, struct strbuf *buff, const void *data)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_rr_weight(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_rr_weight(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
int *int_ptr = (int *)ptr;
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
@@ -1025,7 +1039,7 @@ declare_mp_handler(rr_weight, set_rr_weight)
|
|
|
ebef98 |
declare_mp_snprint(rr_weight, print_rr_weight)
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_pgfailback(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_pgfailback(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
int *int_ptr = (int *)ptr;
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
@@ -1075,7 +1089,7 @@ declare_mp_handler(pgfailback, set_pgfailback)
|
|
|
ebef98 |
declare_mp_snprint(pgfailback, print_pgfailback)
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-no_path_retry_helper(vector strvec, void *ptr)
|
|
|
ebef98 |
+no_path_retry_helper(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
int *int_ptr = (int *)ptr;
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
@@ -1120,7 +1134,8 @@ declare_mp_handler(no_path_retry, no_path_retry_helper)
|
|
|
ebef98 |
declare_mp_snprint(no_path_retry, print_no_path_retry)
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-def_log_checker_err_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+def_log_checker_err_handler(struct config *conf, vector strvec,
|
|
|
ebef98 |
+ const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
|
|
|
ebef98 |
@@ -1193,7 +1208,8 @@ print_reservation_key(struct strbuf *buff,
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-def_reservation_key_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+def_reservation_key_handler(struct config *conf, vector strvec,
|
|
|
ebef98 |
+ const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
return set_reservation_key(strvec, &conf->reservation_key,
|
|
|
ebef98 |
&conf->sa_flags,
|
|
|
ebef98 |
@@ -1209,7 +1225,8 @@ snprint_def_reservation_key (struct config *conf, struct strbuf *buff,
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-mp_reservation_key_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+mp_reservation_key_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable);
|
|
|
ebef98 |
if (!mpe)
|
|
|
ebef98 |
@@ -1229,7 +1246,7 @@ snprint_mp_reservation_key (struct config *conf, struct strbuf *buff,
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-set_off_int_undef(vector strvec, void *ptr)
|
|
|
ebef98 |
+set_off_int_undef(vector strvec, void *ptr, const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
int *int_ptr = (int *)ptr;
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
@@ -1370,7 +1387,8 @@ declare_hw_snprint(recheck_wwid, print_yes_no_undef)
|
|
|
ebef98 |
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-def_uxsock_timeout_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+def_uxsock_timeout_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
unsigned int uxsock_timeout;
|
|
|
ebef98 |
char *buff;
|
|
|
ebef98 |
@@ -1390,7 +1408,8 @@ def_uxsock_timeout_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-hw_vpd_vendor_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+hw_vpd_vendor_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
int i;
|
|
|
ebef98 |
char *buff;
|
|
|
ebef98 |
@@ -1430,7 +1449,8 @@ snprint_hw_vpd_vendor(struct config *conf, struct strbuf *buff,
|
|
|
ebef98 |
* blacklist block handlers
|
|
|
ebef98 |
*/
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-blacklist_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+blacklist_handler(struct config *conf, vector strvec, const char*file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
if (!conf->blist_devnode)
|
|
|
ebef98 |
conf->blist_devnode = vector_alloc();
|
|
|
ebef98 |
@@ -1452,7 +1472,8 @@ blacklist_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-blacklist_exceptions_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+blacklist_exceptions_handler(struct config *conf, vector strvec,
|
|
|
ebef98 |
+ const char *file, int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
if (!conf->elist_devnode)
|
|
|
ebef98 |
conf->elist_devnode = vector_alloc();
|
|
|
ebef98 |
@@ -1475,7 +1496,8 @@ blacklist_exceptions_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_ble_handler(option) \
|
|
|
ebef98 |
static int \
|
|
|
ebef98 |
-ble_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
ebef98 |
+ble_ ## option ## _handler (struct config *conf, vector strvec, \
|
|
|
ebef98 |
+ const char *file, int line_nr) \
|
|
|
ebef98 |
{ \
|
|
|
ebef98 |
char *buff; \
|
|
|
ebef98 |
int rc; \
|
|
|
ebef98 |
@@ -1494,7 +1516,8 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
|
|
|
ebef98 |
|
|
|
ebef98 |
#define declare_ble_device_handler(name, option, vend, prod) \
|
|
|
ebef98 |
static int \
|
|
|
ebef98 |
-ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \
|
|
|
ebef98 |
+ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec, \
|
|
|
ebef98 |
+ const char *file, int line_nr) \
|
|
|
ebef98 |
{ \
|
|
|
ebef98 |
char * buff; \
|
|
|
ebef98 |
int rc; \
|
|
|
ebef98 |
@@ -1536,13 +1559,15 @@ snprint_ble_simple (struct config *conf, struct strbuf *buff, const void *data)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-ble_device_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+ble_device_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
return alloc_ble_device(conf->blist_device);
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-ble_except_device_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+ble_except_device_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
return alloc_ble_device(conf->elist_device);
|
|
|
ebef98 |
}
|
|
|
ebef98 |
@@ -1574,7 +1599,8 @@ static int snprint_bled_product(struct config *conf, struct strbuf *buff,
|
|
|
ebef98 |
* devices block handlers
|
|
|
ebef98 |
*/
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-devices_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+devices_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
if (!conf->hwtable)
|
|
|
ebef98 |
conf->hwtable = vector_alloc();
|
|
|
ebef98 |
@@ -1586,7 +1612,8 @@ devices_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-device_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+device_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
struct hwentry * hwe;
|
|
|
ebef98 |
|
|
|
ebef98 |
@@ -1623,7 +1650,8 @@ declare_hw_snprint(hwhandler, print_str)
|
|
|
ebef98 |
* overrides handlers
|
|
|
ebef98 |
*/
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-overrides_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+overrides_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
if (!conf->overrides)
|
|
|
ebef98 |
conf->overrides = alloc_hwe();
|
|
|
ebef98 |
@@ -1640,7 +1668,8 @@ overrides_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
* multipaths block handlers
|
|
|
ebef98 |
*/
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-multipaths_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+multipaths_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
if (!conf->mptable)
|
|
|
ebef98 |
conf->mptable = vector_alloc();
|
|
|
ebef98 |
@@ -1652,7 +1681,8 @@ multipaths_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
}
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-multipath_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+multipath_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
struct mpentry * mpe;
|
|
|
ebef98 |
|
|
|
ebef98 |
@@ -1681,7 +1711,8 @@ declare_mp_snprint(alias, print_str)
|
|
|
ebef98 |
*/
|
|
|
ebef98 |
|
|
|
ebef98 |
static int
|
|
|
ebef98 |
-deprecated_handler(struct config *conf, vector strvec)
|
|
|
ebef98 |
+deprecated_handler(struct config *conf, vector strvec, const char *file,
|
|
|
ebef98 |
+ int line_nr)
|
|
|
ebef98 |
{
|
|
|
ebef98 |
char * buff;
|
|
|
ebef98 |
|
|
|
ebef98 |
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
|
|
|
ebef98 |
index d5595fb0..68262d0e 100644
|
|
|
ebef98 |
--- a/libmultipath/parser.c
|
|
|
ebef98 |
+++ b/libmultipath/parser.c
|
|
|
ebef98 |
@@ -558,7 +558,8 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
|
|
|
ebef98 |
goto out;
|
|
|
ebef98 |
}
|
|
|
ebef98 |
if (keyword->handler) {
|
|
|
ebef98 |
- t = keyword->handler(conf, strvec);
|
|
|
ebef98 |
+ t = keyword->handler(conf, strvec, file,
|
|
|
ebef98 |
+ line_nr);
|
|
|
ebef98 |
r += t;
|
|
|
ebef98 |
if (t)
|
|
|
ebef98 |
condlog(1, "%s line %d, parsing failed: %s",
|
|
|
ebef98 |
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
|
|
|
ebef98 |
index 3452bde1..11ea2278 100644
|
|
|
ebef98 |
--- a/libmultipath/parser.h
|
|
|
ebef98 |
+++ b/libmultipath/parser.h
|
|
|
ebef98 |
@@ -43,7 +43,7 @@ struct strbuf;
|
|
|
ebef98 |
|
|
|
ebef98 |
/* keyword definition */
|
|
|
ebef98 |
typedef int print_fn(struct config *, struct strbuf *, const void *);
|
|
|
ebef98 |
-typedef int handler_fn(struct config *, vector);
|
|
|
ebef98 |
+typedef int handler_fn(struct config *, vector, const char *file, int line_nr);
|
|
|
ebef98 |
|
|
|
ebef98 |
struct keyword {
|
|
|
ebef98 |
char *string;
|