device-mapper-multipath/0024-libmultipath-use-typedef-for-keyword-handler-functio.patch
Benjamin Marzinski b335d16aab device-mapper-multipath-0.8.7-3
Add 0024-libmultipath-use-typedef-for-keyword-handler-functio.patch
Add 0025-libmultipath-print-the-correct-file-when-parsing-fai.patch
Add 0026-libmultipath-pass-file-and-line-number-to-keyword-ha.patch
Add 0027-libmultipath-make-set_int-take-a-range-for-valid-val.patch
Add 0028-libmultipath-improve-checks-for-set_str.patch
Add 0029-libmultipath-deprecate-file-and-directory-config-opt.patch
Add 0030-libmultipath-split-set_int-to-enable-reuse.patch
Add 0031-libmultipath-cleanup-invalid-config-handling.patch
Add 0032-libmultipath-don-t-return-error-on-invalid-values.patch
  * The above 9 patches fix bz #2017969
Add 0033-multipathd-avoid-unnecessary-path-read-only-reloads.patch
  * Fixes bz #2017979
Add 0034-multipath-fix-exit-status-of-multipath-T.patch
Resolves: bz #2017969, #2017979
2021-11-19 12:35:32 -06:00

85 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 23 Sep 2021 21:39:36 -0500
Subject: [PATCH] libmultipath: use typedef for keyword handler function
Don't keep writing out the function type.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/parser.c | 6 +++---
libmultipath/parser.h | 15 ++++++---------
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
index 611054f7..ebe1cbd9 100644
--- a/libmultipath/parser.c
+++ b/libmultipath/parser.c
@@ -33,7 +33,7 @@ static int line_nr;
int
keyword_alloc(vector keywords, char *string,
- int (*handler) (struct config *, vector),
+ handler_fn *handler,
print_fn *print,
int unique)
{
@@ -72,7 +72,7 @@ install_sublevel_end(void)
int
_install_keyword(vector keywords, char *string,
- int (*handler) (struct config *, vector),
+ handler_fn *handler,
print_fn *print,
int unique)
{
@@ -558,7 +558,7 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
goto out;
}
if (keyword->handler) {
- t = (*keyword->handler) (conf, strvec);
+ t = keyword->handler(conf, strvec);
r += t;
if (t)
condlog(1, "multipath.conf +%d, parsing failed: %s",
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
index b43d46f8..3452bde1 100644
--- a/libmultipath/parser.h
+++ b/libmultipath/parser.h
@@ -43,10 +43,11 @@ struct strbuf;
/* keyword definition */
typedef int print_fn(struct config *, struct strbuf *, const void *);
+typedef int handler_fn(struct config *, vector);
struct keyword {
char *string;
- int (*handler) (struct config *, vector);
+ handler_fn *handler;
print_fn *print;
vector sub;
int unique;
@@ -62,18 +63,14 @@ struct keyword {
for (i = 0; i < (k)->sub->allocated && ((p) = (k)->sub->slot[i]); i++)
/* Prototypes */
-extern int keyword_alloc(vector keywords, char *string,
- int (*handler) (struct config *, vector),
- print_fn *print,
- int unique);
+extern int keyword_alloc(vector keywords, char *string, handler_fn *handler,
+ print_fn *print, int unique);
#define install_keyword_root(str, h) keyword_alloc(keywords, str, h, NULL, 1)
extern void install_sublevel(void);
extern void install_sublevel_end(void);
-extern int _install_keyword(vector keywords, char *string,
- int (*handler) (struct config *, vector),
- print_fn *print,
- int unique);
+extern int _install_keyword(vector keywords, char *string, handler_fn *handler,
+ print_fn *print, int unique);
#define install_keyword(str, vec, pri) _install_keyword(keywords, str, vec, pri, 1)
#define install_keyword_multi(str, vec, pri) _install_keyword(keywords, str, vec, pri, 0)
extern void dump_keywords(vector keydump, int level);