From: Bean Huo <beanhuo@iokpp.de>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org, tz.stoyanov@gmail.com,
Bean Huo <beanhuo@micron.com>
Subject: Re: [PATCH] libtracefs: Fix wrong return value in tracefs_tracing_dir_is_mounted()
Date: Mon, 28 Nov 2022 17:29:50 +0100 [thread overview]
Message-ID: <85c4e8cf7dfab9cd2f2e6c247e11336d5d3e66f2.camel@iokpp.de> (raw)
In-Reply-To: <e6c020fc59cd3a2333806fbaf2a90092866fb7b7.camel@iokpp.de>
On Mon, 2022-11-28 at 16:41 +0100, Bean Huo wrote:
> On Mon, 2022-11-28 at 10:24 -0500, Steven Rostedt wrote:
> > On Mon, 28 Nov 2022 14:21:06 +0100
> >
> > Bean Huo <beanhuo@iokpp.de> wrote:
> >
> >
> >
> > > From: Bean Huo <beanhuo@micron.com>
> > > If it eventually mounts successfully, it should return 1 instead
> > > of
> > > 0, otherwise it will make the caller's verification logic more
> > > complicated
> >
> > The man page shows:
> >
> >
> >
> > The tracefs_tracing_dir_is_mounted() returns 1 if the tracing
> > directory is
> >
> > already mounted, 0 if it is not, and -1 on error.
> >
> >
> >
> > If you only want to mount it and not care if it was already mounted
> > then
> >
> > use tracefs_tracing_dir(), as it will return the path of the mount
> > point
> >
> > and try to mount it if it is not already, or NULL if it could not
> > mount it.
> >
> >
> >
>
> Hi Steve,
>
> I used to reply on tracefs_tracing_dir(). But after updated the
> libtracefs yesterday, I found my app doesn't work as before, then
> checked the changelog, and switch to use
> tracefs_tracing_dir_is_mounted.
>
> in your latest libtracefs:
>
>
> const char *tracefs_tracing_dir(void) {
>
> ...
> tracing_dir = trace_find_tracing_dir(false);//shold be changed to
> true?
> ...
>
> }
>
>
> __hidden char *trace_find_tracing_dir(bool debugfs)
> {
> return find_tracing_dir(debugfs, false);
> }
>
>
>
> static char *find_tracing_dir(bool debugfs, bool mount) {
>
> ...
> if (!mount || mount_debugfs() < 0)
> return NULL;
>
>
> ...
>
>
> }
>
>
instead of changing tracefs_tracing_dir_is_mounted(), or we could
change trace_find_tracing_dir(), let it mount the tracefs in case of it
is not mounted when we call tracefs_tracing_dir():
--- a/src/tracefs-utils.c
+++ b/src/tracefs-utils.c
@@ -200,7 +200,7 @@ int tracefs_tracing_dir_is_mounted(bool mount,
const char **path)
*/
__hidden char *trace_find_tracing_dir(bool debugfs)
{
- return find_tracing_dir(debugfs, false);
+ return find_tracing_dir(debugfs, true);
}
Kind regard,
Bean
next prev parent reply other threads:[~2022-11-28 16:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 13:21 [PATCH] libtracefs: Fix wrong return value in tracefs_tracing_dir_is_mounted() Bean Huo
2022-11-28 15:24 ` Steven Rostedt
2022-11-28 15:41 ` Bean Huo
2022-11-28 16:29 ` Bean Huo [this message]
2022-11-28 18:37 ` Steven Rostedt
2022-12-06 21:13 ` Steven Rostedt
2022-12-08 12:05 ` Bean Huo
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=85c4e8cf7dfab9cd2f2e6c247e11336d5d3e66f2.camel@iokpp.de \
--to=beanhuo@iokpp.de \
--cc=beanhuo@micron.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tz.stoyanov@gmail.com \
/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).