[tip:perf/core] tools lib api fs: Add FSTYPE__configured() method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  709adcb33928b5bf965587b23ed6544e964584a3
Gitweb:     http://git.kernel.org/tip/709adcb33928b5bf965587b23ed6544e964584a3
Author:     Jiri Olsa <jolsa@xxxxxxxxxx>
AuthorDate: Wed, 2 Sep 2015 09:56:42 +0200
Committer:  Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Fri, 4 Sep 2015 12:01:01 -0300

tools lib api fs: Add FSTYPE__configured() method

Add FSTYPE__configured() (where FSTYPE is one of sysfs, procfs, debugfs,
tracefs) interface that returns bool state of the filesystem mount:

  true - mounted, false - not mounted

It will not try to mount the filesystem.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Raphael Beamonte <raphael.beamonte@xxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Matt Fleming <matt@xxxxxxxxxxxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Link: http://lkml.kernel.org/r/1441180605-24737-13-git-send-email-jolsa@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
 tools/lib/api/fs/fs.c | 23 ++++++++++++++---------
 tools/lib/api/fs/fs.h |  5 ++++-
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index bc93baf..8afe08a 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -244,15 +244,20 @@ static const char *fs__mount(int idx)
 	return fs__check_mounts(fs) ? fs->path : NULL;
 }
 
-#define FS(name, idx)			\
-const char *name##__mountpoint(void)	\
-{					\
-	return fs__mountpoint(idx);	\
-}					\
-					\
-const char *name##__mount(void)		\
-{					\
-	return fs__mount(idx);		\
+#define FS(name, idx)				\
+const char *name##__mountpoint(void)		\
+{						\
+	return fs__mountpoint(idx);		\
+}						\
+						\
+const char *name##__mount(void)			\
+{						\
+	return fs__mount(idx);			\
+}						\
+						\
+bool name##__configured(void)			\
+{						\
+	return name##__mountpoint() != NULL;	\
 }
 
 FS(sysfs,   FS__SYSFS);
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index a9627ea..f654bcb 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -1,6 +1,8 @@
 #ifndef __API_FS__
 #define __API_FS__
 
+#include <stdbool.h>
+
 /*
  * On most systems <limits.h> would have given us this, but  not on some systems
  * (e.g. GNU/Hurd).
@@ -11,7 +13,8 @@
 
 #define FS(name)				\
 	const char *name##__mountpoint(void);	\
-	const char *name##__mount(void);
+	const char *name##__mount(void);	\
+	bool name##__configured(void);		\
 
 FS(sysfs)
 FS(procfs)
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux