[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/6] nbd/server: refactor negotiation functio
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/6] nbd/server: refactor negotiation functions parameters |
Date: |
Thu, 11 Jan 2018 13:54:46 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 01/11/2018 11:55 AM, Vladimir Sementsov-Ogievskiy wrote:
> 11.01.2018 02:08, Eric Blake wrote:
>> From: Vladimir Sementsov-Ogievskiy <address@hidden>
>>
>> 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.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
>> Reviewed-by: Eric Blake <address@hidden>
>> Message-Id: <address@hidden>
>> [eblake: rebase, commit message tweak, assert !optlen after
>> negotiation completes]
>> Signed-off-by: Eric Blake <address@hidden>
>> ---
>> nbd/server.c | 168
>> +++++++++++++++++++++++++++++------------------------------
>> 1 file changed, 84 insertions(+), 84 deletions(-)
>
>> @@ -1707,6 +1706,7 @@ static coroutine_fn void
>> nbd_co_client_start(void *opaque)
>> return;
>> }
>>
>> + assert(!client->optlen);
>
>
> hmm, should not it be at the end of nbd_negotiate() ? Looks OK anyway.
Sure, I'll squash this in, for no real change in behavior:
diff --git i/nbd/server.c w/nbd/server.c
index c22d5e6ecf..3fd145592e 100644
--- i/nbd/server.c
+++ w/nbd/server.c
@@ -902,6 +902,7 @@ static coroutine_fn int nbd_negotiate(NBDClient
*client, Error **errp)
}
}
+ assert(!client->optlen);
trace_nbd_negotiate_success();
return 0;
@@ -1726,7 +1727,6 @@ static coroutine_fn void nbd_co_client_start(void
*opaque)
return;
}
- assert(!client->optlen);
nbd_client_receive_next_request(client);
}
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH v2 5/6] nbd/server: Add helper functions for parsing option payload, Eric Blake, 2018/01/10
[Qemu-devel] [PATCH v2 4/6] nbd/server: Add va_list form of nbd_negotiate_send_rep_err(), Eric Blake, 2018/01/10