On Fri, Dec 07, 2018 at 10:00:42AM -0600, Eric Blake wrote:
Use new 'name_of_*' functions to offer a bit more details
about
messages being forwarded on to the remote server.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
plugins/nbd/nbd.c | 8 +++++---
plugins/nbd/Makefile.am | 3 ++-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c
index 672f35b..6bd8861 100644
--- a/plugins/nbd/nbd.c
+++ b/plugins/nbd/nbd.c
@@ -267,8 +267,9 @@ nbd_request_raw (struct handle *h, uint16_t flags, uint16_t type,
int r;
pthread_mutex_lock (&h->write_lock);
- nbdkit_debug ("sending request with type %d and cookie %#" PRIx64, type,
- cookie);
+ nbdkit_debug ("sending request type %d (%s), flags %#x, offset %#" PRIx64
+ ", count %#x, cookie %#" PRIx64, type, name_of_nbd_cmd(type),
+ flags, offset, count, cookie);
r = write_full (h->fd, &req, sizeof req);
if (buf && !r)
r = write_full (h->fd, buf, count);
@@ -353,7 +354,8 @@ nbd_reply_raw (struct handle *h, int *fd)
return nbd_mark_dead (h);
if (be32toh (rep.magic) != NBD_REPLY_MAGIC)
return nbd_mark_dead (h);
- nbdkit_debug ("received reply for cookie %#" PRIx64, rep.handle);
+ nbdkit_debug ("received reply for cookie %#" PRIx64 ", status
%s",
+ rep.handle, name_of_nbd_error(be32toh (rep.error)));
trans = find_trans_by_cookie (h, rep.handle);
if (!trans) {
nbdkit_error ("reply with unexpected cookie %#" PRIx64, rep.handle);
diff --git a/plugins/nbd/Makefile.am b/plugins/nbd/Makefile.am
index e998a28..9f08057 100644
--- a/plugins/nbd/Makefile.am
+++ b/plugins/nbd/Makefile.am
@@ -38,7 +38,8 @@ plugin_LTLIBRARIES = nbdkit-nbd-plugin.la
nbdkit_nbd_plugin_la_SOURCES = \
nbd.c \
- $(top_srcdir)/include/nbdkit-plugin.h
+ $(top_srcdir)/include/nbdkit-plugin.h \
+ $(top_srcdir)/src/protostrings.c
nbdkit_nbd_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/include \
Patch 6/5 had me confused for a while there :-)
ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW