aboutsummaryrefslogtreecommitdiff
path: root/trace
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2017-11-08 00:31:34 +0900
committerStefan Hajnoczi <stefanha@redhat.com>2017-12-18 14:37:36 +0000
commit5070570c9089b905dd9efae30ee4318033c6ccd6 (patch)
treeb6fc3720ab92442a4fd6fb15fb1998d179599771 /trace
parent411ad78115ebeb3411cf4b7622784b93dfabe259 (diff)
downloadqemu-5070570c9089b905dd9efae30ee4318033c6ccd6.zip
qemu-5070570c9089b905dd9efae30ee4318033c6ccd6.tar.gz
qemu-5070570c9089b905dd9efae30ee4318033c6ccd6.tar.bz2
trace: Simplify find_debugfs()
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> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'trace')
-rw-r--r--trace/ftrace.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/trace/ftrace.c b/trace/ftrace.c
index 7de104d..bfa38e7 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)