From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: famz@redhat.com, jsnow@redhat.com, kwolf@redhat.com,
mreitz@redhat.com, pbonzini@redhat.com, armbru@redhat.com,
den@virtuozzo.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 04/18] nbd/client: refactor nbd_receive_starttls
Date: Tue, 7 Feb 2017 10:32:00 -0600 [thread overview]
Message-ID: <7b79d03c-0fba-ddb8-4295-b155cb26a206@redhat.com> (raw)
In-Reply-To: <20170203154757.36140-5-vsementsov@virtuozzo.com>
[-- Attachment #1: Type: text/plain, Size: 1973 bytes --]
On 02/03/2017 09:47 AM, Vladimir Sementsov-Ogievskiy wrote:
> Split out nbd_receive_simple_option to be reused for structured reply
> option.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> nbd/client.c | 54 +++++++++++++++++++++++++++++++++++-------------------
> nbd/nbd-internal.h | 14 ++++++++++++++
> 2 files changed, 49 insertions(+), 19 deletions(-)
>
> +++ b/nbd/nbd-internal.h
> @@ -96,6 +96,20 @@
> #define NBD_ENOSPC 28
> #define NBD_ESHUTDOWN 108
>
> +static inline const char *nbd_opt_name(int opt)
> +{
> + switch (opt) {
> + case NBD_OPT_EXPORT_NAME: return "export_name";
Does this really get past checkpatch?
> + case NBD_OPT_ABORT: return "abort";
> + case NBD_OPT_LIST: return "list";
> + case NBD_OPT_PEEK_EXPORT: return "peek_export";
> + case NBD_OPT_STARTTLS: return "tls";
Why just 'tls' instead of 'starttls'?
> + case NBD_OPT_STRUCTURED_REPLY: return "structured_reply";
> + }
> +
> + return "<unknown option>";
Can you please consider making this include the %d representation of the
unknown option; perhaps by snprintf'ing into static storage? While it
is unlikely that a well-behaved server will respond to a client with an
option the client doesn't recognize, it is much more likely that this
reverse lookup function will be used in a server to respond to an
unknown option from a client.
In fact, I might have split this into two patches: one providing
nbd_opt_name() and using it throughout the code base where appropriate,
and the other refactoring starttls in the client.
I'm not sure if the reverse lookup function needs to be inline in the
header; it could reasonably live in nbd/common.c, particularly if you
are going to take my advice to have it format a message for unknown values.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-02-07 16:32 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 15:47 [Qemu-devel] [PATCH 00/18] nbd: BLOCK_STATUS Vladimir Sementsov-Ogievskiy
2017-02-03 15:47 ` [Qemu-devel] [PATCH 01/18] nbd: rename NBD_REPLY_MAGIC to NBD_SIMPLE_REPLY_MAGIC Vladimir Sementsov-Ogievskiy
2017-02-06 19:54 ` Eric Blake
2017-02-03 15:47 ` [Qemu-devel] [PATCH 02/18] nbd-server: refactor simple reply sending Vladimir Sementsov-Ogievskiy
2017-02-06 21:09 ` Eric Blake
2017-02-03 15:47 ` [Qemu-devel] [PATCH 03/18] nbd: Minimal structured read for server Vladimir Sementsov-Ogievskiy
2017-02-06 23:01 ` Eric Blake
2017-02-07 17:44 ` Paolo Bonzini
2017-05-04 10:58 ` Vladimir Sementsov-Ogievskiy
2017-05-04 13:28 ` Eric Blake
2017-05-05 11:30 ` Vladimir Sementsov-Ogievskiy
2017-02-03 15:47 ` [Qemu-devel] [PATCH 04/18] nbd/client: refactor nbd_receive_starttls Vladimir Sementsov-Ogievskiy
2017-02-07 16:32 ` Eric Blake [this message]
2017-02-09 6:20 ` Vladimir Sementsov-Ogievskiy
2017-02-09 14:41 ` Eric Blake
2017-02-10 11:23 ` Vladimir Sementsov-Ogievskiy
2017-02-11 19:30 ` Eric Blake
2017-02-20 16:14 ` Eric Blake
2017-02-03 15:47 ` [Qemu-devel] [PATCH 05/18] nbd/client: fix drop_sync Vladimir Sementsov-Ogievskiy
2017-02-06 23:17 ` Eric Blake
2017-02-15 14:50 ` Eric Blake
2017-02-03 15:47 ` [Qemu-devel] [PATCH 06/18] nbd/client: refactor drop_sync Vladimir Sementsov-Ogievskiy
2017-02-06 23:19 ` Eric Blake
2017-02-08 7:55 ` Vladimir Sementsov-Ogievskiy
2017-02-15 16:52 ` Paolo Bonzini
2017-02-03 15:47 ` [Qemu-devel] [PATCH 07/18] nbd: Minimal structured read for client Vladimir Sementsov-Ogievskiy
2017-02-07 20:14 ` Eric Blake
2017-02-15 16:54 ` Paolo Bonzini
2017-08-01 15:41 ` Vladimir Sementsov-Ogievskiy
2017-08-01 15:56 ` Vladimir Sementsov-Ogievskiy
2017-02-03 15:47 ` [Qemu-devel] [PATCH 08/18] hbitmap: add next_zero function Vladimir Sementsov-Ogievskiy
2017-02-07 22:55 ` Eric Blake
2017-02-15 16:57 ` Paolo Bonzini
2017-02-03 15:47 ` [Qemu-devel] [PATCH 09/18] block/dirty-bitmap: add bdrv_dirty_bitmap_next() Vladimir Sementsov-Ogievskiy
2017-02-03 15:47 ` [Qemu-devel] [PATCH 10/18] block/dirty-bitmap: add bdrv_load_dirty_bitmap Vladimir Sementsov-Ogievskiy
2017-02-08 11:45 ` Fam Zheng
2017-02-16 12:37 ` Denis V. Lunev
2017-02-03 15:47 ` [Qemu-devel] [PATCH 11/18] nbd: BLOCK_STATUS for bitmap export: server part Vladimir Sementsov-Ogievskiy
2017-02-08 13:13 ` Eric Blake
2017-02-16 13:00 ` Denis V. Lunev
2017-02-03 15:47 ` [Qemu-devel] [PATCH 12/18] nbd: BLOCK_STATUS for bitmap export: client part Vladimir Sementsov-Ogievskiy
2017-02-08 23:06 ` Eric Blake
2017-02-03 15:47 ` [Qemu-devel] [PATCH 13/18] nbd: add nbd_dirty_bitmap_load Vladimir Sementsov-Ogievskiy
2017-02-03 15:47 ` [Qemu-devel] [PATCH 14/18] qmp: add x-debug-block-dirty-bitmap-sha256 Vladimir Sementsov-Ogievskiy
2017-02-03 15:47 ` [Qemu-devel] [PATCH 15/18] qmp: add block-dirty-bitmap-load Vladimir Sementsov-Ogievskiy
2017-02-07 12:04 ` Fam Zheng
2017-02-09 15:18 ` Eric Blake
2017-02-15 16:57 ` Paolo Bonzini
2017-02-03 15:47 ` [Qemu-devel] [PATCH 16/18] iotests: add test for nbd dirty bitmap export Vladimir Sementsov-Ogievskiy
2017-02-03 15:47 ` [Qemu-devel] [PATCH 17/18] nbd: BLOCK_STATUS for standard get_block_status function: server part Vladimir Sementsov-Ogievskiy
2017-02-09 15:38 ` Eric Blake
2017-02-15 17:02 ` Paolo Bonzini
2017-02-15 17:02 ` Paolo Bonzini
2017-02-03 15:47 ` [Qemu-devel] [PATCH 18/18] nbd: BLOCK_STATUS for standard get_block_status function: client part Vladimir Sementsov-Ogievskiy
2017-02-09 16:00 ` Eric Blake
2017-02-15 17:04 ` Paolo Bonzini
2017-02-15 17:05 ` [Qemu-devel] [PATCH 00/18] nbd: BLOCK_STATUS Paolo Bonzini
2017-07-13 11:10 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7b79d03c-0fba-ddb8-4295-b155cb26a206@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=den@virtuozzo.com \
--cc=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).