qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] nbd: publish _lookup functions


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 2/3] nbd: publish _lookup functions
Date: Tue, 18 Dec 2018 14:53:07 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

On 11/2/18 10:11 AM, Vladimir Sementsov-Ogievskiy wrote:
These functions are used for formatting pretty trace points. We are
going to add some in block/nbd-client, so, let's publish all these
functions at once. Note, that nbd_reply_type_lookup is already
published, and constants, "named" by these functions live in
include/block/nbd.h too.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
  include/block/nbd.h | 5 +++++
  nbd/nbd-internal.h  | 5 -----
  2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/block/nbd.h b/include/block/nbd.h
index 6a5bfe5d55..65402d3396 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -343,5 +343,10 @@ static inline bool nbd_reply_is_structured(NBDReply *reply)
  }
const char *nbd_reply_type_lookup(uint16_t type);
+const char *nbd_opt_lookup(uint32_t opt);
+const char *nbd_rep_lookup(uint32_t rep);
+const char *nbd_info_lookup(uint16_t info);
+const char *nbd_cmd_lookup(uint16_t info);
+const char *nbd_err_lookup(int err);

Reviewed-by: Eric Blake <address@hidden>

Side note: We could even go further, and have code to auto-generate the tables; see how nbdkit did it:

https://github.com/libguestfs/nbdkit/commit/d198cf9c

But for now, the protocol doesn't grow all that frequently, so keeping the lists up to date by hand doesn't bother me.


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]