From nobody Wed May 14 08:31:17 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; 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 1527056520991746.3189565321399; Tue, 22 May 2018 23:22:00 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D1E836C1C1; Wed, 23 May 2018 06:21:59 +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 B6202600CC; Wed, 23 May 2018 06:21:58 +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 786D04CA81; Wed, 23 May 2018 06:21:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4N6LtmR015678 for ; Wed, 23 May 2018 02:21:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6F6433083320; Wed, 23 May 2018 06:21:55 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63C513001648; Wed, 23 May 2018 06:21:53 +0000 (UTC) Received: from prv3-mh.provo.novell.com (victor.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C044E30C7E53; Wed, 23 May 2018 06:21:51 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Wed, 23 May 2018 00:21:43 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:19:18 +0800 Message-Id: <20180523061925.3256-2-lma@suse.com> In-Reply-To: <20180523061925.3256-1-lma@suse.com> References: <20180523061925.3256-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 23 May 2018 06:21:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 23 May 2018 06:21:52 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'victor.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 victor.provo.novell.com 137.65.250.26 victor.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com Subject: [libvirt] [ [PATCH v3 1/8] virsh-secret: Rename vshEventCallback to vshSecretEventCallback 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 23 May 2018 06:21:59 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The next patch will use it in virsh-completer.c for returning the name list of secret events. The patch code originally authored by Michal Privoznik, Please refer to https://www.redhat.com/archives/libvir-list/2018-May/msg01022.html I splitted it to 2 patches with tiny change. Signed-off-by: Lin Ma --- tools/virsh-secret.c | 17 ++++++----------- tools/virsh-secret.h | 8 ++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 9e4ec61a88..07bc54d1bf 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -571,18 +571,12 @@ virshSecretEventToString(int event) return str ? _(str) : _("unknown"); } =20 -struct vshEventCallback { - const char *name; - virConnectSecretEventGenericCallback cb; -}; -typedef struct vshEventCallback vshEventCallback; - struct virshSecretEventData { vshControl *ctl; bool loop; bool timestamp; int count; - vshEventCallback *cb; + vshSecretEventCallback *cb; }; typedef struct virshSecretEventData virshSecretEventData; =20 @@ -652,11 +646,12 @@ vshEventGenericPrint(virConnectPtr conn ATTRIBUTE_UNU= SED, vshEventDone(data->ctl); } =20 -static vshEventCallback vshEventCallbacks[] =3D { +vshSecretEventCallback vshSecretEventCallbacks[] =3D { { "lifecycle", VIR_SECRET_EVENT_CALLBACK(vshEventLifecyclePrint), }, { "value-changed", vshEventGenericPrint, }, }; +verify(VIR_SECRET_EVENT_ID_LAST =3D=3D ARRAY_CARDINALITY(vshSecretEventCal= lbacks)); =20 static const vshCmdInfo info_secret_event[] =3D { {.name =3D "help", @@ -713,7 +708,7 @@ cmdSecretEvent(vshControl *ctl, const vshCmd *cmd) size_t i; =20 for (i =3D 0; i < VIR_SECRET_EVENT_ID_LAST; i++) - vshPrint(ctl, "%s\n", vshEventCallbacks[i].name); + vshPrint(ctl, "%s\n", vshSecretEventCallbacks[i].name); return true; } =20 @@ -724,7 +719,7 @@ cmdSecretEvent(vshControl *ctl, const vshCmd *cmd) return false; } for (event =3D 0; event < VIR_SECRET_EVENT_ID_LAST; event++) - if (STREQ(eventName, vshEventCallbacks[event].name)) + if (STREQ(eventName, vshSecretEventCallbacks[event].name)) break; if (event =3D=3D VIR_SECRET_EVENT_ID_LAST) { vshError(ctl, _("unknown event type %s"), eventName); @@ -735,7 +730,7 @@ cmdSecretEvent(vshControl *ctl, const vshCmd *cmd) data.loop =3D vshCommandOptBool(cmd, "loop"); data.timestamp =3D vshCommandOptBool(cmd, "timestamp"); data.count =3D 0; - data.cb =3D &vshEventCallbacks[event]; + data.cb =3D &vshSecretEventCallbacks[event]; if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0) return false; =20 diff --git a/tools/virsh-secret.h b/tools/virsh-secret.h index dda22b021e..c70a2b5c75 100644 --- a/tools/virsh-secret.h +++ b/tools/virsh-secret.h @@ -28,6 +28,14 @@ =20 # include "virsh.h" =20 +struct vshSecretEventCallback { + const char *name; + virConnectSecretEventGenericCallback cb; +}; +typedef struct vshSecretEventCallback vshSecretEventCallback; + +extern vshSecretEventCallback vshSecretEventCallbacks[]; + extern const vshCmdDef secretCmds[]; =20 #endif /* VIRSH_SECRET_H */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list