#include <sys/mount.h>
#include <errno.h>
#include <stdio.h>
+#include <string.h>
#include "debugfs.h"
char debugfs_path[128];
+char debugfs_dri_path[128];
int debugfs_init(void)
{
return errno;
find_minor:
+ strcpy(debugfs_path, path);
for (n = 0; n < 16; n++) {
- int len = sprintf(debugfs_path, "%s/dri/%d", path, n);
- sprintf(debugfs_path + len, "/i915_error_state");
- if (stat(debugfs_path, &st) == 0) {
- debugfs_path[len] = '\0';
+ int len = sprintf(debugfs_dri_path, "%s/dri/%d", path, n);
+ sprintf(debugfs_dri_path + len, "/i915_error_state");
+ if (stat(debugfs_dri_path, &st) == 0) {
+ debugfs_dri_path[len] = '\0';
return 0;
}
}
- debugfs_path[0] = '\0';
+ debugfs_dri_path[0] = '\0';
return ENOENT;
}
#define DEBUGFS_H
extern char debugfs_path[128];
+extern char debugfs_dri_path[128];
+
int debugfs_init(void);
#endif /* DEBUGFS_H */
memset(obj, 0, sizeof(*obj));
- sprintf(buf, "%s/i915_gem_objects", debugfs_path);
+ sprintf(buf, "%s/i915_gem_objects", debugfs_dri_path);
fd = open(buf, 0);
if (fd < 0)
return errno;
freed = obj->comm;
obj->comm = NULL;
- sprintf(buf, "%s/i915_gem_objects", debugfs_path);
+ sprintf(buf, "%s/i915_gem_objects", debugfs_dri_path);
fd = open(buf, 0);
if (fd < 0) {
ret = errno;
memset(gf, 0, sizeof(*gf));
- sprintf(buf, "%s/i915_cur_delayinfo", debugfs_path);
+ sprintf(buf, "%s/i915_cur_delayinfo", debugfs_dri_path);
fd = open(buf, 0);
if (fd < 0)
return gf->error = errno;
if (gf->error)
return gf->error;
- sprintf(buf, "%s/i915_cur_delayinfo", debugfs_path);
+ sprintf(buf, "%s/i915_cur_delayinfo", debugfs_dri_path);
fd = open(buf, 0);
if (fd < 0)
return gf->error = errno;
memset(power, 0, sizeof(*power));
- sprintf(buf, "%s/i915_energy_uJ", debugfs_path);
+ sprintf(buf, "%s/i915_energy_uJ", debugfs_dri_path);
fd = open(buf, 0);
if (fd < 0)
return power->error = errno;