On 9.12.21 г. 20:24 ч., Steven Rostedt wrote:
+/* + * tracefs_synth_echo_fmt - show the raw format of a synthetic event + * @seq: A trace_seq to store the format string + * @synth: The synthetic event to read format from + * + * This shows the raw format that describes the synthetic event, including + * the format of the dynamic event and the start / end histograms. + * + * Returns 0 on succes -1 on error. + */ +int tracefs_synth_echo_fmt(struct trace_seq *seq, struct tracefs_synth *synth)Sorry to nitpick on the naming again, but perhaps we should call this tracefs_synth_raw_fmt() Because saying "echo_fmt" I would think it would include the "echo" command in the output.
OK
+{ + if (!synth->dyn_event) + return -1; + + trace_seq_printf(seq, "%s", synth->dyn_event->format); + trace_seq_printf(seq, "\n%s", synth->start_hist); + trace_seq_printf(seq, "\n%s", synth->end_hist);Hmm, shouldn't this end with a \n? Or is it to allow quoting?
The function returns string and the user is free to do anything with it. If this string ends with "\n" and you print this string with puts() you will get extra line (same problem printing it in Python).
Thanks! Y.
-- Steve+ + return 0; +} +