diff options
author | Eric Blake | 2018-01-11 00:08:24 +0100 |
---|---|---|
committer | Eric Blake | 2018-01-18 03:14:12 +0100 |
commit | 894e02804c862c6940b43a0a488164655d3fb3f0 (patch) | |
tree | 9994f5b536c702f336f6c5e34f051ba750c75dcc /accel/kvm/kvm-all.c | |
parent | nbd/server: Add va_list form of nbd_negotiate_send_rep_err() (diff) | |
download | qemu-894e02804c862c6940b43a0a488164655d3fb3f0.tar.gz qemu-894e02804c862c6940b43a0a488164655d3fb3f0.tar.xz qemu-894e02804c862c6940b43a0a488164655d3fb3f0.zip |
nbd/server: Add helper functions for parsing option payload
Rather than making every callsite perform length sanity checks
and error reporting, add the helper functions nbd_opt_read()
and nbd_opt_drop() that use the length stored in the client
struct; also add an assertion that optlen is 0 before any
option (ie. any previous option was fully handled), complementing
the assertion added in an earlier patch that optlen is 0 after
all negotiation completes.
Note that the call in nbd_negotiate_handle_export_name() does
not use the new helper (in part because the server cannot
reply to NBD_OPT_EXPORT_NAME - it either succeeds or the
connection drops).
Based on patches by Vladimir Sementsov-Ogievskiy.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20180110230825.18321-6-eblake@redhat.com>
Diffstat (limited to 'accel/kvm/kvm-all.c')
0 files changed, 0 insertions, 0 deletions