libtracefs: Add more methods for writing to files

For the moment the library provides only one method for writing to
tracefs files, that is:

int tracefs_instance_file_write()

This method first truncates the size of the file to 0 (clearing it),
then writes new content to this file. Essentially this method overwrites
(clear + write). In this patch we add two additional methids:

int tracefs_instance_file_append()

which writes without clearing and

int tracefs_instance_file_clear()

which clears without writing anything. Those two new APIs have various
use-cases. For example one can use the two methods when adding/clearing
kprobes.

Link: https://lore.kernel.org/linux-trace-devel/20210415121311.59787-2-y.karadz@gmail.com

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2 files changed