* Insert lock into the active list, keeping list entries ordered by * increasing values of lf_start. */
| 1091 | * increasing values of lf_start. |
| 1092 | */ |
| 1093 | static void |
| 1094 | lf_insert_lock(struct lockf *state, struct lockf_entry *lock) |
| 1095 | { |
| 1096 | struct lockf_entry *lf, *lfprev; |
| 1097 | |
| 1098 | if (LIST_EMPTY(&state->ls_active)) { |
| 1099 | LIST_INSERT_HEAD(&state->ls_active, lock, lf_link); |
| 1100 | return; |
| 1101 | } |
| 1102 | |
| 1103 | lfprev = NULL; |
| 1104 | LIST_FOREACH(lf, &state->ls_active, lf_link) { |
| 1105 | if (lf->lf_start > lock->lf_start) { |
| 1106 | LIST_INSERT_BEFORE(lf, lock, lf_link); |
| 1107 | return; |
| 1108 | } |
| 1109 | lfprev = lf; |
| 1110 | } |
| 1111 | LIST_INSERT_AFTER(lfprev, lock, lf_link); |
| 1112 | } |
| 1113 | |
| 1114 | /* |
| 1115 | * Wake up a sleeping lock and remove it from the pending list now |
no outgoing calls
no test coverage detected