コード例 #1
0
char *debugfs_mount(const char *mountpoint)
{
	/* see if it's already mounted */
	if (debugfs_find_mountpoint()) {
		debugfs_premounted = 1;
		return debugfs_mountpoint;
	}

	/* 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 */
	strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
	debugfs_found = 1;

	return debugfs_mountpoint;
}
コード例 #2
0
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;
}
コード例 #3
0
ファイル: debugfs.c プロジェクト: HatimLokhandwala/batctl
char *debugfs_mount(const char *mountpoint)
{
	/* see if it's already mounted */
	if (debugfs_find_mountpoint()) {
		debugfs_premounted = 1;
		return debugfs_mountpoint;
	}

	/* if not mounted and no argument */
	if (mountpoint == NULL)
		mountpoint = "/sys/kernel/debug";

	if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0)
		return NULL;

	/* save the mountpoint */
	strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
	debugfs_mountpoint[sizeof(debugfs_mountpoint) - 1] = '\0';
	debugfs_found = 1;

	return debugfs_mountpoint;
}
コード例 #4
0
/* use this to force a umount */
void debugfs_force_cleanup(void)
{
	debugfs_find_mountpoint();
	debugfs_premounted = 0;
	debugfs_umount();
}