From patchwork Fri Sep 3 09:03:37 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: 506491 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp832311jai; Fri, 3 Sep 2021 02:22:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi7ccfeUytrDaOVc3PXQ8Sl2DvpUFhHm11u0ikEcyuBISD1P96IPt/pl6GggUe0Q8vPybh X-Received: by 2002:a67:df01:: with SMTP id s1mr1778964vsk.18.1630660925585; Fri, 03 Sep 2021 02:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630660925; cv=none; d=google.com; s=arc-20160816; b=Xh3yLGBPeTO8QymGDx5qpX+r6GUje8yA5gGpdaU09Y5NNQQouT/NuvPqxTKGTOoZ+S Aa6fRZo2BODzpqCEiuG7zyIRXWwvfEEkddmzk7h4I0Tvvb/dMQovkOTn+2bmEQfyQqff gQ0W9Qmj3AAUdBVf+1nCROg4r8GDZLH97wCB6tLB/Hclx9Oe+dbBaSY4S9WkfND5XEEN JgJHtLa5FJ14GQRMRhdzJRz60KS4/tD/XZG6KSVFQfe9r3yG1MdC/UjBhaK8J5ZHRQuM YI94+78NZsIwOWtq97HS5aJGGNIHNUwIof0dSzWRWT3RDGggjaCJm7DlvjO1xlXKW3Mh ij5A== 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=rctBFtmR+dPbwtBUWAW00cSmCz1yMMhGQfbKWbQXJww=; b=eKhABzQAr5Unj+DGPExl8j8qV6ij763zDfBMAAFzu/h+JuSD72HN9nP7JoMk8/MDW1 mg1VSquw8ovv5CDxLjjfDFtU0kd4sbMxK66kCzneILkaa7qmar7cfXLO6e+PUQ5vyYj2 jHUP7k8u2Vv5Ogpke0Olxi0k2ApYMVjhq4ECmn7+mV8M2nMOjTSX/juyAE44y1hnCpvD 2kQdCQ4+XjD3rqVGlQFF6Z4MN856UwfECQHrNAe8/vVu3+j3pJhbQ1Pc3IJcxLAlnwqX vMvCxy66ImCY36PizR+tn2bowbN/5FbE7+rs9szX6lfRofm2SMsBlNA3WGkwrA2vL6/N GurQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Fr1STz58; 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 f16si1084258uap.82.2021.09.03.02.22.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 02:22:05 -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=Fr1STz58; 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]:57012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mM5Oe-0007Ie-WE for patch@linaro.org; Fri, 03 Sep 2021 05:22:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mM57K-0006YM-PJ for qemu-devel@nongnu.org; Fri, 03 Sep 2021 05:04:12 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:36737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mM57E-0005lJ-MU for qemu-devel@nongnu.org; Fri, 03 Sep 2021 05:04:07 -0400 Received: by mail-wr1-x42d.google.com with SMTP id q14so7180426wrp.3 for ; Fri, 03 Sep 2021 02:04:04 -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=rctBFtmR+dPbwtBUWAW00cSmCz1yMMhGQfbKWbQXJww=; b=Fr1STz58etTag+mpOkNieMCu+pUwUCdb8jGtW68Nis66iws5MyW+UOBwaYN4Y17Juv gsdSyGNP/dC15kRpYGJnVCgfMkTK2poVzMYuWld7lg5pSkwEJra8Z3J3+QItCocn+ZwT QPSMZrwPCYeKLLsCIYQNTltDazE5hHiqSnJHmj2gntxg0F/2uFEK92hL30v1fNVtguQa Vs/QO1rZutvE9B+Y2/uewuXmlxQhanC3KbCANFQTGPVjP+14jotA3S/aNyCmtXwAM/bc pdmu2IoywYavqMQOg+wUej7BKbFEeLkNpvCb0y4VaFg10uzu4EqqM0wUtfSNi8ocQvmM IWkA== 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=rctBFtmR+dPbwtBUWAW00cSmCz1yMMhGQfbKWbQXJww=; b=YIoNWW5TcCL0kUKTSKPQ7r1AveBovaoooPwzoL77XNENzv5sKNk3hYsfP/sZK5uOPs Rx2O3PgaEYMUpggTLUXV4KIuk/tjaj/h6yXZ3EwnGkCkL2v6oXdhB9yXoRiDvC3UeLMu WyBaos2CxNke4egXu6Dnce0je4NA7rbbWTZIvub9faAZ0YZf6zfih/DQ2WgMgreciS9J GZyO1NheNLeHhmvIZFjR34dTmbXl9GxbFlXTL5uwHOkSDSMtLdpn75Boy1rwgOr5QrZR P1vAA8BiGaUpgB5zD9WwrHnq5bnC62dJBJfCoEbLiioi1PrC/IK+cEbgVoyPw8LXblqq XsTQ== X-Gm-Message-State: AOAM5329GxBOIGS4Z863ZukR9FhlhYhbRLeVbSdCF8IAr3e9jsT/eKxa w+Rh1BI5bAv9xtFTWgYTJPxaGA== X-Received: by 2002:adf:a2c4:: with SMTP id t4mr2832210wra.258.1630659843258; Fri, 03 Sep 2021 02:04:03 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id k14sm4124243wri.46.2021.09.03.02.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 02:03:57 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 732981FFB5; Fri, 3 Sep 2021 10:03:41 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 20/22] tests/plugins/syscalls: adhere to new arg-passing scheme Date: Fri, 3 Sep 2021 10:03:37 +0100 Message-Id: <20210903090339.1074887-21-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::42d; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42d.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 Signed-off-by: Mahmoud Mandour Reviewed-by: Alex Bennée Signed-off-by: Alex Bennée Message-Id: <20210730135817.17816-13-ma.mandourr@gmail.com> -- 2.30.2 diff --git a/tests/plugin/syscall.c b/tests/plugin/syscall.c index 6dd71092e1..484b48de49 100644 --- a/tests/plugin/syscall.c +++ b/tests/plugin/syscall.c @@ -119,17 +119,26 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, int argc, char **argv) { - if (argc == 0) { - statistics = g_hash_table_new_full(NULL, g_direct_equal, NULL, g_free); - } else { - for (int i = 0; i < argc; i++) { - if (g_strcmp0(argv[i], "print") != 0) { - fprintf(stderr, "unsupported argument: %s\n", argv[i]); - return -1; + bool do_print = false; + + for (int i = 0; i < argc; i++) { + char *opt = argv[i]; + g_autofree char **tokens = g_strsplit(opt, "=", 2); + + if (g_strcmp0(tokens[0], "print") == 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_print)) { + fprintf(stderr, "boolean argument parsing failed: %s\n", opt); } + } else { + fprintf(stderr, "unsupported argument: %s\n", argv[i]); + return -1; } } + if (!do_print) { + statistics = g_hash_table_new_full(NULL, g_direct_equal, NULL, g_free); + } + qemu_plugin_register_vcpu_syscall_cb(id, vcpu_syscall); qemu_plugin_register_vcpu_syscall_ret_cb(id, vcpu_syscall_ret); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);