From nobody Wed May 14 01:43:31 2025 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 1527057347195395.25527249811375; Tue, 22 May 2018 23:35:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB43E30BF396; Wed, 23 May 2018 06:35:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 83EE34505; Wed, 23 May 2018 06:35:45 +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 1CD934CA80; Wed, 23 May 2018 06:35:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4N6ZgXP017147 for ; Wed, 23 May 2018 02:35:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A55A4D9E0; Wed, 23 May 2018 06:35:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4DA3D5C3FD; Wed, 23 May 2018 06:35:40 +0000 (UTC) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) (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 E07BF31475E3; Wed, 23 May 2018 06:35:28 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id j20-v6so9974905pff.10; Tue, 22 May 2018 23:35:28 -0700 (PDT) Received: from localhost.localdomain ([45.122.156.254]) by smtp.gmail.com with ESMTPSA id g64-v6sm34500852pfd.50.2018.05.22.23.35.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 23:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=baRHo6SPJ17aA+QEIeXhL1wHlzQpwE5RO34IUsOdIHs=; b=buY5W0BSWpp6b2PJJMbL+NtxfK7WNtGIMsFbUSRNmJWeQLVZacY/0X0LzcvOqkXZBY suUyPMzVXlPo2Z/tfXKBom/giEcQlIazd3i4FeNFDjOVSGZcFsF/4Luh67mxy3Bz0t8Q 0wRxZW86zONHXFZxpvgygPVfQkkP+TA1jfnSytFfvD/r5ThQ1Sx422gLRFJf+Pogz8P8 kqLonVZ8ghl4JIzQFuMsS+MLRNql0LuJM2q850rgMt9jdFeA3juzMsiKe8UOwvD49dIu y5tIipAnd62vfDaC1pqXyW4LrAdxTyaa720zYPfyhtCipJz6ghOaTWuc8UFQC3GTfssc kwsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=baRHo6SPJ17aA+QEIeXhL1wHlzQpwE5RO34IUsOdIHs=; b=nW2d21NsqBHIaL5SUoZRvG+JbVBKxjtE0xVqVsu3CCZZ+QdPY9H3RpxUYWM5FSRnr5 Y4VovSKq+X+oE61JdHH1rzXeWDOVSmsfhNtKRHU+nC2NAn4cBz96YCaIBoiUxXaH/FsM UgeWO0mCH0ptz27BC4zvs9XsiPWZMPs+7YIdG/JdbwJufm4tbVbX/a5A9ch3JltzUJOd zpc4CR7T75CLLRDMycpptMt1XMKNNYEr/Cr0x6OIwb9oVFcUcPiRQHt/8V2Gl5KMBDAX Z1SWsv7dg2yyCjj/9OzIPUWvUI6GJN0mCw06vzY3DxIaiHUvE5/z0YXl+W1eAZHLq/Pz yP5Q== X-Gm-Message-State: ALKqPwf5MhPGTfnoCxo8pu+zzNnkIuMm/U2NLExFV2QIsC1k0UHJ/oGV S0PZTmXtJAe0TK3Q6kC17prtXg== X-Google-Smtp-Source: AB8JxZq5SiuyTQiLPRFDA4nBMW6quf3A8dm8BvoP/h50PFpknudgp2gN97MpW7u2UXdQnlUMwpwh1g== X-Received: by 2002:a62:a50c:: with SMTP id v12-v6mr1594177pfm.237.1527057328149; Tue, 22 May 2018 23:35:28 -0700 (PDT) From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:32:40 +0800 Message-Id: <20180523063246.3742-3-lma@suse.com> In-Reply-To: <20180523063246.3742-1-lma@suse.com> References: <20180523063246.3742-1-lma@suse.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 23 May 2018 06:35:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 23 May 2018 06:35:29 +0000 (UTC) for IP:'209.85.192.195' DOMAIN:'mail-pf0-f195.google.com' HELO:'mail-pf0-f195.google.com' FROM:'morecache@gmail.com' RCPT:'' X-RedHat-Spam-Score: -1.199 (DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.192.195 mail-pf0-f195.google.com 209.85.192.195 mail-pf0-f195.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma Subject: [libvirt] [ [PATCH v3 2/8] virsh: Add event name completion to 'secret-event' command 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 23 May 2018 06:35:46 +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" The patch code originally authored by Michal Privoznik, Please refer to https://www.redhat.com/archives/libvir-list/2018-May/msg01022.html Signed-off-by: Lin Ma --- tools/virsh-completer.c | 27 +++++++++++++++++++++++++++ tools/virsh-completer.h | 4 ++++ tools/virsh-secret.c | 1 + 3 files changed, 32 insertions(+) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 1435d1d4c6..b402fd22c3 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -26,6 +26,7 @@ #include "virsh.h" #include "virsh-pool.h" #include "virsh-util.h" +#include "virsh-secret.h" #include "internal.h" #include "virutil.h" #include "viralloc.h" @@ -649,3 +650,29 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl, VIR_FREE(ret); goto cleanup; } + + +char ** +virshSecretEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + size_t i; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (VIR_ALLOC_N(ret, VIR_SECRET_EVENT_ID_LAST) < 0) + goto error; + + for (i =3D 0; i < VIR_SECRET_EVENT_ID_LAST; i++) { + if (VIR_STRDUP(ret[i], vshSecretEventCallbacks[i].name) < 0) + goto error; + } + + return ret; + + error: + virStringListFree(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index c7b181879e..c662267882 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -78,4 +78,8 @@ char ** virshAllocpagesPagesizeCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshSecretEventNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 07bc54d1bf..ba0210e765 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -671,6 +671,7 @@ static const vshCmdOptDef opts_secret_event[] =3D { }, {.name =3D "event", .type =3D VSH_OT_STRING, + .completer =3D virshSecretEventNameCompleter, .help =3D N_("which event type to wait for") }, {.name =3D "loop", --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list