From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH v2] libtracefs: Have tracefs_instance_destroy() match the man page
Date: Mon, 12 Apr 2021 18:40:14 -0400 [thread overview]
Message-ID: <20210412184014.000a315e@gandalf.local.home> (raw)
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
According to the man page of tracefs_instance_destroy():
"The tracefs_instance_destroy() frees the instance structure, and will also
remove the trace instance from the system."
Which is wrong, and trace-cmd actually depends on this function not
freeing the structure. Update the documentation to reflect this.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
Changes since v1:
- Found that trace-cmd depends on this not freeing it, so
change the documentation to match the code, instead of the
code to match the documentation.
Documentation/libtracefs-instances-manage.txt | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/Documentation/libtracefs-instances-manage.txt b/Documentation/libtracefs-instances-manage.txt
index e7dc393..2ba48c4 100644
--- a/Documentation/libtracefs-instances-manage.txt
+++ b/Documentation/libtracefs-instances-manage.txt
@@ -35,8 +35,9 @@ then the new tracefs_instance structure is initialised for the top instance.
Note that the top instance cannot be created in the system, if it does not
exist.
-The _tracefs_instance_destroy()_ frees the _instance_ structure, and will
-also remove the trace instance from the system.
+The _tracefs_instance_destroy()_ removes the instance from the system, but
+does not free the structure. _tracefs_instance_free()__ must still be called
+on _instance_.
The _tracefs_instance_alloc()_ function allocates a new tracefs_instance structure
for existing trace instance. If the instance does not exist in the system, the function
@@ -55,11 +56,11 @@ before that.
RETURN VALUE
------------
The _tracefs_instance_create()_ and _tracefs_instance_alloc()_ functions return a pointer to
-a newly allocated tracefs_instance structure. It must be freed with _tracefs_instance_destroy()_ or
-_tracefs_instance_free()_.
+a newly allocated tracefs_instance structure. It must be freed with _tracefs_instance_free()_.
-The _tracefs_instance_destroy()_ function returns -1 in case of an error,
-or 0 otherwise.
+The _tracefs_instance_destroy()_ function returns 0 if it succeeds to remove
+the instance, otherwise it returns -1 if the instance does not exist or it
+fails to remove it.
The _tracefs_instance_is_new()_ function returns true if the
_tracefs_instance_create()_ that allocated _instance_ also created the
@@ -83,8 +84,7 @@ struct tracefs_instance *inst = tracefs_instance_create("foo");
if (tracefs_instance_is_new(inst))
tracefs_instance_destroy(inst);
- else
- tracefs_instance_free(inst);
+ tracefs_instance_free(inst);
...
struct tracefs_instance *inst = tracefs_instance_alloc(NULL, "bar");
--
2.29.2
reply other threads:[~2021-04-12 22:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210412184014.000a315e@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
/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).