From patchwork Tue Nov 22 15:32:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 120105 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E9455A0582; Tue, 22 Nov 2022 16:33:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD1A142D72; Tue, 22 Nov 2022 16:33:05 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mails.dpdk.org (Postfix) with ESMTP id 3D04442D71 for ; Tue, 22 Nov 2022 16:33:04 +0100 (CET) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id CB1935C01F1; Tue, 22 Nov 2022 10:33:02 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 22 Nov 2022 10:33:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1669131182; x=1669217582; bh=bn /sfW8qJPYTaGhHHJ2a/K8UknYYJ8YmWksBltOTDE4=; b=O9TF6QvGbwaQm1ALtw rdmCVd4hjq2RFa0oJXb4NY25C2I9r8kK80PMihqAIgQQMyOjAIFsCtU2f7qDyepb kDki0V3kCKdUpMpJPiKBPoARG7AR7aBqIVtD1YhBpejNTqeHfCdv+56rVPSVNSiX j9H4up0WOvZoOyHHcQ4hcSdnzy1RAp9cANPu34p8CUTzc36w7v8nJFbceRWU6Up5 yuVJXiyUd0N2GGNzwZL6MfKL6jICg2cR3hlgjuRWgwv9T7+OihqXyvIKq5KWUJ2s e9Tr47YrcGOfCRrQ9IQ8xHvZwgw7J97ZUrgY8fTE+q/yKGnCVF/H53jaAeCsx1qh iyLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1669131182; x=1669217582; bh=bn/sfW8qJPYTa GhHHJ2a/K8UknYYJ8YmWksBltOTDE4=; b=E4bv4nslZB/kQ/RW2KZIxADDYXnM2 Eo5QVEipliUnq3pJ7JxJIc3J55wxczCwJj/Pud1HVfUhwksQOB5ET+vR2gMAvj4t YZe4rmhqB2gp76olTQXGkRFaypGvloJN7RWXeqyVfzhsaMiEFhEoTzOaskozhGcM Bk+GrW/fhdfP4QMtRlsY3lzwPxqaUGKuSsWwUu3ERxKBeNYL8Sjmr0Jg5ThYI9UV LZcNyT/RQkysfIy4F3wmMtkUCaOqHSCgaUI8AyRb8yhlpcwCSPaLr5JXLn3FZ7UH /EuDC/Kd9fWD9e9S5S9pGFZH+vJfdVwTiriknAruYciXQVYl4dRYc6R5w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrheelgdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedvjefhudeghedvtdeije eigeetuedugfejueekieeltdfhteevkeehhfeilefhtdenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrd hnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 22 Nov 2022 10:33:01 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: rjarry@redhat.com, bruce.richardson@intel.com, stephen@networkplumber.org, dmitry.kozliuk@gmail.com Subject: [PATCH v2] usertools/hugepages: show usage if no action specified Date: Tue, 22 Nov 2022 16:32:38 +0100 Message-Id: <20221122153238.2373095-1-thomas@monjalon.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221104113018.4069058-1-thomas@monjalon.net> References: <20221104113018.4069058-1-thomas@monjalon.net> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Previously, the script was doing nothing if no argument was provided. If neither show, mount/unmount, clear/reserve are specified, it is assumed that the user does not know how to use the script. So the usage and an error message are printed. The exit code will be non-zero. The user will understand something is wrong, and can recall the script with the option -h to get more information. Signed-off-by: Thomas Monjalon Acked-by: David Marchand --- v2: replace parser.print_usage() and sys.exit(1) with parser.error() --- usertools/dpdk-hugepages.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py index a22d504d3a..bf2575ba36 100755 --- a/usertools/dpdk-hugepages.py +++ b/usertools/dpdk-hugepages.py @@ -272,6 +272,9 @@ def main(): args.reserve = args.setup args.mount = True + if not (args.show or args.mount or args.unmount or args.clear or args.reserve): + parser.error("no action specified") + if args.pagesize: pagesize_kb = get_memsize(args.pagesize) else: