mirror of https://github.com/ipxe/ipxe.git
Added pkb_unput() and pkb_len().
parent
744b895077
commit
ab139ceda9
|
@ -68,6 +68,17 @@ static inline void * pkb_put ( struct pk_buff *pkb, size_t len ) {
|
||||||
return old_tail;
|
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
|
* Empty a packet buffer
|
||||||
*
|
*
|
||||||
|
@ -77,4 +88,14 @@ static inline void pkb_empty ( struct pk_buff *pkb ) {
|
||||||
pkb->tail = pkb->data;
|
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 */
|
#endif /* _PKBUFF_H */
|
||||||
|
|
Loading…
Reference in New Issue