From nobody Sat Apr 27 11:14:06 2024 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 From nobody Sat Apr 27 11:14:06 2024 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 From nobody Sat Apr 27 11:14:06 2024 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 1527057350659907.986627443255; Tue, 22 May 2018 23:35:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E8B830BD443; Wed, 23 May 2018 06:35:49 +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 1AD892010D5A; Wed, 23 May 2018 06:35:49 +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 C3B3C4CA82; Wed, 23 May 2018 06:35:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4N6ZlYT017158 for ; Wed, 23 May 2018 02:35:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 08AA291EB7; Wed, 23 May 2018 06:35:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0114391EAD; Wed, 23 May 2018 06:35:44 +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 8ACE430B5A17; Wed, 23 May 2018 06:35:33 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id w129-v6so9976098pfd.3; Tue, 22 May 2018 23:35:33 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 23:35:31 -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=HxDxdaGCDASCB2hLRaDJH5dnUrOBr3qaY6GUPn/j8NA=; b=sz0cRUNRG2NOPgliLFU74Os5/cUqyi9T77e8DlBLLybJv1BQMGvlsXXCKrU8wH5r56 +yRehtSXMi/vaolyfTcg/pg+PgIa9Nclo4vfcHPY1P5ATkVhNx+wSGkBKyZQVY9mJmsW yQvtBVWzSz8XS9T6TJ1yBTKfV2RMPaoNHjgu6ik0Uj2/WPWMjDPONSbv2i59Z2C1FPNI dJWrQLshtAG8bxG8zTxu7CyCqVGqGnE+GM5HgwH+a3no5nebKzkC4wu1IS8/GFyU7HM4 HNBsZmyLZWmr6qmFZZm4VaHRzrxdts7tH0QOZgZIVR9eCB0ao/XohUBg/oBqoXb2pzyi BirQ== 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=HxDxdaGCDASCB2hLRaDJH5dnUrOBr3qaY6GUPn/j8NA=; b=m2FWtg0u+WtzvB25qyWPhRu1JWJUJ6iPNTcloSIGS0VpyliYLkrglkxH9DLDiwrDoe Czq89U7zMn9iiStOOUoQYgeUfA55e60vFy/ppWRBIvQo8C2t92h4dmMKjh59gLlq3Py+ y8yqG5N3xQe2/B8/i93haZvNnQQdAzNePJtzn9nXXthWLX9ct2VgsGqUlV0HtIv4KQyY IWjrRA7HMIJFagDeR5RNEfD4BL+blKl5n0T8ilyQEHP89zlsv9D+0CXQyhj+cjMU5Rap RIoA+fKF5WsYali7pSgn6O7v+I+WWDSekIo0Hey96I9JN0uHyGmSFEfTRtTlffzpkLt/ k6/Q== X-Gm-Message-State: ALKqPweiN97w1xSGJyGMn3I5hw6b0qhLR4GvFvA77pKH3eeERo5S7p8P h9jQGnO10dHKnPwblSJj3nvPbA== X-Google-Smtp-Source: AB8JxZpVxQqhqDJqLTtO9+vy6sd+c2PLtBiWS58kQC4ZEtmH5KGNwiZBwOy+pddCFEPGEcncduFgzw== X-Received: by 2002:aa7:850f:: with SMTP id v15-v6mr1621278pfn.144.1527057332766; Tue, 22 May 2018 23:35:32 -0700 (PDT) From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:32:41 +0800 Message-Id: <20180523063246.3742-4-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.48]); Wed, 23 May 2018 06:35:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 23 May 2018 06:35:33 +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.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma Subject: [libvirt] [ [PATCH v3 3/8] virsh: Move vshEventCallback structure definition to virsh-domain.h 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.25 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:49 +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 strings of domain event name. Signed-off-by: Lin Ma --- tools/virsh-domain.c | 8 +------- tools/virsh-domain.h | 8 ++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index cfbbf5a7bc..347c744bc9 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -12832,12 +12832,6 @@ virshDomainEventTrayChangeToString(int reason) return str ? _(str) : _("unknown"); } =20 -struct vshEventCallback { - const char *name; - virConnectDomainEventGenericCallback cb; -}; -typedef struct vshEventCallback vshEventCallback; - struct virshDomEventData { vshControl *ctl; bool loop; @@ -13278,7 +13272,7 @@ virshEventBlockThresholdPrint(virConnectPtr conn AT= TRIBUTE_UNUSED, } =20 =20 -static vshEventCallback vshEventCallbacks[] =3D { +vshEventCallback vshEventCallbacks[] =3D { { "lifecycle", VIR_DOMAIN_EVENT_CALLBACK(virshEventLifecyclePrint), }, { "reboot", virshEventGenericPrint, }, diff --git a/tools/virsh-domain.h b/tools/virsh-domain.h index 3f9d12a5ff..e8e5611244 100644 --- a/tools/virsh-domain.h +++ b/tools/virsh-domain.h @@ -28,6 +28,14 @@ =20 # include "virsh.h" =20 +struct vshEventCallback { + const char *name; + virConnectDomainEventGenericCallback cb; +}; +typedef struct vshEventCallback vshEventCallback; + +extern vshEventCallback vshEventCallbacks[]; + extern const vshCmdDef domManagementCmds[]; =20 #endif /* VIRSH_DOMAIN_H */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 11:14:06 2024 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 1527057361615157.03577183506331; Tue, 22 May 2018 23:36:01 -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 A02E33007B0E; Wed, 23 May 2018 06:35:59 +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 6137F4529; Wed, 23 May 2018 06:35:59 +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 E8E4B18033ED; Wed, 23 May 2018 06:35:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4N6ZuPn017178 for ; Wed, 23 May 2018 02:35:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id AE6326090C; Wed, 23 May 2018 06:35:56 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C4ED608F3; Wed, 23 May 2018 06:35:47 +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 E31433078ACC; Wed, 23 May 2018 06:35:36 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id o76-v6so9974219pfi.5; Tue, 22 May 2018 23:35:36 -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.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 23:35:35 -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=g2sTc8HFnWKj1YoRNTzyks3HUp5oidpR3XHcRwjY4Lo=; b=QaTItU7oSS3ScU7MHB93T/fXqdYPFcohm6bo1AakpQHvKZ6J3ZQLOpPasar4YIYOAG rB8dd6XxNheJJGTasEvnQq8jjvCXqajDhYYHRd3S+EiH/zQV2F5YI0UlDPxJkyrkKNHo DMZOqvUCqjbUm4mx9675Luy5Zhqa4srl22QrF6gg5FmjL/7YSumD1GN/N2Sr+VEhqg/Y C6oNb5JHugdCYHzEsq84+DAfNl4lG9FB32d/uBgxNSIcIQRU66mUIW1m3ok2LGAwO+B5 ROHVk3ZNByPMsMjoq8/vILp6AonSgTVWuULe5/AM3QtxkjrxZ0BwKiO64v/7kbmyg3fR T6gw== 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=g2sTc8HFnWKj1YoRNTzyks3HUp5oidpR3XHcRwjY4Lo=; b=lr1YbgYoXQgVEFkJcXSDjEnmIEt3L2oLe1jJF8Cj7PnSSzmXNSRO6Y5qCnd8OsG8+L s8GUXZ+qRxXI8hrCV1F7hA3n+4Q1ZquhO892xVHZqBPEuolRYif+W7W4CYsIPr42a/qn hLlGVAf6ERlvDjaKLGaicCBQc26qc5WNtCO25aTXfDQtQPf0l34P3SsuoFfz31qKHaix 6TIOIVpZVDlbBjQraeIrW06CnAJYvRXWRsqVqMiUsjgd456H2VVPxQp1KqQWfl4miM/0 /UoB6aDLwyrJyK9wmGWdCa2ndx+io0+OXGQoVcYbhCh+tTTLMeqBrrDyA0reYctGQqv7 7Q4g== X-Gm-Message-State: ALKqPwdttjJHYRduiVxdxCqxWZh4x2OiTvqJ9JB+M0nz3ZKfuYkQ9OBg 1X+uJ3e9TQuBmRIsuLROaexSjQ== X-Google-Smtp-Source: AB8JxZppXKVn9FzoUe6Lxx5ftZwJp3UG5Yjlef/MImOfUJew4XoaQC2IyFApg17o5VLop4QPwNy2UA== X-Received: by 2002:a62:d38f:: with SMTP id z15-v6mr1625138pfk.100.1527057336148; Tue, 22 May 2018 23:35:36 -0700 (PDT) From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:32:42 +0800 Message-Id: <20180523063246.3742-5-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.48]); Wed, 23 May 2018 06:35:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 23 May 2018 06:35:37 +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.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma Subject: [libvirt] [ [PATCH v3 4/8] virsh: Add event name completion to '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.40]); Wed, 23 May 2018 06:36:00 +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" Signed-off-by: Lin Ma --- tools/virsh-completer.c | 31 +++++++++++++++++++++++++++++++ tools/virsh-completer.h | 3 +++ tools/virsh-domain.c | 1 + 3 files changed, 35 insertions(+) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index b402fd22c3..c0c3c5571a 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -23,6 +23,7 @@ #include =20 #include "virsh-completer.h" +#include "virsh-domain.h" #include "virsh.h" #include "virsh-pool.h" #include "virsh-util.h" @@ -676,3 +677,33 @@ virshSecretEventNameCompleter(vshControl *ctl ATTRIBUT= E_UNUSED, virStringListFree(ret); return NULL; } + + +char ** +virshEventNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if (VIR_ALLOC_N(ret, VIR_DOMAIN_EVENT_ID_LAST + 1) < 0) + goto error; + + for (i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++) { + if (VIR_STRDUP(ret[i], vshEventCallbacks[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 c662267882..9f8dc3dfa8 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -73,6 +73,9 @@ char ** virshSecretUUIDCompleter(vshControl *ctl, char ** virshSnapshotNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); +char ** virshEventNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); =20 char ** virshAllocpagesPagesizeCompleter(vshControl *ctl, const vshCmd *cmd, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 347c744bc9..4af7aa2155 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -13339,6 +13339,7 @@ static const vshCmdOptDef opts_event[] =3D { 0), {.name =3D "event", .type =3D VSH_OT_STRING, + .completer =3D virshEventNameCompleter, .help =3D N_("which event type to wait for") }, {.name =3D "all", --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 11:14:06 2024 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 From nobody Sat Apr 27 11:14:06 2024 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 1527057377545451.1773450962379; Tue, 22 May 2018 23:36:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D32DC3E316; Wed, 23 May 2018 06:36:14 +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 9809D308BDA1; Wed, 23 May 2018 06:36:14 +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 0F38D18033F1; Wed, 23 May 2018 06:36:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4N6a0l5017199 for ; Wed, 23 May 2018 02:36:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5537460BEB; Wed, 23 May 2018 06:36:00 +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 48D58610C8; Wed, 23 May 2018 06:35:56 +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 BB612C004A89; Wed, 23 May 2018 06:35:45 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id p9-v6so8945818pgc.9; Tue, 22 May 2018 23:35:45 -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.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 23:35:44 -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=+RJcYhhQiex4cT2bZJAA43677+OgU88DQyntDQQ8bzA=; b=Bd5xcS0O/Gyh7PoVVKN+Sk8btRZ4VNazC6vzzYOAEhbU2YkydVotrvIDyk28MQQpYP QmMsAFIlIqBMnBRYAZ9uOxCaT3Qvna9DegdK8SXd8MizGo8hcXj4k+T/0X33QD3zZwHK uTui8Acv0ieW9l7TLhNLUoobTGGRXH8qSTgYjBt5/kv3/5Mo+gINcPsIoyz20wzqAAnX 4Z6Yc8iQ6aHSp8jgiZKnevN95Ggirkk7DQu4CxvohLq136NC+MZCZR/zzbX80SB616Ie 4celdbrBrgzvuZ5U8ptPoEDncIrLQHk6dc3yMQ5bjDTAJoOj/eKwUxWSHEpcpwidlSwx x8iA== 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=+RJcYhhQiex4cT2bZJAA43677+OgU88DQyntDQQ8bzA=; b=tFLZzXsiQKYpsuXFgzz538/l3PVaAjm/Hs0SufdpHATT4LLj4TRclZnFVMqIMIDA5g LAmqNgaysMQJptFHRf52Qns80agUuU9I9gpFhvzpyXbRRnKI5YFcHQC3nqGo73v1+wtV xW2f4UsOtp6PuBVNzaFYd68xob76PKT+i3CvmU2JB54wZwJcqpukxy84evDNe5QlDI9V cOk+wNomxkyCbgBM1UNVKY3z/SRJGEWFRN1vpcW+LtfeT73Cs3QOavdEGKscPhSIEF0m xAcKkOdqJqvXgEKRYAiHIXgEBzs5tyXsASPsLS7Ezsk2bRziuXOa/CyQkqXJt4t/YTym WxAg== X-Gm-Message-State: ALKqPwdhwxAnmNRoeM9Qg1P+4QkEIzsEmJne9k1Ec4Yu82D2a3uVM1Ba 7CMC3Yr7HgSahd1WL8VEdiSnWw== X-Google-Smtp-Source: AB8JxZr+Sc4XeaQaqtRlmBceg5voJJWBSvhgZEcOrrDmO6xJRINfbSKUVCcX3nlUNx02cesJG+RT6A== X-Received: by 2002:a62:3745:: with SMTP id e66-v6mr1604652pfa.43.1527057344991; Tue, 22 May 2018 23:35:44 -0700 (PDT) From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:32:44 +0800 Message-Id: <20180523063246.3742-7-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:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 23 May 2018 06:35:45 +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.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma Subject: [libvirt] [ [PATCH v3 6/8] virsh: Add event name completion to 'pool-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.24 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:36:16 +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" Signed-off-by: Lin Ma --- tools/virsh-completer.c | 30 ++++++++++++++++++++++++++++++ tools/virsh-completer.h | 4 ++++ tools/virsh-pool.c | 1 + 3 files changed, 35 insertions(+) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index c0c3c5571a..1fab758e12 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -707,3 +707,33 @@ virshEventNameCompleter(vshControl *ctl, virStringListFree(ret); return NULL; } + + +char ** +virshPoolEventNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if (VIR_ALLOC_N(ret, VIR_STORAGE_POOL_EVENT_ID_LAST) < 0) + goto error; + + for (i =3D 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) { + if (VIR_STRDUP(ret[i], vshPoolEventCallbacks[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 9f8dc3dfa8..76fa31cb47 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -85,4 +85,8 @@ char ** virshSecretEventNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshPoolEventNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index f0544d2e2d..5f59e35894 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -2098,6 +2098,7 @@ static const vshCmdOptDef opts_pool_event[] =3D { }, {.name =3D "event", .type =3D VSH_OT_STRING, + .completer =3D virshPoolEventNameCompleter, .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 From nobody Sat Apr 27 11:14:06 2024 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 From nobody Sat Apr 27 11:14:06 2024 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 1527057383493696.2495791285793; Tue, 22 May 2018 23:36:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BEB1630B397E; Wed, 23 May 2018 06:36:21 +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 567DB5D752; 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 E326D4CA83; Wed, 23 May 2018 06:36:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4N6aHCd017427 for ; Wed, 23 May 2018 02:36:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id DE05E60851; Wed, 23 May 2018 06:36:17 +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 143EB6090D; Wed, 23 May 2018 06:36:10 +0000 (UTC) Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) (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 F232A30B9DFA; Wed, 23 May 2018 06:35:54 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id e1-v6so8952066pga.6; Tue, 22 May 2018 23:35:54 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 23:35:53 -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=pjzCkx+pVhDdqAxaOkHaJqcXdPHxufpsz93JFLQI4ak=; b=WkQQ55y1sgEH/TTH9lXL1g0DHdsjKhPbSlui/mcC8P4l7NghalSL5yV7dNcSHg0cJj urNxaIwTTNS3q9HMiwJKlUvKSG9GMNAbzpv1j+nE8u5+zC240Hr0i2DP4z7MfQyUgKtV 80NP7F7/mi24dFxDS9eAHirPMsYgD+ILFhudBuYz2OGdyPmoqwg5r1vRKU8RruiTDXWs BPH4Q5civG0Scu2b9KlAXJDeAWXGDTxAmrpjXGu52DI8G9qXZJ3cE5+f2rPQ9Lf73vld ljxGJ5L6lBBt/VKdLI26vpIx3gIJAukpSzAAzuGv0mtl6LBnbcmLC2skhNjcCGK1bOtQ okIw== 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=pjzCkx+pVhDdqAxaOkHaJqcXdPHxufpsz93JFLQI4ak=; b=l6bK2grOlrfYneLyjLcaiX1uGezTe/X7Osu+FkeIFazDWt/8mFoBNd5/JGS+bcnGDi QFwcT4OWoDxeP5YFbJSFVbaY42fbqU1DoWIcZmV+u2YG7zHk6zJbsLO6YaO41VStLkVl 06IPzm5yp1B+QOA+ixWA/ZmVS39NihA/jDr1Q9m0kOOq2azTHT83riYKOWlq9LRe9jpw tkUh0wTW6+9qS9N0bj4sa5NqY7rVFuHebAcmfJXwoa2jJ6QroDWW0E/8Y5y7QI/9N4+N E60ng6/lSPKA7IrCUOchGGnI7OIM1f6yA3eEg/hFPa5cukdQRW2bjBjU0Qa+07sOHmY4 mPKQ== X-Gm-Message-State: ALKqPwejmQT9fWxVjRDpPQ1qGT3J8deS4gahO3Vh/5brBBW/I9ofPQzk LtOzKywEWwEjxfUUBT5W53xRpA== X-Google-Smtp-Source: AB8JxZp/pd7Sov/ATFWOScYbyfNzfw3UOiPpRqZ9RsGX/MYgyrndgAMfpNManAqnrFeUEzhzFNyIhg== X-Received: by 2002:a63:81c7:: with SMTP id t190-v6mr1281224pgd.378.1527057354169; Tue, 22 May 2018 23:35:54 -0700 (PDT) From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:32:46 +0800 Message-Id: <20180523063246.3742-9-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:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 23 May 2018 06:35:55 +0000 (UTC) for IP:'74.125.83.68' DOMAIN:'mail-pg0-f68.google.com' HELO:'mail-pg0-f68.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.68 mail-pg0-f68.google.com 74.125.83.68 mail-pg0-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma Subject: [libvirt] [ [PATCH v3 8/8] virsh: Add event name completion to 'nodedev-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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 23 May 2018 06:36:22 +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" Signed-off-by: Lin Ma --- tools/virsh-completer.c | 31 +++++++++++++++++++++++++++++++ tools/virsh-completer.h | 4 ++++ tools/virsh-nodedev.c | 1 + 3 files changed, 36 insertions(+) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 1fab758e12..162b7a0e1c 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -26,6 +26,7 @@ #include "virsh-domain.h" #include "virsh.h" #include "virsh-pool.h" +#include "virsh-nodedev.h" #include "virsh-util.h" #include "virsh-secret.h" #include "internal.h" @@ -737,3 +738,33 @@ virshPoolEventNameCompleter(vshControl *ctl, virStringListFree(ret); return NULL; } + + +char ** +virshNodedevEventNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if (VIR_ALLOC_N(ret, VIR_NODE_DEVICE_EVENT_ID_LAST) < 0) + goto error; + + for (i =3D 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++) { + if (VIR_STRDUP(ret[i], vshNodedevEventCallbacks[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 76fa31cb47..1190130ec0 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -89,4 +89,8 @@ char ** virshPoolEventNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshNodedevEventNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 66cf46c22f..f6bdeadd62 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -870,6 +870,7 @@ static const vshCmdOptDef opts_node_device_event[] =3D { }, {.name =3D "event", .type =3D VSH_OT_STRING, + .completer =3D virshNodedevEventNameCompleter, .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