svn commit: r364445 - in stable/12/sys: kern sys

Mark Johnston markj at FreeBSD.org
Fri Aug 21 00:59:16 UTC 2020


Author: markj
Date: Fri Aug 21 00:59:15 2020
New Revision: 364445
URL: https://svnweb.freebsd.org/changeset/base/364445

Log:
  MFC r364235:
  Rename the pipe_map field of struct pipe.

Modified:
  stable/12/sys/kern/sys_pipe.c
  stable/12/sys/sys/pipe.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/sys_pipe.c
==============================================================================
--- stable/12/sys/kern/sys_pipe.c	Fri Aug 21 00:34:33 2020	(r364444)
+++ stable/12/sys/kern/sys_pipe.c	Fri Aug 21 00:59:15 2020	(r364445)
@@ -736,19 +736,19 @@ pipe_read(struct file *fp, struct uio *uio, struct ucr
 		/*
 		 * Direct copy, bypassing a kernel buffer.
 		 */
-		} else if ((size = rpipe->pipe_map.cnt) != 0) {
+		} else if ((size = rpipe->pipe_pages.cnt) != 0) {
 			if (size > uio->uio_resid)
 				size = (u_int) uio->uio_resid;
 			PIPE_UNLOCK(rpipe);
-			error = uiomove_fromphys(rpipe->pipe_map.ms,
-			    rpipe->pipe_map.pos, size, uio);
+			error = uiomove_fromphys(rpipe->pipe_pages.ms,
+			    rpipe->pipe_pages.pos, size, uio);
 			PIPE_LOCK(rpipe);
 			if (error)
 				break;
 			nread += size;
-			rpipe->pipe_map.pos += size;
-			rpipe->pipe_map.cnt -= size;
-			if (rpipe->pipe_map.cnt == 0) {
+			rpipe->pipe_pages.pos += size;
+			rpipe->pipe_pages.cnt -= size;
+			if (rpipe->pipe_pages.cnt == 0) {
 				rpipe->pipe_state &= ~PIPE_WANTW;
 				wakeup(rpipe);
 			}
@@ -852,7 +852,7 @@ pipe_build_write_buffer(struct pipe *wpipe, struct uio
 	PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
 	KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0,
 	    ("%s: PIPE_DIRECTW set on %p", __func__, wpipe));
-	KASSERT(wpipe->pipe_map.cnt == 0,
+	KASSERT(wpipe->pipe_pages.cnt == 0,
 	    ("%s: pipe map for %p contains residual data", __func__, wpipe));
 
 	if (uio->uio_iov->iov_len > wpipe->pipe_buffer.size)
@@ -864,17 +864,17 @@ pipe_build_write_buffer(struct pipe *wpipe, struct uio
 	PIPE_UNLOCK(wpipe);
 	i = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map,
 	    (vm_offset_t)uio->uio_iov->iov_base, size, VM_PROT_READ,
-	    wpipe->pipe_map.ms, PIPENPAGES);
+	    wpipe->pipe_pages.ms, PIPENPAGES);
 	PIPE_LOCK(wpipe);
 	if (i < 0) {
 		wpipe->pipe_state &= ~PIPE_DIRECTW;
 		return (EFAULT);
 	}
 
-	wpipe->pipe_map.npages = i;
-	wpipe->pipe_map.pos =
+	wpipe->pipe_pages.npages = i;
+	wpipe->pipe_pages.pos =
 	    ((vm_offset_t) uio->uio_iov->iov_base) & PAGE_MASK;
-	wpipe->pipe_map.cnt = size;
+	wpipe->pipe_pages.cnt = size;
 
 	uio->uio_iov->iov_len -= size;
 	uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + size;
@@ -895,12 +895,12 @@ pipe_destroy_write_buffer(struct pipe *wpipe)
 	PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
 	KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0,
 	    ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe));
-	KASSERT(wpipe->pipe_map.cnt == 0,
+	KASSERT(wpipe->pipe_pages.cnt == 0,
 	    ("%s: pipe map for %p contains residual data", __func__, wpipe));
 
 	wpipe->pipe_state &= ~PIPE_DIRECTW;
-	vm_page_unhold_pages(wpipe->pipe_map.ms, wpipe->pipe_map.npages);
-	wpipe->pipe_map.npages = 0;
+	vm_page_unhold_pages(wpipe->pipe_pages.ms, wpipe->pipe_pages.npages);
+	wpipe->pipe_pages.npages = 0;
 }
 
 /*
@@ -920,9 +920,9 @@ pipe_clone_write_buffer(struct pipe *wpipe)
 	KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0,
 	    ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe));
 
-	size = wpipe->pipe_map.cnt;
-	pos = wpipe->pipe_map.pos;
-	wpipe->pipe_map.cnt = 0;
+	size = wpipe->pipe_pages.cnt;
+	pos = wpipe->pipe_pages.pos;
+	wpipe->pipe_pages.cnt = 0;
 
 	wpipe->pipe_buffer.in = size;
 	wpipe->pipe_buffer.out = 0;
@@ -938,7 +938,7 @@ pipe_clone_write_buffer(struct pipe *wpipe)
 	uio.uio_segflg = UIO_SYSSPACE;
 	uio.uio_rw = UIO_READ;
 	uio.uio_td = curthread;
-	uiomove_fromphys(wpipe->pipe_map.ms, pos, size, &uio);
+	uiomove_fromphys(wpipe->pipe_pages.ms, pos, size, &uio);
 	PIPE_LOCK(wpipe);
 	pipe_destroy_write_buffer(wpipe);
 }
@@ -1002,7 +1002,7 @@ retry:
 		goto error1;
 	}
 
-	while (wpipe->pipe_map.cnt != 0 &&
+	while (wpipe->pipe_pages.cnt != 0 &&
 	    (wpipe->pipe_state & PIPE_EOF) == 0) {
 		if (wpipe->pipe_state & PIPE_WANTR) {
 			wpipe->pipe_state &= ~PIPE_WANTR;
@@ -1019,7 +1019,7 @@ retry:
 	}
 
 	if ((wpipe->pipe_state & PIPE_EOF) != 0) {
-		wpipe->pipe_map.cnt = 0;
+		wpipe->pipe_pages.cnt = 0;
 		pipe_destroy_write_buffer(wpipe);
 		pipeselwakeup(wpipe);
 		error = EPIPE;
@@ -1144,7 +1144,7 @@ pipe_write(struct file *fp, struct uio *uio, struct uc
 		 * pipe buffer.  We break out if a signal occurs or the
 		 * reader goes away.
 		 */
-		if (wpipe->pipe_map.cnt != 0) {
+		if (wpipe->pipe_pages.cnt != 0) {
 			if (wpipe->pipe_state & PIPE_WANTR) {
 				wpipe->pipe_state &= ~PIPE_WANTR;
 				wakeup(wpipe);
@@ -1362,8 +1362,8 @@ pipe_ioctl(struct file *fp, u_long cmd, void *data, st
 			PIPE_UNLOCK(mpipe);
 			return (0);
 		}
-		if (mpipe->pipe_map.cnt != 0)
-			*(int *)data = mpipe->pipe_map.cnt;
+		if (mpipe->pipe_pages.cnt != 0)
+			*(int *)data = mpipe->pipe_pages.cnt;
 		else
 			*(int *)data = mpipe->pipe_buffer.cnt;
 		break;
@@ -1418,7 +1418,7 @@ pipe_poll(struct file *fp, int events, struct ucred *a
 		goto locked_error;
 #endif
 	if (fp->f_flag & FREAD && events & (POLLIN | POLLRDNORM))
-		if (rpipe->pipe_map.cnt > 0 || rpipe->pipe_buffer.cnt > 0)
+		if (rpipe->pipe_pages.cnt > 0 || rpipe->pipe_buffer.cnt > 0)
 			revents |= events & (POLLIN | POLLRDNORM);
 
 	if (fp->f_flag & FWRITE && events & (POLLOUT | POLLWRNORM))
@@ -1500,8 +1500,8 @@ pipe_stat(struct file *fp, struct stat *ub, struct ucr
 	bzero(ub, sizeof(*ub));
 	ub->st_mode = S_IFIFO;
 	ub->st_blksize = PAGE_SIZE;
-	if (pipe->pipe_map.cnt != 0)
-		ub->st_size = pipe->pipe_map.cnt;
+	if (pipe->pipe_pages.cnt != 0)
+		ub->st_size = pipe->pipe_pages.cnt;
 	else
 		ub->st_size = pipe->pipe_buffer.cnt;
 	ub->st_blocks = howmany(ub->st_size, ub->st_blksize);
@@ -1591,9 +1591,9 @@ pipe_free_kmem(struct pipe *cpipe)
 	}
 #ifndef PIPE_NODIRECT
 	{
-		cpipe->pipe_map.cnt = 0;
-		cpipe->pipe_map.pos = 0;
-		cpipe->pipe_map.npages = 0;
+		cpipe->pipe_pages.cnt = 0;
+		cpipe->pipe_pages.pos = 0;
+		cpipe->pipe_pages.npages = 0;
 	}
 #endif
 }
@@ -1739,7 +1739,7 @@ filt_piperead(struct knote *kn, long hint)
 	PIPE_LOCK_ASSERT(rpipe, MA_OWNED);
 	kn->kn_data = rpipe->pipe_buffer.cnt;
 	if (kn->kn_data == 0)
-		kn->kn_data = rpipe->pipe_map.cnt;
+		kn->kn_data = rpipe->pipe_pages.cnt;
 
 	if ((rpipe->pipe_state & PIPE_EOF) != 0 &&
 	    ((rpipe->pipe_state & PIPE_NAMED) == 0 ||

Modified: stable/12/sys/sys/pipe.h
==============================================================================
--- stable/12/sys/sys/pipe.h	Fri Aug 21 00:34:33 2020	(r364444)
+++ stable/12/sys/sys/pipe.h	Fri Aug 21 00:59:15 2020	(r364445)
@@ -103,7 +103,7 @@ struct pipemapping {
  */
 struct pipe {
 	struct	pipebuf pipe_buffer;	/* data storage */
-	struct	pipemapping pipe_map;	/* pipe mapping for direct I/O */
+	struct	pipemapping pipe_pages;	/* wired pages for direct I/O */
 	struct	selinfo pipe_sel;	/* for compat with select */
 	struct	timespec pipe_atime;	/* time of last access */
 	struct	timespec pipe_mtime;	/* time of last modify */


More information about the svn-src-stable-12 mailing list