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

Function sglist_build

freebsd/kern/subr_sglist.c:681–699  ·  view source on GitHub ↗

* Allocate and populate a scatter/gather list to describe a single * kernel virtual address range. */

Source from the content-addressed store, hash-verified

679 * kernel virtual address range.
680 */
681struct sglist *
682sglist_build(void *buf, size_t len, int mflags)
683{
684 struct sglist *sg;
685 int nsegs;
686
687 if (len == 0)
688 return (NULL);
689
690 nsegs = sglist_count(buf, len);
691 sg = sglist_alloc(nsegs, mflags);
692 if (sg == NULL)
693 return (NULL);
694 if (sglist_append(sg, buf, len) != 0) {
695 sglist_free(sg);
696 return (NULL);
697 }
698 return (sg);
699}
700
701/*
702 * Clone a new copy of a scatter/gather list.

Callers

nothing calls this directly

Calls 4

sglist_countFunction · 0.85
sglist_allocFunction · 0.85
sglist_appendFunction · 0.85
sglist_freeFunction · 0.85

Tested by

no test coverage detected