Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp279662pxb; Sat, 21 Aug 2021 02:24:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzg7rOIPTY0jfqsJRXmM3WQd4PuRVm9laypeYpC7mOA10beuvoElYPOgnXUPurdIWIU2TlL X-Received: by 2002:a17:906:c316:: with SMTP id s22mr26211524ejz.39.1629537858446; Sat, 21 Aug 2021 02:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629537858; cv=none; d=google.com; s=arc-20160816; b=wpy7ZJtAWgCgtwlX5p43PGbU2VGumwFRMdGSDlDK3DsiEPNzbb/5nd7W8p0OmtviWE 6V9F/oKSukcqrZ7y3SafM+CNR4eWNevK5AbNcIjn/QMey+TYtAxb+k2jOCo08nTU05cs wgUlMVoUCvwiNNPQBEGeWG9+bO1Jnv5EuTUtxE97FDuEv3D6Er1HyqiGMNz2ewu2ETo7 mx7duufVXpZ1x34CVvZLuf+hc7DdfEb5rzEugDw8+601IgLmLsdQQmMWvKhPeDzi5ErC lN4OK1Q+WcYrsNG57bz3ZggJuJPcgQqQQ9mJuazurq+gAeQIr3bLNmAiQGy2Us9yCIun 5Srw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FRWPQ8HxhbjIOSVCF9fueneGQHgaEtyHF4yxY4sSzec=; b=MRSGP6RjzhE1KyEf5/yztZ7FBSSc8AYb/S4DHRbMLG3jaVEipxrmUVVjw7DIP6N5Pi Ch5D4Lr36dfHJbX/T2GBVcHP6vsbsbJfQQvpfmq4j9Ua/mtQarHsi7+LY2PsI1JuVAj1 Jc3c3q7EXVYwlDk4EmVlbfLy9ooO35xCAMSx9aK6S95jDrX5JQ7KE4k14WWqbZaZ8MW2 fCUkEv8KglckbJZWJovQchjsGxC2jTfTxP4qaX33Y2wu3fsB8+78HLy3XeBbJCNY/JRo rTvIH+wxAx/PQYaQ1EwcwDr/v38epp23Thh+pu0L1GykRtuitGxK+GuRwDU7jmh7XXh4 bHaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JIHhV+40; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si9421442edd.110.2021.08.21.02.23.56; Sat, 21 Aug 2021 02:24:18 -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=@gmail.com header.s=20161025 header.b=JIHhV+40; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241059AbhHUJXB (ORCPT + 99 others); Sat, 21 Aug 2021 05:23:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233774AbhHUJWP (ORCPT ); Sat, 21 Aug 2021 05:22:15 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1D7EC06114F; Sat, 21 Aug 2021 02:20:28 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id i6so17675592edu.1; Sat, 21 Aug 2021 02:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FRWPQ8HxhbjIOSVCF9fueneGQHgaEtyHF4yxY4sSzec=; b=JIHhV+40z3DGp/eALzG7aaet5twMq1a/vpBct8kXXSCGkw+XCFmERWJNER2GFveio/ o0v9jX4CHSnNnHTKAaLukGGLDp5nxdG437LX+P2XTSMmDD4FLHlGq3MlDtZZQ5LwCqNu h5MM8t54E+8Hp8LRtBDgRjk+uopp2T0BAKJz5UMjtglzVwaHBBITdDWWHTDj9rVOZK9g 5Tg/fIEXHBhA0YDvBe1aUDPliS/qD7LPuuWZlmkDmB6VCGcoYYkmhFxY8zRBZiRr9f0G RXU2fUxbSdKXMwZEvSlA+gN7CyjpG9SfpM8uJYVeqTn5rm5OaggXF6hRmQ/7FBRUO86d jV5w== 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=FRWPQ8HxhbjIOSVCF9fueneGQHgaEtyHF4yxY4sSzec=; b=lIyfXcLrBbv/h41p0lBUBw4l1JzJsVSYRyUJQWF78Jl369H0ujlKGts2aq0QhzIs9y /k7AcaMJKdAnhJmoesJXcJp6st1cUiuivM+olkEtx5lM+LfZFLePTHkpS5Rjkwsn8zlS w/YO3K8H2Io2NA4Yu/VILspK+kcNELKvtwmh7Evp0L9Lw8L8XM0QvDZIMUu+2clOHRdA p3kDONxyQaOIrZz+jdWGB3I+aPggpmGE6lW7lUPRY2YwjjGsJe+5OwKKBEGC4U6OR/3K /AFsKPoeu2l0vgyHBe1mDnaCM2qAasXgde4efXvAUhATykuYOEcA6sMcllI5aE5+l7SI +BPg== X-Gm-Message-State: AOAM531Np01P85TtlhrH9X58aRkVWT1M4ENp7G4dbiuOzkwD7ffenQdx qYxjyyPvHiRI0IdH2tuoukE= X-Received: by 2002:a05:6402:220f:: with SMTP id cq15mr5378154edb.142.1629537627317; Sat, 21 Aug 2021 02:20:27 -0700 (PDT) Received: from honeypot.. (mob-176-243-254-204.net.vodafone.it. [176.243.254.204]) by smtp.googlemail.com with ESMTPSA id a25sm4003878ejv.91.2021.08.21.02.20.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 02:20:27 -0700 (PDT) From: Riccardo Mancini To: Arnaldo Carvalho de Melo Cc: Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Riccardo Mancini Subject: [RFC PATCH v1 31/37] tools lib/subcmd: add OPT_UINTEGER_OPTARG option type Date: Sat, 21 Aug 2021 11:19:37 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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