lib: mgmtd: fix build warnings (as error)

Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
Christian Hopps 2023-03-20 19:28:42 -04:00 committed by Christian Hopps
parent d6c755f245
commit 0b645fd216
6 changed files with 29 additions and 23 deletions

View File

@ -819,7 +819,11 @@ static int
mgmt_be_client_handle_msg(struct mgmt_be_client_ctx *client_ctx, mgmt_be_client_handle_msg(struct mgmt_be_client_ctx *client_ctx,
Mgmtd__BeMessage *be_msg) Mgmtd__BeMessage *be_msg)
{ {
switch (be_msg->message_case) { /*
* protobuf-c adds a max size enum with an internal, and changing by
* version, name; cast to an int to avoid unhandled enum warnings
*/
switch ((int)be_msg->message_case) {
case MGMTD__BE_MESSAGE__MESSAGE_SUBSCR_REPLY: case MGMTD__BE_MESSAGE__MESSAGE_SUBSCR_REPLY:
MGMTD_BE_CLIENT_DBG("Subscribe Reply Msg from mgmt, status %u", MGMTD_BE_CLIENT_DBG("Subscribe Reply Msg from mgmt, status %u",
be_msg->subscr_reply->success); be_msg->subscr_reply->success);
@ -861,9 +865,6 @@ mgmt_be_client_handle_msg(struct mgmt_be_client_ctx *client_ctx,
case MGMTD__BE_MESSAGE__MESSAGE_SHOW_CMD_REPLY: case MGMTD__BE_MESSAGE__MESSAGE_SHOW_CMD_REPLY:
case MGMTD__BE_MESSAGE__MESSAGE_NOTIFY_DATA: case MGMTD__BE_MESSAGE__MESSAGE_NOTIFY_DATA:
case MGMTD__BE_MESSAGE__MESSAGE__NOT_SET: case MGMTD__BE_MESSAGE__MESSAGE__NOT_SET:
#if PROTOBUF_C_VERSION_NUMBER >= 1003000
case _MGMTD__BE_MESSAGE__MESSAGE_IS_INT_SIZE:
#endif
default: default:
/* /*
* A 'default' case is being added contrary to the * A 'default' case is being added contrary to the

View File

@ -428,7 +428,11 @@ mgmt_fe_client_handle_msg(struct mgmt_fe_client_ctx *client_ctx,
{ {
struct mgmt_fe_client_session *session = NULL; struct mgmt_fe_client_session *session = NULL;
switch (fe_msg->message_case) { /*
* protobuf-c adds a max size enum with an internal, and changing by
* version, name; cast to an int to avoid unhandled enum warnings
*/
switch ((int)fe_msg->message_case) {
case MGMTD__FE_MESSAGE__MESSAGE_SESSION_REPLY: case MGMTD__FE_MESSAGE__MESSAGE_SESSION_REPLY:
if (fe_msg->session_reply->create if (fe_msg->session_reply->create
&& fe_msg->session_reply->has_client_conn_id) { && fe_msg->session_reply->has_client_conn_id) {
@ -634,9 +638,6 @@ mgmt_fe_client_handle_msg(struct mgmt_fe_client_ctx *client_ctx,
case MGMTD__FE_MESSAGE__MESSAGE_GETCFG_REQ: case MGMTD__FE_MESSAGE__MESSAGE_GETCFG_REQ:
case MGMTD__FE_MESSAGE__MESSAGE_GETDATA_REQ: case MGMTD__FE_MESSAGE__MESSAGE_GETDATA_REQ:
case MGMTD__FE_MESSAGE__MESSAGE__NOT_SET: case MGMTD__FE_MESSAGE__MESSAGE__NOT_SET:
#if PROTOBUF_C_VERSION_NUMBER >= 1003000
case _MGMTD__FE_MESSAGE__MESSAGE_IS_INT_SIZE:
#endif
default: default:
/* /*
* A 'default' case is being added contrary to the * A 'default' case is being added contrary to the

View File

@ -56,7 +56,7 @@ enum mgmt_msg_rsched mgmt_msg_read(struct mgmt_msg_state *ms, int fd,
*/ */
while (avail > sizeof(struct mgmt_msg_hdr)) { while (avail > sizeof(struct mgmt_msg_hdr)) {
n = stream_read_try(ms->ins, fd, avail); n = stream_read_try(ms->ins, fd, avail);
MGMT_MSG_DBG(dbgtag, "got %ld bytes", n); MGMT_MSG_DBG(dbgtag, "got %zd bytes", n);
/* -2 is normal nothing read, and to retry */ /* -2 is normal nothing read, and to retry */
if (n == -2) if (n == -2)
@ -85,7 +85,7 @@ enum mgmt_msg_rsched mgmt_msg_read(struct mgmt_msg_state *ms, int fd,
MGMT_MSG_DBG(dbgtag, "recv corrupt buffer, disconnect"); MGMT_MSG_DBG(dbgtag, "recv corrupt buffer, disconnect");
return MSR_DISCONNECT; return MSR_DISCONNECT;
} }
if (mhdr->len > left) if ((ssize_t)mhdr->len > left)
break; break;
MGMT_MSG_DBG(dbgtag, "read full message len %u", mhdr->len); MGMT_MSG_DBG(dbgtag, "read full message len %u", mhdr->len);

View File

@ -364,7 +364,11 @@ static int
mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter, mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
Mgmtd__BeMessage *be_msg) Mgmtd__BeMessage *be_msg)
{ {
switch (be_msg->message_case) { /*
* protobuf-c adds a max size enum with an internal, and changing by
* version, name; cast to an int to avoid unhandled enum warnings
*/
switch ((int)be_msg->message_case) {
case MGMTD__BE_MESSAGE__MESSAGE_SUBSCR_REQ: case MGMTD__BE_MESSAGE__MESSAGE_SUBSCR_REQ:
MGMTD_BE_ADAPTER_DBG( MGMTD_BE_ADAPTER_DBG(
"Got Subscribe Req Msg from '%s' to %sregister %u xpaths", "Got Subscribe Req Msg from '%s' to %sregister %u xpaths",
@ -470,9 +474,6 @@ mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
case MGMTD__BE_MESSAGE__MESSAGE_CFG_CMD_REQ: case MGMTD__BE_MESSAGE__MESSAGE_CFG_CMD_REQ:
case MGMTD__BE_MESSAGE__MESSAGE_SHOW_CMD_REQ: case MGMTD__BE_MESSAGE__MESSAGE_SHOW_CMD_REQ:
case MGMTD__BE_MESSAGE__MESSAGE__NOT_SET: case MGMTD__BE_MESSAGE__MESSAGE__NOT_SET:
#if PROTOBUF_C_VERSION_NUMBER >= 1003000
case _MGMTD__BE_MESSAGE__MESSAGE_IS_INT_SIZE:
#endif
default: default:
/* /*
* A 'default' case is being added contrary to the * A 'default' case is being added contrary to the

View File

@ -1222,9 +1222,10 @@ static int mgmt_fe_session_handle_commit_config_req_msg(
"Failed to create a Configuration session!"); "Failed to create a Configuration session!");
return 0; return 0;
} }
MGMTD_FE_ADAPTER_DBG( MGMTD_FE_ADAPTER_DBG("Created txn %" PRIu64
"Created txn %llu for session %llu for COMMIT-CFG-REQ", " for session %" PRIu64
session->cfg_txn_id, session->session_id); " for COMMIT-CFG-REQ",
session->cfg_txn_id, session->session_id);
} }
@ -1273,7 +1274,11 @@ mgmt_fe_adapter_handle_msg(struct mgmt_fe_client_adapter *adapter,
{ {
struct mgmt_fe_session_ctx *session; struct mgmt_fe_session_ctx *session;
switch (fe_msg->message_case) { /*
* protobuf-c adds a max size enum with an internal, and changing by
* version, name; cast to an int to avoid unhandled enum warnings
*/
switch ((int)fe_msg->message_case) {
case MGMTD__FE_MESSAGE__MESSAGE_REGISTER_REQ: case MGMTD__FE_MESSAGE__MESSAGE_REGISTER_REQ:
MGMTD_FE_ADAPTER_DBG("Got Register Req Msg from '%s'", MGMTD_FE_ADAPTER_DBG("Got Register Req Msg from '%s'",
fe_msg->register_req->client_name); fe_msg->register_req->client_name);
@ -1397,9 +1402,6 @@ mgmt_fe_adapter_handle_msg(struct mgmt_fe_client_adapter *adapter,
case MGMTD__FE_MESSAGE__MESSAGE_GETCFG_REPLY: case MGMTD__FE_MESSAGE__MESSAGE_GETCFG_REPLY:
case MGMTD__FE_MESSAGE__MESSAGE_GETDATA_REPLY: case MGMTD__FE_MESSAGE__MESSAGE_GETDATA_REPLY:
case MGMTD__FE_MESSAGE__MESSAGE__NOT_SET: case MGMTD__FE_MESSAGE__MESSAGE__NOT_SET:
#if PROTOBUF_C_VERSION_NUMBER >= 1003000
case _MGMTD__FE_MESSAGE__MESSAGE_IS_INT_SIZE:
#endif
default: default:
/* /*
* A 'default' case is being added contrary to the * A 'default' case is being added contrary to the

View File

@ -2476,7 +2476,8 @@ int mgmt_txn_notify_be_adapter_conn(struct mgmt_be_client_adapter *adapter,
return -1; return -1;
} }
MGMTD_TXN_DBG("Created initial txn %llu for BE connection %s", MGMTD_TXN_DBG("Created initial txn %" PRIu64
" for BE connection %s",
txn->txn_id, adapter->name); txn->txn_id, adapter->name);
/* /*
* Set the changeset for transaction to commit and trigger the * Set the changeset for transaction to commit and trigger the
@ -2815,7 +2816,7 @@ int mgmt_txn_rollback_trigger_cfg_apply(struct mgmt_ds_ctx *src_ds_ctx,
return -1; return -1;
} }
MGMTD_TXN_DBG("Created rollback txn %llu", txn->txn_id); MGMTD_TXN_DBG("Created rollback txn %" PRIu64, txn->txn_id);
/* /*
* Set the changeset for transaction to commit and trigger the commit * Set the changeset for transaction to commit and trigger the commit