From: Amitay Isaacs Date: Thu, 12 Sep 2013 06:36:09 +0000 (+1000) Subject: ctdbd: Create a utility function to log error for "not implemented" controls X-Git-Tag: ctdb-2.5~79 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=3c892ea1b5aa42686adb82ce29b9fcfdf9d204a1;p=ctdb.git ctdbd: Create a utility function to log error for "not implemented" controls Signed-off-by: Amitay Isaacs --- diff --git a/server/ctdb_control.c b/server/ctdb_control.c index cd96e822..4885e5f7 100644 --- a/server/ctdb_control.c +++ b/server/ctdb_control.c @@ -65,6 +65,20 @@ int32_t ctdb_dump_memory(struct ctdb_context *ctdb, TDB_DATA *outdata) return 0; } +static int32_t control_not_implemented(const char *unsupported, + const char *alternate) +{ + if (alternate == NULL) { + DEBUG(DEBUG_ERR, + ("Control %s is not implemented any more\n", + unsupported)); + } else { + DEBUG(DEBUG_ERR, + ("Control %s is not implemented any more, use %s instead\n", + unsupported, alternate)); + } + return -1; +} /* process a control request @@ -172,10 +186,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb, return ctdb_control_pull_db(ctdb, indata, outdata); case CTDB_CONTROL_SET_DMASTER: - CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_control_set_dmaster)); - DEBUG(DEBUG_ERR, ("The SET_DMASTER control is not implemented " - "any more.\n")); - return -1; + return control_not_implemented("SET_DMASTER", NULL); case CTDB_CONTROL_PUSH_DB: return ctdb_control_push_db(ctdb, indata);