Browse Source

Added pkb_unput() and pkb_len().

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
ab139ceda9
1 changed files with 21 additions and 0 deletions
  1. 21
    0
      src/include/gpxe/pkbuff.h

+ 21
- 0
src/include/gpxe/pkbuff.h View File

@@ -68,6 +68,17 @@ static inline void * pkb_put ( struct pk_buff *pkb, size_t len ) {
68 68
 	return old_tail;
69 69
 }
70 70
 
71
+/**
72
+ * Remove data from end of packet buffer
73
+ *
74
+ * @v pkb	Packet buffer
75
+ * @v len	Length to remove
76
+ */
77
+static inline void pkb_unput ( struct pk_buff *pkb, size_t len ) {
78
+	pkb->tail -= len;
79
+	assert ( pkb->tail >= pkb->data );
80
+}
81
+
71 82
 /**
72 83
  * Empty a packet buffer
73 84
  *
@@ -77,4 +88,14 @@ static inline void pkb_empty ( struct pk_buff *pkb ) {
77 88
 	pkb->tail = pkb->data;
78 89
 }
79 90
 
91
+/**
92
+ * Calculate length of data in a packet buffer
93
+ *
94
+ * @v pkb	Packet buffer
95
+ * @ret len	Length of data in buffer
96
+ */
97
+static inline size_t pkb_len ( struct pk_buff *pkb ) {
98
+	return ( pkb->tail - pkb->data );
99
+}
100
+
80 101
 #endif /* _PKBUFF_H */

Loading…
Cancel
Save