[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150125164059.GC31987@krava.brq.redhat.com>
Date: Sun, 25 Jan 2015 17:41:00 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Jiri Olsa <jolsa@...nel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH 1/5] tools lib fs: Add helper to find mounted file systems
On Sat, Jan 24, 2015 at 01:13:31PM -0500, Steven Rostedt wrote:
SNIP
> /* find the path to the mounted debugfs */
> const char *debugfs_find_mountpoint(void)
> {
> - const char * const *ptr;
> - char type[100];
> - FILE *fp;
> -
> if (debugfs_found)
> return (const char *)debugfs_mountpoint;
>
> - ptr = debugfs_known_mountpoints;
> - while (*ptr) {
> - if (debugfs_valid_mountpoint(*ptr) == 0) {
> - debugfs_found = true;
> - strcpy(debugfs_mountpoint, *ptr);
> - return debugfs_mountpoint;
> - }
> - ptr++;
> - }
> -
> - /* give up and parse /proc/mounts */
> - fp = fopen("/proc/mounts", "r");
> - if (fp == NULL)
> - return NULL;
> -
> - while (fscanf(fp, "%*s %" STR(PATH_MAX) "s %99s %*s %*d %*d\n",
> - debugfs_mountpoint, type) == 2) {
> - if (strcmp(type, "debugfs") == 0)
> - break;
> - }
> - fclose(fp);
> -
> - if (strcmp(type, "debugfs") != 0)
> - return NULL;
> -
> - debugfs_found = true;
> -
> - return debugfs_mountpoint;
> + return find_mountpoint("debugfs", (long) DEBUGFS_MAGIC,
> + debugfs_mountpoint, PATH_MAX + 1,
> + debugfs_known_mountpoints);
> }
debugfs_found is no longer set 'true' by debugfs_find_mountpoint
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists