Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpvfs Support non-hostbacked regular file...



details:   https://anonhg.NetBSD.org/src/rev/c572f44d25f9
branches:  trunk
changeset: 758615:c572f44d25f9
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Nov 11 14:46:55 2010 +0000

description:
Support non-hostbacked regular files, at least just a little bit.

diffstat:

 sys/rump/librump/rumpvfs/rumpfs.c |  27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diffs (85 lines):

diff -r 680e1d42b9a7 -r c572f44d25f9 sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Thu Nov 11 14:38:36 2010 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Thu Nov 11 14:46:55 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpfs.c,v 1.66 2010/11/08 11:01:45 pooka Exp $        */
+/*     $NetBSD: rumpfs.c,v 1.67 2010/11/11 14:46:55 pooka Exp $        */
 
 /*
  * Copyright (c) 2009  Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.66 2010/11/08 11:01:45 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.67 2010/11/11 14:46:55 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -98,7 +98,8 @@
        { &vop_write_desc, rump_vop_write },
        { &vop_open_desc, rump_vop_open },
        { &vop_seek_desc, genfs_seek },
-       { &vop_putpages_desc, genfs_null_putpages },
+       { &vop_getpages_desc, genfs_getpages },
+       { &vop_putpages_desc, genfs_putpages },
        { &vop_whiteout_desc, rump_vop_whiteout },
        { &vop_fsync_desc, rump_vop_success },
        { &vop_lock_desc, genfs_lock },
@@ -507,10 +508,6 @@
        } else {
                vpops = rump_vnodeop_p;
        }
-       if (vpops != rump_specop_p && va->va_type != VDIR
-           && !(va->va_type == VREG && rn->rn_hostpath != NULL)
-           && va->va_type != VSOCK && va->va_type != VLNK)
-               return EOPNOTSUPP;
 
        rv = getnewvnode(VT_RUMP, mp, vpops, &vp);
        if (rv)
@@ -826,13 +823,11 @@
        struct componentname *cnp = ap->a_cnp;
        struct vattr *va = ap->a_vap;
        struct rumpfs_node *rnd = dvp->v_data, *rn;
+       off_t newsize;
        int rv;
 
-       if (va->va_type != VSOCK) {
-               rv = EOPNOTSUPP;
-               goto out;
-       }
-       rn = makeprivate(VSOCK, NODEV, DEV_BSIZE);
+       newsize = va->va_type == VSOCK ? DEV_BSIZE : 0;
+       rn = makeprivate(va->va_type, NODEV, newsize);
        rv = makevnode(dvp->v_mount, rn, vpp);
        if (rv)
                goto out;
@@ -940,7 +935,7 @@
        int mode = ap->a_mode;
        int error = EINVAL;
 
-       if (vp->v_type != VREG)
+       if (vp->v_type != VREG || rn->rn_hostpath == NULL)
                return 0;
 
        if (mode & FREAD) {
@@ -1047,6 +1042,9 @@
        ssize_t n;
        int error = 0;
 
+       if (rn->rn_readfd == -1)
+               return EOPNOTSUPP;
+
        bufsize = uio->uio_resid;
        buf = kmem_alloc(bufsize, KM_SLEEP);
        if ((n = rumpuser_pread(rn->rn_readfd, buf, bufsize,
@@ -1077,6 +1075,9 @@
        ssize_t n;
        int error = 0;
 
+       if (rn->rn_writefd == -1)
+               return EOPNOTSUPP;
+
        bufsize = uio->uio_resid;
        buf = kmem_alloc(bufsize, KM_SLEEP);
        error = uiomove(buf, bufsize, uio);



Home | Main Index | Thread Index | Old Index