From nobody Tue Nov 5 07:50:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=mit.edu ARC-Seal: i=1; a=rsa-sha256; t=1670967782; cv=none; d=zohomail.com; s=zohoarc; b=nnoOSvVqEDMTiGxdRhD33763dQwQoR4LuQmEGWit7stLX9pqczQDT7sP3VqlAVwNOerZz7qaHlVkfgTnHzHDbIz+EWwPlqBnrvaO804bXBwWB8QjXAYQAdgwNdhYmU/jI/Y9nbJWMGSitNBt9WiILibXG4b3d5xv1UzaNH69zgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670967782; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b/fRDQjk1a1CUz1f4lwvRtAJOQhJid7h6LlJif5e9Qk=; b=EIXDB3SYQwOrIU295Ffyciyg/Vflo1XgOybs/5XEX0D6rorzyph91PjtwYYhbuFOEJxnQbx8oBazZAKDlrt9TSQona2laPlFgUPuVYldgoDfGU4Vqh0aNKuNSUAur9pSPHA2Gzzh+FFJDDjbEfijsRVA8Y7y28FORudwqAtIurA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1670967782938462.901333656965; Tue, 13 Dec 2022 13:43:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5D04-0001I7-1q; Tue, 13 Dec 2022 16:39:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5D00-0001Ea-S9 for qemu-devel@nongnu.org; Tue, 13 Dec 2022 16:39:41 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11] helo=outgoing.mit.edu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5Czz-0007jY-9X for qemu-devel@nongnu.org; Tue, 13 Dec 2022 16:39:40 -0500 Received: from panda194.. ([18.4.85.108]) (authenticated bits=0) (User authenticated as fasano@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 2BDLcaPA030603 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 16:39:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1670967574; bh=b/fRDQjk1a1CUz1f4lwvRtAJOQhJid7h6LlJif5e9Qk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Re+IXSkO82sIvAiugHKM0M5MOjygXQVHZ60AwcxOAk5N5C2ZU1vYkj7pFS51f0z+D owhAdwuM0wBDr5cDX0FMHQRCgOwVi0c1IwaVBGLGaO5L3WnVufPMd3eVg9w2Eol/El OF+ML6mFGBQ4exZt9IVyXUPOnKyO/NVXvWWdhBXeHtUzqfyNRlYsI6lHnmRIocKUDd gB6Ccu2qxbnDT4F8RhuTKGULyhwDOjm+i3ecEUy1DtKjJ5Y4ex/6BfXxY2uSvAgJYk k6eey1l2c7EZiCcQDNrg2sXs6O8jsG4bYtjOc2rTugAcmU54veozI39MMGQ5A6+9A7 d+GukysafNJ4Q== From: Andrew Fasano To: qemu-devel@nongnu.org Cc: elysia.witham@ll.mit.edu, alex.bennee@linaro.org, erdnaxe@crans.org, ma.mandourr@gmail.com, Andrew Fasano Subject: [PATCH 3/8] plugins: add id_to_plugin_name Date: Tue, 13 Dec 2022 16:37:52 -0500 Message-Id: <20221213213757.4123265-4-fasano@mit.edu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221213213757.4123265-1-fasano@mit.edu> References: <20221213213757.4123265-1-fasano@mit.edu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=18.9.28.11; envelope-from=fasano@mit.edu; helo=outgoing.mit.edu X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @mit.edu) X-ZM-MESSAGEID: 1670967784911100003 Content-Type: text/plain; charset="utf-8" From: Elysia Witham Plugins will pass their unique id when creating callbacks to ensure they are associated with the correct plugin. This internal function resolves those ids to the declared names. Signed-off-by: Elysia Witham Signed-off-by: Andrew Fasano --- plugins/core.c | 12 ++++++++++++ plugins/plugin.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/plugins/core.c b/plugins/core.c index 5fbdcb5768..6a50b4a6e6 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -248,6 +248,18 @@ int name_to_plugin_version(const char *name) return -1; } =20 +const char *id_to_plugin_name(qemu_plugin_id_t id) +{ + const char *plugin =3D plugin_id_to_ctx_locked(id)->name; + if (plugin) { + return plugin; + } else { + warn_report("Unnamed plugin cannot use QPP, not supported in plugi= n " + "version. Please update plugin."); + return NULL; + } +} + struct plugin_for_each_args { struct qemu_plugin_ctx *ctx; qemu_plugin_vcpu_simple_cb_t cb; diff --git a/plugins/plugin.h b/plugins/plugin.h index ce885bfa98..9e710c23a7 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -104,4 +104,6 @@ void exec_inline_op(struct qemu_plugin_dyn_cb *cb); =20 int name_to_plugin_version(const char *name); =20 +const char *id_to_plugin_name(qemu_plugin_id_t id); + #endif /* PLUGIN_H */ --=20 2.34.1