Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700502

Re: [PATCH 2/2] trace-cmd: replace show_file() -> show_instance_file()

From Federico Vaga <federico.vaga@vaga.pv.it>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] trace-cmd: replace show_file() -> show_instance_file()
Date 2017-08-01 01:30 +0200
Message-ID <u9sil-455-11@gated-at.bofh.it> (permalink)
References <tOWEp-193-3@gated-at.bofh.it> <tOWEq-193-27@gated-at.bofh.it> <u0nrB-3is-59@gated-at.bofh.it> <u1uAG-6ba-5@gated-at.bofh.it> <u9oHM-1Rm-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jul 31, 2017 at 03:35:39PM -0400, Steven Rostedt wrote:
> On Mon, 10 Jul 2017 02:15:35 +0200
> Federico Vaga <federico.vaga@vaga.pv.it> wrote:
> 
>> On Friday, July 7, 2017 12:29:35 AM CEST Steven Rostedt wrote:
>> > On Mon,  5 Jun 2017 11:31:18 +0200
>> >
>> > Federico Vaga <federico.vaga@vaga.pv.it> wrote:
>> > > show_file(name) and show_instance_file(&top_instance, name) are
>> > > equivalent.
>> > >
>> > > Remove the show_file() function in order to have a single function for
>> > > this task.
>> >
>> > Actually I find nothing wrong with having a helper function like this.
>> > IIRC, show_file() was first, and then show_instance_file() came later.
>> > There's some files that only exist for the top_instance, and I like the
>> > fact that this is annotated that way.
>> >
>> > I'm curious to know what the benefit of removing show_file() is?
>> 
>> The show_file(name) and show_instance_file(&top_instance, name) are
>> equivalent: they do the same thing. By removing `show_file` the 
>> developers are
>> forced to use always the same function and being explicit about the 
>> instance
>> they want to use.
>> 
>> The name `show_file()` is so generic that does not implies 
>> automatically that
>> we are accessing the top_instance. This is not even clear by reading 
>> the
>> implementation; people must read the other functions used in 
>> `show_file()` to
>> understand that their instance scope is always 'top_instance'.
>> 
>> So, in my opinion, it makes the code easier to read and more explicit 
>> in what
>> is doing without too much effort.
>> 
> 
> Just an FYI. You'll find lots of these types of helper functions in the
> Linux Kernel. As I'm a Linux Kernel developer, I prefer them ;-)

We are kind of artists: there is always a bit of personal taste 
(preferences)
in what we do; that justify our presence instead of an AI (for the time 
being) :P

As I said in the other email, I tend to be verbose when something does 
not have
an unique interpretation at first sight.

If this is your preference, I will not say anything more and I will not 
send a V2
for this patch.


Federico Vaga

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/2] trace-cmd: replace show_file() ->  show_instance_file() Steven Rostedt <rostedt@goodmis.org> - 2017-07-31 21:40 +0200
  Re: [PATCH 2/2] trace-cmd: replace show_file() ->  show_instance_file() Federico Vaga <federico.vaga@vaga.pv.it> - 2017-08-01 01:30 +0200

csiph-web