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

Function ff_zc_mbuf_write

lib/ff_veth.c:326–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326int
327ff_zc_mbuf_write(struct ff_zc_mbuf *zm, const char *data, int len)
328{
329 int ret, length, progress = 0;
330 struct mbuf *m, *mb;
331
332 if (zm == NULL) {
333 return -1;
334 }
335 m = (struct mbuf *)zm->bsd_mbuf_off;
336
337 if (zm->off + len > zm->len) {
338 return -1;
339 }
340
341 for (mb = m; mb != NULL; mb = mb->m_next) {
342 length = min(M_TRAILINGSPACE(mb), len - progress);
343 bcopy(data + progress, mtod(mb, char *) + mb->m_len, length);
344
345 mb->m_len += length;
346 progress += length;
347 if (len == progress) {
348 break;
349 }
350 //if (flags & M_PKTHDR)
351 // m->m_pkthdr.len += length;
352 }
353 zm->off += len;
354 zm->bsd_mbuf_off = mb;
355
356 return len;
357}
358
359int
360ff_zc_mbuf_read(struct ff_zc_mbuf *m, const char *data, int len)

Callers 1

loopFunction · 0.85

Calls 1

minFunction · 0.85

Tested by

no test coverage detected