From nobody Fri May 08 09:09:14 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gBjwq1Zbvz6bwh3 for ; Fri, 08 May 2026 09:09:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gBjwp5Cbyz3W9B for ; Fri, 08 May 2026 09:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778231354; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tpJOdoMh1/Ivf9vZAtwu0gEtTL40iuuSHn/BVQjrxdc=; b=jQVcGd0hGVH9FmOl/sKSoBQlBbQZ1CN6qKdiGl+VSVg6NcpPIafjP+saaDA0jY7ZSsrL1J sqkTteYaxJ3GCH60ClsrDvXeJ+TI/YxPml5Js/6hPYOkFWHGiZlHcug4zT4qJF3lCnjJot 2ektvAX9jApPwZMf8Q1RKtU+Js3ntn5mdp4psZotjvQfI/u+laDG+ZBLWPxL0cy6ZncIMi FGrOPOQ73az7RI369FfmjOyjkH60y1uVrtzx2nvSLYRChJa/iqvVZBuxI/jytl1i8urrHv lksiUsaK5vZlr0o1ZltuRdOdJOnJQsvEq8SnxftMM7+65AH5tlFchn7CcHxrsA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1778231354; a=rsa-sha256; cv=none; b=LITlfpsWhqurttXEhKex/7UL5cZRSHtvRv6roXZp89UUKbDhW70f8T2PotIEN7PBOSV23Q wclC7WttZC14BzX0pbTqGHrGKbF2SyNxpp2/rvEZH79nbp6khLBIc2bi2hdRJojkve077G 1f3b9d9BH3G9Uu6Z6dEetAoQpsq05wXPKxiht6/9L4FpI0HXaWyNoj7leKH7RVaBLB2eYi ILIbPlMZXTmA7oLndseyoDtpTGRci91b99w5lF/gYUHWFKDwhP+rpFE/v3pb4oXrOo4qNb Ws6PRBPuQa0DOU14BecHoiJar7xItybwJP8vr4OIJgpiPwtUT268apU/EEfV3Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778231354; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tpJOdoMh1/Ivf9vZAtwu0gEtTL40iuuSHn/BVQjrxdc=; b=aUqWD34/IKzBjaUqYESDJbbRuIZYmuQrgTtvfiHxLmn5jJFBW16i4QeLA9aeIz6XU7/zFg htBU8iaNM+aKN8HT+icid8L647H6dSxaERZS7c3khiXR6PpMIrB8T3MO0Xi7zHMbCwfnRP m+1Kn5GvFpKf96mLNemjxUBpbq0P9zsn1loKN0a/lJ7w803BBZMMRZG9IcE3Wt/O+irSoI ORDWA9n7z8HT2q7oRwpOD6MM7IK5s3d1cWskRjzXhEVIcUUmaglPrGoNLdL3F5nu8Yfkry UzwrBnZsQkmejW28jkKNHJ6OULd0/h3zCnSOmK978guMZFVYOjbygUU6CLvB1w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gBjwp43qJz167L for ; Fri, 08 May 2026 09:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 20450 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 08 May 2026 09:09:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 076e44839160 - main - uio.9: Document uiomove_fromphys() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 076e44839160f74f96fda83fa81c3acb41b9ebc8 Auto-Submitted: auto-generated Date: Fri, 08 May 2026 09:09:14 +0000 Message-Id: <69fda83a.20450.75b6eef0@gitrepo.freebsd.org> The branch main has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=076e44839160f74f96fda83fa81c3acb41b9ebc8 commit 076e44839160f74f96fda83fa81c3acb41b9ebc8 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2026-03-20 07:52:28 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2026-05-08 09:05:57 +0000 uio.9: Document uiomove_fromphys() Reviewed by: kib Discussed with: markj, royger MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D54070 --- share/man/man9/Makefile | 1 + share/man/man9/uio.9 | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 29c822c10eb2..fbb981891ce4 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -2333,6 +2333,7 @@ MLINKS+=uidinfo.9 uifind.9 \ 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 index b143eb6e8e62..a7563125a351 100644 --- a/share/man/man9/uio.9 +++ b/share/man/man9/uio.9 @@ -23,13 +23,14 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 22, 2025 +.Dd May 7, 2026 .Dt UIO 9 .Os .Sh NAME .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,27 @@ When .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 provides a machine-independent way to copy memory +to and from the physical address space. +The +.Fa "ma[]" +argument is an array of physical pages. +Every physical page address in the array provides +a page-sized chunk of the physical space. +The +.Fa "offset" +argument is the offset into the +.Fa "ma[]" +array. +In particular, the offset does not have to lie within the first page. .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 +190,7 @@ will not work (the buffer pointer is not being advanced in case of a 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 +222,8 @@ fooread(struct cdev *dev, struct uio *uio, int flag) } .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 +234,7 @@ The invoked or .Xr copyout 9 returned -.Er EFAULT +.Er EFAULT . .El .Pp In addition,