Re: [PATCH V8 02/14] rtla: Helper functions for rtla

From
Tao Zhou <hidden>
Date
2021-12-03 09:08:03
Also in
lkml
Reply to
Daniel Bristot de Oliveira, 2021-11-29
On Mon, Nov 29, 2021 at 12:07:40PM +0100,
Daniel Bristot de Oliveira wrote:
quoted hunk ↗ jump to hunk
+/*
+ * enable_tracer_by_name - enable a tracer on the given instance
+ */
+int enable_tracer_by_name(struct tracefs_instance *inst, const char *tracer)
+{ 
+	enum tracefs_tracers t;
+	int retval;
+
+	t = TRACEFS_TRACER_CUSTOM;
+
+	debug_msg("enabling %s tracer\n", tracer);
+
+	retval = tracefs_tracer_set(inst, t, tracer);
The comment of parameters used for tracefs_tracer_set() says:

'
 * tracefs_set_tracer - function to set the tracer
 * @instance: ftrace instance, can be NULL for top tracing instance
 * @tracer: The tracer enum that defines the tracer to be set
 * @t: A tracer name if TRACEFS_TRACER_CUSTOM is passed in for @tracer
'

tracefs_tracer_set(inst, tracer, t); @tracer is enum and @t is tracer
name. this is not important.
quoted hunk ↗ jump to hunk
+	if (retval < 0) {
+		if (errno == ENODEV)
+			err_msg("tracer %s not found!\n", tracer);
+
+		err_msg("failed to enable the tracer %s\n", tracer);
+		return -1;
+	}
+
+	return 0;
+}
Thread (29 messages) 29 messages, 3 authors, last reply 2021-12-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help