* Allocate and populate a scatter/gather list to describe a single * kernel virtual address range. */
| 679 | * kernel virtual address range. |
| 680 | */ |
| 681 | struct sglist * |
| 682 | sglist_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. |
nothing calls this directly
no test coverage detected