]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-common: Remove old runstate/string translation functions
authorMartin Schwenke <mschwenke@ddn.com>
Sat, 10 Feb 2024 04:41:38 +0000 (15:41 +1100)
committerVolker Lendecke <vl@samba.org>
Wed, 6 Mar 2024 06:05:38 +0000 (06:05 +0000)
The canonical versions are in protocol utils.

These were unused apart from some stray forward declarations in
tools/ctdb.c and a single call in ctdb_set_runstate(), where
ctdb_runstate_to_string() can be used instead.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
ctdb/common/common.h
ctdb/common/ctdb_util.c
ctdb/tools/ctdb.c

index 9a73bec1ac6c924a82c4dc3e475a566ba5ae47b2..4f48e8926da375cffd6f97939dd2159ed7ec15c1 100644 (file)
@@ -149,10 +149,6 @@ struct ctdb_node_map_old *ctdb_node_list_to_map(struct ctdb_node **nodes,
                                                uint32_t num_nodes,
                                                TALLOC_CTX *mem_ctx);
 
-const char *runstate_to_string(enum ctdb_runstate runstate);
-
-enum ctdb_runstate runstate_from_string(const char *label);
-
 void ctdb_set_runstate(struct ctdb_context *ctdb, enum ctdb_runstate runstate);
 
 uint32_t *ctdb_key_to_idkey(TALLOC_CTX *mem_ctx, TDB_DATA key);
index 5daa69d375b8094265df50ae06bf95213d72c18e..3ca1f772ebac507cadf82cfdd10d6cab83ee4439 100644 (file)
@@ -595,48 +595,10 @@ ctdb_node_list_to_map(struct ctdb_node **nodes, uint32_t num_nodes,
 }
 
 /* Runstate handling */
-static struct {
-       enum ctdb_runstate runstate;
-       const char * label;
-} runstate_map[] = {
-       { CTDB_RUNSTATE_UNKNOWN, "UNKNOWN" },
-       { CTDB_RUNSTATE_INIT, "INIT" },
-       { CTDB_RUNSTATE_SETUP, "SETUP" },
-       { CTDB_RUNSTATE_FIRST_RECOVERY, "FIRST_RECOVERY" },
-       { CTDB_RUNSTATE_STARTUP, "STARTUP" },
-       { CTDB_RUNSTATE_RUNNING, "RUNNING" },
-       { CTDB_RUNSTATE_SHUTDOWN, "SHUTDOWN" },
-       { -1, NULL },
-};
-
-const char *runstate_to_string(enum ctdb_runstate runstate)
-{
-       int i;
-       for (i=0; runstate_map[i].label != NULL ; i++) {
-               if (runstate_map[i].runstate == runstate) {
-                       return runstate_map[i].label;
-               }
-       }
-
-       return runstate_map[0].label;
-}
-
-enum ctdb_runstate runstate_from_string(const char *label)
-{
-       int i;
-       for (i=0; runstate_map[i].label != NULL; i++) {
-               if (strcasecmp(runstate_map[i].label, label) == 0) {
-                       return runstate_map[i].runstate;
-               }
-       }
-
-       return CTDB_RUNSTATE_UNKNOWN;
-}
-
 void ctdb_set_runstate(struct ctdb_context *ctdb, enum ctdb_runstate runstate)
 {
        DEBUG(DEBUG_NOTICE,("Set runstate to %s (%d)\n",
-                           runstate_to_string(runstate), runstate));
+                           ctdb_runstate_to_string(runstate), runstate));
 
        if (runstate <= ctdb->runstate) {
                ctdb_fatal(ctdb, "runstate must always increase");
index 6e8185ff4951789896bf825f8d058158cd539a59..3c4bb7ef45d090f6989cc32b9ee30773bf99be79 100644 (file)
@@ -1121,9 +1121,6 @@ static int control_ping(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
        return 0;
 }
 
-const char *runstate_to_string(enum ctdb_runstate runstate);
-enum ctdb_runstate runstate_from_string(const char *runstate_str);
-
 static int control_runstate(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
                            int argc, const char **argv)
 {