]> git.proxmox.com Git - mirror_qemu.git/commit
nbd/server: refactor negotiation functions parameters
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Wed, 10 Jan 2018 23:08:21 +0000 (17:08 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 18 Jan 2018 02:14:12 +0000 (20:14 -0600)
commit0cfae925d2e31a7d7613a6fb60aa58b38ec2b61e
treee387b106a4fd4d94397f4cec7017be81129e9486
parenta16a7907707e08c09843297a6f707f5bfb8beb22
nbd/server: refactor negotiation functions parameters

Instead of passing currently negotiating option and its length to
many of negotiation functions let's just store them on NBDClient
struct to be state-variables of negotiation phase.

This unifies semantics of negotiation functions and allows
tracking changes of remaining option length in future patches.

Asssert that optlen is back to 0 after negotiation (including
old-style connections which don't negotiate), although we need
more patches before we can assert optlen is 0 between options
during negotiation.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20171122101958.17065-2-vsementsov@virtuozzo.com>
[eblake: rebase, commit message tweak, assert !optlen after
negotiation completes]
Signed-off-by: Eric Blake <eblake@redhat.com>
nbd/server.c