All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH] libtracefs: Implement tracefs_warning()
Date: Wed, 7 Apr 2021 19:46:43 +0300	[thread overview]
Message-ID: <CAPpZLN4BUmTwx1QGYLZPoWc0iTRS0GPN3vo1GkXXd9GFerToVg@mail.gmail.com> (raw)
In-Reply-To: <20210407121928.464045ee@gandalf.local.home>

On Wed, Apr 7, 2021 at 7:19 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed,  7 Apr 2021 08:11:54 +0300
> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
>
> > The warning() function is used in a lot of places in the libracefs
> > library, and it is implemented as a dummy weak function. There is a
> > weak implementation of the same function in traceevent library, which
> > could cause a problem when both are used in an application.
> > Replaced warning() with tracefs_warning() and implemented it as a
> > weak function, specific to this library.
> > Added a __weak define in the library internal header file.
>
> I've been thinking about this more, and I think we only want one function
> to override, and that would be:
>
> void __weak tep_vwarning(const char *name, const char *fmt, va_list ap)
> {
>         if (errno)
>                 perror(name);
>
>         fprintf(stderr, "  ");
>         vfprintf(stderr, fmt, ap);
>         fprintf(stderr, "\n");
> }
>
I understood that idea from your comments, but have a few concerns:

1. That way we create a dependency, not logical to the user of the libraries.
2. That print functionality is not something logically specific to the
libtraceevent, it is not related to the main purpose of this library.
3. A weak function specific to each library is a more straightforward
way and the user has the flexibility to control warnings per library.
The overhead to add library specific wrappers to those weak functions
is not so big.

[...]


-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

  reply	other threads:[~2021-04-07 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  5:11 [PATCH] libtracefs: Implement tracefs_warning() Tzvetomir Stoyanov (VMware)
2021-04-07 16:19 ` Steven Rostedt
2021-04-07 16:46   ` Tzvetomir Stoyanov [this message]
2021-04-07 16:54     ` Steven Rostedt
2021-04-07 16:55       ` Steven Rostedt
2021-04-07 16:59         ` Tzvetomir Stoyanov
2021-04-07 17:14           ` Steven Rostedt

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=CAPpZLN4BUmTwx1QGYLZPoWc0iTRS0GPN3vo1GkXXd9GFerToVg@mail.gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.