diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2021-05-25 23:59:18 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2021-05-25 23:59:18 +0000 |
| commit | 6663f8a23e7cb60d798c5ffbd9c716b62b204f2a (patch) | |
| tree | 877a363ddb5353ca7a2f645498249927d6a1b7f2 /sys | |
| parent | 1c8f4b3c9f9e8ca5823d153d3b117246b3d18db4 (diff) | |
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/kern/subr_sglist.c | 15 | ||||
| -rw-r--r-- | sys/sys/sglist.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sys/kern/subr_sglist.c b/sys/kern/subr_sglist.c index 71be45b4231d..7c520fda00f5 100644 --- a/sys/kern/subr_sglist.c +++ b/sys/kern/subr_sglist.c @@ -467,6 +467,21 @@ sglist_append_mbuf(struct sglist *sg, struct mbuf *m0) } /* + * Append the segments that describe a single mbuf to a scatter/gather + * list. If there are insufficient segments, then this fails with + * EFBIG. + */ +int +sglist_append_single_mbuf(struct sglist *sg, struct mbuf *m) +{ + if ((m->m_flags & M_EXTPG) != 0) + return (sglist_append_mbuf_epg(sg, m, + mtod(m, vm_offset_t), m->m_len)); + else + return (sglist_append(sg, m->m_data, m->m_len)); +} + +/* * Append the segments that describe a buffer spanning an array of VM * pages. The buffer begins at an offset of 'pgoff' in the first * page. diff --git a/sys/sys/sglist.h b/sys/sys/sglist.h index 82a3ac6ed6ac..bf8aa482e3ce 100644 --- a/sys/sys/sglist.h +++ b/sys/sys/sglist.h @@ -94,6 +94,7 @@ int sglist_append_phys(struct sglist *sg, vm_paddr_t paddr, size_t len); int sglist_append_sglist(struct sglist *sg, struct sglist *source, size_t offset, size_t length); +int sglist_append_single_mbuf(struct sglist *sg, struct mbuf *m); int sglist_append_uio(struct sglist *sg, struct uio *uio); int sglist_append_user(struct sglist *sg, void *buf, size_t len, struct thread *td); |
