FreeBSD/sys/dev/isci/scil/sci_abstract_list.c
/**
 * This method will add the objToAdd_p object to the list before the obj_p.
 *
 */
This method will add the objToAdd_p object to the list before the obj_p.
This method will add the objToAdd_p object to the list before the obj_p .
void sci_abstract_list_insert(
   SCI_ABSTRACT_LIST_T * list_p,
   void * obj_p,
   void * objToAdd_p
)
{
   SCI_ABSTRACT_ELEMENT_LIST_T * elem_list = &(list_p)->elements;
   SCI_ABSTRACT_ELEMENT_T * obj_element = private_find(elem_list, obj_p);
   SCI_ABSTRACT_ELEMENT_T * objToAdd_element =
      private_pool_allocate((list_p)->free_pool);
   objToAdd_element->object_p = objToAdd_p;
   ASSERT(obj_element != NULL);
   ASSERT(objToAdd_element != NULL);
   if (obj_element == elem_list->front_p)
   {
      objToAdd_element->object_p = (objToAdd_p);
      private_push_front(&(list_p)->elements, objToAdd_element);
   }
   else
   {
      obj_element->previous_p->next_p = objToAdd_element;
      objToAdd_element->previous_p = obj_element->previous_p;
      obj_element->previous_p = objToAdd_element;
      objToAdd_element->next_p = obj_element;
      elem_list->size++;
   }
}
void sci_abstract_list_insert ( SCI_ABSTRACT_LIST_T * list_p , void * obj_p , void * objToAdd_p ) { SCI_ABSTRACT_ELEMENT_LIST_T * elem_list = & ( list_p ) -> elements ; SCI_ABSTRACT_ELEMENT_T * obj_element = private_find ( elem_list , obj_p ) ; SCI_ABSTRACT_ELEMENT_T * objToAdd_element = private_pool_allocate ( ( list_p ) -> free_pool ) ; objToAdd_element -> object_p = objToAdd_p ; ASSERT ( obj_element != NULL ) ; ASSERT ( objToAdd_element != NULL ) ; if ( obj_element == elem_list -> front_p ) { objToAdd_element -> object_p = ( objToAdd_p ) ; private_push_front ( & ( list_p ) -> elements , objToAdd_element ) ; } else { obj_element -> previous_p -> next_p = objToAdd_element ; objToAdd_element -> previous_p = obj_element -> previous_p ; obj_element -> previous_p = objToAdd_element ; objToAdd_element -> next_p = obj_element ; elem_list -> size ++ ; } }
This method will add the objToAdd_p object to the list before the obj_p.
This method will add the objToAdd_p object to the list before the obj_p .