From 278847ae582869752001b85d09c15e1b390d7543 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 9 Sep 2020 12:58:19 +0000 Subject: [PATCH] ggate: Fix ggated/ggatec debug print of offsets. The request offset and length are always unsigned, so print them as such. Submitted by: Yoshihiro Ota MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21388 --- sbin/ggate/ggatec/ggatec.c | 12 +++++++----- sbin/ggate/ggated/ggated.c | 17 +++++++++-------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/sbin/ggate/ggatec/ggatec.c b/sbin/ggate/ggatec/ggatec.c index a2aa49e2b362..45a93c4512fe 100644 --- a/sbin/ggate/ggatec/ggatec.c +++ b/sbin/ggate/ggatec/ggatec.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -174,8 +175,9 @@ send_thread(void *arg __unused) pthread_kill(recvtd, SIGUSR1); break; } - g_gate_log(LOG_DEBUG, "Sent %zd bytes (offset=%llu, " - "size=%u).", data, hdr.gh_offset, hdr.gh_length); + g_gate_log(LOG_DEBUG, "Sent %zd bytes (offset=%" + PRIu64 ", length=%" PRIu32 ").", data, + hdr.gh_offset, hdr.gh_length); } } g_gate_log(LOG_DEBUG, "%s: Died.", __func__); @@ -229,9 +231,9 @@ recv_thread(void *arg __unused) pthread_kill(sendtd, SIGUSR1); break; } - g_gate_log(LOG_DEBUG, "Received %d bytes (offset=%ju, " - "size=%zu).", data, (uintmax_t)hdr.gh_offset, - (size_t)hdr.gh_length); + g_gate_log(LOG_DEBUG, "Received %d bytes (offset=%" + PRIu64 ", length=%" PRIu32 ").", data, + hdr.gh_offset, hdr.gh_length); } g_gate_ioctl(G_GATE_CMD_DONE, &ggio); diff --git a/sbin/ggate/ggated/ggated.c b/sbin/ggate/ggated/ggated.c index 138273349268..226ba1ce72de 100644 --- a/sbin/ggate/ggated/ggated.c +++ b/sbin/ggate/ggated/ggated.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -662,8 +663,8 @@ recv_thread(void *arg) g_gate_log(LOG_DEBUG, "Received hdr packet."); g_gate_swap2h_hdr(&req->r_hdr); - g_gate_log(LOG_DEBUG, "%s: offset=%jd length=%u", __func__, - (intmax_t)req->r_offset, (unsigned)req->r_length); + g_gate_log(LOG_DEBUG, "%s: offset=%" PRIu64 " length=%" PRIu32, + __func__, req->r_offset, req->r_length); /* * Allocate memory for data. @@ -730,8 +731,8 @@ disk_thread(void *arg) assert((req->r_offset % conn->c_sectorsize) == 0); assert((req->r_length % conn->c_sectorsize) == 0); - g_gate_log(LOG_DEBUG, "%s: offset=%jd length=%u", __func__, - (intmax_t)req->r_offset, (unsigned)req->r_length); + g_gate_log(LOG_DEBUG, "%s: offset=%" PRIu64 " length=%" PRIu32, + __func__, req->r_offset, req->r_length); /* * Do the request. @@ -804,8 +805,8 @@ send_thread(void *arg) error = pthread_mutex_unlock(&outqueue_mtx); assert(error == 0); - g_gate_log(LOG_DEBUG, "%s: offset=%jd length=%u", __func__, - (intmax_t)req->r_offset, (unsigned)req->r_length); + g_gate_log(LOG_DEBUG, "%s: offset=%" PRIu64 " length=%" PRIu32, + __func__, req->r_offset, req->r_length); /* * Send the request. @@ -824,8 +825,8 @@ send_thread(void *arg) strerror(errno)); } g_gate_log(LOG_DEBUG, - "Sent %zd bytes (offset=%ju, size=%zu).", data, - (uintmax_t)req->r_offset, (size_t)req->r_length); + "Sent %zd bytes (offset=%" PRIu64 ", size=%" PRIu32 + ").", data, req->r_offset, req->r_length); free(req->r_data); } free(req);