From patchwork Fri Sep 3 09:03:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 506497 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp840359jai; Fri, 3 Sep 2021 02:34:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9p/RD1pmhCb73BXFM+DXYwZ/Vk3ymn3RV06FzCWZCLS9BrlEfEka+lk6Gu24ziG1v0VWV X-Received: by 2002:a25:b7d3:: with SMTP id u19mr3605404ybj.158.1630661698913; Fri, 03 Sep 2021 02:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630661698; cv=none; d=google.com; s=arc-20160816; b=V+ok4Ihk/vsCugvaiSL850q28aGKK0nS33tJzrpQptPvuqb7GKtSmaXacaJGGfvify tI7zH+VXhtgwZgWczxoxN3bVhl67+t5L6etC5HCu++BJNkceIBdGZd5Xs8Mq4pNO0Z/f +Ctor1AzlAN/FNlmrVxz8hhl5EehdjXVpyoMG67DaaHEiRgxhDbJm/OjAW5tukp6T/N0 DDidd1Sgefw7FsUuQYAnkN8aO3LIu3wYz7ysQbTOlsor21o160sWdxSXzjxdzJWvhAx+ GpbixhXAf6i92P70EB5SzquELqkqS4fvp0Z6gG9heZqccPfSLH9tTqb6DcxdEEjYRXtY k+qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1bVEVWhNaQF2veQzCYIds6OQeILaCkMmELL9XjWUDS0=; b=vkU7LPzK23lFPA76auP0F+9D7Lu7FUOMrGEfdX4+X+A9m79DtsLkT4Rnh8SUbL/H6Q SwS5AuIzU1bkzbmN7yGHuw8Po97LQm4ErMk6kS4E+2e4rzTbZWEcb0hftGtXUI80v84V xxt7Ag3QVfgR90TvvbJmmef4E75k0myu6b8wLGAhkn5Emprc6wvxSF3BaRphz1oJnKzw hhZVwm4D0BUtBUiZ/4xWLI+Y8/rK1xoPV8tsGZlMCkyvi/CFeRZS/dLWF2GHi/Cn9Pcm /lCg1vdhLP8Aor+PTixPOgai/KfHf/68q5N4hKl+j44zTeuyIpsL6U6YBwZGMtsuHMOG usqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UgRNCkOW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q203si4495776ybq.7.2021.09.03.02.34.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 02:34:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UgRNCkOW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mM5b8-00025B-CG for patch@linaro.org; Fri, 03 Sep 2021 05:34:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mM5F3-0003d8-N4 for qemu-devel@nongnu.org; Fri, 03 Sep 2021 05:12:09 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:55031) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mM5F1-0003u8-9X for qemu-devel@nongnu.org; Fri, 03 Sep 2021 05:12:09 -0400 Received: by mail-wm1-x336.google.com with SMTP id g138so3031004wmg.4 for ; Fri, 03 Sep 2021 02:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1bVEVWhNaQF2veQzCYIds6OQeILaCkMmELL9XjWUDS0=; b=UgRNCkOWAWGZnfKwkulV/UT0wLptUwmz4/ZuxWARi+dMENZ9kYFVqVF6INdAX1qqen Ii/33CpFZo5/g5usb9mYdoPXdYhLtWutANLZK8ZmI3ZM+U75Mg7B2S+3+whoe6heT306 BF19TUa0dDFEtV9JpnclFsh93ZFap6AOASTROCNSRx9b46ANODMLanMyp4AVmlENecXA wO4vU35YL65czPcMWNxkHFMYxnCrCmkwNXsOq6Pu/xWasEwbYwFvWEflK449FDfrJKfF yzexCHc+OjN/ri0gJo+SbBzyZsqBvUW1giGFh3kUh25pO9yB/uNg4hqpk4+t6n4wmygF oayA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1bVEVWhNaQF2veQzCYIds6OQeILaCkMmELL9XjWUDS0=; b=gqlqUwqQxanOJGBp7WqXo1gtjjcqfVfntrSNLzQDBJ/GEjWFhKLdb7jkTRMoequvvi PIVTMnZvv5LN//QvfsOP1HMqxd9iqWZRCAQDzrkooMwamWL1kAFNd7IJGSpy90S9rUx0 5bSj7Nw0k1iGaZta0z20TpeujcgxA98b9sP2ZQDh4yA+AxutIqHkRra9CjqxCjHNVm5J HlhI3c1EjJlzq9o8ZaRoIKCRWI/RTO3KkzdOp/H54jjibzbanMGavAglTITzY8D1FuzN PelivyYeBJfF6pstwwHKjncj5aZ1omBfaZihD078Rj6H6MroiF0fpDfZSbNRe9bhtdh6 4QWg== X-Gm-Message-State: AOAM530KClmzst/5wIceHr3VVsOoHjMHGuxKUxtjkWzdNsW5jg8Ju2mq aDvlv+I83ave4pX2AT66ulQDnoYK7+lUMA== X-Received: by 2002:a05:600c:350b:: with SMTP id h11mr2283763wmq.101.1630660325417; Fri, 03 Sep 2021 02:12:05 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id x11sm3805781wmk.21.2021.09.03.02.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 02:12:03 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A60981FFA6; Fri, 3 Sep 2021 10:03:40 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 10/22] plugins/api: added a boolean parsing plugin api Date: Fri, 3 Sep 2021 10:03:27 +0100 Message-Id: <20210903090339.1074887-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210903090339.1074887-1-alex.bennee@linaro.org> References: <20210903090339.1074887-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Iooss , Mahmoud Mandour , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Mahmoud Mandour This call will help boolean argument parsing since arguments are now passed to plugins as a name and value. Signed-off-by: Mahmoud Mandour Reviewed-by: Alex Bennée Message-Id: <20210730135817.17816-3-ma.mandourr@gmail.com> [AJB: add to symbols] Signed-off-by: Alex Bennée -- 2.30.2 diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index e6e815abc5..5f1017201f 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -577,4 +577,17 @@ int qemu_plugin_n_max_vcpus(void); */ void qemu_plugin_outs(const char *string); +/** + * qemu_plugin_bool_parse() - parses a boolean argument in the form of + * "=[on|yes|true|off|no|false]" + * + * @name: argument name, the part before the equals sign + * @val: argument value, what's after the equals sign + * @ret: output return value + * + * returns true if the combination @name=@val parses correctly to a boolean + * argument, and false otherwise + */ +bool qemu_plugin_bool_parse(const char *name, const char *val, bool *ret); + #endif /* QEMU_PLUGIN_API_H */ diff --git a/plugins/api.c b/plugins/api.c index 2d521e6ba8..acff9ce8ac 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -383,3 +383,8 @@ void qemu_plugin_outs(const char *string) { qemu_log_mask(CPU_LOG_PLUGIN, "%s", string); } + +bool qemu_plugin_bool_parse(const char *name, const char *value, bool *ret) +{ + return name && value && qapi_bool_parse(name, value, ret, NULL); +} diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index dee7610387..67b309ea2a 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -1,4 +1,5 @@ { + qemu_plugin_bool_parse; qemu_plugin_get_hwaddr; qemu_plugin_hwaddr_is_io; qemu_plugin_insn_data;