qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 26/29] nbd: Merge nbd_export_new() and nbd_export_create()


From: Max Reitz
Subject: Re: [PATCH 26/29] nbd: Merge nbd_export_new() and nbd_export_create()
Date: Thu, 10 Sep 2020 17:30:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

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 <kwolf@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 <mreitz@redhat.com>

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]