mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
	Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH v2 14/14] perf tools: Move subcommand framework and related utils to libapi
Date: Tue, 8 Dec 2015 17:07:25 -0600	[thread overview]
Message-ID: <20151208230725.GJ14846@treble.redhat.com> (raw)
In-Reply-To: <20151208222732.GA15864@kernel.org>

On Tue, Dec 08, 2015 at 07:27:32PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Dec 08, 2015 at 03:48:25PM -0600, Josh Poimboeuf escreveu:
> > On Tue, Dec 08, 2015 at 04:40:26PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Tue, Dec 08, 2015 at 01:17:00PM -0600, Josh Poimboeuf escreveu:
> > > > On Tue, Dec 08, 2015 at 04:09:31PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > > Em Tue, Dec 08, 2015 at 12:49:53PM -0600, Josh Poimboeuf escreveu:
> > > > > > On Tue, Dec 08, 2015 at 07:16:26PM +0100, Jiri Olsa wrote:
> > > > > > > On Mon, Dec 07, 2015 at 10:21:52PM -0600, Josh Poimboeuf wrote:
> > > > > > > > The perf subcommand framework is needed for other tools.  Move
> > > > > > > > parse-options.c and its dependencies over to libapi.
> > > > > > > > 
> > > > > > > > Any function names with 'perf' have been renamed to something more
> > > > > > > > generic.
> > > > > > > > 
> > > > > > > > Also created a util_cfg struct for passing perf-specific configuration
> > > > > > > > to the library.  Specifying the configuration at runtime allows the same
> > > > > > > > binary to be shared by multiple tools without having to recompile it.
> > > > > > > 
> > > > > > > this patch is too big.. IMO it needs to be split into 3 parts
> > > > > > > as described in above 3 paragraphs
> > > > > > 
> > > > > > Ok, will do.
> > > > > 
> > > > > Also please rename this util_cfg struct to something more expressive,
> > > > > breaking down the patch may help in finding a better name, I guess.
> > > > 
> > > > I'm certainly open to doing so, but I'm having trouble coming up with a
> > > > better name.  The current name makes sense to me, because the struct
> > > > contains various configuration options needed by the libapi "util" code.
> > > > 
> > > > Would 'libapi_util_config' be better?  Or do you have any other
> > > > suggestions?
> > > 
> > > Please break it up into multiple pieces, as suggested by Jiri, in doing
> > > so you may find some better name.
> > >
> > > But since several are related to command environment setup, perhaps
> > > 'struct cmd_exec_env'?
> > 
> > IMO, 'struct cmd_exec_env' doesn't describe the struct accurately.  I
> > think it tangentially describes some features of some of the fields, but
> > not all of them.  That seems more confusing to me.
> 
> So do not try to keep in a single struct unrelated stuff, create two.
> :-)
> 
> > Is your complaint that the name is too vague?  If so, that's actually by
> > design, because the struct is meant to be a generic interface for
> > providing various unrelated configuration variables to libapi.
> > 
> > I've split the patch up into the above 3 paragraphs as Jiri suggested.
> > But I still don't have any ideas for a name better than 'util_cfg'
> > (other than something more verbose like 'libapi_util_config').
> > 
> > Instead of a single struct, we could consider splitting it into multiple
> > structs (e.g., one for exec_cmd.c, one for parse-options.c, and one for
> > pager.c).  But the 'exec_name' field is used by multiple files, so it
> 
> Yeah, got the same conclusion some lines above :)

Ok.  Instead of per-file structs, if there are no objections, I think
I'll go with per-file init functions.  For example:

void exec_cmd_init(const char *exec_name, const char *prefix,
		   const char *exec_path, const char *exec_path_env);

void pager_init(const char *pager_env);

I think that would be a clearer and less surprising interface.

> > wouldn't necessarily be a clean split.  It would also possibly create
> > more room for error for the users of libapi, since there would then be
> > three config interfaces instead of one.
> 
> Humm, and now that you talk... libapi was supposed to be just sugar
> coating kernel APIs, perhaps we need to put it somewhere else in
> tools/lib/ than in tools/lib/api/?

Ah, I didn't realize libapi was a kernel API abstraction library.  Shall
we put it in tools/lib/util instead?

> Borislav, ideas?
> 
> - Arnaldo

-- 
Josh

  reply	other threads:[~2015-12-08 23:07 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08  4:21 [PATCH v2 00/14] perf tools: Move perf subcommand framework into lib/tools Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 01/14] perf: Fix 'make clean' Josh Poimboeuf
2015-12-08 17:40   ` Jiri Olsa
2015-12-08 18:40     ` Jiri Olsa
2015-12-08 18:49       ` Josh Poimboeuf
2015-12-08 18:46     ` Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 02/14] perf: Use -iquote for local include paths Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 03/14] perf: Split up util.h Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 04/14] perf: Move term functions out of util.c Josh Poimboeuf
2015-12-09 15:53   ` Arnaldo Carvalho de Melo
2015-12-10  8:18   ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 05/14] perf: Remove unused pager_use_color variable Josh Poimboeuf
2015-12-09 15:43   ` Arnaldo Carvalho de Melo
2015-12-10  8:18   ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 06/14] perf: Split up cache.h Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 07/14] perf: Remove cache.h Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 08/14] perf: Save cmdline arguments earlier Josh Poimboeuf
2015-12-10  8:18   ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 09/14] perf: Remove check for unused PERF_PAGER_IN_USE Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 10/14] perf: Move cmd_version() to builtin-version.c Josh Poimboeuf
2015-12-10  8:19   ` [tip:perf/core] perf tools: " tip-bot for Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 11/14] perf: Move help_unknown_cmd() to its own file Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 12/14] perf tools: Move strlcpy() to tools/lib/string.c Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 13/14] perf tools: Move tools/lib/string.c to libapi Josh Poimboeuf
2015-12-08  4:21 ` [PATCH v2 14/14] perf tools: Move subcommand framework and related utils " Josh Poimboeuf
2015-12-08 18:16   ` Jiri Olsa
2015-12-08 18:49     ` Josh Poimboeuf
2015-12-08 19:09       ` Arnaldo Carvalho de Melo
2015-12-08 19:17         ` Josh Poimboeuf
2015-12-08 19:40           ` Arnaldo Carvalho de Melo
2015-12-08 21:48             ` Josh Poimboeuf
2015-12-08 22:27               ` Arnaldo Carvalho de Melo
2015-12-08 23:07                 ` Josh Poimboeuf [this message]
2015-12-09  8:03                   ` Ingo Molnar
2015-12-09 12:33                     ` Josh Poimboeuf
2015-12-09 15:58                       ` Arnaldo Carvalho de Melo
2015-12-09 18:59                         ` Josh Poimboeuf
2015-12-10  1:40                           ` Namhyung Kim
2015-12-10 14:54                             ` Josh Poimboeuf
2015-12-10 21:35                               ` Josh Poimboeuf
2015-12-11 11:21                                 ` Arnaldo Carvalho de Melo
2015-12-10 12:55                           ` Arnaldo Carvalho de Melo
2015-12-10 15:15                             ` Josh Poimboeuf
2015-12-10  1:58   ` Namhyung Kim
2015-12-10  2:00 ` [PATCH v2 00/14] perf tools: Move perf subcommand framework into lib/tools Namhyung Kim
2015-12-10 15:11   ` Josh Poimboeuf

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=20151208230725.GJ14846@treble.redhat.com \
    --to=jpoimboe@redhat.com \
    --cc=acme@kernel.org \
    --cc=bp@alien8.de \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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

Powered by JetHome