On 07.09.20 20:20, Kevin Wolf wrote:
> There is no real reason any more why nbd_export_new() and
> nbd_export_create() should be separate functions. The latter only
> performs a few checks before it calls the former. Move all the checks to
> nbd/server.c and make the resulting function static.
> 
> Signed-off-by: Kevin Wolf <kw...@redhat.com>
> ---
>  include/block/nbd.h |  7 +-----
>  blockdev-nbd.c      | 40 +++++----------------------------
>  nbd/server.c        | 54 ++++++++++++++++++++++++++++++++-------------
>  3 files changed, 45 insertions(+), 56 deletions(-)

I suppose it’s a question of style whether one big function (120 loc is
quite big) is better than two functions chain-calling each other (with a
poor split of functionality between the two).

I wouldn’t have anything against clearly splitting the functionality
into a function that checks the parameters, and another one that
actually creates the export.

In any case this isn’t the first function in qemu with more than 100 loc
and it won’t be the last; and it allows getting rid of two public
functions, so:

Reviewed-by: Max Reitz <mre...@redhat.com>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to