summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/lib/api/fs/fs.c23
-rw-r--r--tools/lib/api/fs/fs.h5
2 files changed, 18 insertions, 10 deletions
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index bc93baf33fff..8afe08a99bc6 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 a9627ea5e6ae..f654bcb99d1e 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)