From nobody Sun May 5 20:45:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515826855640672.6992827502195; Fri, 12 Jan 2018 23:00:55 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEAEEC0587D1; Sat, 13 Jan 2018 07:00:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 53BA96A977; Sat, 13 Jan 2018 07:00:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3C1A51800552; Sat, 13 Jan 2018 07:00:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0D70fwE030750 for ; Sat, 13 Jan 2018 02:00:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6D9CC226FA; Sat, 13 Jan 2018 07:00:41 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 660D66A977 for ; Sat, 13 Jan 2018 07:00:39 +0000 (UTC) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE285C070122 for ; Sat, 13 Jan 2018 07:00:37 +0000 (UTC) Received: by mail-lf0-f54.google.com with SMTP id h5so8179176lfj.2 for ; Fri, 12 Jan 2018 23:00:37 -0800 (PST) Received: from kloomba.my.domain ([95.104.133.157]) by smtp.gmail.com with ESMTPSA id d80sm4477185ljd.51.2018.01.12.23.00.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 23:00:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=VjDX0muyYS9UdcOnd+IFWUIshPmMl/D61UPiJIJHOn4=; b=I6W1PeFDGq5OEh4m53w51dwBSltY1lQTrjvnQYQx5pQO7zPIcZ2lmYHDjOvvHr9kRe jXWPxWY4EgyZlz7ZLhxGeBVzbXDfLyFkY6bYGFe8WKDnEQlFDdeHHmg/oW2uUu3njM4j 6dhRWZAl6jzrGjMLlFpPI8mhhckHoi1OM4WEugTfDeJIznmqc2FXjkCo/U8mmZIWZcmm mVUQYIOwSkgr6v/oVOrZKNWHzPXZP9fw09jPkUHNA42JTSe5J0kzbdcRDZDFi8qKvw+u sOHsnTAeLxl7JufeX02VLwMwfZzynDB958i2wch7dbU3+AUIzCfPecRF105lvWV/h6se Jwiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VjDX0muyYS9UdcOnd+IFWUIshPmMl/D61UPiJIJHOn4=; b=XP/pz9NlZ6Nyeh/t7J56BMlvGNFjZ5l6cy5GrIWu1ZuF1Ol6apiYfYqbs4jQJE++yS 66UzGgALHSfVmRbP0GIDeLOt8T7JH/dKYddpaC4BTXy/Fw4L+/bnlJ5zF8Wqh1FrpFyL DQANwKAbgJlGatoaZB8N79Z6CvHm95VJGS+4UmwluTpYN/sfbZGY39vs/MFFraFnwTJb 9VT4IkQv/MYmp25bhZ6KkITgMUPOTKN7qFu0Uh3w3xk6uZvI/j+ddEx3tRZfiftPbxYq bNh1H4MGWZl3T8oy0FX3ybV9jPmOcdfwYy/6qtvPJs7TuB3r7klOAkydQIb/gMnTIAs9 WPRQ== X-Gm-Message-State: AKwxytenW3k5IQk2mIydME5DiPiIaPjuJz00Ll5I5JffPUAbaMWewlOw pnpVuweYzL1rEZ31yqJh5yZkhQ== X-Google-Smtp-Source: ACJfBovTs6DnmMYVXud0knZ+R6HKO4eizaxNXuGhis99YAqfQlakznVrtqd3eclmlb6jR1u/8kDzBw== X-Received: by 10.46.55.19 with SMTP id e19mr11214396lja.82.1515826835650; Fri, 12 Jan 2018 23:00:35 -0800 (PST) From: Roman Bogorodskiy To: libvir-list@redhat.com Date: Sat, 13 Jan 2018 11:00:24 +0400 Message-Id: <20180113070024.29290-1-bogorodskiy@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 13 Jan 2018 07:00:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 13 Jan 2018 07:00:38 +0000 (UTC) for IP:'209.85.215.54' DOMAIN:'mail-lf0-f54.google.com' HELO:'mail-lf0-f54.google.com' FROM:'bogorodskiy@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.215.54 mail-lf0-f54.google.com 209.85.215.54 mail-lf0-f54.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Roman Bogorodskiy Subject: [libvirt] [PATCH] virsh: fix build without readline X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 13 Jan 2018 07:00:54 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Completion in virsh is enabled when readline is available. However, when it's not available, we should: * avoid defining completers with completion functions; * in cmdComplete(), mark unused arguments when there's no readline with ATTRIBUTE_UNUSED. --- tools/virsh-domain-monitor.c | 6 ++++++ tools/virsh-domain.c | 6 ++++++ tools/virsh.h | 11 ++++++++++- tools/virt-admin.c | 14 ++++++++++++++ tools/vsh.c | 2 +- 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 32a42707e..0df20eea0 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -659,7 +659,9 @@ static const vshCmdOptDef opts_domif_getlink[] =3D { {.name =3D "interface", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#if WITH_READLINE .completer =3D virshDomainInterfaceCompleter, +#endif .help =3D N_("interface device (MAC Address)") }, {.name =3D "persistent", @@ -996,7 +998,9 @@ static const vshCmdOptDef opts_domifstat[] =3D { {.name =3D "interface", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D virshDomainInterfaceCompleter, +#endif .help =3D N_("interface device specified by name or MAC Address") }, {.name =3D NULL} @@ -2151,7 +2155,9 @@ static const vshCmdOptDef opts_domifaddr[] =3D { {.name =3D "interface", .type =3D VSH_OT_STRING, .flags =3D VSH_OFLAG_NONE, +#ifdef WITH_READLINE .completer =3D virshDomainInterfaceCompleter, +#endif .help =3D N_("network interface name")}, {.name =3D "full", .type =3D VSH_OT_BOOL, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 0f329d6d7..c5511adbf 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2977,7 +2977,9 @@ static const vshCmdOptDef opts_domif_setlink[] =3D { {.name =3D "interface", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D virshDomainInterfaceCompleter, +#endif .help =3D N_("interface device (MAC Address)") }, {.name =3D "state", @@ -3148,7 +3150,9 @@ static const vshCmdOptDef opts_domiftune[] =3D { {.name =3D "interface", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D virshDomainInterfaceCompleter, +#endif .help =3D N_("interface device (MAC Address)") }, {.name =3D "inbound", @@ -11985,8 +11989,10 @@ static const vshCmdOptDef opts_detach_interface[] = =3D { }, {.name =3D "mac", .type =3D VSH_OT_STRING, +#ifdef WITH_READLINE .completer =3D virshDomainInterfaceCompleter, .completer_flags =3D VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC, +#endif .help =3D N_("MAC address") }, VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, diff --git a/tools/virsh.h b/tools/virsh.h index 528e04558..b3cb15ac4 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -71,7 +71,8 @@ .help =3D _helpstr \ } =20 -# define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \ +# ifdef WITH_READLINE +# define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \ {.name =3D "domain", \ .type =3D VSH_OT_DATA, \ .flags =3D VSH_OFLAG_REQ, \ @@ -79,6 +80,14 @@ .completer =3D virshDomainNameCompleter, \ .completer_flags =3D cflags, \ } +# else +# define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \ + {.name =3D "domain", \ + .type =3D VSH_OT_DATA, \ + .flags =3D VSH_OFLAG_REQ, \ + .help =3D _helpstr, \ + } +# endif =20 # define VIRSH_COMMON_OPT_CONFIG(_helpstr) \ {.name =3D "config", \ diff --git a/tools/virt-admin.c b/tools/virt-admin.c index c86b5763a..ac4d00dd7 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -429,7 +429,9 @@ static const vshCmdOptDef opts_srv_threadpool_info[] = =3D { {.name =3D "server", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D vshAdmServerCompleter, +#endif .help =3D N_("Server to retrieve threadpool attributes from."), }, {.name =3D NULL} @@ -491,7 +493,9 @@ static const vshCmdOptDef opts_srv_threadpool_set[] =3D= { {.name =3D "server", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D vshAdmServerCompleter, +#endif .help =3D N_("Server to alter threadpool attributes on."), }, {.name =3D "min-workers", @@ -598,7 +602,9 @@ static const vshCmdOptDef opts_srv_clients_list[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D vshAdmServerCompleter, +#endif .help =3D N_("server which to list connected clients from"), }, {.name =3D NULL} @@ -680,7 +686,9 @@ static const vshCmdOptDef opts_client_info[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D vshAdmServerCompleter, +#endif .help =3D N_("server to which is connected to"), }, {.name =3D "client", @@ -768,7 +776,9 @@ static const vshCmdOptDef opts_client_disconnect[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D vshAdmServerCompleter, +#endif .help =3D N_("server which the client is currently connected to"), }, {.name =3D "client", @@ -834,7 +844,9 @@ static const vshCmdOptDef opts_srv_clients_info[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D vshAdmServerCompleter, +#endif .help =3D N_("Server to retrieve the client limits from."), }, {.name =3D NULL} @@ -894,7 +906,9 @@ static const vshCmdOptDef opts_srv_clients_set[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, +#ifdef WITH_READLINE .completer =3D vshAdmServerCompleter, +#endif .help =3D N_("Server to alter the client-related configuration limits= on."), }, {.name =3D "max-clients", diff --git a/tools/vsh.c b/tools/vsh.c index 4426c08d6..59c8a440e 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -3500,7 +3500,7 @@ const vshCmdInfo info_complete[] =3D { }; =20 bool -cmdComplete(vshControl *ctl, const vshCmd *cmd) +cmdComplete(vshControl *ctl ATTRIBUTE_UNUSED, const vshCmd *cmd ATTRIBUTE_= UNUSED) { bool ret =3D false; #ifdef WITH_READLINE --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list