summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2001-03-04 01:22:23 +0000
committeralc <alc@FreeBSD.org>2001-03-04 01:22:23 +0000
commit6a1cc9f79fb9e7eafdea1794998b46874779b495 (patch)
treee73fca460a4fce5fe0a82ca058fef23716251e96
parent61126b1ae1ff5743fc2c00d1ae62c6e4cdd09b87 (diff)
downloadFreeBSD-src-6a1cc9f79fb9e7eafdea1794998b46874779b495.zip
FreeBSD-src-6a1cc9f79fb9e7eafdea1794998b46874779b495.tar.gz
Remove the field privatemodes from struct __aiocb_private and the
related code from aio_read() and aio_write(). This field was intended, but never used, to allow a mythical user-level library to make an aio_read() or aio_write() behave like an ordinary read() or write(), i.e., a blocking I/O operation.
-rw-r--r--sys/kern/vfs_aio.c139
-rw-r--r--sys/sys/aio.h12
2 files changed, 2 insertions, 149 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 8335264..6caf253 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -1872,73 +1872,7 @@ aio_read(struct proc *p, struct aio_read_args *uap)
#ifndef VFS_AIO
return ENOSYS;
#else
- struct filedesc *fdp;
- struct file *fp;
- struct uio auio;
- struct iovec aiov;
- unsigned int fd;
- int cnt;
- struct aiocb iocb;
- int error, pmodes;
-
- pmodes = fuword(&uap->aiocbp->_aiocb_private.privatemodes);
- if ((pmodes & AIO_PMODE_SYNC) == 0)
- return aio_aqueue(p, (struct aiocb *)uap->aiocbp, LIO_READ);
-
- /* Get control block. */
- if ((error = copyin((caddr_t)uap->aiocbp, (caddr_t)&iocb, sizeof iocb))
- != 0)
- return error;
-
- /* Get the fd info for process. */
- fdp = p->p_fd;
-
- /*
- * Range check file descriptor.
- */
- fd = iocb.aio_fildes;
- if (fd >= fdp->fd_nfiles)
- return EBADF;
- fp = fdp->fd_ofiles[fd];
- if ((fp == NULL) || ((fp->f_flag & FREAD) == 0))
- return EBADF;
- if (iocb.aio_offset == -1LL)
- return EINVAL;
-
- auio.uio_resid = iocb.aio_nbytes;
- if (auio.uio_resid < 0)
- return (EINVAL);
-
- /*
- * Process sync simply -- queue async request.
- */
- if ((iocb._aiocb_private.privatemodes & AIO_PMODE_SYNC) == 0)
- return aio_aqueue(p, (struct aiocb *)uap->aiocbp, LIO_READ);
-
- aiov.iov_base = (void *)iocb.aio_buf;
- aiov.iov_len = iocb.aio_nbytes;
-
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_offset = iocb.aio_offset;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_procp = p;
-
- cnt = iocb.aio_nbytes;
- /*
- * Temporarily bump the ref count while reading to avoid the
- * descriptor being ripped out from under us.
- */
- fhold(fp);
- error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET, p);
- fdrop(fp, p);
- if (error && (auio.uio_resid != cnt) && (error == ERESTART || error ==
- EINTR || error == EWOULDBLOCK))
- error = 0;
- cnt -= auio.uio_resid;
- p->p_retval[0] = cnt;
- return error;
+ return aio_aqueue(p, (struct aiocb *)uap->aiocbp, LIO_READ);
#endif /* VFS_AIO */
}
@@ -1948,76 +1882,7 @@ aio_write(struct proc *p, struct aio_write_args *uap)
#ifndef VFS_AIO
return ENOSYS;
#else
- struct filedesc *fdp;
- struct file *fp;
- struct uio auio;
- struct iovec aiov;
- unsigned int fd;
- int cnt;
- struct aiocb iocb;
- int error;
- int pmodes;
-
- /*
- * Process sync simply -- queue async request.
- */
- pmodes = fuword(&uap->aiocbp->_aiocb_private.privatemodes);
- if ((pmodes & AIO_PMODE_SYNC) == 0)
- return aio_aqueue(p, (struct aiocb *)uap->aiocbp, LIO_WRITE);
-
- if ((error = copyin((caddr_t)uap->aiocbp, (caddr_t)&iocb, sizeof iocb))
- != 0)
- return error;
-
- /* Get the fd info for process. */
- fdp = p->p_fd;
-
- /*
- * Range check file descriptor.
- */
- fd = iocb.aio_fildes;
- if (fd >= fdp->fd_nfiles)
- return EBADF;
- fp = fdp->fd_ofiles[fd];
- if ((fp == NULL) || ((fp->f_flag & FWRITE) == 0))
- return EBADF;
- if (iocb.aio_offset == -1LL)
- return EINVAL;
-
- aiov.iov_base = (void *)iocb.aio_buf;
- aiov.iov_len = iocb.aio_nbytes;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_offset = iocb.aio_offset;
-
- auio.uio_resid = iocb.aio_nbytes;
- if (auio.uio_resid < 0)
- return (EINVAL);
-
- auio.uio_rw = UIO_WRITE;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_procp = p;
-
- cnt = iocb.aio_nbytes;
- /*
- * Temporarily bump the ref count while writing to avoid the
- * descriptor being ripped out from under us.
- */
- fhold(fp);
- error = fo_write(fp, &auio, fp->f_cred, FOF_OFFSET, p);
- fdrop(fp, p);
- if (error) {
- if (auio.uio_resid != cnt) {
- if (error == ERESTART || error == EINTR || error ==
- EWOULDBLOCK)
- error = 0;
- if (error == EPIPE)
- psignal(p, SIGPIPE);
- }
- }
- cnt -= auio.uio_resid;
- p->p_retval[0] = cnt;
- return error;
+ return aio_aqueue(p, (struct aiocb *)uap->aiocbp, LIO_WRITE);
#endif /* VFS_AIO */
}
diff --git a/sys/sys/aio.h b/sys/sys/aio.h
index de1db8e..0f21566 100644
--- a/sys/sys/aio.h
+++ b/sys/sys/aio.h
@@ -50,24 +50,12 @@
#define AIO_LISTIO_MAX 16
/*
- * Private mode bit for aio.
- * (This bit is set by the library routine
- * to allow the kernel to support sync
- * or async operations in the future.)
- */
-#define AIO_PMODE_SYNC 0x1
-#define AIO_PMODE_DONE 0x2
-#define AIO_PMODE_SUSPEND 0x4
-#define AIO_PMODE_ACTIVE 0x2357c0de
-
-/*
* Private members for aiocb -- don't access
* directly.
*/
struct __aiocb_private {
long status;
long error;
- long privatemodes;
void *kernelinfo;
};
OpenPOWER on IntegriCloud