nbd: Add qemu-nbd -D for human-readable description

The NBD protocol allows servers to advertise a human-readable
description alongside an export name during NBD_OPT_LIST.  Add
an option to pass through the user's string to the NBD client.

Doing this also makes it easier to test commit 200650d4, which
is the client counterpart of receiving the description.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1476469998-28592-2-git-send-email-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Eric Blake 2016-10-14 13:33:03 -05:00 committed by Paolo Bonzini
parent 1775f111ea
commit b1a75b3348
5 changed files with 45 additions and 12 deletions

View file

@ -104,9 +104,10 @@ static inline ssize_t read_sync(QIOChannel *ioc, void *buffer, size_t size)
return nbd_wr_syncv(ioc, &iov, 1, size, true);
}
static inline ssize_t write_sync(QIOChannel *ioc, void *buffer, size_t size)
static inline ssize_t write_sync(QIOChannel *ioc, const void *buffer,
size_t size)
{
struct iovec iov = { .iov_base = buffer, .iov_len = size };
struct iovec iov = { .iov_base = (void *) buffer, .iov_len = size };
return nbd_wr_syncv(ioc, &iov, 1, size, false);
}