summaryrefslogtreecommitdiff
path: root/overlay/debugfs.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-19 18:15:04 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-19 18:16:11 +0100
commit55b8c33ca50ce82393f99fb4412aaaed17f010fb (patch)
tree01043c18ae739e2186781de759cd71db4f315b92 /overlay/debugfs.c
parent34198b801ebca69fba654c8d1e011acea45b778c (diff)
overlay: Auatomatically mount debugfs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay/debugfs.c')
-rw-r--r--overlay/debugfs.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/overlay/debugfs.c b/overlay/debugfs.c
new file mode 100644
index 00000000..969ec368
--- /dev/null
+++ b/overlay/debugfs.c
@@ -0,0 +1,21 @@
+#include <sys/stat.h>
+#include <sys/mount.h>
+#include <errno.h>
+
+#include "debugfs.h"
+
+int debugfs_init(void)
+{
+ struct stat st;
+
+ if (stat("/sys/kernel/debug/dri", &st) == 0)
+ return 0;
+
+ if (stat("/sys/kernel/debug", &st))
+ return errno;
+
+ if (mount("debug", "/sys/kernel/debug", "debugfs", 0, 0))
+ return errno;
+
+ return 0;
+}