Skip to content

Commit

Permalink
ggate: Fix ggated/ggatec debug print of offsets.
Browse files Browse the repository at this point in the history
The request offset and length are always unsigned, so print them as
such.

Submitted by:	Yoshihiro Ota <[email protected]>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21388
  • Loading branch information
markjdb committed Sep 9, 2020
1 parent 285385b commit 278847a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
12 changes: 7 additions & 5 deletions sbin/ggate/ggatec/ggatec.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
#include <libgen.h>
#include <pthread.h>
#include <signal.h>
Expand Down Expand Up @@ -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__);
Expand Down Expand Up @@ -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);
Expand Down
17 changes: 9 additions & 8 deletions sbin/ggate/ggated/ggated.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <inttypes.h>
#include <fcntl.h>
#include <libgen.h>
#include <libutil.h>
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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);
Expand Down

0 comments on commit 278847a

Please sign in to comment.