linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Yordan Karadzhov <y.karadz@gmail.com>,
	Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH v3 01/11] libtracefs: Add new public macros for bits manipulations
Date: Wed, 3 Nov 2021 18:34:49 +0200	[thread overview]
Message-ID: <CAPpZLN5ihwBHfKaaUtZGddRnJrrEvdsqc1poohUNxRmdiovo5g@mail.gmail.com> (raw)
In-Reply-To: <20211103122406.7a21859c@gandalf.local.home>

On Wed, Nov 3, 2021 at 6:24 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed,  3 Nov 2021 17:44:07 +0200
> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
>
> > diff --git a/include/tracefs.h b/include/tracefs.h
> > index a2cda30..fa7f316 100644
> > --- a/include/tracefs.h
> > +++ b/include/tracefs.h
> > @@ -10,6 +10,10 @@
> >  #include <sched.h>
> >  #include <event-parse.h>
> >
> > +#define TRACEFS_BIT_SET(M, B)        do { (M) |= (1ULL << (B)); } while (0)
> > +#define TRACEFS_BIT_TEST(M, B)       ((M) & (1ULL<<(B)))
> > +#define TRACEFS_BIT_CLEAR(M, B)      do { (M) &= ~(1ULL << (B)); } while (0)
>
> Does this really need to be public?
>
> I was thinking that this would just be used internally, and thus in the
> tracefs-local.h.
>

The  only reason to export it is because of these APIs, which get
bitmask of enum tracefs_dynevent_type types:
     int tracefs_dynevent_destroy_all(unsigned long type_mask, bool force);
     struct tracefs_dynevent **tracefs_dynevent_get_all(unsigned long
type_mask, const char *system);
Currently that type is simple enum, and those macros are used to
construct the bitmask:
enum tracefs_dynevent_type {
    TRACEFS_DYNEVENT_KPROBE = 0,
    TRACEFS_DYNEVENT_KRETPROBE,
    TRACEFS_DYNEVENT_UPROBE,
    TRACEFS_DYNEVENT_URETPROBE,
    TRACEFS_DYNEVENT_EPROBE,
    TRACEFS_DYNEVENT_SYNTH,
    TRACEFS_DYNEVENT_MAX,
};

The other possible approach is to define the eum in that way, then no
macros will be needed:
enum tracefs_dynevent_type {
    TRACEFS_DYNEVENT_KPROBE = 1,
    TRACEFS_DYNEVENT_KRETPROBE = 1 << 1,
    TRACEFS_DYNEVENT_UPROBE = 1 << 2,
    TRACEFS_DYNEVENT_URETPROBE = 1 << 3,
    TRACEFS_DYNEVENT_EPROBE = 1 << 4,
    TRACEFS_DYNEVENT_SYNTH = 1 << 5,
    TRACEFS_DYNEVENT_MAX = 0,
};

> -- Steve
>
> > +
> >  char *tracefs_get_tracing_file(const char *name);



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

  reply	other threads:[~2021-11-03 16:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 15:44 [PATCH v3 00/11] libtracefs dynamic events support Tzvetomir Stoyanov (VMware)
2021-11-03 15:44 ` [PATCH v3 01/11] libtracefs: Add new public macros for bits manipulations Tzvetomir Stoyanov (VMware)
2021-11-03 16:24   ` Steven Rostedt
2021-11-03 16:34     ` Tzvetomir Stoyanov [this message]
2021-11-03 16:47       ` Steven Rostedt
2021-11-03 15:44 ` [PATCH v3 02/11] libtracefs: New APIs for dynamic events Tzvetomir Stoyanov (VMware)
2021-11-03 17:03   ` Steven Rostedt
2021-11-03 22:17     ` Steven Rostedt
2021-11-04  0:56       ` Steven Rostedt
2021-11-04  1:17     ` Steven Rostedt
2021-11-04  1:26     ` Steven Rostedt
2021-11-03 22:18   ` Steven Rostedt
2021-11-04  2:27   ` Steven Rostedt
2021-11-03 15:44 ` [PATCH v3 03/11] libtracefs: New APIs for kprobe allocation Tzvetomir Stoyanov (VMware)
2021-11-04  2:40   ` Steven Rostedt
2021-11-03 15:44 ` [PATCH v3 04/11] libtracefs: Remove redundant kprobes APIs Tzvetomir Stoyanov (VMware)
2021-11-03 15:44 ` [PATCH v3 05/11] libtracefs: Change tracefs_kprobe_info API Tzvetomir Stoyanov (VMware)
2021-11-04  3:06   ` Steven Rostedt
2021-11-03 15:44 ` [PATCH v3 06/11] libtracefs: Reimplement kprobe raw APIs Tzvetomir Stoyanov (VMware)
2021-11-03 15:44 ` [PATCH v3 07/11] libtracefs: Extend kprobes unit test Tzvetomir Stoyanov (VMware)
2021-11-03 15:44 ` [PATCH v3 08/11] libtracefs: Rename tracefs_synth_init API Tzvetomir Stoyanov (VMware)
2021-11-03 15:44 ` [PATCH v3 09/11] libtracefs: Use the internal dynamic events API when creating synthetic events Tzvetomir Stoyanov (VMware)
2021-11-03 15:44 ` [PATCH v3 10/11] libtracefs: Update kprobes man pages Tzvetomir Stoyanov (VMware)
2021-11-03 15:44 ` [PATCH v3 11/11] libtracefs: Document dynamic events APIs Tzvetomir Stoyanov (VMware)

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=CAPpZLN5ihwBHfKaaUtZGddRnJrrEvdsqc1poohUNxRmdiovo5g@mail.gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=y.karadz@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).