+int getdebugfsmntdir(char *mntdir)
+{
+ char mnt_dir[PATH_MAX];
+ char mnt_type[PATH_MAX];
+
+ FILE *fp = fopen("/proc/mounts", "r");
+ if (!fp) {
+ return EINVAL;
+ }
+
+ while (1) {
+ if (fscanf(fp, "%*s %s %s %*s %*s %*s", mnt_dir, mnt_type) <= 0) {
+ return ENOENT;
+ }
+ if (!strcmp(mnt_type, "debugfs")) {
+ strcpy(mntdir, mnt_dir);
+ return 0;
+ }
+ }
+}