From patchwork Fri Sep 3 09:03:30 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: 506495 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp838385jai; Fri, 3 Sep 2021 02:31:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1xkc0f165DhLQFbDWJaIkbf0whokZZIchucWEAIr7rZ92adI3ydaaMV4FW2ozawYgCDMm X-Received: by 2002:a25:48c7:: with SMTP id v190mr3487170yba.312.1630661518363; Fri, 03 Sep 2021 02:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630661518; cv=none; d=google.com; s=arc-20160816; b=fXL3fOB/14f4YNc+aV+qtQ6qJ8En/pUSyIYaMYWYUjVGeDVY2NwI3xNN2TNOUvgk7C dymTPBqUbhoMXwwadZpNIG+nIJt0Uqr1HwGkrdnu1/4N68Y43wfBYpD+UyUDCrPGIHuJ HoNc/SI5W61Zjbl5JOS3ikOTVrTpAPiYFF5A+6KBS7b3dD7ZOVSCPg6Dd+2e4YhOfco+ 75hmFT5WX6qyqGoV2rFaV7EQzzO8wEkQDvt8awB/gdZtBOnNpkXakyjjK2cwuoxsA3FG OU/IVWOMXkjgWmgpfrz1Pwj2+ITrQVxHkdRqHVaRvJ+338e96PJt60raGQYNUsM9S1S4 vVkw== 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=ZXuwxkhWA08Lj53nliSBduusJq0bDFXFFfvFTQKmSYs=; b=hk6QoIDVZ4HpAY/6AgqzmUUamWHO2dIWFSNah02Whgjalpt4vNRTaNWZmAJwqELkLd oeR4C5y1vDyVOxTZ4yA61env1Dmt/XIvxRyIMGJrbo7YwpxWDA3Yvm2A9CVVjWYE7TOl 89euDRe7za0GxazLI3ec4HoHtrU8qoBTxLBYA9uv/97XDVqouawqdHfNQHXLKoXl8uLx +Huird2Ah9OGaE08SBB0Sm5exZjQQnvWDLeUs8Z4ffyNc1OFKWaTvx8f+vZ0WikwzmT0 U7szGslsw+nnXZSwzmFKPwMI30+ptji/3w6RkBQL+eD/aOCmf/slCOtfwx48mLNA9E9V MWdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HwZ+apV9; 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 u64si4244309yba.456.2021.09.03.02.31.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 02:31: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=HwZ+apV9; 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]:59816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mM5YD-0003Bk-Ni for patch@linaro.org; Fri, 03 Sep 2021 05:31:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mM5F6-0003mw-IX for qemu-devel@nongnu.org; Fri, 03 Sep 2021 05:12:12 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:38532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mM5F4-0003xR-Uh for qemu-devel@nongnu.org; Fri, 03 Sep 2021 05:12:12 -0400 Received: by mail-wm1-x333.google.com with SMTP id k5-20020a05600c1c8500b002f76c42214bso3287412wms.3 for ; Fri, 03 Sep 2021 02:12:10 -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=ZXuwxkhWA08Lj53nliSBduusJq0bDFXFFfvFTQKmSYs=; b=HwZ+apV9EWg5qfya3blYaNtAAdb5nUfb9OEjD1UA1Y8Mr2qpuR8MNo4T3PGXmXPl32 Zefk+e/q5YLRJvx2THXRepvoLVIOHcbCBxZ3QXtpdtPylKu7QByN2BlAIbyjysVLEAmx zZk4qfWGqvnuuOMy6P9C5c8FWygtVEms+SwsCseaanpVSOa10mdmQdzDfsXM3mjILVLJ NABn1aL0ivQUXovX+YKswW9boQXDeh0mct+581GMqzt3Pz8lMU6R62/dvgxVMwK4o1WV IZ25bbuZyjGnob2HUxgeXcppCLinojQBRa5/yMKHZqPHxHbKA0A6SIGXH26V7sd5WHrb Hygw== 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=ZXuwxkhWA08Lj53nliSBduusJq0bDFXFFfvFTQKmSYs=; b=qOPoDLR18792QEXyAgsH6fP9/sjKluRKJEAckoDBk1upPvRZ2m/ERubW2MKJTN7k+c sPbIfFQrnqqNa18kw2K09JkvfPy9JPjZGqcHRmmdvKAhCJI9wAoZ+cArwcUsOEcg93fG JIfEDbbE0st7QM+AaD/R/I80fAYSUovNfPEMe39G80lh7R90yKgP2bR9vCuXW8HAqlMv DNpJ/S8UpYkPsD3OxyWbNOgGqu8/vklGPyV7gLnlJRWVv/Zik21OIvEF38MM6pmSqzte 3IpJEq9CXBa1V8+HTYZ5UiTRk9N3EuVCrHBoPkdqYQkMBwQz6xCr+PfWfYB9f5teHrAr HBoA== X-Gm-Message-State: AOAM531oYamjYKc1sadtTXCpwuWdZY7Xh9SjlmuLDWiusaSq1f9tpUab gMdmnBpCMk8M7m28gJ+O4XhOSA== X-Received: by 2002:a1c:98d5:: with SMTP id a204mr7200184wme.52.1630660329625; Fri, 03 Sep 2021 02:12:09 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id q14sm4136468wrc.31.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 E41361FFAB; Fri, 3 Sep 2021 10:03:40 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 13/22] plugins/lockstep: make socket path not positional & parse bool arg Date: Fri, 3 Sep 2021 10:03:30 +0100 Message-Id: <20210903090339.1074887-14-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::333; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x333.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-6-ma.mandourr@gmail.com> -- 2.30.2 diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index aa75b390b1..5cddf31c70 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -286,7 +286,7 @@ communicate over:: ./sparc-softmmu/qemu-system-sparc -monitor none -parallel none \ -net none -M SS-20 -m 256 -kernel day11/zImage.elf \ - -plugin ./contrib/plugins/liblockstep.so,arg=lockstep-sparc.sock \ + -plugin ./contrib/plugins/liblockstep.so,sockpath=lockstep-sparc.sock \ -d plugin,nochain which will eventually report:: diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index 7fd35eb669..a41ffe83fa 100644 --- a/contrib/plugins/lockstep.c +++ b/contrib/plugins/lockstep.c @@ -319,22 +319,35 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, int argc, char **argv) { int i; - - if (!argc || !argv[0]) { - qemu_plugin_outs("Need a socket path to talk to other instance."); - return -1; - } + g_autofree char *sock_path = NULL; for (i = 0; i < argc; i++) { char *p = argv[i]; - if (strcmp(p, "verbose") == 0) { - verbose = true; - } else if (!setup_unix_socket(argv[0])) { - qemu_plugin_outs("Failed to setup socket for communications."); + g_autofree char **tokens = g_strsplit(p, "=", 2); + + if (g_strcmp0(tokens[0], "verbose") == 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &verbose)) { + fprintf(stderr, "boolean argument parsing failed: %s\n", p); + return -1; + } + } else if (g_strcmp0(tokens[0], "sockpath") == 0) { + sock_path = tokens[1]; + } else { + fprintf(stderr, "option parsing failed: %s\n", p); return -1; } } + if (sock_path == NULL) { + fprintf(stderr, "Need a socket path to talk to other instance.\n"); + return -1; + } + + if (!setup_unix_socket(sock_path)) { + fprintf(stderr, "Failed to setup socket for communications.\n"); + return -1; + } + our_id = id; qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans);