diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -2325,6 +2325,7 @@ uidinfo.9 uihold.9 MLINKS+=uio.9 uiomove.9 \ uio.9 uiomove_frombuf.9 \ + uio.9 uiomove_fromphys.9 \ uio.9 uiomove_nofault.9 MLINKS+=unr.9 alloc_unr.9 \ unr.9 alloc_unrl.9 \ diff --git a/share/man/man9/uio.9 b/share/man/man9/uio.9 --- a/share/man/man9/uio.9 +++ b/share/man/man9/uio.9 @@ -30,6 +30,7 @@ .Nm uio , .Nm uiomove , .Nm uiomove_frombuf , +.Nm uiomove_fromphys , .Nm uiomove_nofault .Nd device driver I/O routines .Sh SYNOPSIS @@ -37,25 +38,29 @@ .In sys/uio.h .Bd -literal struct uio { - struct iovec *uio_iov; /* scatter/gather list */ - int uio_iovcnt; /* length of scatter/gather list */ - off_t uio_offset; /* offset in target object */ - ssize_t uio_resid; /* remaining bytes to copy */ - enum uio_seg uio_segflg; /* address space */ - enum uio_rw uio_rw; /* operation */ - struct thread *uio_td; /* owner */ + struct iovec *uio_iov; /* scatter/gather list */ + int uio_iovcnt; /* length of scatter/gather list */ + off_t uio_offset; /* offset in target object */ + ssize_t uio_resid; /* remaining bytes to process */ + enum uio_seg uio_segflg; /* address space */ + enum uio_rw uio_rw; /* operation */ + struct thread *uio_td; /* owner */ }; .Ed +.Pp .Ft int .Fn uiomove "void *buf" "int howmuch" "struct uio *uiop" .Ft int .Fn uiomove_frombuf "void *buf" "int howmuch" "struct uio *uiop" .Ft int +.Fn uiomove_fromphys "vm_page_t ma[]" "vm_offset_t offset" "int howmuch" "struct uio *uiop" +.Ft int .Fn uiomove_nofault "void *buf" "int howmuch" "struct uio *uiop" .Sh DESCRIPTION The functions .Fn uiomove , .Fn uiomove_frombuf , +.Fn uiomove_fromphys , and .Fn uiomove_nofault are used to transfer data between buffers and I/O vectors that might @@ -152,10 +157,30 @@ .Va uio_offset is greater than or equal to the buffer size, the result is success with no bytes transferred, effectively signaling EOF. +.Pp +The +.Fn uiomove_fromphys +function implements +.Fn uiomove +from physical memory using the direct map to avoid the creation and destruction +of ephemeral memory mappings. +The physical pages to be used in the transfer is described by the +.Fa "ma[]" +array. +The +.Fa "offset" +argument is the page offset of the first page in the +.Fa "ma[]" +array. +.Sh IMPLEMENTATION NOTES +The implementation of +.Fn uiomove_fromphys +is machine dependent. .Sh RETURN VALUES On success .Fn uiomove , .Fn uiomove_frombuf , +.Fn uiomove_fromphys , and .Fn uiomove_nofault will return 0; on error they will return an appropriate error code. @@ -168,7 +193,7 @@ partial read), it is just here to demonstrate the .Nm handling. -.Bd -literal +.Bd -literal -offset 2n /* MIN() can be found there: */ #include @@ -200,7 +225,8 @@ } .Ed .Sh ERRORS -.Fn uiomove +.Fn uiomove , +.Fn uiomove_fromphys and .Fn uiomove_nofault will fail and return the following error code if: @@ -211,7 +237,7 @@ or .Xr copyout 9 returned -.Er EFAULT +.Er EFAULT . .El .Pp In addition,