From dcb0a4f3bbf2caf675c26245c8028dd5dae66074 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 6 Dec 2013 13:55:38 -0800 Subject: [PATCH] Monitor: add a separate leader_supported_commands This isn't used yet, but will be shortly. Signed-off-by: Greg Farnum --- src/mon/Monitor.cc | 14 ++++++++++++++ src/mon/Monitor.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 136c42672a16b..bb19bce6a41c4 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1880,6 +1880,8 @@ MonCommand mon_commands[] = { {parsesig, helptext, modulename, req_perms, avail}, #include }; +const MonCommand *leader_supported_mon_commands = NULL; +int leader_supported_mon_commands_size = 0; bool Monitor::_allowed_command(MonSession *s, string &module, string &prefix, map& cmdmap) { @@ -1950,6 +1952,18 @@ void get_locally_supported_monitor_commands(const MonCommand **cmds, int *count) *cmds = mon_commands; *count = ARRAY_SIZE(mon_commands); } +void get_leader_supported_commands(const MonCommand **cmds, int *count) +{ + *cmds = leader_supported_mon_commands; + *count = leader_supported_mon_commands_size; +} +void set_leader_supported_commands(const MonCommand *cmds, int size) +{ + if (leader_supported_mon_commands != mon_commands) + delete[] leader_supported_mon_commands; + leader_supported_mon_commands = cmds; + leader_supported_mon_commands_size = size; +} void Monitor::handle_command(MMonCommand *m) { diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index cfb9f549c398e..bda625fb2215c 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -911,5 +911,9 @@ void get_command_descriptions(const MonCommand *commands, Formatter *f, bufferlist *rdata); void get_locally_supported_monitor_commands(const MonCommand **cmds, int *count); +void get_leader_supported_commands(const MonCommand **cmds, int *count); +/// the Monitor owns this pointer once you pass it in +void set_leader_supported_commands(const MonCommand *cmds, int size); + #endif -- 2.39.5