Commit b9543c76 authored by Aurelio Colosimo's avatar Aurelio Colosimo

diagnostic: removed some old-style PP_PRINTF and PP_VPRINTF

Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent 6ab4378a
......@@ -60,7 +60,7 @@ void posix_main_loop(struct pp_globals *ppg)
ppi->last_rcv_time.seconds += DSPRO(ppi)->currentUtcOffset;
if (i < PP_MINIMUM_LENGTH) {
PP_PRINTF("Error or short packet: %d < %d\n", i,
pp_diag(ppi, frames, 1, "Error or short packet: %d < %d\n", i,
PP_MINIMUM_LENGTH
);
delay_ms = -1;
......
......@@ -252,7 +252,8 @@ static int posix_open_ch(struct pp_instance *ppi, char *ifname, int chtype)
iface_addr.s_addr =
((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
PP_VPRINTF("Local IP address used : %s\n", inet_ntoa(iface_addr));
pp_diag(ppi, frames, 2, "Local IP address used : %s\n",
inet_ntoa(iface_addr));
temp = 1; /* allow address reuse */
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
......@@ -341,14 +342,14 @@ int posix_net_init(struct pp_instance *ppi)
pp_prepare_pointers(ppi);
if (ppi->ethernet_mode) {
PP_PRINTF("posix_net_init IEEE 802.3\n");
pp_diag(ppi, frames, 1, "posix_net_init IEEE 802.3\n");
/* raw sockets implementation always use gen socket */
return posix_open_ch(ppi, ppi->iface_name, PP_NP_GEN);
}
/* else: UDP */
PP_PRINTF("posix_net_init UDP\n");
pp_diag(ppi, frames, 1, "posix_net_init UDP\n");
for (i = PP_NP_GEN; i <= PP_NP_EVT; i++) {
if (posix_open_ch(ppi, ppi->iface_name, i))
return -1;
......
......@@ -11,7 +11,7 @@
static void clock_fatal_error(char *context)
{
PP_PRINTF("failure in \"%s\": %s\n.Exiting.\n", context,
pp_error("failure in \"%s\": %s\n.Exiting.\n", context,
strerror(errno));
exit(1);
}
......
......@@ -82,8 +82,8 @@ static int wrpc_net_send(struct pp_instance *ppi, void *pkt, int len,
t->phase = 0;
t->correct = wr_ts.correct;
PP_VPRINTF("%s: snt=%d, sec=%d, nsec=%d\n", __func__, snt,
t->seconds, t->nanoseconds);
pp_diag(ppi, frames, 2, "%s: snt=%d, sec=%d, nsec=%d\n",
__func__, snt, t->seconds, t->nanoseconds);
}
/* The header is separate, so dump payload only */
if (snt >0 && pp_diag_allow(ppi, frames, 2))
......
......@@ -139,14 +139,14 @@ static int bare_net_init(struct pp_instance *ppi)
pp_prepare_pointers(ppi);
if (ppi->ethernet_mode) {
PP_PRINTF("bare_net_init IEEE 802.3\n");
pp_diag(ppi, frames, 1, "bare_net_init IEEE 802.3\n");
/* raw sockets implementation always use gen socket */
return bare_open_ch(ppi, ppi->iface_name);
}
/* else: UDP -- not supported */
PP_PRINTF("bare_net_init UDP\n");
pp_diag(ppi, frames, 1, "bare_net_init UDP\n");
return -1;
}
......
......@@ -9,7 +9,7 @@ static int bare_time_get(struct pp_instance *ppi, TimeInternal *t)
struct bare_timeval tv;
if (sys_gettimeofday(&tv, NULL) < 0) {
PP_PRINTF("gettimeofday error");
pp_error("%s:", __func__);
sys_exit(1);
}
t->seconds = tv.tv_sec;
......@@ -28,7 +28,7 @@ static int bare_time_set(struct pp_instance *ppi, TimeInternal *t)
tv.tv_usec = t->nanoseconds / 1000;
if (sys_settimeofday(&tv, NULL) < 0) {
PP_PRINTF("settimeofday error");
pp_error("%s:", __func__);
sys_exit(1);
}
pp_diag(ppi, time, 1, "%s: %9li.%06li\n", __func__, tv.tv_sec,
......
......@@ -55,9 +55,9 @@ int wr_calibration(struct pp_instance *ppi, unsigned char *pkt, int plen)
0xFFFFFFFF & (((uint64_t)delta) >> 16);
WR_DSPOR(ppi)->deltaTx.scaledPicoseconds.lsb =
0xFFFFFFFF & (((uint64_t)delta) << 16);
PP_PRINTF("Tx=>>scaledPicoseconds.msb = 0x%x\n",
pp_diag(ppi, ext, 1, "Tx=>>scaledPicoseconds.msb = 0x%x\n",
WR_DSPOR(ppi)->deltaTx.scaledPicoseconds.msb);
PP_PRINTF("Tx=>>scaledPicoseconds.lsb = 0x%x\n",
pp_diag(ppi, ext, 1, "Tx=>>scaledPicoseconds.lsb = 0x%x\n",
WR_DSPOR(ppi)->deltaTx.scaledPicoseconds.lsb);
WR_DSPOR(ppi)->wrPortState = WRS_CALIBRATION_3;
......@@ -92,14 +92,14 @@ int wr_calibration(struct pp_instance *ppi, unsigned char *pkt, int plen)
/* wait until Rx calibration is finished */
if (wr_calibrating_poll(ppi, WR_HW_CALIB_RX, &delta) ==
WR_HW_CALIB_READY) {
PP_PRINTF("Rx fixed delay = %d\n", (int)delta);
pp_diag(ppi, ext, 1, "Rx fixed delay = %d\n", (int)delta);
WR_DSPOR(ppi)->deltaRx.scaledPicoseconds.msb =
0xFFFFFFFF & (delta >> 16);
WR_DSPOR(ppi)->deltaRx.scaledPicoseconds.lsb =
0xFFFFFFFF & (delta << 16);
PP_PRINTF("Rx=>>scaledPicoseconds.msb = 0x%x\n",
pp_diag(ppi, ext, 1, "Rx=>>scaledPicoseconds.msb = 0x%x\n",
WR_DSPOR(ppi)->deltaRx.scaledPicoseconds.msb);
PP_PRINTF("Rx=>>scaledPicoseconds.lsb = 0x%x\n",
pp_diag(ppi, ext, 1, "Rx=>>scaledPicoseconds.lsb = 0x%x\n",
WR_DSPOR(ppi)->deltaRx.scaledPicoseconds.lsb);
WR_DSPOR(ppi)->wrPortState = WRS_CALIBRATION_7;
......
......@@ -112,7 +112,8 @@ int msg_pack_wrsig(struct pp_instance *ppi, Enumeration16 wr_msg_id)
UInteger16 len = 0;
if ((WR_DSPOR(ppi)->wrMode == NON_WR) || (wr_msg_id == ANN_SUFIX)) {
PP_PRINTF("BUG: Trying to send invalid wr_msg mode=%x id=%x",
pp_diag(ppi, frames, 1,
"BUG: Trying to send invalid wr_msg mode=%x id=%x",
WR_DSPOR(ppi)->wrMode, wr_msg_id);
return 0;
}
......@@ -204,25 +205,25 @@ void msg_unpack_wrsig(struct pp_instance *ppi, void *buf,
tlv_versionNumber = 0xFF & htons(*(UInteger16 *)(buf + 52));
if (tlv_type != TLV_TYPE_ORG_EXTENSION) {
PP_PRINTF("handle Signaling msg, failed, This is not "
pp_diag(ppi, frames, 1, "handle Signaling msg, failed, This is not "
"organization extension TLV = 0x%x\n", tlv_type);
return;
}
if (tlv_organizationID != WR_TLV_ORGANIZATION_ID) {
PP_PRINTF("handle Signaling msg, failed, not CERN's "
pp_diag(ppi, frames, 1, "handle Signaling msg, failed, not CERN's "
"OUI = 0x%x\n", tlv_organizationID);
return;
}
if (tlv_magicNumber != WR_TLV_MAGIC_NUMBER) {
PP_PRINTF("handle Signaling msg, failed, "
pp_diag(ppi, frames, 1, "handle Signaling msg, failed, "
"not White Rabbit magic number = 0x%x\n", tlv_magicNumber);
return;
}
if (tlv_versionNumber != WR_TLV_WR_VERSION_NUMBER ) {
PP_PRINTF("handle Signaling msg, failed, not supported "
pp_diag(ppi, frames, 1, "handle Signaling msg, failed, not supported "
"version number = 0x%x\n", tlv_versionNumber);
return;
}
......
......@@ -45,7 +45,7 @@ int from_TimeInternal(TimeInternal *internal, Timestamp *external)
if ((internal->seconds & ~INT_MAX) ||
(internal->nanoseconds & ~INT_MAX)) {
PP_PRINTF("Error: Negative value cannot be converted into "
pp_error("Negative value cannot be converted into "
"timestamp\n");
return -1;
} else {
......@@ -64,7 +64,7 @@ int to_TimeInternal(TimeInternal *internal, Timestamp *external)
internal->nanoseconds = external->nanosecondsField;
return 0;
} else {
PP_PRINTF("to_TimeInternal: "
pp_error("to_TimeInternal: "
"seconds field is higher than signed integer (32bits)\n");
return -1;
}
......@@ -111,7 +111,7 @@ void div2_TimeInternal(TimeInternal *r)
void display_TimeInternal(const char *label, TimeInternal *t)
{
PP_VPRINTF("%s: %s%d.%09d\n", label,
pp_Vprintf("%s: %s%d.%09d\n", label,
(t->seconds < 0 || (t->seconds == 0 && t->nanoseconds < 0))
? "-" : " ",
abs(t->seconds), abs(t->nanoseconds));
......
......@@ -95,7 +95,7 @@ static void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
msg_copy_header(&GLBS(ppi)->frgn_master[i].hdr, hdr);
msg_unpack_announce(buf, &GLBS(ppi)->frgn_master[i].ann);
PP_VPRINTF("New foreign Master added\n");
pp_diag(ppi, bmc, 2, "New foreign Master added\n");
GLBS(ppi)->frgn_rec_i = (GLBS(ppi)->frgn_rec_i+1) %
PP_NR_FOREIGN_RECORDS;
......@@ -215,7 +215,7 @@ int st_com_master_handle_announce(struct pp_instance *ppi, unsigned char *buf,
if (len < PP_ANNOUNCE_LENGTH)
return -1;
PP_VPRINTF("Announce message from another foreign master\n");
pp_diag(ppi, bmc, 2, "Announce message from another foreign master\n");
st_com_add_foreign(ppi, buf);
ppi->next_state = bmc(ppi); /* got a new announce: run bmc */
......
......@@ -12,7 +12,7 @@
int pp_faulty(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
PP_PRINTF("Faulty state detected\n");
pp_diag(ppi, fsm, 1, "Faulty state detected\n");
ppi->next_state = PPS_INITIALIZING;
return 0;
}
......@@ -46,12 +46,12 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (pp_hooks.init)
ret = pp_hooks.init(ppi, pkt, plen);
if (ret) {
PP_PRINTF("%s: can't init extension\n", __func__);
pp_diag(ppi, ext, 1, "%s: can't init extension\n", __func__);
goto failure;
}
if (ret) {
PP_PRINTF("%s: can't init timers\n", __func__);
pp_diag(ppi, time, 1, "%s: can't init timers\n", __func__);
goto failure;
}
pp_init_clock(ppi);
......
......@@ -87,7 +87,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
hdr->logMessageInterval;
} else {
PP_VPRINTF("pp_slave : "
pp_diag(ppi, frames, 2, "pp_slave : "
"Delay Resp doesn't match Delay Req\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment