Source-Changes-HG archive

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

[src/chs-ubc2]: src/sys UBCify.



details:   https://anonhg.NetBSD.org/src/rev/2c53afad619d
branches:  chs-ubc2
changeset: 471453:2c53afad619d
user:      chs <chs%NetBSD.org@localhost>
date:      Fri Aug 06 12:55:27 1999 +0000

description:
UBCify.

diffstat:

 sys/adosfs/advfsops.c             |    5 +-
 sys/adosfs/advnops.c              |   35 ++++-
 sys/filecorefs/filecore_vfsops.c  |    5 +-
 sys/filecorefs/filecore_vnops.c   |   34 ++++-
 sys/isofs/cd9660/cd9660_vfsops.c  |    4 +-
 sys/isofs/cd9660/cd9660_vnops.c   |   35 ++++-
 sys/ufs/ext2fs/ext2fs_balloc.c    |  278 +++++++++++++++++++++++++++++++------
 sys/ufs/ext2fs/ext2fs_extern.h    |    7 +-
 sys/ufs/ext2fs/ext2fs_inode.c     |   51 ++----
 sys/ufs/ext2fs/ext2fs_readwrite.c |   81 ++++++++++-
 sys/ufs/ext2fs/ext2fs_vfsops.c    |    6 +-
 sys/ufs/ext2fs/ext2fs_vnops.c     |   11 +-
 12 files changed, 450 insertions(+), 102 deletions(-)

diffs (truncated from 981 to 300 lines):

diff -r 26cba82db9ab -r 2c53afad619d sys/adosfs/advfsops.c
--- a/sys/adosfs/advfsops.c     Fri Aug 06 12:54:23 1999 +0000
+++ b/sys/adosfs/advfsops.c     Fri Aug 06 12:55:27 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advfsops.c,v 1.35.4.1 1999/06/21 00:44:32 thorpej Exp $        */
+/*     $NetBSD: advfsops.c,v 1.35.4.2 1999/08/06 12:55:27 chs Exp $    */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -235,6 +235,9 @@
         mp->mnt_stat.f_fsid.val[0] = (long)devvp->v_rdev;
         mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_ADOSFS);
        mp->mnt_flag |= MNT_LOCAL;
+       mp->mnt_dev_bshift = ffs(amp->bsize) - 1;
+       mp->mnt_fs_bshift = ffs(amp->secsperblk) - 1;
+
        devvp->v_specflags |= SI_MOUNTEDON;
 
        /*
diff -r 26cba82db9ab -r 2c53afad619d sys/adosfs/advnops.c
--- a/sys/adosfs/advnops.c      Fri Aug 06 12:54:23 1999 +0000
+++ b/sys/adosfs/advnops.c      Fri Aug 06 12:55:27 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advnops.c,v 1.48.4.2 1999/08/02 19:30:59 thorpej Exp $ */
+/*     $NetBSD: advnops.c,v 1.48.4.3 1999/08/06 12:55:27 chs Exp $     */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -141,7 +141,8 @@
        { &vop_truncate_desc, adosfs_truncate },        /* truncate */
        { &vop_update_desc, adosfs_update },            /* update */
        { &vop_bwrite_desc, adosfs_bwrite },            /* bwrite */
-       { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
+       { &vop_getpages_desc, genfs_getpages },         /* getpages */
+       { NULL, NULL }
 };
 
 struct vnodeopv_desc adosfs_vnodeop_opv_desc =
@@ -224,6 +225,7 @@
                int a_ioflag;
                struct ucred *a_cred;
        } */ *sp = v;
+       struct vnode *vp = sp->a_vp;
        struct adosfsmount *amp;
        struct anode *ap;
        struct uio *uio;
@@ -263,6 +265,33 @@
        /*
         * taken from ufs_read()
         */
+
+       if (vp->v_type == VREG) {
+               error = 0;
+               while (uio->uio_resid > 0) {
+                       void *win;
+                       vsize_t bytelen = min(ap->fsize - uio->uio_offset,
+                                             uio->uio_resid);
+
+                       if (bytelen == 0) {
+                               break;
+                       }
+                       win = ubc_alloc(&vp->v_uvm.u_obj, uio->uio_offset,
+                                       &bytelen, UBC_READ);
+#ifdef DIAGNOSTIC
+                       if (win == NULL) {
+                               panic("adosfs_read: ubc_alloc -> NULL");
+                       }
+#endif
+                       error = uiomove(win, bytelen, uio);
+                       ubc_release(win, 0);
+                       if (error) {
+                               break;
+                       }
+               }
+               goto out;
+       }
+
        do {
                /*
                 * we are only supporting ADosFFS currently
@@ -324,6 +353,8 @@
                                amp->bsize - amp->dbsize, (int)n, uio);
                brelse(bp);
        } while (error == 0 && uio->uio_resid > 0 && n != 0);
+
+out:
 reterr:
 #ifdef ADOSFS_DIAGNOSTIC
        printf(" %d)", error);
diff -r 26cba82db9ab -r 2c53afad619d sys/filecorefs/filecore_vfsops.c
--- a/sys/filecorefs/filecore_vfsops.c  Fri Aug 06 12:54:23 1999 +0000
+++ b/sys/filecorefs/filecore_vfsops.c  Fri Aug 06 12:55:27 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_vfsops.c,v 1.6.4.1 1999/08/02 22:10:52 thorpej Exp $  */
+/*     $NetBSD: filecore_vfsops.c,v 1.6.4.2 1999/08/06 12:55:28 chs Exp $      */
 
 /*-
  * Copyright (c) 1998 Andrew McMurry
@@ -323,6 +323,9 @@
        mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_FILECORE);
        mp->mnt_maxsymlinklen = 0;
        mp->mnt_flag |= MNT_LOCAL;
+       mp->mnt_dev_bshift = fcdr->log2secsize;
+       mp->mnt_fs_bshift = fcmp->log2bsize;
+
        fcmp->fc_mountp = mp;
        fcmp->fc_dev = dev;
        fcmp->fc_devvp = devvp;
diff -r 26cba82db9ab -r 2c53afad619d sys/filecorefs/filecore_vnops.c
--- a/sys/filecorefs/filecore_vnops.c   Fri Aug 06 12:54:23 1999 +0000
+++ b/sys/filecorefs/filecore_vnops.c   Fri Aug 06 12:55:27 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_vnops.c,v 1.6.4.1 1999/08/02 22:10:52 thorpej Exp $   */
+/*     $NetBSD: filecore_vnops.c,v 1.6.4.2 1999/08/06 12:55:28 chs Exp $       */
 
 /*-
  * Copyright (c) 1998 Andrew McMurry
@@ -162,6 +162,33 @@
                return (EINVAL);
        ip->i_flag |= IN_ACCESS;
        fcmp = ip->i_mnt;
+
+       if (vp->v_type == VREG) {
+               error = 0;
+               while (uio->uio_resid > 0) {
+                       void *win;
+                       vsize_t bytelen = min(ip->i_size - uio->uio_offset,
+                                             uio->uio_resid);
+
+                       if (bytelen == 0) {
+                               break;
+                       }
+                       win = ubc_alloc(&vp->v_uvm.u_obj, uio->uio_offset,
+                                       &bytelen, UBC_READ);
+#ifdef DIAGNOSTIC
+                       if (win == NULL) {
+                               panic("filecore_read: ubc_alloc -> NULL");
+                       }
+#endif
+                       error = uiomove(win, bytelen, uio);
+                       ubc_release(win, 0);
+                       if (error) {
+                               break;
+                       }
+               }
+               goto out;
+       }
+
        do {
                lbn = lblkno(fcmp, uio->uio_offset);
                on = blkoff(fcmp, uio->uio_offset);
@@ -213,6 +240,8 @@
 #endif
                brelse(bp);
        } while (error == 0 && uio->uio_resid > 0 && n != 0);
+
+out:
        return (error);
 }
 
@@ -570,7 +599,8 @@
        { &vop_truncate_desc, filecore_truncate },      /* truncate */
        { &vop_update_desc, filecore_update },          /* update */
        { &vop_bwrite_desc, vn_bwrite },                /* bwrite */
-       { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
+       { &vop_getpages_desc, genfs_getpages },         /* getpages */
+       { NULL, NULL }
 };
 struct vnodeopv_desc filecore_vnodeop_opv_desc =
        { &filecore_vnodeop_p, filecore_vnodeop_entries };
diff -r 26cba82db9ab -r 2c53afad619d sys/isofs/cd9660/cd9660_vfsops.c
--- a/sys/isofs/cd9660/cd9660_vfsops.c  Fri Aug 06 12:54:23 1999 +0000
+++ b/sys/isofs/cd9660/cd9660_vfsops.c  Fri Aug 06 12:55:27 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vfsops.c,v 1.36.4.1 1999/08/02 22:11:16 thorpej Exp $   */
+/*     $NetBSD: cd9660_vfsops.c,v 1.36.4.2 1999/08/06 12:55:28 chs Exp $       */
 
 /*-
  * Copyright (c) 1994
@@ -405,6 +405,8 @@
        mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CD9660);
        mp->mnt_maxsymlinklen = 0;
        mp->mnt_flag |= MNT_LOCAL;
+       mp->mnt_dev_bshift = iso_bsize;
+       mp->mnt_fs_bshift = ffs(logical_block_size) - 1;
        isomp->im_mountp = mp;
        isomp->im_dev = dev;
        isomp->im_devvp = devvp;
diff -r 26cba82db9ab -r 2c53afad619d sys/isofs/cd9660/cd9660_vnops.c
--- a/sys/isofs/cd9660/cd9660_vnops.c   Fri Aug 06 12:54:23 1999 +0000
+++ b/sys/isofs/cd9660/cd9660_vnops.c   Fri Aug 06 12:55:27 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vnops.c,v 1.52.4.1 1999/08/02 22:11:16 thorpej Exp $    */
+/*     $NetBSD: cd9660_vnops.c,v 1.52.4.2 1999/08/06 12:55:29 chs Exp $        */
 
 /*-
  * Copyright (c) 1994
@@ -278,6 +278,30 @@
                return (EINVAL);
        ip->i_flag |= IN_ACCESS;
        imp = ip->i_mnt;
+
+       if (vp->v_type == VREG) {
+               error = 0;
+               while (uio->uio_resid > 0) {
+                       void *win;
+                       vsize_t bytelen = min(ip->i_size - uio->uio_offset,
+                                             uio->uio_resid);
+
+                       if (bytelen == 0)
+                               break;
+                       win = ubc_alloc(&vp->v_uvm.u_obj, uio->uio_offset,
+                                       &bytelen, UBC_READ);
+#ifdef DIAGNOSTIC
+                       if (win == NULL)
+                               panic("cd9660_read: ubc_alloc -> NULL");
+#endif
+                       error = uiomove(win, bytelen, uio);
+                       ubc_release(win, 0);
+                       if (error)
+                               break;
+               }
+               goto out;
+       }
+
        do {
                lbn = lblkno(imp, uio->uio_offset);
                on = blkoff(imp, uio->uio_offset);
@@ -315,6 +339,8 @@
                error = uiomove(bp->b_data + on, (int)n, uio);
                brelse(bp);
        } while (error == 0 && uio->uio_resid > 0 && n != 0);
+
+out:
        return (error);
 }
 
@@ -954,7 +980,8 @@
        { &vop_truncate_desc, cd9660_truncate },        /* truncate */
        { &vop_update_desc, cd9660_update },            /* update */
        { &vop_bwrite_desc, vn_bwrite },                /* bwrite */
-       { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
+       { &vop_getpages_desc, genfs_getpages },         /* getpages */
+       { NULL, NULL }
 };
 struct vnodeopv_desc cd9660_vnodeop_opv_desc =
        { &cd9660_vnodeop_p, cd9660_vnodeop_entries };
@@ -1007,7 +1034,7 @@
        { &vop_truncate_desc, spec_truncate },          /* truncate */
        { &vop_update_desc, cd9660_update },            /* update */
        { &vop_bwrite_desc, vn_bwrite },                /* bwrite */
-       { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
+       { NULL, NULL }
 };
 struct vnodeopv_desc cd9660_specop_opv_desc =
        { &cd9660_specop_p, cd9660_specop_entries };
@@ -1057,7 +1084,7 @@
        { &vop_truncate_desc, fifo_truncate },          /* truncate */
        { &vop_update_desc, cd9660_update },            /* update */
        { &vop_bwrite_desc, vn_bwrite },                /* bwrite */
-       { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
+       { NULL, NULL }
 };
 struct vnodeopv_desc cd9660_fifoop_opv_desc =
        { &cd9660_fifoop_p, cd9660_fifoop_entries };
diff -r 26cba82db9ab -r 2c53afad619d sys/ufs/ext2fs/ext2fs_balloc.c
--- a/sys/ufs/ext2fs/ext2fs_balloc.c    Fri Aug 06 12:54:23 1999 +0000
+++ b/sys/ufs/ext2fs/ext2fs_balloc.c    Fri Aug 06 12:55:27 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_balloc.c,v 1.3 1998/03/01 02:23:45 fvdl Exp $   */
+/*     $NetBSD: ext2fs_balloc.c,v 1.3.10.1 1999/08/06 12:55:29 chs Exp $       */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -37,14 +37,18 @@
  * Modified for ext2fs by Manuel Bouyer.
  */
 
+#include "opt_uvmhist.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/buf.h>
 #include <sys/proc.h>
 #include <sys/file.h>
 #include <sys/vnode.h>
+#include <sys/mount.h>
 
 #include <vm/vm.h>
+#include <uvm/uvm.h>
 
 #include <ufs/ufs/quota.h>
 #include <ufs/ufs/inode.h>
@@ -58,17 +62,72 @@
  * by allocating the physical blocks on a device given
  * the inode and the logical block number in a file.
  */
+
 int
-ext2fs_balloc(ip, bn, size, cred, bpp, flags)



Home | Main Index | Thread Index | Old Index