[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 4/9] nbd: Simplify trace of client flags in negot
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v5 4/9] nbd: Simplify trace of client flags in negotiation |
Date: |
Fri, 7 Jul 2017 15:30:44 -0500 |
Simplify the tracing of client flags in the server, and return -EINVAL
instead of -EIO if we successfully read but don't like those flags.
Signed-off-by: Eric Blake <address@hidden>
---
v5: new patch
---
nbd/server.c | 6 ++----
nbd/trace-events | 4 +---
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/nbd/server.c b/nbd/server.c
index 27a0aab..8e363d3 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -396,21 +396,19 @@ static int nbd_negotiate_options(NBDClient *client, Error
**errp)
error_prepend(errp, "read failed: ");
return -EIO;
}
- trace_nbd_negotiate_options_flags();
be32_to_cpus(&flags);
+ trace_nbd_negotiate_options_flags(flags);
if (flags & NBD_FLAG_C_FIXED_NEWSTYLE) {
- trace_nbd_negotiate_options_newstyle();
fixedNewstyle = true;
flags &= ~NBD_FLAG_C_FIXED_NEWSTYLE;
}
if (flags & NBD_FLAG_C_NO_ZEROES) {
- trace_nbd_negotiate_options_no_zeroes();
client->no_zeroes = true;
flags &= ~NBD_FLAG_C_NO_ZEROES;
}
if (flags != 0) {
error_setg(errp, "Unknown client flags 0x%" PRIx32 " received", flags);
- return -EIO;
+ return -EINVAL;
}
while (1) {
diff --git a/nbd/trace-events b/nbd/trace-events
index e61feda..765f5f4 100644
--- a/nbd/trace-events
+++ b/nbd/trace-events
@@ -35,9 +35,7 @@ nbd_negotiate_handle_export_name(void) "Checking length"
nbd_negotiate_handle_export_name_request(const char *name) "Client requested
export '%s'"
nbd_negotiate_handle_starttls(void) "Setting up TLS"
nbd_negotiate_handle_starttls_handshake(void) "Starting TLS handshake"
-nbd_negotiate_options_flags(void) "Checking client flags"
-nbd_negotiate_options_newstyle(void) "Client supports fixed newstyle handshake"
-nbd_negotiate_options_no_zeroes(void) "Client supports no zeroes at handshake
end"
+nbd_negotiate_options_flags(uint32_t flags) "Received client flags 0x%" PRIx32
nbd_negotiate_options_check_magic(uint64_t magic) "Checking opts magic 0x%"
PRIx64
nbd_negotiate_options_check_option(uint32_t option, const char *name)
"Checking option 0x%" PRIx32 " (%s)"
nbd_opt_abort_reply_failed(const char *error) "Reply to NBD_OPT_ABORT request
failed: %s"
--
2.9.4
[Qemu-devel] [PATCH v5 4/9] nbd: Simplify trace of client flags in negotiation,
Eric Blake <=
[Qemu-devel] [PATCH v5 5/9] nbd: Refactor reply to NBD_OPT_EXPORT_NAME, Eric Blake, 2017/07/07
[Qemu-devel] [PATCH v5 3/9] nbd: Expose and debug more NBD constants, Eric Blake, 2017/07/07
[Qemu-devel] [PATCH v5 8/9] nbd: Implement NBD_INFO_BLOCK_SIZE on server, Eric Blake, 2017/07/07
[Qemu-devel] [PATCH v5 7/9] nbd: Implement NBD_OPT_GO on client, Eric Blake, 2017/07/07