Lines Matching defs:list

31  *   This implements a timed double linked list.
32 * This list supports:
33 * - addition of node to the end of the list
34 * - atomic deletion of node anywhere in list
35 * - get and remove node from head of list
37 * - timeout feature, if enabled, will remove each node on the list which
38 * has been on the list for > timeout. The callback provided will be
43 * the list. This is a general statement and ignores things like
46 * - The timer is only used when something is on the list
60 static void hci1394_tlist_remove(hci1394_tlist_t *list,
67 * Initialize the tlist. The list will be protected by a mutex at the
76 hci1394_tlist_t *list;
82 /* try to alloc the space to keep track of the list */
83 list = kmem_alloc(sizeof (hci1394_tlist_t), KM_SLEEP);
86 *tlist_handle = list;
88 /* initialize the list structure */
89 list->tl_drvinfo = drvinfo;
90 list->tl_state = HCI1394_TLIST_TIMEOUT_OFF;
91 list->tl_head = NULL;
92 list->tl_tail = NULL;
94 list->tl_timer_enabled = B_FALSE;
97 list->tl_timer_enabled = B_TRUE;
98 list->tl_timer_info = *timer;
100 mutex_init(&list->tl_mutex, NULL, MUTEX_DRIVER,
116 hci1394_tlist_t *list;
122 list = (hci1394_tlist_t *)*tlist_handle;
123 hci1394_tlist_timeout_cancel(list);
124 mutex_destroy(&list->tl_mutex);
125 kmem_free(list, sizeof (hci1394_tlist_t));
136 * Add the node to the tail of the linked list. The list is protected by a
149 /* add's always go at the end of the list */
161 /* if there is nothing in the list */
177 /* put the node on the end of the list */
195 * Remove the node from the list. The node can be anywhere in the list. Make
212 * node from the list. hci1394_tlist_delete() supports two threads
233 * get the node at the head of the linked list. This function also removes
234 * the node from the list.
262 * get the node at the head of the linked list. This function does not
263 * remove the node from the list.
285 * the all of nodes currently present in the list are gone. It only makes
306 * cancel any scheduled timeouts. This should be called after the list is
307 * empty and there is no chance for any other nodes to be placed on the list.
334 * on the list which have timed out. If so, call the registered callback for
335 * each timed out node. We always start looking at the top of the list since
336 * the list is time sorted (oldest at the top).
341 hci1394_tlist_t *list;
350 list = (hci1394_tlist_t *)tlist_handle;
352 mutex_enter(&list->tl_mutex);
355 * if there is something on the list, check to see if the oldest has
356 * expired. If there is nothing on the list, there is no reason to
359 node = list->tl_head;
370 (uint64_t)list->tl_timer_info.tlt_timeout) <
373 hci1394_tlist_remove(list, node);
380 * entry from our list. This code should not reference
383 * list since we released/acquired the list mutex around
386 mutex_exit(&list->tl_mutex);
387 list->tl_timer_info.tlt_callback(node,
388 list->tl_timer_info.tlt_callback_arg);
389 mutex_enter(&list->tl_mutex);
390 node = list->tl_head;
401 (uint64_t)list->tl_timer_info.tlt_timeout) >
404 hci1394_tlist_remove(list, node);
411 * entry from our list. This code should not reference
414 * list since we released/acquired the list mutex around
417 mutex_exit(&list->tl_mutex);
418 list->tl_timer_info.tlt_callback(node,
419 list->tl_timer_info.tlt_callback_arg);
420 mutex_enter(&list->tl_mutex);
421 node = list->tl_head;
426 * Since this list is time sorted, we are
434 * if there are nodes still on the pending list, kick
438 list->tl_timeout_id = timeout(hci1394_tlist_callback, list,
440 list->tl_timer_info.tlt_timer_resolution));
441 list->tl_state = HCI1394_TLIST_TIMEOUT_ON;
443 list->tl_state = HCI1394_TLIST_TIMEOUT_OFF;
446 mutex_exit(&list->tl_mutex);
455 * This is an internal function which removes the given node from the list.
456 * The list MUST be locked before calling this function.
459 hci1394_tlist_remove(hci1394_tlist_t *list, hci1394_tlist_node_t *node)
461 ASSERT(list != NULL);
464 ASSERT(MUTEX_HELD(&list->tl_mutex));
468 /* if this is the only node on the list */
469 if ((list->tl_head == node) &&
470 (list->tl_tail == node)) {
471 list->tl_head = NULL;
472 list->tl_tail = NULL;
474 /* if the node is at the head of the list */
475 } else if (list->tl_head == node) {
476 list->tl_head = node->tln_next;
479 /* if the node is at the tail of the list */
480 } else if (list->tl_tail == node) {
481 list->tl_tail = node->tln_prev;
484 /* if the node is in the middle of the list */
490 /* Set state that this node has been removed from the list */