Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp28952pxb; Tue, 31 Aug 2021 14:17:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHDckIaLBUme9B2s/pyk3GinnJrUsK8b7iNEOhcjOeOERbJOPuRZ7VxIaNVI5/yuZjPeTa X-Received: by 2002:a6b:b44f:: with SMTP id d76mr24607576iof.189.1630444628787; Tue, 31 Aug 2021 14:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630444628; cv=none; d=google.com; s=arc-20160816; b=OEMhv3ZfaUQSTVYImHV+bIeeTJHRmbDyauG5NS9OSFhmPaBSOYMP0X2hHVt9S1m2XP A2Pw/m2QLXM2yO2mHBq9YUSm06UB+HZRu59m/YHNfP/RtVEWJpv8cw1HIg5wVAza1/Yw GC97PiCuBiFyYS14aDNTeO7h54CADgD6NTNydNNjudOb2kEmJFPEtvmqlM1dHJDO8wxB /xTUSg1SWLvycEihTdbZOe4RRjNZYEMKrd9iJ60Dxu5Ch84hPmek2TpxYNny1cdmN1Xj vLuPbrZcJojMxTn990o7xwMhHFeHsDkSpIOnNqj9JVr22/dZNirI/yRKLoVnHhqMPA4v yVyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LRe13p6ZwTbI34iuc+7hBkuKtcchmH5XuEbvrSbO1wQ=; b=ie+9CPVHn8+c+Jf91maxNu4CAO1Q+NUnpSL5i1IB4wV81+C50FVURXpvWvUD/erOOq 04QO7qZR9fcuE8ecMqYo7oVRNpE7wq+QA+IH8yZao720bLzcy05N9CxalqA505pUOzi3 Lh8/e3lI4x9o8ERUD2eAEkRiY6aO2qpnBFsrIScI3bah/1BkO9JCc0uY42MJxJk0pAj4 8lFfX2Km24XyuCBaxbKndQ1KZOP7NQnfZPGPw3Z7R36wau9Jt3zN/ZAspd56k3/GLE6H OHHL+zCusDx7PR5l9t2wIUsihUemf/ovhR4UA4nGq0nDzGz73Z6ftIenWc7FMyIrgM5v nrhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Bpk668iW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si17427094iop.30.2021.08.31.14.16.44; Tue, 31 Aug 2021 14:17:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Bpk668iW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234270AbhHaSpz (ORCPT + 99 others); Tue, 31 Aug 2021 14:45:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:56106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbhHaSpv (ORCPT ); Tue, 31 Aug 2021 14:45:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 95D2D60FF2; Tue, 31 Aug 2021 18:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630435495; bh=IWw13YnK9rW1CKWgDL11yNR61oOp+iBIT8indqr3iGI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Bpk668iWJmNVqL5ZBx+tRbvzuKrwQ4OoASsSwqNTDThTxEYQ1+CKxW7pcCjiUyx3g +vDU+Z6pfmNrNV3yt9yOdCrW1BO5GtyU/5qYemUP+XE5d+lmzhMQFoOk6Eclv0FgXg kl+c6oadqi3XRfKGojpBYgP8bGLljNGwnmLWDCXSa7WswmBMlKqG9Yur8lGpS7vB6S b2IdR4rsOyUtLnw3cEQ8pic0dCF7lj1sjMji8RrqhzSGTwABRUPXQR0Mu7cS+X0ivT zxXqSmHKT39hddwGqHb631iWlC8/Upy9xCIvXjuUh7soJ04BFoi3JpzHiFjKPXMxBy qnovK6eHeKG4w== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id A4C7A4007E; Tue, 31 Aug 2021 15:44:52 -0300 (-03) Date: Tue, 31 Aug 2021 15:44:52 -0300 From: Arnaldo Carvalho de Melo To: Riccardo Mancini Cc: Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [RFC PATCH v1 31/37] tools lib/subcmd: add OPT_UINTEGER_OPTARG option type Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sat, Aug 21, 2021 at 11:19:37AM +0200, Riccardo Mancini escreveu: > This patch adds OPT_UINTEGER_OPTARG, which is the same as OPT_UINTEGER, > but also makes it possible to use the option without any value, setting > the variable to a default value, d. Thanks, applied, just to erode a bit the patch kit. - Arnaldo > Signed-off-by: Riccardo Mancini > --- > tools/lib/subcmd/parse-options.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tools/lib/subcmd/parse-options.h b/tools/lib/subcmd/parse-options.h > index d2414144eb8c9927..41b9b942504d398e 100644 > --- a/tools/lib/subcmd/parse-options.h > +++ b/tools/lib/subcmd/parse-options.h > @@ -133,6 +133,7 @@ struct option { > #define OPT_SET_PTR(s, l, v, h, p) { .type = OPTION_SET_PTR, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (p) } > #define OPT_INTEGER(s, l, v, h) { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) } > #define OPT_UINTEGER(s, l, v, h) { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) } > +#define OPT_UINTEGER_OPTARG(s, l, v, d, h) { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h), .flags = PARSE_OPT_OPTARG, .defval = (intptr_t)(d) } > #define OPT_LONG(s, l, v, h) { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) } > #define OPT_ULONG(s, l, v, h) { .type = OPTION_ULONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned long *), .help = (h) } > #define OPT_U64(s, l, v, h) { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) } > -- > 2.31.1 --