[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/8] qemu-nbd: define struct NbdClientOpts when HAVE_NBD_DEVI
From: |
Eric Blake |
Subject: |
Re: [PATCH 2/8] qemu-nbd: define struct NbdClientOpts when HAVE_NBD_DEVICE is not defined |
Date: |
Thu, 7 Sep 2023 16:35:25 -0500 |
User-agent: |
NeoMutt/20230517 |
On Wed, Sep 06, 2023 at 11:32:04AM +0200, Denis V. Lunev wrote:
> This patch also drops definition of some locals in main() to avoid
> useless data copy.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Eric Blake <eblake@redhat.com>
> CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> qemu-nbd.c | 60 ++++++++++++++++++++++++------------------------------
> 1 file changed, 27 insertions(+), 33 deletions(-)
> @@ -519,7 +519,6 @@ int main(int argc, char **argv)
> const char *bindto = NULL;
> const char *port = NULL;
> char *sockpath = NULL;
> - char *device = NULL;
> QemuOpts *sn_opts = NULL;
> const char *sn_id_or_name = NULL;
> const char *sopt = "hVb:o:p:rsnc:dvk:e:f:tl:x:T:D:AB:L";
> @@ -582,16 +581,16 @@ int main(int argc, char **argv)
> const char *tlshostname = NULL;
> bool imageOpts = false;
> bool writethrough = false; /* Client will flush as needed. */
> - bool verbose = false;
> - bool fork_process = false;
> bool list = false;
> unsigned socket_activation;
> const char *pid_file_name = NULL;
> const char *selinux_label = NULL;
> BlockExportOptions *export_opts;
> -#if HAVE_NBD_DEVICE
> - struct NbdClientOpts opts;
> -#endif
> + struct NbdClientOpts opts = {
> + .fork_process = false,
> + .verbose = false,
> + .device = NULL,
> + };
Could also do 'struct NbdClietnOpts opts = {};' since you happen to be
zero-initializing, but this may not remain the case if more fields get
added to the struct, so I'm fine leaving it as written.
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
- [PATCH v3 0/8] qemu-nbd: Restore "qemu-nbd -v --fork" output, Denis V. Lunev, 2023/09/06
- [PATCH 2/8] qemu-nbd: define struct NbdClientOpts when HAVE_NBD_DEVICE is not defined, Denis V. Lunev, 2023/09/06
- Re: [PATCH 2/8] qemu-nbd: define struct NbdClientOpts when HAVE_NBD_DEVICE is not defined,
Eric Blake <=
- [PATCH 1/8] qemu-nbd: improve error message for dup2 error, Denis V. Lunev, 2023/09/06
- [PATCH 4/8] qemu-nbd: put saddr into into struct NbdClientOpts, Denis V. Lunev, 2023/09/06
- [PATCH 5/8] qemu-nbd: invent nbd_client_release_pipe() helper, Denis V. Lunev, 2023/09/06
- [PATCH 8/8] qemu-nbd: fix formatting in main(), Denis V. Lunev, 2023/09/06
- [PATCH 6/8] qemu-nbd: Restore "qemu-nbd -v --fork" output, Denis V. Lunev, 2023/09/06