From: Namhyung Kim <namhyung@kernel.org>
To: Taewoong Song <treeze.taeung@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
jolsa@redhat.com, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH v4 4/5] perf config: Add a option 'list-all' to perf-config
Date: Sun, 9 Aug 2015 12:07:50 +0900 [thread overview]
Message-ID: <20150809030750.GC29295@danjae.kornet> (raw)
In-Reply-To: <9C7D1EDC-754E-4B4A-8986-8435BF5B343E@gmail.com>
On Sat, Aug 08, 2015 at 06:50:59PM +0900, Taewoong Song wrote:
> >>> OPT_GROUP("Action"),
> >>> OPT_BIT('l', "list", &actions,
> >>> "show current config variables", ACTION_LIST),
> >>> + OPT_BIT('a', "list-all", &actions,
> >>> + "show current and all possible config variables with default values", ACTION_LIST_ALL),
> >> Why did you use OPT_BIT? Do you want to support multiple 'actions' at
> >> the same time? I'd rather support just one action, but I won't insist
> >> it strongly.. Anyway, setting bits will confuse the switch statement
> >> in the cmd_config().
> >>
> >> Thanks,
> >> Namhyung
> >>
> > I don't understand why setting bits will confuse the switch statement.
> > Is the reason about readability of source code ?
> >
> > But I searched for other parse-option which can be replaced.
> > Is it better to use OPT_SET_INT instead of OPT_BIT ?
> >
>
> I modified source code to use OPT_SET_UINT
> but the problem is happened. I declared "enum actions” to use OPT_SET_UINT like this.
>
> enum actions {
> ACTION_LIST,
> ACTION_LIST_ALL,
> ACTION_REMOVE
> } actions;
>
> But default value of actions” variable is 0 and ACTION_LIST is also 0
> so when ‘get’ or ’set’ feature is used, ‘default:' of the switch statement in cmd_config() can’t reached
> because of default value of ‘actions’ variable is 0.
I don't know what's the problem. You could either set default value
to -1 or make ACTION_LIST start from 1.
Thanks,
Namhyung
next prev parent reply other threads:[~2015-08-09 3:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-26 15:58 [PATCH v4 0/5] perf tools: Add 'perf-config' command Taeung Song
2015-07-26 15:58 ` [PATCH v4 1/5] " Taeung Song
2015-07-27 7:59 ` Namhyung Kim
2015-07-26 15:58 ` [PATCH v4 2/5] perf config: Add '--system' and '--global' options to select which config file is used Taeung Song
2015-07-27 8:06 ` Namhyung Kim
2015-07-26 15:58 ` [PATCH v4 3/5] perf config: Add functions which can get or set perf config variables Taeung Song
2015-07-27 8:38 ` Namhyung Kim
2015-07-26 15:58 ` [PATCH v4 4/5] perf config: Add a option 'list-all' to perf-config Taeung Song
2015-07-27 8:48 ` Namhyung Kim
2015-08-07 1:12 ` taeung
2015-08-08 9:50 ` Taewoong Song
2015-08-09 3:07 ` Namhyung Kim [this message]
2015-08-09 3:01 ` Namhyung Kim
2015-08-09 7:54 ` Taewoong Song
2015-07-26 15:58 ` [PATCH v4 5/5] perf config: Add a option 'remove' " Taeung Song
-- strict thread matches above, loose matches on Subject: below --
2015-07-17 1:39 [PATCH v4 0/5] perf tools: Add 'perf-config' command Taeung Song
2015-07-17 1:40 ` [PATCH v4 4/5] perf config: Add a option 'list-all' to perf-config Taeung Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150809030750.GC29295@danjae.kornet \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=treeze.taeung@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox