From: Alex Bligh <alex@alex.org.uk>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Wouter Verhelst <w@uter.be>, Alex Bligh <alex@alex.org.uk>
Subject: [Qemu-devel] [PATCH] Make nbd-tester-client use FIXED_NEWSTYLE negotiation
Date: Mon, 11 Apr 2016 15:31:23 +0100 [thread overview]
Message-ID: <1460385083-28246-1-git-send-email-alex@alex.org.uk> (raw)
Signed-off-by: Alex Bligh <alex@alex.org.uk>
---
tests/run/nbd-tester-client.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tests/run/nbd-tester-client.c b/tests/run/nbd-tester-client.c
index 06396a7..1b99fa8 100644
--- a/tests/run/nbd-tester-client.c
+++ b/tests/run/nbd-tester-client.c
@@ -342,6 +342,8 @@ int setup_connection_common(int sock, char* name, CONNECTION_TYPE ctype, int* se
u64 tmp64;
uint64_t mymagic = (name ? opts_magic : cliserv_magic);
uint32_t tmp32 = 0;
+ uint16_t handshakeflags = 0;
+ uint32_t negotiationflags = 0;
if(ctype<CONNECTION_TYPE_INIT_PASSWD)
goto end;
@@ -370,10 +372,12 @@ int setup_connection_common(int sock, char* name, CONNECTION_TYPE ctype, int* se
READ_ALL_ERRCHK(sock, buf, 128, err, "Could not read data: %s", strerror(errno));
goto end;
}
- /* flags */
- READ_ALL_ERRCHK(sock, buf, sizeof(uint16_t), err, "Could not read reserved field: %s", strerror(errno));
- /* reserved field */
- WRITE_ALL_ERRCHK(sock, &tmp32, sizeof(tmp32), err, "Could not write reserved field: %s", strerror(errno));
+ /* handshake flags */
+ READ_ALL_ERRCHK(sock, &handshakeflags, sizeof(handshakeflags), err, "Could not read reserved field: %s", strerror(errno));
+ /* negotiation flags */
+ if (handshakeflags & NBD_FLAG_FIXED_NEWSTYLE)
+ negotiationflags |= NBD_FLAG_C_FIXED_NEWSTYLE;
+ WRITE_ALL_ERRCHK(sock, &negotiationflags, sizeof(negotiationflags), err, "Could not write reserved field: %s", strerror(errno));
/* magic */
tmp64 = htonll(opts_magic);
WRITE_ALL_ERRCHK(sock, &tmp64, sizeof(tmp64), err, "Could not write magic: %s", strerror(errno));
--
1.9.1
next reply other threads:[~2016-04-11 14:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-11 14:31 Alex Bligh [this message]
2016-04-11 14:37 ` [Qemu-devel] [PATCH] Make nbd-tester-client use FIXED_NEWSTYLE negotiation Alex Bligh
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=1460385083-28246-1-git-send-email-alex@alex.org.uk \
--to=alex@alex.org.uk \
--cc=qemu-devel@nongnu.org \
--cc=w@uter.be \
/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).