Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182330
b: refs/heads/master
c: 61be3e5
h: refs/heads/master
v: v3
  • Loading branch information
Xiao Guangrong authored and Ingo Molnar committed Dec 28, 2009
1 parent 46c676d commit 5146025
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 29c52aa2300173dd45df04dae1f5acc81a2c93b1
refs/heads/master: 61be3e59ba7a6dbd39f92fd1f107285a0caeb008
1 change: 1 addition & 0 deletions trunk/tools/perf/util/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ char *debugfs_mount(const char *mountpoint)

/* save the mountpoint */
strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
debugfs_found = 1;

return debugfs_mountpoint;
}
Expand Down
29 changes: 5 additions & 24 deletions trunk/tools/perf/util/trace-event-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include "../perf.h"
#include "trace-event.h"
#include "debugfs.h"

#define VERSION "0.5"

Expand Down Expand Up @@ -102,32 +103,12 @@ void *malloc_or_die(unsigned int size)

static const char *find_debugfs(void)
{
static char debugfs[MAX_PATH+1];
static int debugfs_found;
FILE *fp;
struct mntent *m;

if (debugfs_found)
return debugfs;

fp = setmntent("/proc/mounts", "r");
if (!fp)
die("Can't open /proc/mounts for read");

while ((m = getmntent(fp)) != NULL) {
if (strcmp(m->mnt_type, "debugfs") == 0) {
strcpy(debugfs, m->mnt_dir);
debugfs_found = 1;
break;
}
}

endmntent(fp);
const char *path = debugfs_mount(NULL);

if (!debugfs_found)
die("debugfs not mounted, please mount");
if (!path)
die("Your kernel not support debugfs filesystem");

return debugfs;
return path;
}

/*
Expand Down

0 comments on commit 5146025

Please sign in to comment.