From: Michael Brown Date: Wed, 19 Apr 2006 01:54:24 +0000 (+0000) Subject: Added pkb_unput() and pkb_len(). X-Git-Tag: v0.9.3~1509 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab139ceda9b9f03fcc0884e97e29810a693b6469;p=thirdparty%2Fipxe.git Added pkb_unput() and pkb_len(). --- diff --git a/src/include/gpxe/pkbuff.h b/src/include/gpxe/pkbuff.h index 54d8511c2..bcc304977 100644 --- a/src/include/gpxe/pkbuff.h +++ b/src/include/gpxe/pkbuff.h @@ -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 */