[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150809030750.GC29295@danjae.kornet>
Date: Sun, 9 Aug 2015 12:07:50 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Taewoong Song <treeze.taeung@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
jolsa@...hat.com, Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v4 4/5] perf config: Add a option 'list-all' to
perf-config
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists