david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Added pkb_unput() and pkb_len().

This commit is contained in:
Michael Brown 2006-04-19 01:54:24 +00:00
parent 744b895077
commit ab139ceda9
1 changed files with 21 additions and 0 deletions

View File

@ -68,6 +68,17 @@ static inline void * pkb_put ( struct pk_buff *pkb, size_t len ) {
return old_tail;
}
/**
* Remove data from end of packet buffer
*
* @v pkb Packet buffer
* @v len Length to remove
*/
static inline void pkb_unput ( struct pk_buff *pkb, size_t len ) {
pkb->tail -= len;
assert ( pkb->tail >= pkb->data );
}
/**
* Empty a packet buffer
*
@ -77,4 +88,14 @@ static inline void pkb_empty ( struct pk_buff *pkb ) {
pkb->tail = pkb->data;
}
/**
* Calculate length of data in a packet buffer
*
* @v pkb Packet buffer
* @ret len Length of data in buffer
*/
static inline size_t pkb_len ( struct pk_buff *pkb ) {
return ( pkb->tail - pkb->data );
}
#endif /* _PKBUFF_H */