summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-05-15 06:11:46 +0200
committerChristian Hopps <chopps@labn.net>2023-05-28 11:13:22 +0200
commit218625aa439071cb4aac7cd08e0f85eb1163134f (patch)
treeab15d710b728045551e04c3d36b08ba25736c151
parentmgmtd: lib: move INIT to after client registers (diff)
downloadfrr-218625aa439071cb4aac7cd08e0f85eb1163134f.tar.xz
frr-218625aa439071cb4aac7cd08e0f85eb1163134f.zip
mgmtd: lib: cleanup error and debug messages
- always use IDs not a mix of IDs and pointers. - always use PRIu64 not a mix of hex and decimal for IDs Signed-off-by: Christian Hopps <chopps@labn.net>
-rw-r--r--lib/mgmt_be_client.c114
-rw-r--r--mgmtd/mgmt_be_adapter.c66
-rw-r--r--mgmtd/mgmt_ds.c2
-rw-r--r--mgmtd/mgmt_fe_adapter.c102
-rw-r--r--mgmtd/mgmt_txn.c304
5 files changed, 316 insertions, 272 deletions
diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c
index 63c38081c..2445fe9d0 100644
--- a/lib/mgmt_be_client.c
+++ b/lib/mgmt_be_client.c
@@ -169,8 +169,9 @@ mgmt_be_batch_create(struct mgmt_be_txn_ctx *txn, uint64_t batch_id)
batch->batch_id = batch_id;
mgmt_be_batches_add_tail(&txn->cfg_batches, batch);
- MGMTD_BE_CLIENT_DBG("Added new batch 0x%llx to transaction",
- (unsigned long long)batch_id);
+ MGMTD_BE_CLIENT_DBG("Added new batch-id: %" PRIu64
+ " to transaction",
+ batch_id);
}
return batch;
@@ -246,8 +247,7 @@ mgmt_be_txn_create(struct mgmt_be_client_ctx *client_ctx,
mgmt_be_batches_init(&txn->apply_cfgs);
mgmt_be_txns_add_tail(&client_ctx->txn_head, txn);
- MGMTD_BE_CLIENT_DBG("Added new transaction 0x%llx",
- (unsigned long long)txn_id);
+ MGMTD_BE_CLIENT_DBG("Added new txn-id: %" PRIu64, txn_id);
}
return txn;
@@ -316,9 +316,7 @@ static int mgmt_be_send_txn_reply(struct mgmt_be_client_ctx *client_ctx,
be_msg.message_case = MGMTD__BE_MESSAGE__MESSAGE_TXN_REPLY;
be_msg.txn_reply = &txn_reply;
- MGMTD_BE_CLIENT_DBG(
- "Sending TXN_REPLY message to MGMTD for txn 0x%llx",
- (unsigned long long)txn_id);
+ MGMTD_BE_CLIENT_DBG("Sending TXN_REPLY txn-id %" PRIu64, txn_id);
return mgmt_be_client_send_msg(client_ctx, &be_msg);
}
@@ -336,14 +334,12 @@ static int mgmt_be_process_txn_req(struct mgmt_be_client_ctx *client_ctx,
* Should not happen under any circumstances.
*/
MGMTD_BE_CLIENT_ERR(
- "Transaction 0x%llx already exists!!!",
- (unsigned long long)txn_id);
+ "txn-id: %" PRIu64 " already exists", txn_id);
mgmt_be_send_txn_reply(client_ctx, txn_id, create,
false);
}
- MGMTD_BE_CLIENT_DBG("Created new transaction 0x%llx",
- (unsigned long long)txn_id);
+ MGMTD_BE_CLIENT_DBG("Created new txn-id %" PRIu64, txn_id);
txn = mgmt_be_txn_create(client_ctx, txn_id);
if (client_ctx->client_params.txn_notify)
@@ -358,12 +354,11 @@ static int mgmt_be_process_txn_req(struct mgmt_be_client_ctx *client_ctx,
* Transaction with same txn-id does not exists.
* Return sucess anyways.
*/
- MGMTD_BE_CLIENT_DBG(
- "Transaction to delete 0x%llx does NOT exists!!!",
- (unsigned long long)txn_id);
+ MGMTD_BE_CLIENT_DBG("txn-id: %" PRIu64
+ " for delete does NOT exists",
+ txn_id);
} else {
- MGMTD_BE_CLIENT_DBG("Delete transaction 0x%llx",
- (unsigned long long)txn_id);
+ MGMTD_BE_CLIENT_DBG("Delete txn-id: %" PRIu64, txn_id);
mgmt_be_txn_delete(client_ctx, &txn);
}
}
@@ -392,9 +387,9 @@ mgmt_be_send_cfgdata_create_reply(struct mgmt_be_client_ctx *client_ctx,
be_msg.message_case = MGMTD__BE_MESSAGE__MESSAGE_CFG_DATA_REPLY;
be_msg.cfg_data_reply = &cfgdata_reply;
- MGMTD_BE_CLIENT_DBG(
- "Sending CFGDATA_CREATE_REPLY message to MGMTD for txn 0x%llx batch 0x%llx",
- (unsigned long long)txn_id, (unsigned long long)batch_id);
+ MGMTD_BE_CLIENT_DBG("Sending CFGDATA_CREATE_REPLY txn-id: %" PRIu64
+ " batch-id: %" PRIu64,
+ txn_id, batch_id);
return mgmt_be_client_send_msg(client_ctx, &be_msg);
}
@@ -406,8 +401,8 @@ static void mgmt_be_txn_cfg_abort(struct mgmt_be_txn_ctx *txn)
assert(txn && txn->client_ctx);
if (txn->nb_txn) {
MGMTD_BE_CLIENT_ERR(
- "Aborting configurations after prep for Txn 0x%llx",
- (unsigned long long)txn->txn_id);
+ "Aborting configs after prep for txn-id: %" PRIu64,
+ txn->txn_id);
nb_candidate_commit_abort(txn->nb_txn, errmsg, sizeof(errmsg));
txn->nb_txn = 0;
}
@@ -419,8 +414,8 @@ static void mgmt_be_txn_cfg_abort(struct mgmt_be_txn_ctx *txn)
* does that work?
*/
MGMTD_BE_CLIENT_DBG(
- "Reset candidate configurations after abort of Txn 0x%llx",
- (unsigned long long)txn->txn_id);
+ "Reset candidate configurations after abort of txn-id: %" PRIu64,
+ txn->txn_id);
nb_config_replace(txn->client_ctx->candidate_config,
txn->client_ctx->running_config, true);
}
@@ -470,10 +465,10 @@ static int mgmt_be_txn_cfg_prepare(struct mgmt_be_txn_ctx *txn)
if (error) {
err_buf[sizeof(err_buf) - 1] = 0;
MGMTD_BE_CLIENT_ERR(
- "Failed to update configs for Txn %llx Batch %llx to Candidate! Err: '%s'",
- (unsigned long long)txn->txn_id,
- (unsigned long long)batch->batch_id,
- err_buf);
+ "Failed to update configs for txn-id: %" PRIu64
+ " batch-id: %" PRIu64
+ " to candidate, err: '%s'",
+ txn->txn_id, batch->batch_id, err_buf);
return -1;
}
gettimeofday(&edit_nb_cfg_end, NULL);
@@ -512,21 +507,20 @@ static int mgmt_be_txn_cfg_prepare(struct mgmt_be_txn_ctx *txn)
err_buf[sizeof(err_buf) - 1] = 0;
if (err == NB_ERR_VALIDATION)
MGMTD_BE_CLIENT_ERR(
- "Failed to validate configs for Txn %llx %u Batches! Err: '%s'",
- (unsigned long long)txn->txn_id,
- (uint32_t)num_processed, err_buf);
+ "Failed to validate configs txn-id: %" PRIu64
+ " %zu batches, err: '%s'",
+ txn->txn_id, num_processed, err_buf);
else
MGMTD_BE_CLIENT_ERR(
- "Failed to prepare configs for Txn %llx, %u Batches! Err: '%s'",
- (unsigned long long)txn->txn_id,
- (uint32_t)num_processed, err_buf);
+ "Failed to prepare configs for txn-id: %" PRIu64
+ " %zu batches, err: '%s'",
+ txn->txn_id, num_processed, err_buf);
error = true;
SET_FLAG(txn->flags, MGMTD_BE_TXN_FLAGS_CFGPREP_FAILED);
} else
- MGMTD_BE_CLIENT_DBG(
- "Prepared configs for Txn %llx, %u Batches! successfully!",
- (unsigned long long)txn->txn_id,
- (uint32_t)num_processed);
+ MGMTD_BE_CLIENT_DBG("Prepared configs for txn-id: %" PRIu64
+ " %zu batches",
+ txn->txn_id, num_processed);
gettimeofday(&prep_nb_cfg_end, NULL);
prep_nb_cfg_tm = timeval_elapsed(prep_nb_cfg_end, prep_nb_cfg_start);
@@ -582,10 +576,9 @@ mgmt_be_update_setcfg_in_batch(struct mgmt_be_client_ctx *client_ctx,
txn_req = &batch->txn_req;
txn_req->event = MGMTD_BE_TXN_PROC_SETCFG;
- MGMTD_BE_CLIENT_DBG(
- "Created Set-Config request for batch 0x%llx, txn id 0x%llx, cfg-items:%d",
- (unsigned long long)batch_id, (unsigned long long)txn->txn_id,
- num_req);
+ MGMTD_BE_CLIENT_DBG("Created SETCFG request for batch-id: %" PRIu64
+ " txn-id: %" PRIu64 " cfg-items:%d",
+ batch_id, txn->txn_id, num_req);
txn_req->req.set_cfg.num_cfg_changes = num_req;
for (index = 0; index < num_req; index++) {
@@ -628,9 +621,9 @@ mgmt_be_process_cfgdata_req(struct mgmt_be_client_ctx *client_ctx,
txn = mgmt_be_find_txn_by_id(client_ctx, txn_id);
if (!txn) {
- MGMTD_BE_CLIENT_ERR(
- "Invalid txn-id 0x%llx provided from MGMTD server",
- (unsigned long long)txn_id);
+ MGMTD_BE_CLIENT_ERR("Invalid txn-id: %" PRIu64
+ " from MGMTD server",
+ txn_id);
mgmt_be_send_cfgdata_create_reply(
client_ctx, txn_id, batch_id, false,
"Transaction context not created yet");
@@ -669,12 +662,11 @@ static int mgmt_be_send_apply_reply(struct mgmt_be_client_ctx *client_ctx,
be_msg.cfg_apply_reply = &apply_reply;
MGMTD_BE_CLIENT_DBG(
- "Sending CFG_APPLY_REPLY message to MGMTD for txn 0x%llx, %d batches [0x%llx - 0x%llx]",
- (unsigned long long)txn_id, (int)num_batch_ids,
- success && num_batch_ids ?
- (unsigned long long)batch_ids[0] : 0,
- success && num_batch_ids ?
- (unsigned long long)batch_ids[num_batch_ids - 1] : 0);
+ "Sending CFG_APPLY_REPLY txn-id %" PRIu64
+ " %zu batch ids %" PRIu64 " - %" PRIu64,
+ txn_id, num_batch_ids,
+ success && num_batch_ids ? batch_ids[0] : 0,
+ success && num_batch_ids ? batch_ids[num_batch_ids - 1] : 0);
return mgmt_be_client_send_msg(client_ctx, &be_msg);
}
@@ -772,15 +764,24 @@ mgmt_be_client_handle_msg(struct mgmt_be_client_ctx *client_ctx,
*/
switch ((int)be_msg->message_case) {
case MGMTD__BE_MESSAGE__MESSAGE_SUBSCR_REPLY:
- MGMTD_BE_CLIENT_DBG("Subscribe Reply Msg from mgmt, status %u",
- be_msg->subscr_reply->success);
+ MGMTD_BE_CLIENT_DBG("Got SUBSCR_REPLY success %u",
+ be_msg->subscr_reply->success);
break;
case MGMTD__BE_MESSAGE__MESSAGE_TXN_REQ:
+ MGMTD_BE_CLIENT_DBG("Got TXN_REQ %s txn-id: %" PRIu64,
+ be_msg->txn_req->create ? "Create"
+ : "Delete",
+ be_msg->txn_req->txn_id);
mgmt_be_process_txn_req(client_ctx,
be_msg->txn_req->txn_id,
be_msg->txn_req->create);
break;
case MGMTD__BE_MESSAGE__MESSAGE_CFG_DATA_REQ:
+ MGMTD_BE_CLIENT_DBG("Got CFG_DATA_REQ txn-id: %" PRIu64
+ " batch-id: %" PRIu64 " end-of-data %u",
+ be_msg->cfg_data_req->txn_id,
+ be_msg->cfg_data_req->batch_id,
+ be_msg->cfg_data_req->end_of_data);
mgmt_be_process_cfgdata_req(
client_ctx, be_msg->cfg_data_req->txn_id,
be_msg->cfg_data_req->batch_id,
@@ -789,6 +790,8 @@ mgmt_be_client_handle_msg(struct mgmt_be_client_ctx *client_ctx,
be_msg->cfg_data_req->end_of_data);
break;
case MGMTD__BE_MESSAGE__MESSAGE_CFG_APPLY_REQ:
+ MGMTD_BE_CLIENT_DBG("Got CFG_APPLY_REQ txn-id: %" PRIu64,
+ be_msg->cfg_data_req->txn_id);
mgmt_be_process_cfg_apply(
client_ctx, (uint64_t)be_msg->cfg_apply_req->txn_id);
break;
@@ -796,6 +799,8 @@ mgmt_be_client_handle_msg(struct mgmt_be_client_ctx *client_ctx,
case MGMTD__BE_MESSAGE__MESSAGE_SUBSCR_REQ:
case MGMTD__BE_MESSAGE__MESSAGE_CFG_CMD_REQ:
case MGMTD__BE_MESSAGE__MESSAGE_SHOW_CMD_REQ:
+ MGMTD_BE_CLIENT_ERR("Got unhandled message type %u",
+ be_msg->message_case);
/*
* TODO: Add handling code in future.
*/
@@ -868,6 +873,11 @@ static int mgmt_be_send_subscr_req(struct mgmt_be_client_ctx *client_ctx,
be_msg.message_case = MGMTD__BE_MESSAGE__MESSAGE_SUBSCR_REQ;
be_msg.subscr_req = &subscr_req;
+ MGMTD_FE_CLIENT_DBG(
+ "Sending SUBSCR_REQ name: %s subscr_xpaths: %u num_xpaths: %zu",
+ subscr_req.client_name, subscr_req.subscribe_xpaths,
+ subscr_req.n_xpath_reg);
+
return mgmt_be_client_send_msg(client_ctx, &be_msg);
}
diff --git a/mgmtd/mgmt_be_adapter.c b/mgmtd/mgmt_be_adapter.c
index 907590501..e58fb9d18 100644
--- a/mgmtd/mgmt_be_adapter.c
+++ b/mgmtd/mgmt_be_adapter.c
@@ -393,13 +393,13 @@ mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
switch ((int)be_msg->message_case) {
case MGMTD__BE_MESSAGE__MESSAGE_SUBSCR_REQ:
MGMTD_BE_ADAPTER_DBG(
- "Got Subscribe Req Msg from '%s' to %sregister %u xpaths",
+ "Got SUBSCR_REQ from '%s' to %sregister %zu xpaths",
be_msg->subscr_req->client_name,
- !be_msg->subscr_req->subscribe_xpaths
- && be_msg->subscr_req->n_xpath_reg
+ !be_msg->subscr_req->subscribe_xpaths &&
+ be_msg->subscr_req->n_xpath_reg
? "de"
: "",
- (uint32_t)be_msg->subscr_req->n_xpath_reg);
+ be_msg->subscr_req->n_xpath_reg);
if (strlen(be_msg->subscr_req->client_name)) {
strlcpy(adapter->name, be_msg->subscr_req->client_name,
@@ -429,10 +429,10 @@ mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
break;
case MGMTD__BE_MESSAGE__MESSAGE_TXN_REPLY:
MGMTD_BE_ADAPTER_DBG(
- "Got %s TXN_REPLY Msg for Txn-Id 0x%llx from '%s' with '%s'",
+ "Got %s TXN_REPLY from '%s' txn-id %" PRIx64
+ " with '%s'",
be_msg->txn_reply->create ? "Create" : "Delete",
- (unsigned long long)be_msg->txn_reply->txn_id,
- adapter->name,
+ adapter->name, be_msg->txn_reply->txn_id,
be_msg->txn_reply->success ? "success" : "failure");
/*
* Forward the TXN_REPLY to txn module.
@@ -444,10 +444,10 @@ mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
break;
case MGMTD__BE_MESSAGE__MESSAGE_CFG_DATA_REPLY:
MGMTD_BE_ADAPTER_DBG(
- "Got CFGDATA_REPLY Msg from '%s' for Txn-Id 0x%llx Batch-Id 0x%llx with Err:'%s'",
- adapter->name,
- (unsigned long long)be_msg->cfg_data_reply->txn_id,
- (unsigned long long)be_msg->cfg_data_reply->batch_id,
+ "Got CFGDATA_REPLY from '%s' txn-id %" PRIx64
+ " batch-id %" PRIu64 " err:'%s'",
+ adapter->name, be_msg->cfg_data_reply->txn_id,
+ be_msg->cfg_data_reply->batch_id,
be_msg->cfg_data_reply->error_if_any
? be_msg->cfg_data_reply->error_if_any
: "None");
@@ -462,19 +462,15 @@ mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
break;
case MGMTD__BE_MESSAGE__MESSAGE_CFG_APPLY_REPLY:
MGMTD_BE_ADAPTER_DBG(
- "Got %s CFG_APPLY_REPLY Msg from '%s' for Txn-Id 0x%llx for %d batches (Id 0x%llx-0x%llx), Err:'%s'",
+ "Got %s CFG_APPLY_REPLY from '%s' txn-id %" PRIx64
+ " for %zu batches id %" PRIu64 "-%" PRIu64 " err:'%s'",
be_msg->cfg_apply_reply->success ? "successful"
- : "failed",
- adapter->name,
- (unsigned long long)
- be_msg->cfg_apply_reply->txn_id,
- (int)be_msg->cfg_apply_reply->n_batch_ids,
- (unsigned long long)
- be_msg->cfg_apply_reply->batch_ids[0],
- (unsigned long long)be_msg->cfg_apply_reply
- ->batch_ids[be_msg->cfg_apply_reply
- ->n_batch_ids
- - 1],
+ : "failed",
+ adapter->name, be_msg->cfg_apply_reply->txn_id,
+ be_msg->cfg_apply_reply->n_batch_ids,
+ be_msg->cfg_apply_reply->batch_ids[0],
+ be_msg->cfg_apply_reply->batch_ids
+ [be_msg->cfg_apply_reply->n_batch_ids - 1],
be_msg->cfg_apply_reply->error_if_any
? be_msg->cfg_apply_reply->error_if_any
: "None");
@@ -535,9 +531,8 @@ static int mgmt_be_send_txn_req(struct mgmt_be_client_adapter *adapter,
be_msg.message_case = MGMTD__BE_MESSAGE__MESSAGE_TXN_REQ;
be_msg.txn_req = &txn_req;
- MGMTD_BE_ADAPTER_DBG(
- "Sending TXN_REQ message to Backend client '%s' for Txn-Id %llx",
- adapter->name, (unsigned long long)txn_id);
+ MGMTD_BE_ADAPTER_DBG("Sending TXN_REQ to '%s' txn-id: %" PRIu64,
+ adapter->name, txn_id);
return mgmt_be_adapter_send_msg(adapter, &be_msg);
}
@@ -563,9 +558,9 @@ mgmt_be_send_cfgdata_create_req(struct mgmt_be_client_adapter *adapter,
be_msg.cfg_data_req = &cfgdata_req;
MGMTD_BE_ADAPTER_DBG(
- "Sending CFGDATA_CREATE_REQ message to Backend client '%s' for Txn-Id %llx, Batch-Id: %llx",
- adapter->name, (unsigned long long)txn_id,
- (unsigned long long)batch_id);
+ "Sending CFGDATA_CREATE_REQ to '%s' txn-id: %" PRIu64
+ " batch-id: %" PRIu64,
+ adapter->name, txn_id, batch_id);
return mgmt_be_adapter_send_msg(adapter, &be_msg);
}
@@ -583,9 +578,8 @@ static int mgmt_be_send_cfgapply_req(struct mgmt_be_client_adapter *adapter,
be_msg.message_case = MGMTD__BE_MESSAGE__MESSAGE_CFG_APPLY_REQ;
be_msg.cfg_apply_req = &apply_req;
- MGMTD_BE_ADAPTER_DBG(
- "Sending CFG_APPLY_REQ message to Backend client '%s' for Txn-Id 0x%llx",
- adapter->name, (unsigned long long)txn_id);
+ MGMTD_BE_ADAPTER_DBG("Sending CFG_APPLY_REQ to '%s' txn-id: %" PRIu64,
+ adapter->name, txn_id);
return mgmt_be_adapter_send_msg(adapter, &be_msg);
}
@@ -608,9 +602,9 @@ static void mgmt_be_adapter_process_msg(uint8_t version, uint8_t *data,
mgmtd__be_message__free_unpacked(be_msg, NULL);
}
-static void mgmt_be_iter_and_get_cfg(struct mgmt_ds_ctx *ds_ctx,
- char *xpath, struct lyd_node *node,
- struct nb_node *nb_node, void *ctx)
+static void mgmt_be_iter_and_get_cfg(struct mgmt_ds_ctx *ds_ctx, char *xpath,
+ struct lyd_node *node,
+ struct nb_node *nb_node, void *ctx)
{
struct mgmt_be_client_subscr_info subscr_info;
struct mgmt_be_get_adapter_config_params *parms;
@@ -862,7 +856,7 @@ int mgmt_be_get_subscr_info_for_xpath(
root_xp = true;
}
- MGMTD_BE_ADAPTER_DBG("XPATH: %s", xpath);
+ MGMTD_BE_ADAPTER_DBG("XPATH: '%s'", xpath);
for (indx = 0; indx < mgmt_num_xpath_maps; indx++) {
/*
* For Xpaths: '/' and '/ *' all xpath maps should match
diff --git a/mgmtd/mgmt_ds.c b/mgmtd/mgmt_ds.c
index b8cb5b2b1..f9c9933ac 100644
--- a/mgmtd/mgmt_ds.c
+++ b/mgmtd/mgmt_ds.c
@@ -339,7 +339,7 @@ static int mgmt_walk_ds_nodes(
*num_nodes = 0;
}
- MGMTD_DS_DBG(" -- START: Base: %s", base_xpath);
+ MGMTD_DS_DBG(" -- START: Base: '%s'", base_xpath);
if (!base_dnode)
base_dnode = yang_dnode_get(
diff --git a/mgmtd/mgmt_fe_adapter.c b/mgmtd/mgmt_fe_adapter.c
index 996d9a230..7327940c1 100644
--- a/mgmtd/mgmt_fe_adapter.c
+++ b/mgmtd/mgmt_fe_adapter.c
@@ -74,15 +74,18 @@ mgmt_fe_session_write_lock_ds(Mgmtd__DatastoreId ds_id,
if (!session->ds_write_locked[ds_id]) {
if (mgmt_ds_write_lock(ds_ctx) != 0) {
MGMTD_FE_ADAPTER_DBG(
- "Failed to lock the DS %u for Sessn: %p from %s!",
- ds_id, session, session->adapter->name);
+ "Failed to lock the DS %u for session-id: %" PRIu64
+ " from %s!",
+ ds_id, session->session_id,
+ session->adapter->name);
return -1;
}
session->ds_write_locked[ds_id] = true;
MGMTD_FE_ADAPTER_DBG(
- "Write-Locked the DS %u for Sessn: %p from %s!", ds_id,
- session, session->adapter->name);
+ "Write-Locked the DS %u for session-id: %" PRIu64
+ " from %s",
+ ds_id, session->session_id, session->adapter->name);
}
return 0;
@@ -96,15 +99,18 @@ mgmt_fe_session_read_lock_ds(Mgmtd__DatastoreId ds_id,
if (!session->ds_read_locked[ds_id]) {
if (mgmt_ds_read_lock(ds_ctx) != 0) {
MGMTD_FE_ADAPTER_DBG(
- "Failed to lock the DS %u for Sessn: %p from %s!",
- ds_id, session, session->adapter->name);
+ "Failed to lock the DS %u for session-is: %" PRIu64
+ " from %s",
+ ds_id, session->session_id,
+ session->adapter->name);
return -1;
}
session->ds_read_locked[ds_id] = true;
MGMTD_FE_ADAPTER_DBG(
- "Read-Locked the DS %u for Sessn: %p from %s!", ds_id,
- session, session->adapter->name);
+ "Read-Locked the DS %u for session-id: %" PRIu64
+ " from %s",
+ ds_id, session->session_id, session->adapter->name);
}
return 0;
@@ -120,27 +126,33 @@ static int mgmt_fe_session_unlock_ds(Mgmtd__DatastoreId ds_id,
session->ds_locked_implict[ds_id] = false;
if (mgmt_ds_unlock(ds_ctx) != 0) {
MGMTD_FE_ADAPTER_DBG(
- "Failed to unlock the DS %u taken earlier by Sessn: %p from %s!",
- ds_id, session, session->adapter->name);
+ "Failed to unlock the DS %u taken earlier by session-id: %" PRIu64
+ " from %s",
+ ds_id, session->session_id,
+ session->adapter->name);
return -1;
}
MGMTD_FE_ADAPTER_DBG(
- "Unlocked DS %u write-locked earlier by Sessn: %p from %s",
- ds_id, session, session->adapter->name);
+ "Unlocked DS %u write-locked earlier by session-id: %" PRIu64
+ " from %s",
+ ds_id, session->session_id, session->adapter->name);
} else if (unlock_read && session->ds_read_locked[ds_id]) {
session->ds_read_locked[ds_id] = false;
session->ds_locked_implict[ds_id] = false;
if (mgmt_ds_unlock(ds_ctx) != 0) {
MGMTD_FE_ADAPTER_DBG(
- "Failed to unlock the DS %u taken earlier by Sessn: %p from %s!",
- ds_id, session, session->adapter->name);
+ "Failed to unlock the DS %u taken earlier by session-id: %" PRIu64
+ " from %s",
+ ds_id, session->session_id,
+ session->adapter->name);
return -1;
}
MGMTD_FE_ADAPTER_DBG(
- "Unlocked DS %u read-locked earlier by Sessn: %p from %s",
- ds_id, session, session->adapter->name);
+ "Unlocked DS %u read-locked earlier by session-id: %" PRIu64
+ " from %s",
+ ds_id, session->session_id, session->adapter->name);
}
return 0;
@@ -734,8 +746,10 @@ mgmt_fe_session_handle_lockds_req_msg(struct mgmt_fe_session_ctx *session,
true, NULL)
!= 0) {
MGMTD_FE_ADAPTER_DBG(
- "Failed to send LOCK_DS_REPLY for DS %u Sessn: %p from %s",
- lockds_req->ds_id, session, session->adapter->name);
+ "Failed to send LOCK_DS_REPLY for DS %u session-id: %" PRIu64
+ " from %s",
+ lockds_req->ds_id, session->session_id,
+ session->adapter->name);
}
return 0;
@@ -825,13 +839,14 @@ mgmt_fe_session_handle_setcfg_req_msg(struct mgmt_fe_session_ctx *session,
goto mgmt_fe_sess_handle_setcfg_req_failed;
}
- MGMTD_FE_ADAPTER_DBG(
- "Created new Config Txn 0x%llx for session %p",
- (unsigned long long)session->cfg_txn_id, session);
+ MGMTD_FE_ADAPTER_DBG("Created new Config txn-id: %" PRIu64
+ " for session-id %" PRIu64,
+ session->cfg_txn_id, session->session_id);
} else {
- MGMTD_FE_ADAPTER_DBG(
- "Config Txn 0x%llx for session %p already created",
- (unsigned long long)session->cfg_txn_id, session);
+ MGMTD_FE_ADAPTER_ERR("Config txn-id: %" PRIu64
+ " for session-id: %" PRIu64
+ " already created",
+ session->cfg_txn_id, session->session_id);
if (setcfg_req->implicit_commit) {
/*
@@ -958,13 +973,14 @@ mgmt_fe_session_handle_getcfg_req_msg(struct mgmt_fe_session_ctx *session,
goto mgmt_fe_sess_handle_getcfg_req_failed;
}
- MGMTD_FE_ADAPTER_DBG(
- "Created new Show Txn 0x%llx for session %p",
- (unsigned long long)session->txn_id, session);
+ MGMTD_FE_ADAPTER_DBG("Created new show txn-id: %" PRIu64
+ " for session-id: %" PRIu64,
+ session->txn_id, session->session_id);
} else {
- MGMTD_FE_ADAPTER_DBG(
- "Show Txn 0x%llx for session %p already created",
- (unsigned long long)session->txn_id, session);
+ MGMTD_FE_ADAPTER_DBG("Show txn-id: %" PRIu64
+ " for session-id: %" PRIu64
+ " already created",
+ session->txn_id, session->session_id);
}
/*
@@ -1048,13 +1064,13 @@ mgmt_fe_session_handle_getdata_req_msg(struct mgmt_fe_session_ctx *session,
goto mgmt_fe_sess_handle_getdata_req_failed;
}
- MGMTD_FE_ADAPTER_DBG(
- "Created new Show Txn 0x%llx for session %p",
- (unsigned long long)session->txn_id, session);
+ MGMTD_FE_ADAPTER_DBG("Created new Show Txn %" PRIu64
+ " for session %" PRIu64,
+ session->txn_id, session->session_id);
} else {
- MGMTD_FE_ADAPTER_DBG(
- "Show Txn 0x%llx for session %p already created",
- (unsigned long long)session->txn_id, session);
+ MGMTD_FE_ADAPTER_DBG("Show txn-id: %" PRIu64
+ " for session %" PRIu64 " already created",
+ session->txn_id, session->session_id);
}
/*
@@ -1483,9 +1499,9 @@ int mgmt_fe_send_set_cfg_reply(uint64_t session_id, uint64_t txn_id,
if (!session || session->cfg_txn_id != txn_id) {
if (session)
MGMTD_FE_ADAPTER_ERR(
- "Txn_id doesnot match, session txn is 0x%llx, current txn 0x%llx",
- (unsigned long long)session->cfg_txn_id,
- (unsigned long long)txn_id);
+ "txn-id doesn't match, session txn-id is %" PRIu64
+ " current txnid: %" PRIu64,
+ session->cfg_txn_id, txn_id);
return -1;
}
@@ -1707,10 +1723,10 @@ void mgmt_fe_adapter_status_write(struct vty *vty, bool detail)
vty_out(vty, " Sessions\n");
FOREACH_SESSION_IN_LIST (adapter, session) {
vty_out(vty, " Session: \t\t\t\t%p\n", session);
- vty_out(vty, " Client-Id: \t\t\t%llu\n",
- (unsigned long long)session->client_id);
- vty_out(vty, " Session-Id: \t\t\t%llx\n",
- (unsigned long long)session->session_id);
+ vty_out(vty, " Client-Id: \t\t\t%" PRIu64 "\n",
+ session->client_id);
+ vty_out(vty, " Session-Id: \t\t\t%" PRIu64 "\n",
+ session->session_id);
vty_out(vty, " DS-Locks:\n");
FOREACH_MGMTD_DS_ID (ds_id) {
if (session->ds_write_locked[ds_id]
diff --git a/mgmtd/mgmt_txn.c b/mgmtd/mgmt_txn.c
index 5046d70ab..4b9d95206 100644
--- a/mgmtd/mgmt_txn.c
+++ b/mgmtd/mgmt_txn.c
@@ -327,7 +327,8 @@ mgmt_txn_cfg_batch_free(struct mgmt_txn_be_cfg_batch **cfg_btch)
size_t indx;
struct mgmt_commit_cfg_req *cmtcfg_req;
- MGMTD_TXN_DBG(" Batch: %p, Txn: %p", *cfg_btch, (*cfg_btch)->txn);
+ MGMTD_TXN_DBG(" freeing batch-id: %" PRIu64 " txn-id %" PRIu64,
+ (*cfg_btch)->batch_id, (*cfg_btch)->txn->txn_id);
assert((*cfg_btch)->txn
&& (*cfg_btch)->txn->type == MGMTD_TXN_TYPE_CONFIG);
@@ -435,15 +436,15 @@ static struct mgmt_txn_req *mgmt_txn_req_alloc(struct mgmt_txn_ctx *txn,
sizeof(struct mgmt_set_cfg_req));
assert(txn_req->req.set_cfg);
mgmt_txn_reqs_add_tail(&txn->set_cfg_reqs, txn_req);
- MGMTD_TXN_DBG(
- "Added a new SETCFG Req: %p for Txn: %p, Sessn: 0x%llx",
- txn_req, txn, (unsigned long long)txn->session_id);
+ MGMTD_TXN_DBG("Added a new SETCFG req-id: %" PRIu64
+ " txn-id: %" PRIu64 ", session-id: %" PRIu64,
+ txn_req->req_id, txn->txn_id, txn->session_id);
break;
case MGMTD_TXN_PROC_COMMITCFG:
txn->commit_cfg_req = txn_req;
- MGMTD_TXN_DBG(
- "Added a new COMMITCFG Req: %p for Txn: %p, Sessn: 0x%llx",
- txn_req, txn, (unsigned long long)txn->session_id);
+ MGMTD_TXN_DBG("Added a new COMMITCFG req-id: %" PRIu64
+ " txn-id: %" PRIu64 " session-id: %" PRIu64,
+ txn_req->req_id, txn->txn_id, txn->session_id);
FOREACH_MGMTD_BE_CLIENT_ID (id) {
mgmt_txn_batches_init(
@@ -463,9 +464,9 @@ static struct mgmt_txn_req *mgmt_txn_req_alloc(struct mgmt_txn_ctx *txn,
sizeof(struct mgmt_get_data_req));
assert(txn_req->req.get_data);
mgmt_txn_reqs_add_tail(&txn->get_cfg_reqs, txn_req);
- MGMTD_TXN_DBG(
- "Added a new GETCFG Req: %p for Txn: %p, Sessn: 0x%llx",
- txn_req, txn, (unsigned long long)txn->session_id);
+ MGMTD_TXN_DBG("Added a new GETCFG req-id: %" PRIu64
+ " txn-id: %" PRIu64 " session-id: %" PRIu64,
+ txn_req->req_id, txn->txn_id, txn->session_id);
break;
case MGMTD_TXN_PROC_GETDATA:
txn_req->req.get_data =
@@ -473,9 +474,9 @@ static struct mgmt_txn_req *mgmt_txn_req_alloc(struct mgmt_txn_ctx *txn,
sizeof(struct mgmt_get_data_req));
assert(txn_req->req.get_data);
mgmt_txn_reqs_add_tail(&txn->get_data_reqs, txn_req);
- MGMTD_TXN_DBG(
- "Added a new GETDATA Req: %p for Txn: %p, Sessn: 0x%llx",
- txn_req, txn, (unsigned long long)txn->session_id);
+ MGMTD_TXN_DBG("Added a new GETDATA req-id: %" PRIu64
+ " txn-id: %" PRIu64 " session-id: %" PRIu64,
+ txn_req->req_id, txn->txn_id, txn->session_id);
break;
case MGMTD_TXN_COMMITCFG_TIMEOUT:
case MGMTD_TXN_CLEANUP:
@@ -517,13 +518,15 @@ static void mgmt_txn_req_free(struct mgmt_txn_req **txn_req)
}
}
req_list = &(*txn_req)->txn->set_cfg_reqs;
- MGMTD_TXN_DBG("Deleting SETCFG Req: %p for Txn: %p",
- *txn_req, (*txn_req)->txn);
+ MGMTD_TXN_DBG("Deleting SETCFG req-id: %" PRIu64
+ " txn-id: %" PRIu64,
+ (*txn_req)->req_id, (*txn_req)->txn->txn_id);
XFREE(MTYPE_MGMTD_TXN_SETCFG_REQ, (*txn_req)->req.set_cfg);
break;
case MGMTD_TXN_PROC_COMMITCFG:
- MGMTD_TXN_DBG("Deleting COMMITCFG Req: %p for Txn: %p",
- *txn_req, (*txn_req)->txn);
+ MGMTD_TXN_DBG("Deleting COMMITCFG req-id: %" PRIu64
+ " txn-id: %" PRIu64,
+ (*txn_req)->req_id, (*txn_req)->txn->txn_id);
FOREACH_MGMTD_BE_CLIENT_ID (id) {
/*
* Send TXN_DELETE to cleanup state for this
@@ -561,8 +564,9 @@ static void mgmt_txn_req_free(struct mgmt_txn_req **txn_req)
->req.get_data->xpaths[indx]);
}
req_list = &(*txn_req)->txn->get_cfg_reqs;
- MGMTD_TXN_DBG("Deleting GETCFG Req: %p for Txn: %p",
- *txn_req, (*txn_req)->txn);
+ MGMTD_TXN_DBG("Deleting GETCFG req-id: %" PRIu64
+ " txn-id: %" PRIu64,
+ (*txn_req)->req_id, (*txn_req)->txn->txn_id);
if ((*txn_req)->req.get_data->reply)
XFREE(MTYPE_MGMTD_TXN_GETDATA_REPLY,
(*txn_req)->req.get_data->reply);
@@ -577,8 +581,9 @@ static void mgmt_txn_req_free(struct mgmt_txn_req **txn_req)
}
pending_list = &(*txn_req)->txn->pending_get_datas;
req_list = &(*txn_req)->txn->get_data_reqs;
- MGMTD_TXN_DBG("Deleting GETDATA Req: %p for Txn: %p",
- *txn_req, (*txn_req)->txn);
+ MGMTD_TXN_DBG("Deleting GETDATA req-id: %" PRIu64
+ " txn-id: %" PRIu64,
+ (*txn_req)->req_id, (*txn_req)->txn->txn_id);
if ((*txn_req)->req.get_data->reply)
XFREE(MTYPE_MGMTD_TXN_GETDATA_REPLY,
(*txn_req)->req.get_data->reply);
@@ -591,12 +596,16 @@ static void mgmt_txn_req_free(struct mgmt_txn_req **txn_req)
if ((*txn_req)->pending_be_proc && pending_list) {
mgmt_txn_reqs_del(pending_list, *txn_req);
- MGMTD_TXN_DBG("Removed Req: %p from pending-list (left:%d)",
- *txn_req, (int)mgmt_txn_reqs_count(pending_list));
+ MGMTD_TXN_DBG("Removed req-id: %" PRIu64
+ " from pending-list (left:%zu)",
+ (*txn_req)->req_id,
+ mgmt_txn_reqs_count(pending_list));
} else if (req_list) {
mgmt_txn_reqs_del(req_list, *txn_req);
- MGMTD_TXN_DBG("Removed Req: %p from request-list (left:%d)",
- *txn_req, (int)mgmt_txn_reqs_count(req_list));
+ MGMTD_TXN_DBG("Removed req-id: %" PRIu64
+ " from request-list (left:%zu)",
+ (*txn_req)->req_id,
+ mgmt_txn_reqs_count(req_list));
}
(*txn_req)->pending_be_proc = false;
@@ -622,10 +631,10 @@ static void mgmt_txn_process_set_cfg(struct event *thread)
assert(txn);
cmt_stats = mgmt_fe_get_session_commit_stats(txn->session_id);
- MGMTD_TXN_DBG(
- "Processing %d SET_CONFIG requests for Txn:%p Session:0x%llx",
- (int)mgmt_txn_reqs_count(&txn->set_cfg_reqs), txn,
- (unsigned long long)txn->session_id);
+ MGMTD_TXN_DBG("Processing %zu SET_CONFIG requests txn-id:%" PRIu64
+ " session-id: %" PRIu64,
+ mgmt_txn_reqs_count(&txn->set_cfg_reqs), txn->txn_id,
+ txn->session_id);
FOREACH_TXN_REQ_IN_LIST (&txn->set_cfg_reqs, txn_req) {
error = false;
@@ -675,9 +684,10 @@ static void mgmt_txn_process_set_cfg(struct event *thread)
txn_req->req.set_cfg->dst_ds_ctx);
if (ret != 0) {
MGMTD_TXN_ERR(
- "Failed to lock the DS %u for txn: %p session 0x%llx, errstr %s!",
- txn_req->req.set_cfg->dst_ds_id, txn,
- (unsigned long long)txn->session_id,
+ "Failed to lock DS %u txn-id: %" PRIu64
+ " session-id: %" PRIu64 " err: %s",
+ txn_req->req.set_cfg->dst_ds_id,
+ txn->txn_id, txn->session_id,
strerror(ret));
mgmt_txn_send_commit_cfg_reply(
txn, MGMTD_DS_LOCK_FAILED,
@@ -702,8 +712,9 @@ static void mgmt_txn_process_set_cfg(struct event *thread)
txn_req->req_id, MGMTD_SUCCESS, NULL, false)
!= 0) {
MGMTD_TXN_ERR(
- "Failed to send SET_CONFIG_REPLY for txn %p session 0x%llx",
- txn, (unsigned long long)txn->session_id);
+ "Failed to send SET_CONFIG_REPLY txn-id %" PRIu64
+ " session-id: %" PRIu64,
+ txn->txn_id, txn->session_id);
error = true;
}
@@ -751,8 +762,9 @@ static int mgmt_txn_send_commit_cfg_reply(struct mgmt_txn_ctx *txn,
result, error_if_any)
!= 0) {
MGMTD_TXN_ERR(
- "Failed to send COMMIT-CONFIG-REPLY for Txn %p Sessn 0x%llx",
- txn, (unsigned long long)txn->session_id);
+ "Failed to send COMMIT-CONFIG-REPLY txn-id: %" PRIu64
+ " session-id: %" PRIu64,
+ txn->txn_id, txn->session_id);
}
if (txn->commit_cfg_req->req.commit_cfg.implicit && txn->session_id
@@ -763,9 +775,9 @@ static int mgmt_txn_send_commit_cfg_reply(struct mgmt_txn_ctx *txn,
success ? MGMTD_SUCCESS : MGMTD_INTERNAL_ERROR,
error_if_any, true)
!= 0) {
- MGMTD_TXN_ERR(
- "Failed to send SET-CONFIG-REPLY for Txn %p Sessn 0x%llx",
- txn, (unsigned long long)txn->session_id);
+ MGMTD_TXN_ERR("Failed to send SET-CONFIG-REPLY txn-id: %" PRIu64
+ " session-id: %" PRIu64,
+ txn->txn_id, txn->session_id);
}
if (success) {
@@ -862,8 +874,9 @@ mgmt_move_txn_cfg_batch_to_next(struct mgmt_commit_cfg_req *cmtcfg_req,
mgmt_txn_batches_del(src_list, cfg_btch);
if (update_commit_phase) {
- MGMTD_TXN_DBG("Move Txn-Id %p Batch-Id %p from '%s' --> '%s'",
- cfg_btch->txn, cfg_btch,
+ MGMTD_TXN_DBG("Move txn-id %" PRIu64 " batch-id: %" PRIu64
+ " from '%s' --> '%s'",
+ cfg_btch->txn->txn_id, cfg_btch->batch_id,
mgmt_commit_phase2str(cfg_btch->comm_phase),
mgmt_txn_commit_phase_str(cfg_btch->txn, false));
cfg_btch->comm_phase = to_phase;
@@ -895,8 +908,8 @@ mgmt_try_move_commit_to_next_phase(struct mgmt_txn_ctx *txn,
struct mgmt_txn_batches_head *curr_list, *next_list;
enum mgmt_be_client_id id;
- MGMTD_TXN_DBG("Txn-Id %p, Phase(current:'%s' next:'%s')", txn,
- mgmt_txn_commit_phase_str(txn, true),
+ MGMTD_TXN_DBG("txn-id: %" PRIu64 ", Phase(current:'%s' next:'%s')",
+ txn->txn_id, mgmt_txn_commit_phase_str(txn, true),
mgmt_txn_commit_phase_str(txn, false));
/*
@@ -917,9 +930,9 @@ mgmt_try_move_commit_to_next_phase(struct mgmt_txn_ctx *txn,
}
}
- MGMTD_TXN_DBG("Move entire Txn-Id %p from '%s' to '%s'", txn,
- mgmt_txn_commit_phase_str(txn, true),
- mgmt_txn_commit_phase_str(txn, false));
+ MGMTD_TXN_DBG("Move entire txn-id: %" PRIu64 " from '%s' to '%s'",
+ txn->txn_id, mgmt_txn_commit_phase_str(txn, true),
+ mgmt_txn_commit_phase_str(txn, false));
/*
* If we are here, it means all the clients has moved to next phase.
@@ -927,9 +940,9 @@ mgmt_try_move_commit_to_next_phase(struct mgmt_txn_ctx *txn,
*/
cmtcfg_req->curr_phase = cmtcfg_req->next_phase;
cmtcfg_req->next_phase++;
- MGMTD_TXN_DBG(
- "Move back all config batches for Txn %p from next to current branch",
- txn);
+ MGMTD_TXN_DBG("Move back all config batches for txn-id: %" PRIu64
+ " from next to current branch",
+ txn->txn_id);
FOREACH_MGMTD_BE_CLIENT_ID (id) {
curr_list = &cmtcfg_req->curr_batches[id];
next_list = &cmtcfg_req->next_batches[id];
@@ -954,10 +967,11 @@ mgmt_move_be_commit_to_next_phase(struct mgmt_txn_ctx *txn,
cmtcfg_req = &txn->commit_cfg_req->req.commit_cfg;
- MGMTD_TXN_DBG(
- "Move Txn-Id %p for '%s' Phase(current: '%s' next:'%s')", txn,
- adapter->name, mgmt_txn_commit_phase_str(txn, true),
- mgmt_txn_commit_phase_str(txn, false));
+ MGMTD_TXN_DBG("Move txn-id: %" PRIu64
+ " for '%s' Phase(current: '%s' next:'%s')",
+ txn->txn_id, adapter->name,
+ mgmt_txn_commit_phase_str(txn, true),
+ mgmt_txn_commit_phase_str(txn, false));
MGMTD_TXN_DBG(
"Move all config batches for '%s' from current to next list",
@@ -967,9 +981,9 @@ mgmt_move_be_commit_to_next_phase(struct mgmt_txn_ctx *txn,
mgmt_move_txn_cfg_batches(txn, cmtcfg_req, curr_list, next_list, true,
cmtcfg_req->next_phase);
- MGMTD_TXN_DBG("Txn-Id %p, Phase(current:'%s' next:'%s')", txn,
- mgmt_txn_commit_phase_str(txn, true),
- mgmt_txn_commit_phase_str(txn, false));
+ MGMTD_TXN_DBG("txn-id: %" PRIu64 ", Phase(current:'%s' next:'%s')",
+ txn->txn_id, mgmt_txn_commit_phase_str(txn, true),
+ mgmt_txn_commit_phase_str(txn, false));
/*
* Check if all clients has moved to next phase or not.
@@ -1095,11 +1109,13 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req,
cmtcfg_req->subscr_info.xpath_subscr[id].subscribed |=
subscr_info.xpath_subscr[id].subscribed;
MGMTD_TXN_DBG(
- " -- %s, {V:%d, N:%d}, Batch: %p, Item:%d",
+ " -- %s, {V:%d, N:%d}, batch-id: %" PRIu64
+ " item:%d",
adapter->name,
subscr_info.xpath_subscr[id].validate_config,
subscr_info.xpath_subscr[id].notify_config,
- cfg_btch, (int)cfg_btch->num_cfg_data);
+ cfg_btch->batch_id,
+ (int)cfg_btch->num_cfg_data);
cfg_btch->num_cfg_data++;
num_chgs++;
@@ -1358,11 +1374,11 @@ static int mgmt_txn_send_be_txn_create(struct mgmt_txn_ctx *txn)
* come back.
*/
- MGMTD_TXN_DBG(
- "Txn:%p Session:0x%llx, Phase(Current:'%s', Next: '%s')", txn,
- (unsigned long long)txn->session_id,
- mgmt_txn_commit_phase_str(txn, true),
- mgmt_txn_commit_phase_str(txn, false));
+ MGMTD_TXN_DBG("txn-id: %" PRIu64 " session-id: %" PRIu64
+ " Phase(Current:'%s', Next: '%s')",
+ txn->txn_id, txn->session_id,
+ mgmt_txn_commit_phase_str(txn, true),
+ mgmt_txn_commit_phase_str(txn, false));
return 0;
}
@@ -1399,8 +1415,9 @@ mgmt_txn_send_be_cfg_data(struct mgmt_txn_ctx *txn,
txn, MGMTD_INTERNAL_ERROR,
"Internal Error! Could not send config data to backend!");
MGMTD_TXN_ERR(
- "Could not send CFGDATA_CREATE for Txn %p Batch %p to client '%s",
- txn, cfg_btch, adapter->name);
+ "Could not send CFGDATA_CREATE txn-id: %" PRIu64
+ " batch-id: %" PRIu64 " to client '%s",
+ txn->txn_id, cfg_btch->batch_id, adapter->name);
return -1;
}
@@ -1457,9 +1474,8 @@ static void mgmt_txn_cfg_commit_timedout(struct event *thread)
if (!txn->commit_cfg_req)
return;
- MGMTD_TXN_ERR(
- "Backend operations for Config Txn %p has timedout! Aborting commit!!",
- txn);
+ MGMTD_TXN_ERR("Backend timeout txn-id: %" PRIu64 " aborting commit",
+ txn->txn_id);
/*
* Send a COMMIT_CONFIG_REPLY with failure.
@@ -1543,11 +1559,12 @@ static void mgmt_txn_process_commit_cfg(struct event *thread)
txn = (struct mgmt_txn_ctx *)EVENT_ARG(thread);
assert(txn);
- MGMTD_TXN_DBG(
- "Processing COMMIT_CONFIG for Txn:%p Session:0x%llx, Phase(Current:'%s', Next: '%s')",
- txn, (unsigned long long)txn->session_id,
- mgmt_txn_commit_phase_str(txn, true),
- mgmt_txn_commit_phase_str(txn, false));
+ MGMTD_TXN_DBG("Processing COMMIT_CONFIG for txn-id: %" PRIu64
+ " session-id: %" PRIu64
+ " Phase(Current:'%s', Next: '%s')",
+ txn->txn_id, txn->session_id,
+ mgmt_txn_commit_phase_str(txn, true),
+ mgmt_txn_commit_phase_str(txn, false));
assert(txn->commit_cfg_req);
cmtcfg_req = &txn->commit_cfg_req->req.commit_cfg;
@@ -1575,13 +1592,15 @@ static void mgmt_txn_process_commit_cfg(struct event *thread)
#ifndef MGMTD_LOCAL_VALIDATIONS_ENABLED
assert(cmtcfg_req->next_phase == MGMTD_COMMIT_PHASE_APPLY_CFG);
MGMTD_TXN_DBG(
- "Txn:%p Session:0x%llx, trigger sending CFG_VALIDATE_REQ to all backend clients",
- txn, (unsigned long long)txn->session_id);
+ "txn-id: %" PRIu64 " session-id: %" PRIu64
+ " trigger sending CFG_VALIDATE_REQ to all backend clients",
+ txn->txn_id, txn->session_id);
#else /* ifndef MGMTD_LOCAL_VALIDATIONS_ENABLED */
assert(cmtcfg_req->next_phase == MGMTD_COMMIT_PHASE_APPLY_CFG);
MGMTD_TXN_DBG(
- "Txn:%p Session:0x%llx, trigger sending CFG_APPLY_REQ to all backend clients",
- txn, (unsigned long long)txn->session_id);
+ "txn-id: %" PRIu64 " session-id: %" PRIu64
+ " trigger sending CFG_APPLY_REQ to all backend clients",
+ txn->txn_id, txn->session_id);
#endif /* ifndef MGMTD_LOCAL_VALIDATIONS_ENABLED */
break;
case MGMTD_COMMIT_PHASE_APPLY_CFG:
@@ -1613,11 +1632,11 @@ static void mgmt_txn_process_commit_cfg(struct event *thread)
break;
}
- MGMTD_TXN_DBG(
- "Txn:%p Session:0x%llx, Phase updated to (Current:'%s', Next: '%s')",
- txn, (unsigned long long)txn->session_id,
- mgmt_txn_commit_phase_str(txn, true),
- mgmt_txn_commit_phase_str(txn, false));
+ MGMTD_TXN_DBG("txn-id:%" PRIu64 " session-id: %" PRIu64
+ " phase updated to (current:'%s', next: '%s')",
+ txn->txn_id, txn->session_id,
+ mgmt_txn_commit_phase_str(txn, true),
+ mgmt_txn_commit_phase_str(txn, false));
}
static void mgmt_init_get_data_reply(struct mgmt_get_data_reply *get_reply)
@@ -1678,9 +1697,8 @@ static void mgmt_txn_send_getcfg_reply_data(struct mgmt_txn_req *txn_req,
data_reply->next_indx =
(!get_reply->last_batch ? get_req->total_reply : -1);
- MGMTD_TXN_DBG("Sending %d Get-Config/Data replies (next-idx:%lld)",
- (int) data_reply->n_data,
- (long long)data_reply->next_indx);
+ MGMTD_TXN_DBG("Sending %zu Get-Config/Data replies next-index:%" PRId64,
+ data_reply->n_data, data_reply->next_indx);
switch (txn_req->req_event) {
case MGMTD_TXN_PROC_GETCFG:
@@ -1690,10 +1708,10 @@ static void mgmt_txn_send_getcfg_reply_data(struct mgmt_txn_req *txn_req,
data_reply, NULL)
!= 0) {
MGMTD_TXN_ERR(
- "Failed to send GET-CONFIG-REPLY for Txn %p, Sessn: 0x%llx, Req: %llu",
- txn_req->txn,
- (unsigned long long)txn_req->txn->session_id,
- (unsigned long long)txn_req->req_id);
+ "Failed to send GET-CONFIG-REPLY txn-id: %" PRIu64
+ " session-id: %" PRIu64 " req-id: %" PRIu64,
+ txn_req->txn->txn_id, txn_req->txn->session_id,
+ txn_req->req_id);
}
break;
case MGMTD_TXN_PROC_GETDATA:
@@ -1703,10 +1721,10 @@ static void mgmt_txn_send_getcfg_reply_data(struct mgmt_txn_req *txn_req,
data_reply, NULL)
!= 0) {
MGMTD_TXN_ERR(
- "Failed to send GET-DATA-REPLY for Txn %p, Sessn: 0x%llx, Req: %llu",
- txn_req->txn,
- (unsigned long long)txn_req->txn->session_id,
- (unsigned long long)txn_req->req_id);
+ "Failed to send GET-DATA-REPLY txn-id: %" PRIu64
+ " session-id: %" PRIu64 " req-id: %" PRIu64,
+ txn_req->txn->txn_id, txn_req->txn->session_id,
+ txn_req->req_id);
}
break;
case MGMTD_TXN_PROC_SETCFG:
@@ -1846,10 +1864,10 @@ static void mgmt_txn_process_get_cfg(struct event *thread)
txn = (struct mgmt_txn_ctx *)EVENT_ARG(thread);
assert(txn);
- MGMTD_TXN_DBG(
- "Processing %d GET_CONFIG requests for Txn:%p Session:0x%llx",
- (int)mgmt_txn_reqs_count(&txn->get_cfg_reqs), txn,
- (unsigned long long)txn->session_id);
+ MGMTD_TXN_DBG("Processing %zu GET_CONFIG requests txn-id: %" PRIu64
+ " session-id: %" PRIu64,
+ mgmt_txn_reqs_count(&txn->get_cfg_reqs), txn->txn_id,
+ txn->session_id);
FOREACH_TXN_REQ_IN_LIST (&txn->get_cfg_reqs, txn_req) {
error = false;
@@ -1867,10 +1885,10 @@ static void mgmt_txn_process_get_cfg(struct event *thread)
if (mgmt_txn_get_config(txn, txn_req, ds_ctx) != 0) {
MGMTD_TXN_ERR(
- "Unable to retrieve Config from DS %d for Txn %p, Sessn: 0x%llx, Req: %llu!",
- txn_req->req.get_data->ds_id, txn,
- (unsigned long long)txn->session_id,
- (unsigned long long)txn_req->req_id);
+ "Unable to retrieve config from DS %d txn-id: %" PRIu64
+ " session-id: %" PRIu64 " req-id: %" PRIu64,
+ txn_req->req.get_data->ds_id, txn->txn_id,
+ txn->session_id, txn_req->req_id);
error = true;
}
@@ -1913,10 +1931,10 @@ static void mgmt_txn_process_get_data(struct event *thread)
txn = (struct mgmt_txn_ctx *)EVENT_ARG(thread);
assert(txn);
- MGMTD_TXN_DBG(
- "Processing %d GET_DATA requests for Txn:%p Session:0x%llx",
- (int)mgmt_txn_reqs_count(&txn->get_data_reqs), txn,
- (unsigned long long)txn->session_id);
+ MGMTD_TXN_DBG("Processing %zu GET_DATA requests txn-id: %" PRIu64
+ " session-id: %" PRIu64,
+ mgmt_txn_reqs_count(&txn->get_data_reqs), txn->txn_id,
+ txn->session_id);
FOREACH_TXN_REQ_IN_LIST (&txn->get_data_reqs, txn_req) {
error = false;
@@ -1936,10 +1954,12 @@ static void mgmt_txn_process_get_data(struct event *thread)
if (mgmt_txn_get_config(txn, txn_req, ds_ctx)
!= 0) {
MGMTD_TXN_ERR(
- "Unable to retrieve Config from DS %d for Txn %p, Sessn: 0x%llx, Req: %llu!",
- txn_req->req.get_data->ds_id, txn,
- (unsigned long long)txn->session_id,
- (unsigned long long)txn_req->req_id);
+ "Unable to retrieve config from DS %d txn-id %" PRIu64
+ " session-id: %" PRIu64
+ " req-id: %" PRIu64,
+ txn_req->req.get_data->ds_id,
+ txn->txn_id, txn->session_id,
+ txn_req->req_id);
error = true;
}
} else {
@@ -2032,8 +2052,8 @@ static struct mgmt_txn_ctx *mgmt_txn_create_new(uint64_t session_id,
txn->txn_id = mgmt_txn_mm->next_txn_id++;
hash_get(mgmt_txn_mm->txn_hash, txn, hash_alloc_intern);
- MGMTD_TXN_DBG("Added new '%s' MGMTD Transaction '%p'",
- mgmt_txn_type2str(type), txn);
+ MGMTD_TXN_DBG("Added new '%s' txn-id: %" PRIu64,
+ mgmt_txn_type2str(type), txn->txn_id);
if (type == MGMTD_TXN_TYPE_CONFIG)
mgmt_txn_mm->cfg_txn = txn;
@@ -2113,8 +2133,9 @@ static void mgmt_txn_lock(struct mgmt_txn_ctx *txn, const char *file,
int line)
{
txn->refcount++;
- MGMTD_TXN_DBG("%s:%d --> Lock %s Txn %p, Count: %d", file, line,
- mgmt_txn_type2str(txn->type), txn, txn->refcount);
+ MGMTD_TXN_DBG("%s:%d --> Lock %s txn-id: %" PRIu64 " refcnt: %d", file,
+ line, mgmt_txn_type2str(txn->type), txn->txn_id,
+ txn->refcount);
}
static void mgmt_txn_unlock(struct mgmt_txn_ctx **txn, const char *file,
@@ -2123,9 +2144,9 @@ static void mgmt_txn_unlock(struct mgmt_txn_ctx **txn, const char *file,
assert(*txn && (*txn)->refcount);
(*txn)->refcount--;
- MGMTD_TXN_DBG("%s:%d --> Unlock %s Txn %p, Count: %d", file, line,
- mgmt_txn_type2str((*txn)->type), *txn,
- (*txn)->refcount);
+ MGMTD_TXN_DBG("%s:%d --> Unlock %s txn-id: %" PRIu64 " refcnt: %d",
+ file, line, mgmt_txn_type2str((*txn)->type),
+ (*txn)->txn_id, (*txn)->refcount);
if (!(*txn)->refcount) {
if ((*txn)->type == MGMTD_TXN_TYPE_CONFIG)
if (mgmt_txn_mm->cfg_txn == *txn)
@@ -2137,9 +2158,10 @@ static void mgmt_txn_unlock(struct mgmt_txn_ctx **txn, const char *file,
hash_release(mgmt_txn_mm->txn_hash, *txn);
mgmt_txns_del(&mgmt_txn_mm->txn_list, *txn);
- MGMTD_TXN_DBG("Deleted %s Txn %p for Sessn: 0x%llx",
- mgmt_txn_type2str((*txn)->type), *txn,
- (unsigned long long)(*txn)->session_id);
+ MGMTD_TXN_DBG("Deleted %s txn-id: %" PRIu64
+ " session-id: %" PRIu64,
+ mgmt_txn_type2str((*txn)->type), (*txn)->txn_id,
+ (*txn)->session_id);
XFREE(MTYPE_MGMTD_TXN, *txn);
}
@@ -2373,9 +2395,9 @@ int mgmt_txn_send_commit_config_req(uint64_t txn_id, uint64_t req_id,
return -1;
if (txn->commit_cfg_req) {
- MGMTD_TXN_ERR(
- "A commit is already in-progress for Txn %p, session 0x%llx. Cannot start another!",
- txn, (unsigned long long)txn->session_id);
+ MGMTD_TXN_ERR("Commit already in-progress txn-id: %" PRIu64
+ " session-id: %" PRIu64 ". Cannot start another",
+ txn->txn_id, txn->session_id);
return -1;
}
@@ -2430,8 +2452,8 @@ int mgmt_txn_notify_be_adapter_conn(struct mgmt_be_client_adapter *adapter,
return -1;
}
- MGMTD_TXN_DBG("Created initial txn %" PRIu64
- " for BE connection %s",
+ MGMTD_TXN_DBG("Created initial txn-id: %" PRIu64
+ " for BE client '%s'",
txn->txn_id, adapter->name);
/*
* Set the changeset for transaction to commit and trigger the
@@ -2548,8 +2570,9 @@ int mgmt_txn_notify_be_cfgdata_reply(
if (!success) {
MGMTD_TXN_ERR(
- "CFGDATA_CREATE_REQ sent to '%s' failed for Txn %p, Batch %p, Err: %s",
- adapter->name, txn, cfg_btch,
+ "CFGDATA_CREATE_REQ sent to '%s' failed txn-id: %" PRIu64
+ " batch-id %" PRIu64 " err: %s",
+ adapter->name, txn->txn_id, cfg_btch->batch_id,
error_if_any ? error_if_any : "None");
mgmt_txn_send_commit_cfg_reply(
txn, MGMTD_INTERNAL_ERROR,
@@ -2559,8 +2582,9 @@ int mgmt_txn_notify_be_cfgdata_reply(
}
MGMTD_TXN_DBG(
- "CFGDATA_CREATE_REQ sent to '%s' was successful for Txn %p, Batch %p, Err: %s",
- adapter->name, txn, cfg_btch,
+ "CFGDATA_CREATE_REQ sent to '%s' was successful txn-id: %" PRIu64
+ " batch-id %" PRIu64 " err: %s",
+ adapter->name, txn->txn_id, cfg_btch->batch_id,
error_if_any ? error_if_any : "None");
mgmt_move_txn_cfg_batch_to_next(
cmtcfg_req, cfg_btch, &cmtcfg_req->curr_batches[adapter->id],
@@ -2591,9 +2615,10 @@ int mgmt_txn_notify_be_cfg_apply_reply(uint64_t txn_id, bool success,
if (!success) {
MGMTD_TXN_ERR(
- "CFGDATA_APPLY_REQ sent to '%s' failed for Txn %p, Batches [0x%llx - 0x%llx], Err: %s",
- adapter->name, txn, (unsigned long long)batch_ids[0],
- (unsigned long long)batch_ids[num_batch_ids - 1],
+ "CFGDATA_APPLY_REQ sent to '%s' failed txn-id: %" PRIu64
+ " batch ids %" PRIu64 " - %" PRIu64 " err: %s",
+ adapter->name, txn->txn_id, batch_ids[0],
+ batch_ids[num_batch_ids - 1],
error_if_any ? error_if_any : "None");
mgmt_txn_send_commit_cfg_reply(
txn, MGMTD_INTERNAL_ERROR,
@@ -2640,9 +2665,9 @@ int mgmt_txn_send_commit_config_reply(uint64_t txn_id,
return -1;
if (!txn->commit_cfg_req) {
- MGMTD_TXN_ERR(
- "NO commit in-progress for Txn %p, session 0x%llx!",
- txn, (unsigned long long)txn->session_id);
+ MGMTD_TXN_ERR("NO commit in-progress txn-id: %" PRIu64
+ " session-id: %" PRIu64,
+ txn->txn_id, txn->session_id);
return -1;
}
@@ -2718,11 +2743,10 @@ void mgmt_txn_status_write(struct vty *vty)
vty_out(vty, "MGMTD Transactions\n");
FOREACH_TXN_IN_LIST (mgmt_txn_mm, txn) {
- vty_out(vty, " Txn: \t\t\t%p\n", txn);
- vty_out(vty, " Txn-Id: \t\t\t%llu\n",
- (unsigned long long)txn->txn_id);
- vty_out(vty, " Session-Id: \t\t%llu\n",
- (unsigned long long)txn->session_id);
+ vty_out(vty, " Txn: \t\t\t0x%p\n", txn);
+ vty_out(vty, " Txn-Id: \t\t\t%" PRIu64 "\n", txn->txn_id);
+ vty_out(vty, " Session-Id: \t\t%" PRIu64 "\n",
+ txn->session_id);
vty_out(vty, " Type: \t\t\t%s\n",
mgmt_txn_type2str(txn->type));
vty_out(vty, " Ref-Count: \t\t\t%d\n", txn->refcount);
@@ -2771,7 +2795,7 @@ int mgmt_txn_rollback_trigger_cfg_apply(struct mgmt_ds_ctx *src_ds_ctx,
return -1;
}
- MGMTD_TXN_DBG("Created rollback txn %" PRIu64, txn->txn_id);
+ MGMTD_TXN_DBG("Created rollback txn-id: %" PRIu64, txn->txn_id);
/*
* Set the changeset for transaction to commit and trigger the commit