On Mon, Sep 26, 2016 at 06:00:15PM +0200, Carl-Daniel Hailfinger wrote:
# HG changeset patch
# User Carl-Daniel Hailfinger <Carl-Daniel.Hailfinger(a)inf.h-brs.de>
# Date 1474903734 -7200
# Mon Sep 26 17:28:54 2016 +0200
# Node ID dbd1ea0a401cedcfa426097a289d852971b14f1e
# Parent d7d5078d08c711032837dcac79a4450226ec2ce5
nbdkit: Fix flags in old-style connection
Is there some other patch that this depends on? It doesn't apply
to the current head.
Rich.
diff -r d7d5078d08c7 -r dbd1ea0a401c src/connections.c
--- a/src/connections.c Sun Sep 25 05:04:02 2016 +0200
+++ b/src/connections.c Mon Sep 26 17:28:54 2016 +0200
@@ -155,7 +155,7 @@
struct old_handshake handshake;
int64_t r;
uint64_t exportsize;
- uint16_t gflags, eflags;
+ uint32_t flags;
int fl;
r = plugin_get_size (conn);
@@ -169,14 +169,13 @@
exportsize = (uint64_t) r;
conn->exportsize = exportsize;
- gflags = 0;
- eflags = NBD_FLAG_HAS_FLAGS;
+ flags = NBD_FLAG_HAS_FLAGS;
fl = plugin_can_write (conn);
if (fl == -1)
return -1;
if (readonly || !fl) {
- eflags |= NBD_FLAG_READ_ONLY;
+ flags |= NBD_FLAG_READ_ONLY;
conn->readonly = 1;
}
@@ -184,7 +183,7 @@
if (fl == -1)
return -1;
if (fl) {
- eflags |= NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA;
+ flags |= NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA;
conn->can_flush = 1;
}
@@ -192,7 +191,7 @@
if (fl == -1)
return -1;
if (fl) {
- eflags |= NBD_FLAG_ROTATIONAL;
+ flags |= NBD_FLAG_ROTATIONAL;
conn->is_rotational = 1;
}
@@ -200,7 +199,7 @@
if (fl == -1)
return -1;
if (fl) {
- eflags |= NBD_FLAG_SEND_TRIM;
+ flags |= NBD_FLAG_SEND_TRIM;
conn->can_trim = 1;
}
@@ -208,19 +207,17 @@
if (fl == -1)
return -1;
if (fl) {
- eflags |= NBD_FLAG_SEND_MARKNOREMANENCE;
+ flags |= NBD_FLAG_SEND_MARKNOREMANENCE;
conn->can_marknoremanence = 1;
}
- debug ("oldstyle negotiation: flags: global 0x%x export 0x%x",
- gflags, eflags);
+ debug ("oldstyle negotiation: server flags: 0x%x", flags);
memset (&handshake, 0, sizeof handshake);
memcpy (handshake.nbdmagic, "NBDMAGIC", 8);
handshake.version = htobe64 (OLD_VERSION);
handshake.exportsize = htobe64 (exportsize);
- handshake.gflags = htobe16 (gflags);
- handshake.eflags = htobe16 (eflags);
+ handshake.flags = htobe32 (flags);
if (xwrite (conn->sockout, &handshake, sizeof handshake) == -1) {
nbdkit_error ("write: %m");
diff -r d7d5078d08c7 -r dbd1ea0a401c src/protocol.h
--- a/src/protocol.h Sun Sep 25 05:04:02 2016 +0200
+++ b/src/protocol.h Mon Sep 26 17:28:54 2016 +0200
@@ -41,8 +41,7 @@
char nbdmagic[8]; /* "NBDMAGIC" */
uint64_t version; /* OLD_VERSION, in network byte order */
uint64_t exportsize; /* in network byte order */
- uint16_t gflags; /* global flags, in network byte order */
- uint16_t eflags; /* per-export flags, in network byte order */
+ uint32_t flags; /* flags, in network byte order */
char zeroes[124]; /* must be sent as zero bytes */
} __attribute__((packed));
_______________________________________________
Libguestfs mailing list
Libguestfs(a)redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html