20 Star 0 Fork 40

openEuler-RISC-V/multipath-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0020-multipathd-make-all-cli_handlers-static.patch 28.14 KB
一键复制 编辑 原始数据 按行查看 历史
wguanghao 提交于 2022-10-31 07:01 . fix CVE-2022-41974
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
From f515b8e552412d01f3b01c5c7129452a82d8714d Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 7 Sep 2021 22:32:46 +0200
Subject: [PATCH] multipathd: make all cli_handlers static
The cli_handler functions are only called from the handler table and
need not be exported.
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/cli_handlers.c | 214 ++++++++++++++++++++++----------------
multipathd/cli_handlers.h | 61 ++---------
multipathd/main.c | 58 +----------
3 files changed, 134 insertions(+), 199 deletions(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index aeb2be5..f75e176 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -39,7 +39,7 @@
*(__len) = *(__rep) ? sizeof(string_literal) : 0; \
} while (0)
-int
+static int
show_paths (char ** r, int * len, struct vectors * vecs, char * style,
int pretty)
{
@@ -70,7 +70,7 @@ show_paths (char ** r, int * len, struct vectors * vecs, char * style,
return 0;
}
-int
+static int
show_path (char ** r, int * len, struct vectors * vecs, struct path *pp,
char * style)
{
@@ -85,7 +85,7 @@ show_path (char ** r, int * len, struct vectors * vecs, struct path *pp,
return 0;
}
-int
+static int
show_map_topology (char ** r, int * len, struct multipath * mpp,
struct vectors * vecs)
{
@@ -102,7 +102,7 @@ show_map_topology (char ** r, int * len, struct multipath * mpp,
return 0;
}
-int
+static int
show_maps_topology (char ** r, int * len, struct vectors * vecs)
{
STRBUF_ON_STACK(reply);
@@ -128,7 +128,7 @@ show_maps_topology (char ** r, int * len, struct vectors * vecs)
return 0;
}
-int
+static int
show_maps_json (char ** r, int * len, struct vectors * vecs)
{
STRBUF_ON_STACK(reply);
@@ -149,7 +149,7 @@ show_maps_json (char ** r, int * len, struct vectors * vecs)
return 0;
}
-int
+static int
show_map_json (char ** r, int * len, struct multipath * mpp,
struct vectors * vecs)
{
@@ -194,7 +194,7 @@ reset_stats(struct multipath * mpp)
mpp->stat_map_failures = 0;
}
-int
+static int
cli_list_config (void * v, char ** reply, int * len, void * data)
{
condlog(3, "list config (operator)");
@@ -207,7 +207,7 @@ static void v_free(void *x)
vector_free(x);
}
-int
+static int
cli_list_config_local (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -223,7 +223,7 @@ cli_list_config_local (void * v, char ** reply, int * len, void * data)
return ret;
}
-int
+static int
cli_list_paths (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -233,7 +233,7 @@ cli_list_paths (void * v, char ** reply, int * len, void * data)
return show_paths(reply, len, vecs, PRINT_PATH_CHECKER, 1);
}
-int
+static int
cli_list_paths_fmt (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -244,7 +244,7 @@ cli_list_paths_fmt (void * v, char ** reply, int * len, void * data)
return show_paths(reply, len, vecs, fmt, 1);
}
-int
+static int
cli_list_paths_raw (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -255,7 +255,7 @@ cli_list_paths_raw (void * v, char ** reply, int * len, void * data)
return show_paths(reply, len, vecs, fmt, 0);
}
-int
+static int
cli_list_path (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -272,7 +272,7 @@ cli_list_path (void * v, char ** reply, int * len, void * data)
return show_path(reply, len, vecs, pp, "%o");
}
-int
+static int
cli_list_map_topology (void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -291,7 +291,7 @@ cli_list_map_topology (void * v, char ** reply, int * len, void * data)
return show_map_topology(reply, len, mpp, vecs);
}
-int
+static int
cli_list_maps_topology (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -301,7 +301,7 @@ cli_list_maps_topology (void * v, char ** reply, int * len, void * data)
return show_maps_topology(reply, len, vecs);
}
-int
+static int
cli_list_map_json (void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -320,7 +320,7 @@ cli_list_map_json (void * v, char ** reply, int * len, void * data)
return show_map_json(reply, len, mpp, vecs);
}
-int
+static int
cli_list_maps_json (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -330,7 +330,7 @@ cli_list_maps_json (void * v, char ** reply, int * len, void * data)
return show_maps_json(reply, len, vecs);
}
-int
+static int
cli_list_wildcards (void * v, char ** reply, int * len, void * data)
{
STRBUF_ON_STACK(buf);
@@ -343,7 +343,7 @@ cli_list_wildcards (void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
show_status (char ** r, int *len, struct vectors * vecs)
{
STRBUF_ON_STACK(reply);
@@ -356,7 +356,7 @@ show_status (char ** r, int *len, struct vectors * vecs)
return 0;
}
-int
+static int
show_daemon (char ** r, int *len)
{
STRBUF_ON_STACK(reply);
@@ -370,7 +370,7 @@ show_daemon (char ** r, int *len)
return 0;
}
-int
+static int
show_map (char ** r, int *len, struct multipath * mpp, char * style,
int pretty)
{
@@ -384,7 +384,7 @@ show_map (char ** r, int *len, struct multipath * mpp, char * style,
return 0;
}
-int
+static int
show_maps (char ** r, int *len, struct vectors * vecs, char * style,
int pretty)
{
@@ -419,7 +419,7 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style,
return 0;
}
-int
+static int
cli_list_maps_fmt (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -430,7 +430,7 @@ cli_list_maps_fmt (void * v, char ** reply, int * len, void * data)
return show_maps(reply, len, vecs, fmt, 1);
}
-int
+static int
cli_list_maps_raw (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -441,7 +441,7 @@ cli_list_maps_raw (void * v, char ** reply, int * len, void * data)
return show_maps(reply, len, vecs, fmt, 0);
}
-int
+static int
cli_list_map_fmt (void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -461,27 +461,7 @@ cli_list_map_fmt (void * v, char ** reply, int * len, void * data)
return show_map(reply, len, mpp, fmt, 1);
}
-int
-cli_list_map_raw (void * v, char ** reply, int * len, void * data)
-{
- struct multipath * mpp;
- struct vectors * vecs = (struct vectors *)data;
- char * param = get_keyparam(v, MAP);
- char * fmt = get_keyparam(v, FMT);
-
- param = convert_dev(param, 0);
- get_path_layout(vecs->pathvec, 0);
- get_multipath_layout(vecs->mpvec, 1);
- mpp = find_mp_by_str(vecs->mpvec, param);
- if (!mpp)
- return 1;
-
- condlog(3, "list map %s fmt %s (operator)", param, fmt);
-
- return show_map(reply, len, mpp, fmt, 0);
-}
-
-int
+static int
cli_list_maps (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -491,7 +471,7 @@ cli_list_maps (void * v, char ** reply, int * len, void * data)
return show_maps(reply, len, vecs, PRINT_MAP_NAMES, 1);
}
-int
+static int
cli_list_status (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -501,7 +481,7 @@ cli_list_status (void * v, char ** reply, int * len, void * data)
return show_status(reply, len, vecs);
}
-int
+static int
cli_list_maps_status (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -511,7 +491,7 @@ cli_list_maps_status (void * v, char ** reply, int * len, void * data)
return show_maps(reply, len, vecs, PRINT_MAP_STATUS, 1);
}
-int
+static int
cli_list_maps_stats (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -521,7 +501,7 @@ cli_list_maps_stats (void * v, char ** reply, int * len, void * data)
return show_maps(reply, len, vecs, PRINT_MAP_STATS, 1);
}
-int
+static int
cli_list_daemon (void * v, char ** reply, int * len, void * data)
{
condlog(3, "list daemon (operator)");
@@ -529,7 +509,7 @@ cli_list_daemon (void * v, char ** reply, int * len, void * data)
return show_daemon(reply, len);
}
-int
+static int
cli_reset_maps_stats (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -544,7 +524,7 @@ cli_reset_maps_stats (void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_reset_map_stats (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -562,7 +542,7 @@ cli_reset_map_stats (void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_add_path (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -678,7 +658,7 @@ blacklisted:
return 0;
}
-int
+static int
cli_del_path (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -701,7 +681,7 @@ cli_del_path (void * v, char ** reply, int * len, void * data)
return (ret == REMOVE_PATH_FAILURE);
}
-int
+static int
cli_add_map (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -761,7 +741,7 @@ cli_add_map (void * v, char ** reply, int * len, void * data)
return rc;
}
-int
+static int
cli_del_map (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -787,7 +767,7 @@ cli_del_map (void * v, char ** reply, int * len, void * data)
return rc;
}
-int
+static int
cli_del_maps (void *v, char **reply, int *len, void *data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -806,7 +786,7 @@ cli_del_maps (void *v, char **reply, int *len, void *data)
return ret;
}
-int
+static int
cli_reload(void *v, char **reply, int *len, void *data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -834,7 +814,7 @@ cli_reload(void *v, char **reply, int *len, void *data)
return reload_and_sync_map(mpp, vecs, 0);
}
-int resize_map(struct multipath *mpp, unsigned long long size,
+static int resize_map(struct multipath *mpp, unsigned long long size,
struct vectors * vecs)
{
char *params __attribute__((cleanup(cleanup_charp))) = NULL;
@@ -859,7 +839,7 @@ int resize_map(struct multipath *mpp, unsigned long long size,
return 0;
}
-int
+static int
cli_resize(void *v, char **reply, int *len, void *data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -941,7 +921,7 @@ cli_resize(void *v, char **reply, int *len, void *data)
return 0;
}
-int
+static int
cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data)
{
struct config *conf;
@@ -954,7 +934,7 @@ cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data)
{
struct config *conf;
@@ -967,7 +947,7 @@ cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_restore_queueing(void *v, char **reply, int *len, void *data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1008,7 +988,7 @@ cli_restore_queueing(void *v, char **reply, int *len, void *data)
return 0;
}
-int
+static int
cli_restore_all_queueing(void *v, char **reply, int *len, void *data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1030,7 +1010,7 @@ cli_restore_all_queueing(void *v, char **reply, int *len, void *data)
return 0;
}
-int
+static int
cli_disable_queueing(void *v, char **reply, int *len, void *data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1059,7 +1039,7 @@ cli_disable_queueing(void *v, char **reply, int *len, void *data)
return 0;
}
-int
+static int
cli_disable_all_queueing(void *v, char **reply, int *len, void *data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1078,7 +1058,7 @@ cli_disable_all_queueing(void *v, char **reply, int *len, void *data)
return 0;
}
-int
+static int
cli_switch_group(void * v, char ** reply, int * len, void * data)
{
char * mapname = get_keyparam(v, MAP);
@@ -1090,7 +1070,7 @@ cli_switch_group(void * v, char ** reply, int * len, void * data)
return dm_switchgroup(mapname, groupnum);
}
-int
+static int
cli_reconfigure(void * v, char ** reply, int * len, void * data)
{
int rc;
@@ -1107,7 +1087,7 @@ cli_reconfigure(void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_suspend(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1137,7 +1117,7 @@ cli_suspend(void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_resume(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1169,7 +1149,7 @@ cli_resume(void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_reinstate(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1192,7 +1172,7 @@ cli_reinstate(void * v, char ** reply, int * len, void * data)
return dm_reinstate_path(pp->mpp->alias, pp->dev_t);
}
-int
+static int
cli_reassign (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1216,7 +1196,7 @@ cli_reassign (void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_fail(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1245,7 +1225,7 @@ cli_fail(void * v, char ** reply, int * len, void * data)
return r;
}
-int
+static int
show_blacklist (char ** r, int * len)
{
STRBUF_ON_STACK(reply);
@@ -1265,7 +1245,7 @@ show_blacklist (char ** r, int * len)
return 0;
}
-int
+static int
cli_list_blacklist (void * v, char ** reply, int * len, void * data)
{
condlog(3, "list blacklist (operator)");
@@ -1273,7 +1253,7 @@ cli_list_blacklist (void * v, char ** reply, int * len, void * data)
return show_blacklist(reply, len);
}
-int
+static int
show_devices (char ** r, int * len, struct vectors *vecs)
{
STRBUF_ON_STACK(reply);
@@ -1294,7 +1274,7 @@ show_devices (char ** r, int * len, struct vectors *vecs)
return 0;
}
-int
+static int
cli_list_devices (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
@@ -1304,13 +1284,13 @@ cli_list_devices (void * v, char ** reply, int * len, void * data)
return show_devices(reply, len, vecs);
}
-int
+static int
cli_quit (void * v, char ** reply, int * len, void * data)
{
return 0;
}
-int
+static int
cli_shutdown (void * v, char ** reply, int * len, void * data)
{
condlog(3, "shutdown (operator)");
@@ -1318,7 +1298,7 @@ cli_shutdown (void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_getprstatus (void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -1343,7 +1323,7 @@ cli_getprstatus (void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_setprstatus(void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -1366,7 +1346,7 @@ cli_setprstatus(void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_unsetprstatus(void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -1388,7 +1368,7 @@ cli_unsetprstatus(void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_getprkey(void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -1420,7 +1400,7 @@ cli_getprkey(void * v, char ** reply, int * len, void * data)
return 0;
}
-int
+static int
cli_unsetprkey(void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -1444,7 +1424,7 @@ cli_unsetprkey(void * v, char ** reply, int * len, void * data)
return ret;
}
-int
+static int
cli_setprkey(void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -1476,7 +1456,7 @@ cli_setprkey(void * v, char ** reply, int * len, void * data)
return ret;
}
-int cli_set_marginal(void * v, char ** reply, int * len, void * data)
+static int cli_set_marginal(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, PATH);
@@ -1503,7 +1483,7 @@ int cli_set_marginal(void * v, char ** reply, int * len, void * data)
return reload_and_sync_map(pp->mpp, vecs, 0);
}
-int cli_unset_marginal(void * v, char ** reply, int * len, void * data)
+static int cli_unset_marginal(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, PATH);
@@ -1530,7 +1510,7 @@ int cli_unset_marginal(void * v, char ** reply, int * len, void * data)
return reload_and_sync_map(pp->mpp, vecs, 0);
}
-int cli_unset_all_marginal(void * v, char ** reply, int * len, void * data)
+static int cli_unset_all_marginal(void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
char * mapname = get_keyparam(v, MAP);
@@ -1566,3 +1546,63 @@ int cli_unset_all_marginal(void * v, char ** reply, int * len, void * data)
return reload_and_sync_map(mpp, vecs, 0);
}
+
+void init_handler_callbacks(void)
+{
+ set_handler_callback(LIST+PATHS, cli_list_paths);
+ set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt);
+ set_handler_callback(LIST+PATHS+RAW+FMT, cli_list_paths_raw);
+ set_handler_callback(LIST+PATH, cli_list_path);
+ set_handler_callback(LIST+MAPS, cli_list_maps);
+ set_handler_callback(LIST+STATUS, cli_list_status);
+ set_unlocked_handler_callback(LIST+DAEMON, cli_list_daemon);
+ set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status);
+ set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats);
+ set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt);
+ set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw);
+ set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology);
+ set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology);
+ set_handler_callback(LIST+MAPS+JSON, cli_list_maps_json);
+ set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology);
+ set_handler_callback(LIST+MAP+FMT, cli_list_map_fmt);
+ set_handler_callback(LIST+MAP+RAW+FMT, cli_list_map_fmt);
+ set_handler_callback(LIST+MAP+JSON, cli_list_map_json);
+ set_handler_callback(LIST+CONFIG+LOCAL, cli_list_config_local);
+ set_handler_callback(LIST+CONFIG, cli_list_config);
+ set_handler_callback(LIST+BLACKLIST, cli_list_blacklist);
+ set_handler_callback(LIST+DEVICES, cli_list_devices);
+ set_handler_callback(LIST+WILDCARDS, cli_list_wildcards);
+ set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats);
+ set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats);
+ set_handler_callback(ADD+PATH, cli_add_path);
+ set_handler_callback(DEL+PATH, cli_del_path);
+ set_handler_callback(ADD+MAP, cli_add_map);
+ set_handler_callback(DEL+MAP, cli_del_map);
+ set_handler_callback(DEL+MAPS, cli_del_maps);
+ set_handler_callback(SWITCH+MAP+GROUP, cli_switch_group);
+ set_unlocked_handler_callback(RECONFIGURE, cli_reconfigure);
+ set_handler_callback(SUSPEND+MAP, cli_suspend);
+ set_handler_callback(RESUME+MAP, cli_resume);
+ set_handler_callback(RESIZE+MAP, cli_resize);
+ set_handler_callback(RELOAD+MAP, cli_reload);
+ set_handler_callback(RESET+MAP, cli_reassign);
+ set_handler_callback(REINSTATE+PATH, cli_reinstate);
+ set_handler_callback(FAIL+PATH, cli_fail);
+ set_handler_callback(DISABLEQ+MAP, cli_disable_queueing);
+ set_handler_callback(RESTOREQ+MAP, cli_restore_queueing);
+ set_handler_callback(DISABLEQ+MAPS, cli_disable_all_queueing);
+ set_handler_callback(RESTOREQ+MAPS, cli_restore_all_queueing);
+ set_unlocked_handler_callback(QUIT, cli_quit);
+ set_unlocked_handler_callback(SHUTDOWN, cli_shutdown);
+ set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus);
+ set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus);
+ set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus);
+ set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q);
+ set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q);
+ set_handler_callback(GETPRKEY+MAP, cli_getprkey);
+ set_handler_callback(SETPRKEY+MAP+KEY, cli_setprkey);
+ set_handler_callback(UNSETPRKEY+MAP, cli_unsetprkey);
+ set_handler_callback(SETMARGINAL+PATH, cli_set_marginal);
+ set_handler_callback(UNSETMARGINAL+PATH, cli_unset_marginal);
+ set_handler_callback(UNSETMARGINAL+MAP, cli_unset_all_marginal);
+}
diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h
index 6f57b42..7eaf847 100644
--- a/multipathd/cli_handlers.h
+++ b/multipathd/cli_handlers.h
@@ -1,55 +1,6 @@
-int cli_list_paths (void * v, char ** reply, int * len, void * data);
-int cli_list_paths_fmt (void * v, char ** reply, int * len, void * data);
-int cli_list_paths_raw (void * v, char ** reply, int * len, void * data);
-int cli_list_path (void * v, char ** reply, int * len, void * data);
-int cli_list_status (void * v, char ** reply, int * len, void * data);
-int cli_list_daemon (void * v, char ** reply, int * len, void * data);
-int cli_list_maps (void * v, char ** reply, int * len, void * data);
-int cli_list_maps_fmt (void * v, char ** reply, int * len, void * data);
-int cli_list_maps_raw (void * v, char ** reply, int * len, void * data);
-int cli_list_map_fmt (void * v, char ** reply, int * len, void * data);
-int cli_list_map_raw (void * v, char ** reply, int * len, void * data);
-int cli_list_maps_status (void * v, char ** reply, int * len, void * data);
-int cli_list_maps_stats (void * v, char ** reply, int * len, void * data);
-int cli_list_map_topology (void * v, char ** reply, int * len, void * data);
-int cli_list_maps_topology (void * v, char ** reply, int * len, void * data);
-int cli_list_map_json (void * v, char ** reply, int * len, void * data);
-int cli_list_maps_json (void * v, char ** reply, int * len, void * data);
-int cli_list_config (void * v, char ** reply, int * len, void * data);
-int cli_list_config_local (void * v, char ** reply, int * len, void * data);
-int cli_list_blacklist (void * v, char ** reply, int * len, void * data);
-int cli_list_devices (void * v, char ** reply, int * len, void * data);
-int cli_list_wildcards (void * v, char ** reply, int * len, void * data);
-int cli_reset_maps_stats (void * v, char ** reply, int * len, void * data);
-int cli_reset_map_stats (void * v, char ** reply, int * len, void * data);
-int cli_add_path (void * v, char ** reply, int * len, void * data);
-int cli_del_path (void * v, char ** reply, int * len, void * data);
-int cli_add_map (void * v, char ** reply, int * len, void * data);
-int cli_del_map (void * v, char ** reply, int * len, void * data);
-int cli_del_maps (void * v, char ** reply, int * len, void * data);
-int cli_switch_group(void * v, char ** reply, int * len, void * data);
-int cli_reconfigure(void * v, char ** reply, int * len, void * data);
-int cli_resize(void * v, char ** reply, int * len, void * data);
-int cli_reload(void * v, char ** reply, int * len, void * data);
-int cli_disable_queueing(void * v, char ** reply, int * len, void * data);
-int cli_disable_all_queueing(void * v, char ** reply, int * len, void * data);
-int cli_restore_queueing(void * v, char ** reply, int * len, void * data);
-int cli_restore_all_queueing(void * v, char ** reply, int * len, void * data);
-int cli_suspend(void * v, char ** reply, int * len, void * data);
-int cli_resume(void * v, char ** reply, int * len, void * data);
-int cli_reinstate(void * v, char ** reply, int * len, void * data);
-int cli_fail(void * v, char ** reply, int * len, void * data);
-int cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data);
-int cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data);
-int cli_quit(void * v, char ** reply, int * len, void * data);
-int cli_shutdown(void * v, char ** reply, int * len, void * data);
-int cli_reassign (void * v, char ** reply, int * len, void * data);
-int cli_getprstatus(void * v, char ** reply, int * len, void * data);
-int cli_setprstatus(void * v, char ** reply, int * len, void * data);
-int cli_unsetprstatus(void * v, char ** reply, int * len, void * data);
-int cli_getprkey(void * v, char ** reply, int * len, void * data);
-int cli_setprkey(void * v, char ** reply, int * len, void * data);
-int cli_unsetprkey(void * v, char ** reply, int * len, void * data);
-int cli_set_marginal(void * v, char ** reply, int * len, void * data);
-int cli_unset_marginal(void * v, char ** reply, int * len, void * data);
-int cli_unset_all_marginal(void * v, char ** reply, int * len, void * data);
+#ifndef _CLI_HANDLERS_H
+#define _CLI_HANDLERS_H
+
+void init_handler_callbacks(void);
+
+#endif
diff --git a/multipathd/main.c b/multipathd/main.c
index 118dadd..08fb992 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1669,63 +1669,7 @@ uxlsnrloop (void * ap)
/* Tell main thread that thread has started */
post_config_state(DAEMON_CONFIGURE);
- set_handler_callback(LIST+PATHS, cli_list_paths);
- set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt);
- set_handler_callback(LIST+PATHS+RAW+FMT, cli_list_paths_raw);
- set_handler_callback(LIST+PATH, cli_list_path);
- set_handler_callback(LIST+MAPS, cli_list_maps);
- set_handler_callback(LIST+STATUS, cli_list_status);
- set_unlocked_handler_callback(LIST+DAEMON, cli_list_daemon);
- set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status);
- set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats);
- set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt);
- set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw);
- set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology);
- set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology);
- set_handler_callback(LIST+MAPS+JSON, cli_list_maps_json);
- set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology);
- set_handler_callback(LIST+MAP+FMT, cli_list_map_fmt);
- set_handler_callback(LIST+MAP+RAW+FMT, cli_list_map_fmt);
- set_handler_callback(LIST+MAP+JSON, cli_list_map_json);
- set_handler_callback(LIST+CONFIG+LOCAL, cli_list_config_local);
- set_handler_callback(LIST+CONFIG, cli_list_config);
- set_handler_callback(LIST+BLACKLIST, cli_list_blacklist);
- set_handler_callback(LIST+DEVICES, cli_list_devices);
- set_handler_callback(LIST+WILDCARDS, cli_list_wildcards);
- set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats);
- set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats);
- set_handler_callback(ADD+PATH, cli_add_path);
- set_handler_callback(DEL+PATH, cli_del_path);
- set_handler_callback(ADD+MAP, cli_add_map);
- set_handler_callback(DEL+MAP, cli_del_map);
- set_handler_callback(DEL+MAPS, cli_del_maps);
- set_handler_callback(SWITCH+MAP+GROUP, cli_switch_group);
- set_unlocked_handler_callback(RECONFIGURE, cli_reconfigure);
- set_handler_callback(SUSPEND+MAP, cli_suspend);
- set_handler_callback(RESUME+MAP, cli_resume);
- set_handler_callback(RESIZE+MAP, cli_resize);
- set_handler_callback(RELOAD+MAP, cli_reload);
- set_handler_callback(RESET+MAP, cli_reassign);
- set_handler_callback(REINSTATE+PATH, cli_reinstate);
- set_handler_callback(FAIL+PATH, cli_fail);
- set_handler_callback(DISABLEQ+MAP, cli_disable_queueing);
- set_handler_callback(RESTOREQ+MAP, cli_restore_queueing);
- set_handler_callback(DISABLEQ+MAPS, cli_disable_all_queueing);
- set_handler_callback(RESTOREQ+MAPS, cli_restore_all_queueing);
- set_unlocked_handler_callback(QUIT, cli_quit);
- set_unlocked_handler_callback(SHUTDOWN, cli_shutdown);
- set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus);
- set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus);
- set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus);
- set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q);
- set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q);
- set_handler_callback(GETPRKEY+MAP, cli_getprkey);
- set_handler_callback(SETPRKEY+MAP+KEY, cli_setprkey);
- set_handler_callback(UNSETPRKEY+MAP, cli_unsetprkey);
- set_handler_callback(SETMARGINAL+PATH, cli_set_marginal);
- set_handler_callback(UNSETMARGINAL+PATH, cli_unset_marginal);
- set_handler_callback(UNSETMARGINAL+MAP, cli_unset_all_marginal);
-
+ init_handler_callbacks();
umask(077);
uxsock_listen(&uxsock_trigger, ux_sock, ap);
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler-risc-v/multipath-tools.git
git@gitee.com:openeuler-risc-v/multipath-tools.git
openeuler-risc-v
multipath-tools
multipath-tools
master

搜索帮助