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