char *debugfs_mount(const char *mountpoint) { if (debugfs_find_mountpoint()) { debugfs_premounted = 1; goto out; } if (mountpoint == NULL) { mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT); if (mountpoint == NULL) mountpoint = "/sys/kernel/debug"; } if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0) return NULL; debugfs_found = 1; strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint)); out: debugfs_set_tracing_events_path(debugfs_mountpoint); return debugfs_mountpoint; }
char *debugfs_mount(const char *mountpoint) { /* see if it's already mounted */ if (debugfs_find_mountpoint()) { debugfs_premounted = 1; goto out; } /* if not mounted and no argument */ if (mountpoint == NULL) { /* see if environment variable set */ mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT); /* if no environment variable, use default */ if (mountpoint == NULL) mountpoint = "/sys/kernel/debug"; } if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0) return NULL; /* save the mountpoint */ debugfs_found = 1; strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint)); out: debugfs_set_tracing_events_path(debugfs_mountpoint); return debugfs_mountpoint; }
void debugfs_set_path(const char *mountpoint) { snprintf(debugfs_mountpoint, sizeof(debugfs_mountpoint), "%s", mountpoint); debugfs_set_tracing_events_path(mountpoint); }