From nobody Wed May 14 01:53:52 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 1527057369149886.1447070269877; Tue, 22 May 2018 23:36:09 -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 8D22530BF4E0; Wed, 23 May 2018 06:36:07 +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 5724A452C; Wed, 23 May 2018 06:36:07 +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 D63DA4CA85; Wed, 23 May 2018 06:36:06 +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 w4N6Zv1E017183 for ; Wed, 23 May 2018 02:35:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3BC553001648; Wed, 23 May 2018 06:35:57 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37097300193C; Wed, 23 May 2018 06:35:52 +0000 (UTC) Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) (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 446E480F9C; Wed, 23 May 2018 06:35:41 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id o76-v6so9974305pfi.5; Tue, 22 May 2018 23:35:41 -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.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 23:35:39 -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=4yTCQpRExm2UnkpNi6Jv3I8asuZdw4g3ch/ursNtPew=; b=djWSAsit+dpBqxVeCnNiAqN/PIMh/aXdrVsou/SIoEONv/+P0FLRiSGSjJWOaUp3dx VyqwfNfUWvZ8dhboEcUUFhTeTb+qNugIOZUSsjZrbERv/IuSP/nbPY5ik+bTJx72ieLt nFa4Oe9/yjhGAOOMWxNILywmv4v+8vPLDga5D2gYRQwnIX9sWcwFIoYLP6o2jTp4rZgp k51V7BTLxB+S9SL4t3crTSgYQSXzClN69+KipgL2EeYLRivVnYdTCQZ0+L6xiza4zWPz AgtudLsht20zsP6E9HA/PdnbH1Gy1O7ihc1gXar0h6w5UDit3kI0Kdj7XGMTedMye3jb 3fOA== 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=4yTCQpRExm2UnkpNi6Jv3I8asuZdw4g3ch/ursNtPew=; b=qyGVqlXMmjsAycjxq7g1j16v9V0otOolHm94Z0ejmAN8ZTY26w0hedLxUV0icn6Llq uBWiRqdNHFUbCmgY89iJezsKHVJWg4TqK3MpEJXkP5GpsuzKmen6HzjUnxTcsQO41VTP LvxdwDyxppdvIMC8Cwks/gG2TqGcDOLh9DTBjiPlhakMryNRRZU1XldjbKxsvZJxmtAr Ym+KkVLcvAZDeHVYda4uQpR1UZ7jeT6cbZOJwBupr0CqKvquXWkhQA/9BeVXzoLL13Nr 1ddMCJsnosregIUobOwlKcC00rOQqPgieLuwjwXYqzcp4pHwgsi4c1wk9WXLDUAeLZKI r7NQ== X-Gm-Message-State: ALKqPwf0Di+UPzv1tYLCf0WFJpEpDCiafHqqEbh1+uXQUewX4BfMcwLS h5pSVtAb6PrEUOQ4B5JU0ODDYw== X-Google-Smtp-Source: AB8JxZqaa8flulv1HdJAN40LledtCWZ0VX0FG830EnF/kI2MyrHVpCF+iGoFBcooJ+R5QOjDZRn3JA== X-Received: by 2002:a62:dc4e:: with SMTP id t75-v6mr1580269pfg.139.1527057340485; Tue, 22 May 2018 23:35:40 -0700 (PDT) From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:32:43 +0800 Message-Id: <20180523063246.3742-6-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.27]); Wed, 23 May 2018 06:35:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 23 May 2018 06:35:41 +0000 (UTC) for IP:'209.85.192.196' DOMAIN:'mail-pf0-f196.google.com' HELO:'mail-pf0-f196.google.com' FROM:'morecache@gmail.com' RCPT:'' X-RedHat-Spam-Score: -1.2 (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.196 mail-pf0-f196.google.com 209.85.192.196 mail-pf0-f196.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma Subject: [libvirt] [ [PATCH v3 5/8] virsh-pool: Rename vshEventCallback to vshPoolEventCallback 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:36:08 +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 pool events. Signed-off-by: Lin Ma --- tools/virsh-pool.c | 18 ++++++------------ tools/virsh-pool.h | 8 ++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 36bf8d9faa..f0544d2e2d 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -1999,18 +1999,12 @@ virshPoolEventToString(int event) return str ? _(str) : _("unknown"); } =20 -struct vshEventCallback { - const char *name; - virConnectStoragePoolEventGenericCallback cb; -}; -typedef struct vshEventCallback vshEventCallback; - struct virshPoolEventData { vshControl *ctl; bool loop; bool timestamp; int count; - vshEventCallback *cb; + vshPoolEventCallback *cb; }; typedef struct virshPoolEventData virshPoolEventData; =20 @@ -2079,12 +2073,12 @@ vshEventGenericPrint(virConnectPtr conn ATTRIBUTE_U= NUSED, vshEventDone(data->ctl); } =20 -static vshEventCallback vshEventCallbacks[] =3D { +vshPoolEventCallback vshPoolEventCallbacks[] =3D { { "lifecycle", VIR_STORAGE_POOL_EVENT_CALLBACK(vshEventLifecyclePrint), }, { "refresh", vshEventGenericPrint, } }; -verify(VIR_STORAGE_POOL_EVENT_ID_LAST =3D=3D ARRAY_CARDINALITY(vshEventCal= lbacks)); +verify(VIR_STORAGE_POOL_EVENT_ID_LAST =3D=3D ARRAY_CARDINALITY(vshPoolEven= tCallbacks)); =20 =20 static const vshCmdInfo info_pool_event[] =3D { @@ -2141,7 +2135,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd) size_t i; =20 for (i =3D 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) - vshPrint(ctl, "%s\n", vshEventCallbacks[i].name); + vshPrint(ctl, "%s\n", vshPoolEventCallbacks[i].name); return true; } =20 @@ -2153,7 +2147,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd) } =20 for (event =3D 0; event < VIR_STORAGE_POOL_EVENT_ID_LAST; event++) - if (STREQ(eventName, vshEventCallbacks[event].name)) + if (STREQ(eventName, vshPoolEventCallbacks[event].name)) break; if (event =3D=3D VIR_STORAGE_POOL_EVENT_ID_LAST) { vshError(ctl, _("unknown event type %s"), eventName); @@ -2164,7 +2158,7 @@ cmdPoolEvent(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 &vshPoolEventCallbacks[event]; if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0) return false; =20 diff --git a/tools/virsh-pool.h b/tools/virsh-pool.h index 5f2671ae63..1148d7cebb 100644 --- a/tools/virsh-pool.h +++ b/tools/virsh-pool.h @@ -37,6 +37,14 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd= , const char *optname, virshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \ VIRSH_BYUUID | VIRSH_BYNAME) =20 +struct vshPoolEventCallback { + const char *name; + virConnectStoragePoolEventGenericCallback cb; +}; +typedef struct vshPoolEventCallback vshPoolEventCallback; + +extern vshPoolEventCallback vshPoolEventCallbacks[]; + extern const vshCmdDef storagePoolCmds[]; =20 #endif /* VIRSH_POOL_H */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list