Prepends the specified packet list to the start of the specified FIFO.
| 1471 | |
| 1472 | // Prepends the specified packet list to the start of the specified FIFO. |
| 1473 | void hb_fifo_push_head( hb_fifo_t * f, hb_buffer_t * b ) |
| 1474 | { |
| 1475 | hb_buffer_t * tmp; |
| 1476 | uint32_t size = 0; |
| 1477 | |
| 1478 | if( !b ) |
| 1479 | { |
| 1480 | return; |
| 1481 | } |
| 1482 | |
| 1483 | hb_lock( f->lock ); |
| 1484 | if (f->size >= f->capacity && |
| 1485 | f->cond_alert_full != NULL) |
| 1486 | { |
| 1487 | hb_cond_broadcast( f->cond_alert_full ); |
| 1488 | } |
| 1489 | |
| 1490 | /* |
| 1491 | * If there are a chain of buffers prepend the lot |
| 1492 | */ |
| 1493 | tmp = b; |
| 1494 | while( tmp->next ) |
| 1495 | { |
| 1496 | tmp = tmp->next; |
| 1497 | size += 1; |
| 1498 | } |
| 1499 | |
| 1500 | if( f->size > 0 ) |
| 1501 | { |
| 1502 | tmp->next = f->first; |
| 1503 | } |
| 1504 | else |
| 1505 | { |
| 1506 | f->last = tmp; |
| 1507 | } |
| 1508 | |
| 1509 | f->first = b; |
| 1510 | f->size += ( size + 1 ); |
| 1511 | |
| 1512 | hb_unlock( f->lock ); |
| 1513 | } |
| 1514 | |
| 1515 | void hb_fifo_close( hb_fifo_t ** _f ) |
| 1516 | { |
no test coverage detected