MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cirbuf_del_buf_tail

Function cirbuf_del_buf_tail

dpdk/lib/cmdline/cmdline_cirbuf.c:247–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245/* buffer del */
246
247int
248cirbuf_del_buf_tail(struct cirbuf *cbuf, unsigned int size)
249{
250 if (!cbuf || !size || size > CIRBUF_GET_LEN(cbuf))
251 return -EINVAL;
252
253 cbuf->len -= size;
254 if (CIRBUF_IS_EMPTY(cbuf)) {
255 cbuf->end += (cbuf->maxlen - size + 1);
256 cbuf->end %= cbuf->maxlen;
257 }
258 else {
259 cbuf->end += (cbuf->maxlen - size);
260 cbuf->end %= cbuf->maxlen;
261 }
262 return 0;
263}
264
265/* del at head */
266

Calls

no outgoing calls