From nobody Wed May 14 01:43:32 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 1527057342292290.6875306441966; Tue, 22 May 2018 23:35:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE36530D1AC4; Wed, 23 May 2018 06:35:40 +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 7D60D10A31DA; Wed, 23 May 2018 06:35:40 +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 3426B180474D; Wed, 23 May 2018 06:35:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4N6ZbVs017135 for ; Wed, 23 May 2018 02:35:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id B3EC8308BDA0; Wed, 23 May 2018 06:35:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A9942308BDA1; Wed, 23 May 2018 06:35:35 +0000 (UTC) Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) (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 6278BC07C596; Wed, 23 May 2018 06:35:24 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id c10-v6so9960647pfi.12; Tue, 22 May 2018 23:35:24 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 23:35:22 -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=jf32d5YcWVEafIMG9J6zKgfTPstbQaD6C05qMpmmvoU=; b=ip3hOe9sd4rnlmIo3ZrI5DZudKhQDQClhjFhVgxBgtY9wptYKxZx8ZqOE6nww/y4JM XfNDAXdmSoSRyeZKbWoQOwooeRZNfEIQlkiyQRZmXqGgIS3Zk0CcitcQSvl9gCGKpD0W +6iDvOeM1SJ8jHD16WRItDWHXpqHvBIU1Ba3F4yMiQkgXNNy8BBiWut7CgvwMeFJ+Vyc JsJtBxmN1z9aPyinXyN+RP12tQV1baxvIGubxAQ+yuH4LCbS8mAxhtz1BoXRRyHdCnMM RKntG1FkuUcCGh63Vo9B/hrpoKdsd4WUQPb8SouDsx4unduTbsXUpo0dKfzqwvcSY8TD K+dA== 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=jf32d5YcWVEafIMG9J6zKgfTPstbQaD6C05qMpmmvoU=; b=ositCW24c9zgISXTDyEosdLzl1cebtdXjeJ6tsiR733CFKqHioNdbHyUpYwAcFXgKP 2Ki+TezMQQzXM0bTL8QHCNcn6L7CR6xBfV8pOamWV0CK2eUCzRetrVeLnZJ4jU9WQYf1 TzlXJnUxR6YIswjfOuca2DxvdBWy2xiC6cVDpLuVnm4JO9NKRPIomjz4KCkyl1skXov2 QVGuyD/iViTjoap/f/YgOZ+CtlizaMgmPsMu0D21z38qtFKIGsHAU9u84nTtqQEbB1k1 mhMGBON8nqSDk53QeNoduaS9I3/QbGnqLEYI1/Gz46UGa9tZThqazJ9JKGcUW1fdKUSP UXhw== X-Gm-Message-State: ALKqPweaq05dQ4PExXkqqN/1P7gVev9otnTZNWANL1nNm19aIPu4pQtR E8NZR53A8Qn9xF7y6CxbNPGnZA== X-Google-Smtp-Source: AB8JxZpOi32NXXPhTjNpvhnpQjRjyY2mWW5q3QdGbK9FvdOft74CdsPYkV9yQ71+wcvm6yMWYL0I/g== X-Received: by 2002:a65:46ce:: with SMTP id n14-v6mr1255473pgr.193.1527057323536; Tue, 22 May 2018 23:35:23 -0700 (PDT) From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:32:39 +0800 Message-Id: <20180523063246.3742-2-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.32]); Wed, 23 May 2018 06:35:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 23 May 2018 06:35:24 +0000 (UTC) for IP:'209.85.192.193' DOMAIN:'mail-pf0-f193.google.com' HELO:'mail-pf0-f193.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.193 mail-pf0-f193.google.com 209.85.192.193 mail-pf0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 23 May 2018 06:35:41 +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 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