-/* TODO merge/factor in debugfs.c here */
-
#include <ctype.h>
#include <errno.h>
#include <stdbool.h>
#define PROC_SUPER_MAGIC 0x9fa0
#endif
+#ifndef DEBUGFS_MAGIC
+#define DEBUGFS_MAGIC 0x64626720
+#endif
+
static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
0,
};
+#ifndef DEBUGFS_DEFAULT_PATH
+#define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug"
+#endif
+
+static const char * const debugfs__known_mountpoints[] = {
+ DEBUGFS_DEFAULT_PATH,
+ "/debug",
+ 0,
+};
+
struct fs {
const char *name;
const char * const *mounts;
};
enum {
- FS__SYSFS = 0,
- FS__PROCFS = 1,
+ FS__SYSFS = 0,
+ FS__PROCFS = 1,
+ FS__DEBUGFS = 2,
};
static struct fs fs__entries[] = {
.mounts = procfs__known_mountpoints,
.magic = PROC_SUPER_MAGIC,
},
+ [FS__DEBUGFS] = {
+ .name = "debugfs",
+ .mounts = debugfs__known_mountpoints,
+ .magic = DEBUGFS_MAGIC,
+ },
};
static bool fs__read_mounts(struct fs *fs)
return fs__mountpoint(idx); \
}
-FS__MOUNTPOINT(sysfs, FS__SYSFS);
-FS__MOUNTPOINT(procfs, FS__PROCFS);
+FS__MOUNTPOINT(sysfs, FS__SYSFS);
+FS__MOUNTPOINT(procfs, FS__PROCFS);
+FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
int filename__read_int(const char *filename, int *value)
{
const char *sysfs__mountpoint(void);
const char *procfs__mountpoint(void);
+const char *debugfs__mountpoint(void);
int filename__read_int(const char *filename, int *value);
int sysctl__read_int(const char *sysctl, int *value);