Commit 709adcb3 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

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: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1441180605-24737-13-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 73ca85ad
...@@ -253,6 +253,11 @@ const char *name##__mountpoint(void) \ ...@@ -253,6 +253,11 @@ const char *name##__mountpoint(void) \
const char *name##__mount(void) \ const char *name##__mount(void) \
{ \ { \
return fs__mount(idx); \ return fs__mount(idx); \
} \
\
bool name##__configured(void) \
{ \
return name##__mountpoint() != NULL; \
} }
FS(sysfs, FS__SYSFS); FS(sysfs, FS__SYSFS);
......
#ifndef __API_FS__ #ifndef __API_FS__
#define __API_FS__ #define __API_FS__
#include <stdbool.h>
/* /*
* On most systems <limits.h> would have given us this, but not on some systems * On most systems <limits.h> would have given us this, but not on some systems
* (e.g. GNU/Hurd). * (e.g. GNU/Hurd).
...@@ -11,7 +13,8 @@ ...@@ -11,7 +13,8 @@
#define FS(name) \ #define FS(name) \
const char *name##__mountpoint(void); \ const char *name##__mountpoint(void); \
const char *name##__mount(void); const char *name##__mount(void); \
bool name##__configured(void); \
FS(sysfs) FS(sysfs)
FS(procfs) FS(procfs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment