Skip to content

libtracefs: Add APIs for user_events to libtracefs

Beau Belgrave linux-trace-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v13 patches 18 repliesSuperseded

Changes in v2 from the cover letter

Renamed tracefs_user_event_group_create() to tracefs_user_event_group_open() Renamed tracefs_user_event_test() to tracefs_user_event_enabled() Renamed tracefs_user_event_write() to tracefs_user_event_record() Updated documentation to new function names
Moved to trace_seq vs snprintf for register commands
Split struct tracefs_user_event into external and internal sides for inlining Changed tracefs_user_event_enabled to inline function
Fixed nits and whitespaces
Keep track of user view size to allow backward / forward compat if needed Couldn't get variadic helper macro to work well, not including it here for now

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3libtracefs: Add user_events to libtracefs sourcesMakefile include/tracefs-local.h include/tracefs.h +2 more+619 -01 reply
2/3libtracefs: Add documentation and sample code for user_eventsDocumentation/libtracefs-userevents.txt samples/Makefile+264 -00 replies
3/3libtracefs: Add unit tests for user_eventsutest/tracefs-utest.c+233 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] libtracefs: Add APIs for user_events to libtracefs

New APIs added:
struct tracefs_user_event_group *tracefs_user_event_group_open(void);

void tracefs_user_event_group_close(struct tracefs_user_event_group *group);

int tracefs_user_event_delete(const char *name);

struct tracefs_user_event *
tracefs_user_event_register(struct tracefs_user_event_group *group,
const char *name, enum tracefs_uevent_flags flags, struct tracefs_uevent_item *items);

bool tracefs_user_event_enabled(struct tracefs_user_event *event);

int tracefs_user_event_record(struct tracefs_user_event *event,

			      struct tracefs_uevent_item *items);

Documentation updates in this series describes the various APIs and the reason for a group.

Items are described with a struct to better ensure contracts for things like custom structs or static length strings. Items are allowed to be mixed/different than what they were when registered. This allows callers the ability to describe events verbosely, but write out via packed structs in their own code if needed.

V2:
Renamed tracefs_user_event_group_create() to tracefs_user_event_group_open() Renamed tracefs_user_event_test() to tracefs_user_event_enabled() Renamed tracefs_user_event_write() to tracefs_user_event_record() Updated documentation to new function names
Moved to trace_seq vs snprintf for register commands
Split struct tracefs_user_event into external and internal sides for inlining Changed tracefs_user_event_enabled to inline function
Fixed nits and whitespaces
Keep track of user view size to allow backward / forward compat if needed Couldn't get variadic helper macro to work well, not including it here for now

Beau Belgrave (3):
libtracefs: Add user_events to libtracefs sources
libtracefs: Add documentation and sample code for user_events
libtracefs: Add unit tests for user_events

 Documentation/libtracefs-userevents.txt | 260 ++++++++++++
 Makefile                                |   8 +
 include/tracefs-local.h                 |  24 ++
 include/tracefs.h                       |  67 +++
 samples/Makefile                        |   4 +
 src/Makefile                            |   4 +
 src/tracefs-userevents.c                | 516 ++++++++++++++++++++++++
 utest/tracefs-utest.c                   | 233 +++++++++++
 8 files changed, 1116 insertions(+)
 create mode 100644 Documentation/libtracefs-userevents.txt
 create mode 100644 src/tracefs-userevents.c

base-commit: e579ba38ff6bc07cd2278faf9d3ac08c15d4e9e8

Signature · 1 line
2.17.1