Page MenuHomeFreeBSD

D30135.id88710.diff
No OneTemporary

D30135.id88710.diff

Index: share/man/man9/Makefile
===================================================================
--- share/man/man9/Makefile
+++ share/man/man9/Makefile
@@ -1941,6 +1941,7 @@
sglist.9 sglist_append_mbuf_epg.9 \
sglist.9 sglist_append_phys.9 \
sglist.9 sglist_append_sglist.9 \
+ sglist.9 sglist_append_single_mbuf.9 \
sglist.9 sglist_append_uio.9 \
sglist.9 sglist_append_user.9 \
sglist.9 sglist_append_vmpages.9 \
Index: share/man/man9/sglist.9
===================================================================
--- share/man/man9/sglist.9
+++ share/man/man9/sglist.9
@@ -38,6 +38,7 @@
.Nm sglist_append_mbuf_epg,
.Nm sglist_append_phys ,
.Nm sglist_append_sglist ,
+.Nm sglist_append_single_mbuf ,
.Nm sglist_append_uio ,
.Nm sglist_append_user ,
.Nm sglist_append_vmpages ,
@@ -74,6 +75,8 @@
.Ft int
.Fn sglist_append_sglist "struct sglist *sg" "struct sglist *source" "size_t offset" "size_t len"
.Ft int
+.Fn sglist_append_single_mbuf "struct sglist *sg" "struct mbuf *m"
+.Ft int
.Fn sglist_append_uio "struct sglist *sg" "struct uio *uio"
.Ft int
.Fn sglist_append_user "struct sglist *sg" "void *buf" "size_t len" "struct thread *td"
@@ -284,6 +287,13 @@
.Fa sg .
.Pp
The
+.Nm sglist_append_mbuf
+function appends the physical address ranges described by a single mbuf
+.Fa m
+to the scatter/gather list
+.Fa sg .
+.Pp
+The
.Nm sglist_append_phys
function appends a single physical address range to the scatter/gather list
.Fa sg .
Index: sys/kern/subr_sglist.c
===================================================================
--- sys/kern/subr_sglist.c
+++ sys/kern/subr_sglist.c
@@ -466,6 +466,21 @@
return (0);
}
+/*
+ * 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
Index: sys/sys/sglist.h
===================================================================
--- sys/sys/sglist.h
+++ sys/sys/sglist.h
@@ -94,6 +94,7 @@
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);

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 24, 1:48 AM (15 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32054894
Default Alt Text
D30135.id88710.diff (2 KB)

Event Timeline