ctdb: Remove an unnecessary cast
[vlendec/samba-autobuild/.git] / ctdb / event / event_protocol_util.c
1 /*
2    CTDB event daemon - protocol utilities
3
4    Copyright (C) Amitay Isaacs  2018
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "replace.h"
21
22 #include "event/event_protocol.h"
23 #include "event/event_protocol_api.h"
24
25 static struct {
26         enum ctdb_event_command command;
27         const char *label;
28 } event_command_map[] = {
29         { CTDB_EVENT_CMD_RUN, "RUN" },
30         { CTDB_EVENT_CMD_STATUS, "STATUS" },
31         { CTDB_EVENT_CMD_SCRIPT, "SCRIPT" },
32         { CTDB_EVENT_CMD_MAX, NULL },
33 };
34
35 const char *ctdb_event_command_to_string(enum ctdb_event_command command)
36 {
37         int i;
38
39         for (i=0; event_command_map[i].label != NULL; i++) {
40                 if (event_command_map[i].command == command) {
41                         return event_command_map[i].label;
42                 }
43         }
44
45         return "UNKNOWN";
46 }