Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/yamt-uio_vmspace]: src/sys adapt some random parts of kernel to uio_vmsp...



details:   https://anonhg.NetBSD.org/src/rev/0b08ff186d1e
branches:  yamt-uio_vmspace
changeset: 586696:0b08ff186d1e
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sat Dec 31 12:37:20 2005 +0000

description:
adapt some random parts of kernel to uio_vmspace.

diffstat:

 sys/arch/i386/i386/process_machdep.c   |  17 ++++++++++++-----
 sys/compat/common/vfs_syscalls_30.c    |   7 +++----
 sys/compat/common/vfs_syscalls_43.c    |  10 +++++-----
 sys/compat/linux/common/linux_file64.c |   7 +++----
 sys/compat/linux/common/linux_misc.c   |   7 +++----
 sys/dev/dkwedge/dk.c                   |  20 ++++++++++++++++----
 sys/dev/vnd.c                          |   6 +++---
 sys/miscfs/genfs/genfs_vnops.c         |  10 ++++------
 sys/miscfs/specfs/spec_vnops.c         |  14 ++++++++------
 sys/ufs/ufs/ufs_quota.c                |  10 ++++------
 sys/ufs/ufs/ufs_readwrite.c            |   8 ++++----
 sys/ufs/ufs/ufs_vnops.c                |   6 +++---
 12 files changed, 68 insertions(+), 54 deletions(-)

diffs (truncated from 462 to 300 lines):

diff -r aec809cf6abc -r 0b08ff186d1e sys/arch/i386/i386/process_machdep.c
--- a/sys/arch/i386/i386/process_machdep.c      Sat Dec 31 11:34:25 2005 +0000
+++ b/sys/arch/i386/i386/process_machdep.c      Sat Dec 31 12:37:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: process_machdep.c,v 1.54 2005/12/24 20:07:10 perry Exp $       */
+/*     $NetBSD: process_machdep.c,v 1.54.2.1 2005/12/31 12:37:20 yamt Exp $    */
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.54 2005/12/24 20:07:10 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.54.2.1 2005/12/31 12:37:20 yamt Exp $");
 
 #include "opt_vm86.h"
 #include "npx.h"
@@ -476,16 +476,23 @@
                if (!process_machdep_validxmmregs(lt->l_proc))
                        return (EINVAL);
                else {
+                       struct vmspace *vm;
+                       int error;
+
+                       error = proc_vmspace_getref(l->l_proc, &vm);
+                       if (error) {
+                               return error;
+                       }
                        iov.iov_base = addr;
                        iov.iov_len = sizeof(struct xmmregs);
                        uio.uio_iov = &iov;
                        uio.uio_iovcnt = 1;
                        uio.uio_offset = 0;
                        uio.uio_resid = sizeof(struct xmmregs);
-                       uio.uio_segflg = UIO_USERSPACE;
                        uio.uio_rw = write ? UIO_WRITE : UIO_READ;
-                       uio.uio_lwp = l;
-                       return (process_machdep_doxmmregs(l, lt, &uio));
+                       error = process_machdep_doxmmregs(l, lt, &uio);
+                       uvmspace_free(vm);
+                       return error;
                }
        }
 
diff -r aec809cf6abc -r 0b08ff186d1e sys/compat/common/vfs_syscalls_30.c
--- a/sys/compat/common/vfs_syscalls_30.c       Sat Dec 31 11:34:25 2005 +0000
+++ b/sys/compat/common/vfs_syscalls_30.c       Sat Dec 31 12:37:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls_30.c,v 1.6 2005/12/11 12:19:56 christos Exp $     */
+/*     $NetBSD: vfs_syscalls_30.c,v 1.6.2.1 2005/12/31 12:37:20 yamt Exp $     */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.6 2005/12/11 12:19:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.6.2.1 2005/12/31 12:37:20 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -231,10 +231,9 @@
        auio.uio_iov = &aiov;
        auio.uio_iovcnt = 1;
        auio.uio_rw = UIO_READ;
-       auio.uio_segflg = UIO_SYSSPACE;
-       auio.uio_lwp = NULL;
        auio.uio_resid = buflen;
        auio.uio_offset = off;
+       UIO_SETUP_SYSSPACE(&auio);
        /*
          * First we read into the malloc'ed buffer, then
          * we massage it into user space, one record at a time.
diff -r aec809cf6abc -r 0b08ff186d1e sys/compat/common/vfs_syscalls_43.c
--- a/sys/compat/common/vfs_syscalls_43.c       Sat Dec 31 11:34:25 2005 +0000
+++ b/sys/compat/common/vfs_syscalls_43.c       Sat Dec 31 12:37:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls_43.c,v 1.31 2005/12/11 12:19:56 christos Exp $    */
+/*     $NetBSD: vfs_syscalls_43.c,v 1.31.2.1 2005/12/31 12:37:20 yamt Exp $    */
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.31 2005/12/11 12:19:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.31.2.1 2005/12/31 12:37:20 yamt Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "fs_union.h"
@@ -385,9 +385,9 @@
        auio.uio_iov = &aiov;
        auio.uio_iovcnt = 1;
        auio.uio_rw = UIO_READ;
-       auio.uio_segflg = UIO_USERSPACE;
-       auio.uio_lwp = l;
        auio.uio_resid = count;
+       KASSERT(l == curlwp);
+       auio.uio_vmspace = l->l_proc->p_vmspace;
        vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
        loff = auio.uio_offset = fp->f_offset;
 #      if (BYTE_ORDER != LITTLE_ENDIAN)
@@ -400,10 +400,10 @@
        {
                kuio = auio;
                kuio.uio_iov = &kiov;
-               kuio.uio_segflg = UIO_SYSSPACE;
                kiov.iov_len = count;
                dirbuf = malloc(count, M_TEMP, M_WAITOK);
                kiov.iov_base = dirbuf;
+               UIO_SETUP_SYSSPACE(&kuio);
                error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag,
                            (off_t **)0, (int *)0);
                fp->f_offset = kuio.uio_offset;
diff -r aec809cf6abc -r 0b08ff186d1e sys/compat/linux/common/linux_file64.c
--- a/sys/compat/linux/common/linux_file64.c    Sat Dec 31 11:34:25 2005 +0000
+++ b/sys/compat/linux/common/linux_file64.c    Sat Dec 31 12:37:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_file64.c,v 1.30 2005/12/11 12:20:19 christos Exp $       */
+/*     $NetBSD: linux_file64.c,v 1.30.2.1 2005/12/31 12:37:20 yamt Exp $       */
 
 /*-
  * Copyright (c) 1995, 1998, 2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.30 2005/12/11 12:20:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.30.2.1 2005/12/31 12:37:20 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -453,10 +453,9 @@
        auio.uio_iov = &aiov;
        auio.uio_iovcnt = 1;
        auio.uio_rw = UIO_READ;
-       auio.uio_segflg = UIO_SYSSPACE;
-       auio.uio_lwp = NULL;
        auio.uio_resid = buflen;
        auio.uio_offset = off;
+       UIO_SETUP_SYSSPACE(&auio);
        /*
          * First we read into the malloc'ed buffer, then
          * we massage it into user space, one record at a time.
diff -r aec809cf6abc -r 0b08ff186d1e sys/compat/linux/common/linux_misc.c
--- a/sys/compat/linux/common/linux_misc.c      Sat Dec 31 11:34:25 2005 +0000
+++ b/sys/compat/linux/common/linux_misc.c      Sat Dec 31 12:37:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_misc.c,v 1.147 2005/12/11 12:20:19 christos Exp $        */
+/*     $NetBSD: linux_misc.c,v 1.147.2.1 2005/12/31 12:37:20 yamt Exp $        */
 
 /*-
  * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.147 2005/12/11 12:20:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.147.2.1 2005/12/31 12:37:20 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -862,10 +862,9 @@
        auio.uio_iov = &aiov;
        auio.uio_iovcnt = 1;
        auio.uio_rw = UIO_READ;
-       auio.uio_segflg = UIO_SYSSPACE;
-       auio.uio_lwp = NULL;
        auio.uio_resid = buflen;
        auio.uio_offset = off;
+       UIO_SETUP_SYSSPACE(&auio);
        /*
          * First we read into the malloc'ed buffer, then
          * we massage it into user space, one record at a time.
diff -r aec809cf6abc -r 0b08ff186d1e sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Sat Dec 31 11:34:25 2005 +0000
+++ b/sys/dev/dkwedge/dk.c      Sat Dec 31 12:37:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.10 2005/12/11 12:21:20 christos Exp $ */
+/*     $NetBSD: dk.c,v 1.10.2.1 2005/12/31 12:37:20 yamt Exp $ */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.10 2005/12/11 12:21:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.10.2.1 2005/12/31 12:37:20 yamt Exp $");
 
 #include "opt_dkwedge.h"
 
@@ -588,6 +588,7 @@
        struct iovec iov;
        struct dkwedge_softc *sc;
        struct dkwedge_info dkw;
+       struct vmspace *vm;
        int error = 0;
 
        iov.iov_base = dkwl->dkwl_buf;
@@ -597,9 +598,16 @@
        uio.uio_iovcnt = 1;
        uio.uio_offset = 0;
        uio.uio_resid = dkwl->dkwl_bufsize;
-       uio.uio_segflg = l != NULL ? UIO_USERSPACE : UIO_SYSSPACE;
        uio.uio_rw = UIO_READ;
-       uio.uio_lwp = l;
+       if (l == NULL) {
+               UIO_SETUP_SYSSPACE(&uio);
+       } else {
+               error = proc_vmspace_getref(l->l_proc, &vm);
+               if (error) {
+                       return error;
+               }
+               uio.uio_vmspace = vm;
+       }
 
        dkwl->dkwl_ncopied = 0;
 
@@ -627,6 +635,10 @@
        dkwl->dkwl_nwedges = pdk->dk_nwedges;
        (void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
 
+       if (l != NULL) {
+               uvmspace_free(vm);
+       }
+
        return (error);
 }
 
diff -r aec809cf6abc -r 0b08ff186d1e sys/dev/vnd.c
--- a/sys/dev/vnd.c     Sat Dec 31 11:34:25 2005 +0000
+++ b/sys/dev/vnd.c     Sat Dec 31 12:37:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.125 2005/12/14 19:49:16 bouyer Exp $ */
+/*     $NetBSD: vnd.c,v 1.125.2.1 2005/12/31 12:37:20 yamt Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.125 2005/12/14 19:49:16 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.125.2.1 2005/12/31 12:37:20 yamt Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "fs_nfs.h"
@@ -1348,8 +1348,8 @@
        auio.uio_iovcnt = 1;
        auio.uio_offset = 0;
        auio.uio_rw = UIO_READ;
-       auio.uio_segflg = UIO_SYSSPACE;
        auio.uio_resid = aiov.iov_len;
+       UIO_SETUP_SYSSPACE(&auio);
        vn_lock(vnd->sc_vp, LK_EXCLUSIVE | LK_RETRY);
        error = VOP_READ(vnd->sc_vp, &auio, 0, vnd->sc_cred);
        if (error == 0) {
diff -r aec809cf6abc -r 0b08ff186d1e sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c    Sat Dec 31 11:34:25 2005 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c    Sat Dec 31 12:37:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfs_vnops.c,v 1.118 2005/12/24 20:45:09 perry Exp $  */
+/*     $NetBSD: genfs_vnops.c,v 1.118.2.1 2005/12/31 12:37:20 yamt Exp $       */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.118 2005/12/24 20:45:09 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.118.2.1 2005/12/31 12:37:20 yamt Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_nfsserver.h"
@@ -1666,10 +1666,9 @@
                uio.uio_iov = &iov;
                uio.uio_iovcnt = 1;
                uio.uio_offset = origoffset + (i << PAGE_SHIFT);
-               uio.uio_segflg = UIO_SYSSPACE;
                uio.uio_rw = UIO_READ;
                uio.uio_resid = PAGE_SIZE;
-               uio.uio_lwp = NULL;
+               UIO_SETUP_SYSSPACE(&uio);
                /* XXX vn_lock */
                error = VOP_READ(vp, &uio, 0, cred);
                if (error) {
@@ -1720,10 +1719,9 @@
        uio.uio_iov = &iov;
        uio.uio_iovcnt = 1;
        uio.uio_offset = offset;
-       uio.uio_segflg = UIO_SYSSPACE;
        uio.uio_rw = UIO_WRITE;
        uio.uio_resid = npages << PAGE_SHIFT;
-       uio.uio_lwp = NULL;
+       UIO_SETUP_SYSSPACE(&uio);



Home | Main Index | Thread Index | Old Index