[igt-dev] [PATCH i-g-t 27/29] lib/igt_debugfs: Implement mount() for FreeBSD

D Scott Phillips d.scott.phillips at intel.com
Wed Dec 11 00:52:33 UTC 2019


debugfs is typically mounted at a different path on FreeBSD, and
the mount function prototype is slightly different.

Signed-off-by: D Scott Phillips <d.scott.phillips at intel.com>
---
 lib/igt_debugfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 5a9c8c3c..33592df3 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -116,6 +116,7 @@ static bool is_mountpoint(const char *path)
 
 static const char *__igt_debugfs_mount(void)
 {
+#if defined(__linux__)
 	if (is_mountpoint("/sys/kernel/debug"))
 		return "/sys/kernel/debug";
 
@@ -126,6 +127,17 @@ static const char *__igt_debugfs_mount(void)
 		return NULL;
 
 	return "/sys/kernel/debug";
+#elif defined(__FreeBSD__)
+	if (is_mountpoint("/compat/linux/debug"))
+		return "/compat/linux/debug";
+
+	if (mount("lindebugfs", "/compat/linux/debug", 0, NULL))
+		return NULL;
+
+	return "/compat/linux/debug";
+#else
+#error Do not know how to mount debugfs
+#endif
 }
 
 /**
-- 
2.23.0



More information about the igt-dev mailing list