FreeBSD/sys/geom/sched/g_sched.c
/*
 * Register or unregister individual scheduling algorithms.
 */
Register or unregister individual scheduling algorithms.
Register or unregister individual scheduling algorithms .
static int
g_gsched_register(struct g_gsched *gsp)
{
	struct g_gsched *cur;
	int error = 0;
	mtx_lock(&me.gs_mtx);
	LIST_FOREACH(cur, &me.gs_scheds, glist) {
		if (strcmp(gsp->gs_name, cur->gs_name) == 0)
			break;
	}
	if (cur != NULL) {
		G_SCHED_DEBUG(0, "A scheduler named %s already"
		    "exists.", gsp->gs_name);
		error = EEXIST;
	} else {
		LIST_INSERT_HEAD(&me.gs_scheds, gsp, glist);
		gsp->gs_refs = 1;
		me.gs_sched_count++;
		g_gsched_build_names(gsp);
	}
	mtx_unlock(&me.gs_mtx);
	return (error);
}
static int g_gsched_register ( struct g_gsched * gsp ) { struct g_gsched * cur ; int error = 0 ; mtx_lock ( & me . gs_mtx ) ; LIST_FOREACH ( cur , & me . gs_scheds , glist ) { if ( strcmp ( gsp -> gs_name , cur -> gs_name ) == 0 ) break ; } if ( cur != NULL ) { G_SCHED_DEBUG ( 0 , " " " " , gsp -> gs_name ) ; error = EEXIST ; } else { LIST_INSERT_HEAD ( & me . gs_scheds , gsp , glist ) ; gsp -> gs_refs = 1 ; me . gs_sched_count ++ ; g_gsched_build_names ( gsp ) ; } mtx_unlock ( & me . gs_mtx ) ; return ( error ) ; }
Register or unregister individual scheduling algorithms.
Register or unregister individual scheduling algorithms .