From nobody Mon Dec 15 23:01:35 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 1527057383909733.7888684890462; Tue, 22 May 2018 23:36:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81AAB3008146; Wed, 23 May 2018 06:36:22 +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 F2DAA5B681; Wed, 23 May 2018 06:36:21 +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 8EA384CA88; Wed, 23 May 2018 06:36:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4N6a3l3017211 for ; Wed, 23 May 2018 02:36:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9C7102010D5B; Wed, 23 May 2018 06:36:03 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90E1C2010D59; Wed, 23 May 2018 06:36:01 +0000 (UTC) Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) (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 4BFDA60AB8; Wed, 23 May 2018 06:35:50 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id a3-v6so4014565pgt.13; Tue, 22 May 2018 23:35:50 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 23:35:48 -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=+kzza+btvWl7aoUowqqWfFR96KrpvUj3MiKh7UQ57hI=; b=aQLawk9Jjd6ueC2w6KSKmS3YoTbxMimBn/KvseJeOp1rDDYqUlyVCg7abjoW9Js0Pd 0G6pKr9PLLOY/FfZjCx+BrFSS13F48bhR3UiSFTGBFJfpctOXf0OKrdgXfURsJMwTX8S jSntArfHuzG7KjpkUqLvp/tt0AbdQEXYAcu/vRQksZL1Rv7oCGElLMvYMOsuuyq9GWVW 2/LtBu3LyK38EusXxUo7YeccZgZw/HsDGs2dCHixJY6bJ14RxDpwj+fylPzfhWMDaAZB hS+2K1TLZoOqtCcvjWJ69DrxjZJ0sQpjlz0eGmtL6LKkiEB+LzmZ+0DvxAwY9MZn69ld WBGw== 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=+kzza+btvWl7aoUowqqWfFR96KrpvUj3MiKh7UQ57hI=; b=hdJnDO+LMMqGeUv/FLst7DBGeWkYKikpUGn1Jdk78sf8EqTjofEadeuwSiGdwin9ke 7f+2VYXcTmZO856KWLIpZQMy5+lWcfaq4Iuzg68gnhDun7Z/1mN+UGO4AhrO60Sm06zP 7MftHPwaPHW4r44OPUHcoTXE7OfwQRK0MC9Tu3U0PrTEYdIFlhkJSwduxYG50CugBEqi liifOVxS/GQCIPEb0TlxkzpkY+34EgYlwgpKqWZJDAsW3xemfm/l18arboTg9cDhtdwj xQFPksVXsapp8EER8/J+rKfiXxpX8cVGRhqKpw7JOhhx0uT7WsDiSA6bGGQQ2up3ysaJ FNIA== X-Gm-Message-State: ALKqPwdwkaTtOR0hxhbnQJuKAOEj/8gGbMIo2tAMqCeJ7lv7iepuUELt LeQNz+2nnvRZ8NlbV+WvsC+VpQ== X-Google-Smtp-Source: AB8JxZrM6Ejq0Getp90WBx/EsOhAD2N9S9SjNFU0CFrlrU+6YvGDT8NzAdsXPbXtugjlH8XxvU12sw== X-Received: by 2002:a62:2043:: with SMTP id g64-v6mr1635499pfg.12.1527057349459; Tue, 22 May 2018 23:35:49 -0700 (PDT) From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:32:45 +0800 Message-Id: <20180523063246.3742-8-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.38]); Wed, 23 May 2018 06:35:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 23 May 2018 06:35:50 +0000 (UTC) for IP:'74.125.83.66' DOMAIN:'mail-pg0-f66.google.com' HELO:'mail-pg0-f66.google.com' FROM:'morecache@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.58 (DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 74.125.83.66 mail-pg0-f66.google.com 74.125.83.66 mail-pg0-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma Subject: [libvirt] [ [PATCH v3 7/8] virsh-nodedev: Rename vshEventCallback to vshNodedevEventCallback 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 23 May 2018 06:36:23 +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 nodedev events. Signed-off-by: Lin Ma --- tools/virsh-nodedev.c | 18 ++++++------------ tools/virsh-nodedev.h | 8 ++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index d25fe0e09b..66cf46c22f 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -773,18 +773,12 @@ virshNodeDeviceEventToString(int event) return str ? _(str) : _("unknown"); } =20 -struct vshEventCallback { - const char *name; - virConnectNodeDeviceEventGenericCallback cb; -}; -typedef struct vshEventCallback vshEventCallback; - struct virshNodeDeviceEventData { vshControl *ctl; bool loop; bool timestamp; int count; - vshEventCallback *cb; + vshNodedevEventCallback *cb; }; typedef struct virshNodeDeviceEventData virshNodeDeviceEventData; =20 @@ -850,12 +844,12 @@ vshEventGenericPrint(virConnectPtr conn ATTRIBUTE_UNU= SED, vshEventDone(data->ctl); } =20 -static vshEventCallback vshEventCallbacks[] =3D { +vshNodedevEventCallback vshNodedevEventCallbacks[] =3D { { "lifecycle", VIR_NODE_DEVICE_EVENT_CALLBACK(vshEventLifecyclePrint), }, { "update", vshEventGenericPrint, } }; -verify(VIR_NODE_DEVICE_EVENT_ID_LAST =3D=3D ARRAY_CARDINALITY(vshEventCall= backs)); +verify(VIR_NODE_DEVICE_EVENT_ID_LAST =3D=3D ARRAY_CARDINALITY(vshNodedevEv= entCallbacks)); =20 =20 static const vshCmdInfo info_node_device_event[] =3D { @@ -914,7 +908,7 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd) size_t i; =20 for (i =3D 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++) - vshPrint(ctl, "%s\n", vshEventCallbacks[i].name); + vshPrint(ctl, "%s\n", vshNodedevEventCallbacks[i].name); return true; } =20 @@ -926,7 +920,7 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd) } =20 for (event =3D 0; event < VIR_NODE_DEVICE_EVENT_ID_LAST; event++) - if (STREQ(eventName, vshEventCallbacks[event].name)) + if (STREQ(eventName, vshNodedevEventCallbacks[event].name)) break; if (event =3D=3D VIR_NODE_DEVICE_EVENT_ID_LAST) { vshError(ctl, _("unknown event type %s"), eventName); @@ -937,7 +931,7 @@ cmdNodeDeviceEvent(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 &vshNodedevEventCallbacks[event]; if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0) return false; if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0) diff --git a/tools/virsh-nodedev.h b/tools/virsh-nodedev.h index c64f7df83c..931beb982d 100644 --- a/tools/virsh-nodedev.h +++ b/tools/virsh-nodedev.h @@ -28,6 +28,14 @@ =20 # include "virsh.h" =20 +struct vshNodedevEventCallback { + const char *name; + virConnectNodeDeviceEventGenericCallback cb; +}; +typedef struct vshNodedevEventCallback vshNodedevEventCallback; + +extern vshNodedevEventCallback vshNodedevEventCallbacks[]; + extern const vshCmdDef nodedevCmds[]; =20 #endif /* VIRSH_NODEDEV_H */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list