Lines Matching refs:fl
21 static void stream_frame_free(SFRAME_LIST *fl, STREAM_FRAME *sf) in stream_frame_free() argument
23 if (fl->cleanse && sf->data != NULL) in stream_frame_free()
48 void ossl_sframe_list_init(SFRAME_LIST *fl) in ossl_sframe_list_init() argument
50 memset(fl, 0, sizeof(*fl)); in ossl_sframe_list_init()
53 void ossl_sframe_list_destroy(SFRAME_LIST *fl) in ossl_sframe_list_destroy() argument
57 for (sf = fl->head; sf != NULL; sf = next_frame) { in ossl_sframe_list_destroy()
59 stream_frame_free(fl, sf); in ossl_sframe_list_destroy()
63 static int append_frame(SFRAME_LIST *fl, UINT_RANGE *range, in append_frame() argument
71 new_frame->prev = fl->tail; in append_frame()
72 if (fl->tail != NULL) in append_frame()
73 fl->tail->next = new_frame; in append_frame()
74 fl->tail = new_frame; in append_frame()
75 ++fl->num_frames; in append_frame()
79 int ossl_sframe_list_insert(SFRAME_LIST *fl, UINT_RANGE *range, in ossl_sframe_list_insert() argument
85 uint64_t curr_end = fl->tail != NULL ? fl->tail->range.end in ossl_sframe_list_insert()
86 : fl->offset; in ossl_sframe_list_insert()
90 && (!fl->fin || curr_end >= range->end)); in ossl_sframe_list_insert()
93 if (fl->offset >= range->end) in ossl_sframe_list_insert()
97 if (fl->tail == NULL) { in ossl_sframe_list_insert()
98 fl->tail = fl->head = stream_frame_new(range, pkt, data); in ossl_sframe_list_insert()
99 if (fl->tail == NULL) in ossl_sframe_list_insert()
102 ++fl->num_frames; in ossl_sframe_list_insert()
107 if (fl->tail->range.start < range->start) { in ossl_sframe_list_insert()
108 if (fl->tail->range.end >= range->end) in ossl_sframe_list_insert()
111 if (!append_frame(fl, range, pkt, data)) in ossl_sframe_list_insert()
117 for (sf = fl->head; sf != NULL && sf->range.start < range->start; in ossl_sframe_list_insert()
145 if (fl->head == drop_frame) in ossl_sframe_list_insert()
146 fl->head = next_frame; in ossl_sframe_list_insert()
147 if (fl->tail == drop_frame) in ossl_sframe_list_insert()
148 fl->tail = prev_frame; in ossl_sframe_list_insert()
149 --fl->num_frames; in ossl_sframe_list_insert()
150 stream_frame_free(fl, drop_frame); in ossl_sframe_list_insert()
157 stream_frame_free(fl, new_frame); in ossl_sframe_list_insert()
162 fl->tail = new_frame; in ossl_sframe_list_insert()
171 fl->head = new_frame; in ossl_sframe_list_insert()
173 ++fl->num_frames; in ossl_sframe_list_insert()
176 fl->fin = fin || fl->fin; in ossl_sframe_list_insert()
181 int ossl_sframe_list_peek(const SFRAME_LIST *fl, void **iter, in ossl_sframe_list_peek() argument
189 start = fl->offset; in ossl_sframe_list_peek()
190 sf = fl->head; in ossl_sframe_list_peek()
204 *fin = sf == NULL ? fl->fin : 0; in ossl_sframe_list_peek()
213 *fin = sf->next == NULL ? fl->fin : 0; in ossl_sframe_list_peek()
218 int ossl_sframe_list_drop_frames(SFRAME_LIST *fl, uint64_t limit) in ossl_sframe_list_drop_frames() argument
223 if (!ossl_assert(limit >= fl->offset) in ossl_sframe_list_drop_frames()
224 || !ossl_assert(fl->tail == NULL in ossl_sframe_list_drop_frames()
225 || limit <= fl->tail->range.end) in ossl_sframe_list_drop_frames()
226 || !ossl_assert(fl->tail != NULL in ossl_sframe_list_drop_frames()
227 || limit == fl->offset)) in ossl_sframe_list_drop_frames()
230 fl->offset = limit; in ossl_sframe_list_drop_frames()
232 for (sf = fl->head; sf != NULL && sf->range.end <= limit;) { in ossl_sframe_list_drop_frames()
236 --fl->num_frames; in ossl_sframe_list_drop_frames()
237 stream_frame_free(fl, drop_frame); in ossl_sframe_list_drop_frames()
239 fl->head = sf; in ossl_sframe_list_drop_frames()
244 fl->tail = NULL; in ossl_sframe_list_drop_frames()
246 fl->head_locked = 0; in ossl_sframe_list_drop_frames()
251 int ossl_sframe_list_lock_head(SFRAME_LIST *fl, UINT_RANGE *range, in ossl_sframe_list_lock_head() argument
258 if (fl->head_locked) in ossl_sframe_list_lock_head()
261 ret = ossl_sframe_list_peek(fl, &iter, range, data, fin); in ossl_sframe_list_lock_head()
263 fl->head_locked = 1; in ossl_sframe_list_lock_head()
267 int ossl_sframe_list_is_head_locked(SFRAME_LIST *fl) in ossl_sframe_list_is_head_locked() argument
269 return fl->head_locked; in ossl_sframe_list_is_head_locked()
272 int ossl_sframe_list_move_data(SFRAME_LIST *fl, in ossl_sframe_list_move_data() argument
276 STREAM_FRAME *sf = fl->head, *prev_frame = NULL; in ossl_sframe_list_move_data()
277 uint64_t limit = fl->offset; in ossl_sframe_list_move_data()
282 if (fl->head_locked) in ossl_sframe_list_move_data()
301 if (fl->cleanse) in ossl_sframe_list_move_data()
322 fl->tail = prev_frame; in ossl_sframe_list_move_data()
324 --fl->num_frames; in ossl_sframe_list_move_data()
325 stream_frame_free(fl, sf); in ossl_sframe_list_move_data()