qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] trace: Simplify find_debugfs()
@ 2017-11-07 15:31 Namhyung Kim
  2017-11-07 15:31 ` [Qemu-devel] [PATCH 2/3] trace: Generalize searching for debugfs Namhyung Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Namhyung Kim @ 2017-11-07 15:31 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

The return vale of find_debugfs() is 1 if it could find a mount point of
debugfs.  It can be saved in the while loop instead of checking it again.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 trace/ftrace.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/trace/ftrace.c b/trace/ftrace.c
index 7de104deba..bfa38e71f0 100644
--- a/trace/ftrace.c
+++ b/trace/ftrace.c
@@ -19,6 +19,7 @@ static int find_debugfs(char *debugfs)
 {
     char type[100];
     FILE *fp;
+    int ret = 0;
 
     fp = fopen("/proc/mounts", "r");
     if (fp == NULL) {
@@ -28,15 +29,13 @@ static int find_debugfs(char *debugfs)
     while (fscanf(fp, "%*s %" STR(PATH_MAX) "s %99s %*s %*d %*d\n",
                   debugfs, type) == 2) {
         if (strcmp(type, "debugfs") == 0) {
+            ret = 1;
             break;
         }
     }
     fclose(fp);
 
-    if (strcmp(type, "debugfs") != 0) {
-        return 0;
-    }
-    return 1;
+    return ret;
 }
 
 bool ftrace_init(void)
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-09 14:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-07 15:31 [Qemu-devel] [PATCH 1/3] trace: Simplify find_debugfs() Namhyung Kim
2017-11-07 15:31 ` [Qemu-devel] [PATCH 2/3] trace: Generalize searching for debugfs Namhyung Kim
2017-11-07 15:31 ` [Qemu-devel] [PATCH 3/3] trace: Try using tracefs first Namhyung Kim
2017-11-09 10:42 ` [Qemu-devel] [PATCH 1/3] trace: Simplify find_debugfs() Stefan Hajnoczi
2017-11-09 14:35   ` Namhyung Kim

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).