From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AF97C433EF for ; Tue, 24 May 2022 14:57:14 +0000 (UTC) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 692714281F; Tue, 24 May 2022 16:57:13 +0200 (CEST) Received: from mail-108-mta72.mxroute.com (mail-108-mta72.mxroute.com [136.175.108.72]) by mails.dpdk.org (Postfix) with ESMTP id DB7D2400D6 for ; Tue, 24 May 2022 16:57:11 +0200 (CEST) Received: from filter006.mxroute.com ([140.82.40.27] 140.82.40.27.vultrusercontent.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta72.mxroute.com (ZoneMTA) with ESMTPSA id 180f692620c000c327.002 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Tue, 24 May 2022 14:57:10 +0000 X-Zone-Loop: 4a532050bf251c74bd668dd87c6027715176b4db67ed X-Originating-IP: [140.82.40.27] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ashroe.eu; s=x; h=Content-Type:MIME-Version:Message-ID:Date:In-reply-to:Subject:Cc:To: From:References:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=aPRs02ZyAmWGIVR9r/WlJG90CjuaLLGv2rmglcGg8Fc=; b=AMYcVAesW0HfAamdF9V6FCba1h OBQKkYL8oqzqyKgXhpYneqk6b+f0ELbJ9SpFYXoBgXd9WUrMAv0PSlx4tQcdPvDvQzHU1n9VSsva2 w70kMBBdbtzm/npGu2u5Jqubm2z6TX7REG04jihopBL50yri9uvVD3Xnil+oG+XWHpGr5+GgIs87l ha8+L76LQWOB2Hyyn3Zt7z/6IKP1BprNeRlwEPef/1kekak6rorvKOxOhPRUxVC9LR2ZnBo610FmL h7EGgnzh+VCxIuWZWRnd5N0UnzN4z3531/6u4VyZj14W0ZCI3IDeIiUQQKzZLXEExbd6VMKRnrw53 3aPpGUrg==; References: <20220520145631.137962-1-bruce.richardson@intel.com> <20220520145631.137962-2-bruce.richardson@intel.com> User-agent: mu4e 1.4.15; emacs 27.1 From: Ray Kinsella To: Bruce Richardson Cc: dev@dpdk.org, stable@dpdk.org, weiyuanx.li@intel.com, xuemingx.zhang@intel.com, Olivier Matz Subject: Re: [PATCH 1/2] cmdline: add function to verify valid commands In-reply-to: <20220520145631.137962-2-bruce.richardson@intel.com> Date: Tue, 24 May 2022 15:57:07 +0100 Message-ID: <87pmk3yo58.fsf@mdr78.vserver.site> MIME-Version: 1.0 Content-Type: text/plain X-AuthUser: mdr@ashroe.eu 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 Bruce Richardson writes: > The cmdline library cmdline_parse() function parses a command and > executes the action automatically too. The cmdline_valid_buffer function > also uses this function to validate commands, meaning that there is no > function to validate a command as ok without executing it. > > To fix this omission, we extract the body of cmdline_parse into a new > static inline function with an extra parameter to indicate whether the > action should be performed or not. Then we create two wrappers around > that - a replacement for the existing cmdline_parse function where the > extra parameter is "true" to execute the command, and a new function > "cmdline_parse_check" which passes the parameter as "false" to perform > cmdline validation only. > > Signed-off-by: Bruce Richardson > --- > lib/cmdline/cmdline_parse.c | 20 +++++++++++++++++--- > lib/cmdline/cmdline_parse.h | 17 +++++++++++++++-- > lib/cmdline/version.map | 3 +++ > 3 files changed, 35 insertions(+), 5 deletions(-) Acked-by: Ray Kinsella