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

Function sglist_append_mbuf

freebsd/kern/subr_sglist.c:440–467  ·  view source on GitHub ↗

* Append the segments that describe a single mbuf chain to a * scatter/gather list. If there are insufficient segments, then this * fails with EFBIG. */

Source from the content-addressed store, hash-verified

438 * fails with EFBIG.
439 */
440int
441sglist_append_mbuf(struct sglist *sg, struct mbuf *m0)
442{
443 struct sgsave save;
444 struct mbuf *m;
445 int error;
446
447 if (sg->sg_maxseg == 0)
448 return (EINVAL);
449
450 error = 0;
451 SGLIST_SAVE(sg, save);
452 for (m = m0; m != NULL; m = m->m_next) {
453 if (m->m_len > 0) {
454 if ((m->m_flags & M_EXTPG) != 0)
455 error = sglist_append_mbuf_epg(sg, m,
456 mtod(m, vm_offset_t), m->m_len);
457 else
458 error = sglist_append(sg, m->m_data,
459 m->m_len);
460 if (error) {
461 SGLIST_RESTORE(sg, save);
462 return (error);
463 }
464 }
465 }
466 return (0);
467}
468
469/*
470 * Append the segments that describe a buffer spanning an array of VM

Callers 1

ccp_populate_sglistFunction · 0.85

Calls 2

sglist_append_mbuf_epgFunction · 0.85
sglist_appendFunction · 0.85

Tested by

no test coverage detected