Message ID | 20171107153136.19426-1-namhyung@gmail.com |
---|---|
State | New |
Headers | show |
Series | [1/3] trace: Simplify find_debugfs() | expand |
On Wed, Nov 08, 2017 at 12:31:34AM +0900, Namhyung Kim wrote: > 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(-) Thanks, applied all to my tracing-next tree: https://github.com/stefanha/qemu/commits/tracing-next Please send multi-patch series with a cover letter in the future (git format-patch --cover-letter). Continuous integration tools may ignore multi-patch series without a cover letter. qemu.git/master is currently frozen for the QEMU 2.11 release so you won't see your patches in master until QEMU 2.11 has been released. Once the development window opens again your patches will be merged into qemu.git/master. Stefan
Hello, On Thu, Nov 9, 2017 at 7:42 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote: > On Wed, Nov 08, 2017 at 12:31:34AM +0900, Namhyung Kim wrote: >> 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(-) > > Thanks, applied all to my tracing-next tree: > https://github.com/stefanha/qemu/commits/tracing-next > > Please send multi-patch series with a cover letter in the future (git > format-patch --cover-letter). Continuous integration tools may ignore > multi-patch series without a cover letter. OK. I usually use a cover letter when a patch series has 5+ patches. But will add it for small series too in the future. > > qemu.git/master is currently frozen for the QEMU 2.11 release so you > won't see your patches in master until QEMU 2.11 has been released. > Once the development window opens again your patches will be merged into > qemu.git/master. Understood. Thanks Namhyung
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)
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(-)