FreeBSD/sys/kern/kern_lockf.c
/*
 * Insert lock into the active list, keeping list entries ordered by
 * increasing values of lf_start.
 */
Insert lock into the active list, keeping list entries ordered by
increasing values of lf_start.
Insert lock into the active list keeping list entries ordered by increasing values of lf_start .
static void
lf_insert_lock(struct lockf *state, struct lockf_entry *lock)
{
	struct lockf_entry *lf, *lfprev;
	if (LIST_EMPTY(&state->ls_active)) {
		LIST_INSERT_HEAD(&state->ls_active, lock, lf_link);
		return;
	}
	lfprev = NULL;
	LIST_FOREACH(lf, &state->ls_active, lf_link) {
		if (lf->lf_start > lock->lf_start) {
			LIST_INSERT_BEFORE(lf, lock, lf_link);
			return;
		}
		lfprev = lf;
	}
	LIST_INSERT_AFTER(lfprev, lock, lf_link);
}
static void lf_insert_lock ( struct lockf * state , struct lockf_entry * lock ) { struct lockf_entry * lf , * lfprev ; if ( LIST_EMPTY ( & state -> ls_active ) ) { LIST_INSERT_HEAD ( & state -> ls_active , lock , lf_link ) ; return ; } lfprev = NULL ; LIST_FOREACH ( lf , & state -> ls_active , lf_link ) { if ( lf -> lf_start > lock -> lf_start ) { LIST_INSERT_BEFORE ( lf , lock , lf_link ) ; return ; } lfprev = lf ; } LIST_INSERT_AFTER ( lfprev , lock , lf_link ) ; }
Insert lock into the active list, keeping list entries ordered by
 increasing values of lf_start.
Insert lock into the active list keeping list entries ordered by increasing values of lf_start .