From patchwork Fri Feb 24 14:30:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Tao X-Patchwork-Id: 61346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp946185wrd; Fri, 24 Feb 2023 06:40:56 -0800 (PST) X-Google-Smtp-Source: AK7set/elMEyeUYT4Su93UYsfH6VZZ1PEA4++0ke/g6fZrf3ilFEMmGwJRenc5MRbJ8s75z4JwQk X-Received: by 2002:a17:90a:195:b0:233:d854:2701 with SMTP id 21-20020a17090a019500b00233d8542701mr15473518pjc.41.1677249656582; Fri, 24 Feb 2023 06:40:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677249656; cv=none; d=google.com; s=arc-20160816; b=D/FSArI+GbLi8qJVyhCSAKXHU6BNohK43UiOX1re9kqd8SWCxOm5awqZTjs/0M7IaB fKP22AERCsuDCHlHCOYAiNwWc+alEluRyW3u2C9FKXg/1QA8wcflbrKAdK0OZTbW/jyE sJANbaos1wyRyCwigUC+DM1IzZkxEDnmubSH/qmUC79YCUuJYxZlsy1oZu0yirXfLPkZ e6hd+B70LfhbeCGTZJmrj+7BCQ9B8mezSSSikXRPj8LpsBD0AhKgngQN/DTl6T2CXen8 YZ/uyI1olXKGa/U9+LKyM4/WS/RjPfWIAuGVcDCzNud2N+XPCs7IYchXXwUc7/CZouih +G6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date :subject:cc:to:from:message-id:dkim-signature; bh=W3vbmfyZv8kgZWgDHqtjr/Qbr0uqZvAd9EBnAPC1r48=; b=ShNle2bUX64ltWnSl8nv1yo+x1chueZvj5y1BncpXxu9WfaZfS0s6Sl7NltJBULcll bnNFf8Vl/uWNKmPL5Pqcmeqi80fIz7XkbeT/DP6x3JvTJy1IU9mVp9MwSd+tqLq9e05D Z93UFec68d3HsA57KLlo4o8lp0OAXYzR7enT8N0z2toDuyO9vfciZgLRv66e1DWYCRHd VJpZIAa1cGCyWDn2U3K57MjY2giD+1s+VKUyIzcpw+u3gpQIjn5cIYYAR2uhQ8nu9cVT JwxH6YqMAvFyiD3GkxPmSKnur7lDSEXF/VSYaPyYSI4Hy+J27Pk05aUUx9G8tZkGHXwc dWow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=VyfK0ekR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a17090a1f8300b00233f33ee8a7si2343480pja.69.2023.02.24.06.40.43; Fri, 24 Feb 2023 06:40:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=VyfK0ekR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbjBXOak (ORCPT + 99 others); Fri, 24 Feb 2023 09:30:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229748AbjBXOai (ORCPT ); Fri, 24 Feb 2023 09:30:38 -0500 Received: from out203-205-221-240.mail.qq.com (out203-205-221-240.mail.qq.com [203.205.221.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CABB864E25 for ; Fri, 24 Feb 2023 06:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1677249033; bh=W3vbmfyZv8kgZWgDHqtjr/Qbr0uqZvAd9EBnAPC1r48=; h=From:To:Cc:Subject:Date; b=VyfK0ekRXk+ILxGydbna7SOM3fd2mBN46hf3hS2CyWjvWYLcF9odQpQEZJN2Z+5QE 43b7gJepztgIgiIKvGMuvq+4aoEyIlfSyFsGOLwutjQqm7mKFE/PLBPMUD81qNr6Ya ShCaoANuklR7UhyBFBnRVsfr3PmcL4U5KxVw3pZc= Received: from rtoax.. ([111.199.188.149]) by newxmesmtplogicsvrszc2-0.qq.com (NewEsmtp) with SMTP id 79FB9AF5; Fri, 24 Feb 2023 22:30:31 +0800 X-QQ-mid: xmsmtpt1677249031thxy3muds Message-ID: X-QQ-XMAILINFO: MTmSu602bpi0NiHlqYwpI9anlZQTJxBil0Q4jE3kJ8tMeztO7+KOEy3BPVCAER j80IWathpRfQP5+IF3vQPVR3jVnfw7T6OJD7uyXdnBkfwtmChgKSQz/Xv/wW0umFlWAQKZ2EFM0i w+K+7J0NxNxIjrqzkXXqdaJrF51BMmVFqoUgdAOKQHzNM7GLNem3EzECXZ7p8+TkBuFtzlC81vQx 7sQsXhdfsc5ltniJzEOT4nTabNBW1e1p6MLp+ydM3+oxPXewQqzbe/VUr9pRlXSHBK3TjyFQzFNY 0mMrxnlvN6cPJsZXeB0VYVSQcvZlS99rgx8EYtj0vOWdK6+bkzE5d+q3JWId+GlyegqxnrThpB40 RAOD36XH/X350+IaigUhA6c2qO650pCtlrEFqQZ0Zac1wlykqlGMC8wyY+3y8G+tjZwpav7y0iWU Q08hUByLoHB4K3rLVTRaaqqqI6ojIK8gbihZOZx5+IKp2O3Sr1ujoDAzxSaOZBYZ7s8oXV6zALXB 0kiJrYFDcMZYfWZYj6QeFR5x26m7/6q0dcdEf8aUNIDUeGwKYIXWzpQ+2oNydYF/IRIKRSYgMuLH 8eqqnuIdqAOZhDVGD/IUCv3hMAhD5zCz752XLLFaXLkX3vQVuQV7OEo/GvXviEomiqbznfhFeG0Y 6uD2I0yDzNVFUrmzZJLSNJvV6pW31KrA3O5z4DJcGfvAXcv/huwqDx0nZzvKshaMaoO7LKfn78nA r4xKB7pfxj1iHaugCt6UQns4eytCgFM9+9ruVb8RXQpWtpUhlXpTIwBiYZXnnVFFxQjzUywV9MMG 1tYQ6bB0ARhNbUyGMtS0WrZv2RBF9Fgr36BTd6XTpx5hhLMMbIW91dF90TpCZ2FUO2I3SBRLc326 9ug5Qk8a4v7SzPPKUBMGsyY7qZxGqY44fnmPzQ4LbQaItPmRy0rflMEc7fa08gQF1QnklMLcLhLX 6PRj8QR8jVuoQ/EM5CKhVdGqpJ/nCT From: Rong Tao To: mst@redhat.com Cc: Rong Tao , Jason Wang , virtualization@lists.linux-foundation.org (open list:VIRTIO CORE AND NET DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] tools/virtio: virtio_test -h,--help should return directly Date: Fri, 24 Feb 2023 22:30:30 +0800 X-OQ-MSGID: <20230224143030.549967-1-rtoax@foxmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, HELO_DYNAMIC_IPADDR,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,RDNS_DYNAMIC, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758723735751263278?= X-GMAIL-MSGID: =?utf-8?q?1758723735751263278?= From: Rong Tao When we get help information, we should return directly, and we should not execute test cases. At the same time, the code indentation issue was fixed and virtio-trace/trace-agent was added to .gitignore. Signed-off-by: Rong Tao --- tools/virtio/.gitignore | 1 + tools/virtio/virtio_test.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/virtio/.gitignore b/tools/virtio/.gitignore index 075588c4da08..9934d48d9a55 100644 --- a/tools/virtio/.gitignore +++ b/tools/virtio/.gitignore @@ -2,3 +2,4 @@ *.d virtio_test vringh_test +virtio-trace/trace-agent diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c index 120062f94590..6370cdada396 100644 --- a/tools/virtio/virtio_test.c +++ b/tools/virtio/virtio_test.c @@ -134,7 +134,7 @@ static void vdev_info_init(struct vdev_info* dev, unsigned long long features) dev->buf_size = 1024; dev->buf = malloc(dev->buf_size); assert(dev->buf); - dev->control = open("/dev/vhost-test", O_RDWR); + dev->control = open("/dev/vhost-test", O_RDWR); assert(dev->control >= 0); r = ioctl(dev->control, VHOST_SET_OWNER, NULL); assert(r >= 0); @@ -142,7 +142,7 @@ static void vdev_info_init(struct vdev_info* dev, unsigned long long features) sizeof dev->mem->regions[0]); assert(dev->mem); memset(dev->mem, 0, offsetof(struct vhost_memory, regions) + - sizeof dev->mem->regions[0]); + sizeof dev->mem->regions[0]); dev->mem->nregions = 1; dev->mem->regions[0].guest_phys_addr = (long)dev->buf; dev->mem->regions[0].userspace_addr = (long)dev->buf; @@ -361,7 +361,7 @@ int main(int argc, char **argv) break; case 'h': help(); - goto done; + exit(0); case 'i': features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC); break;