Re: [PATCH v4 4/5] perf config: Add a option 'list-all' to perf-config
From: Namhyung Kim
Date: Sat Aug 08 2015 - 23:10:55 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/