diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1997-05-30 08:35:23 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1997-05-30 08:35:23 +0000 |
commit | abede2744bbad7139d9bd3435f5f7ca1d4e85e51 (patch) | |
tree | 8db1f2051b877c6f22dc49bb6d13be81d4235ec4 /sys/ufs | |
parent | ec6ef49763f047e88c3866301e0e71dc29900b97 (diff) |
Integrate new ext2fs, reverting ufs support for the old one.
Diffstat (limited to 'sys/ufs')
34 files changed, 459 insertions, 512 deletions
diff --git a/sys/ufs/ext2fs/ext2fs.h b/sys/ufs/ext2fs/ext2fs.h index 136267f4df3..8828d3be6ef 100644 --- a/sys/ufs/ext2fs/ext2fs.h +++ b/sys/ufs/ext2fs/ext2fs.h @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs.h,v 1.2 1997/05/30 08:33:32 downsj Exp $ */ /* $NetBSD: fs.h,v 1.6 1995/04/12 21:21:02 mycroft Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ diff --git a/sys/ufs/ext2fs/ext2fs_alloc.c b/sys/ufs/ext2fs/ext2fs_alloc.c index 14e93c7bf79..598756da9e6 100644 --- a/sys/ufs/ext2fs/ext2fs_alloc.c +++ b/sys/ufs/ext2fs/ext2fs_alloc.c @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_alloc.c,v 1.2 1997/05/30 08:33:36 downsj Exp $ */ /* $NetBSD: ffs_alloc.c,v 1.13 1996/10/12 21:58:44 christos Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ diff --git a/sys/ufs/ext2fs/ext2fs_balloc.c b/sys/ufs/ext2fs/ext2fs_balloc.c index af1fe8c6803..0f99c452516 100644 --- a/sys/ufs/ext2fs/ext2fs_balloc.c +++ b/sys/ufs/ext2fs/ext2fs_balloc.c @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_balloc.c,v 1.2 1997/05/30 08:33:39 downsj Exp $ */ /* $NetBSD: ffs_balloc.c,v 1.3 1996/02/09 22:22:21 christos Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ diff --git a/sys/ufs/ext2fs/ext2fs_bmap.c b/sys/ufs/ext2fs/ext2fs_bmap.c index fb6bef9b8d2..942ac9b3165 100644 --- a/sys/ufs/ext2fs/ext2fs_bmap.c +++ b/sys/ufs/ext2fs/ext2fs_bmap.c @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_bmap.c,v 1.2 1997/05/30 08:33:42 downsj Exp $ */ /* $NetBSD: ufs_bmap.c,v 1.3 1996/02/09 22:36:00 christos Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ diff --git a/sys/ufs/ext2fs/ext2fs_dinode.h b/sys/ufs/ext2fs/ext2fs_dinode.h index db0ce26ec92..4320b50cd6f 100644 --- a/sys/ufs/ext2fs/ext2fs_dinode.h +++ b/sys/ufs/ext2fs/ext2fs_dinode.h @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_dinode.h,v 1.2 1997/05/30 08:33:46 downsj Exp $ */ /* $NetBSD: dinode.h,v 1.7 1995/06/15 23:22:48 cgd Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ diff --git a/sys/ufs/ext2fs/ext2fs_dir.h b/sys/ufs/ext2fs/ext2fs_dir.h index 341dd5ca21d..ec926a6544d 100644 --- a/sys/ufs/ext2fs/ext2fs_dir.h +++ b/sys/ufs/ext2fs/ext2fs_dir.h @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_dir.h,v 1.2 1997/05/30 08:33:49 downsj Exp $ */ /* $NetBSD: dir.h,v 1.8 1996/03/09 19:42:41 scottr Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h index 10681c180ce..09f52e68a12 100644 --- a/sys/ufs/ext2fs/ext2fs_extern.h +++ b/sys/ufs/ext2fs/ext2fs_extern.h @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_extern.h,v 1.2 1997/05/30 08:33:52 downsj Exp $ */ /* $NetBSD: ffs_extern.h,v 1.5 1996/09/01 23:49:18 mycroft Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ @@ -99,7 +100,7 @@ void ext2fs_checkoverlap __P((struct buf *, struct inode *)); /* ext2fs_vfsops.c */ int ext2fs_mountroot __P((void)); -int ext2fs_mount __P((struct mount *, const char *, void *, struct nameidata *, +int ext2fs_mount __P((struct mount *, char *, caddr_t, struct nameidata *, struct proc *)); int ext2fs_reload __P((struct mount *, struct ucred *, struct proc *)); int ext2fs_mountfs __P((struct vnode *, struct mount *, struct proc *)); @@ -137,9 +138,8 @@ int ext2fs_vinit __P(( struct mount *, int (**specops) __P((void *)), int (**fifoops) __P((void *)), struct vnode **)); int ext2fs_makeinode __P((int, struct vnode *, struct vnode **, struct componentname *cnp)); +int ext2fs_fsync __P((void *)); int ext2fs_reclaim __P((void *)); - -#define ext2fs_fsync genfs_fsync __END_DECLS #define IS_EXT2_VNODE(vp) (vp->v_tag == VT_EXT2FS) diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c index 0609c3c13a6..32c6eea5ea1 100644 --- a/sys/ufs/ext2fs/ext2fs_inode.c +++ b/sys/ufs/ext2fs/ext2fs_inode.c @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_inode.c,v 1.2 1997/05/30 08:33:55 downsj Exp $ */ /* $NetBSD: ffs_inode.c,v 1.12 1996/11/06 03:02:59 thorpej Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ @@ -154,13 +155,11 @@ ext2fs_update(v) struct buf *bp; struct inode *ip; int error; - struct timespec ts; if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) return (0); ip = VTOI(ap->a_vp); - TIMEVAL_TO_TIMESPEC(&time, &ts); - EXT2FS_ITIMES(ip, ap->a_access, ap->a_modify, &ts); + EXT2FS_ITIMES(ip, &time, &time); if ((ip->i_flag & IN_MODIFIED) == 0) return (0); ip->i_flag &= ~IN_MODIFIED; diff --git a/sys/ufs/ext2fs/ext2fs_readwrite.c b/sys/ufs/ext2fs/ext2fs_readwrite.c index a94e18deb80..07719439534 100644 --- a/sys/ufs/ext2fs/ext2fs_readwrite.c +++ b/sys/ufs/ext2fs/ext2fs_readwrite.c @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_readwrite.c,v 1.2 1997/05/30 08:33:59 downsj Exp $ */ /* $NetBSD: ufs_readwrite.c,v 1.10 1997/01/30 09:52:26 tls Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ diff --git a/sys/ufs/ext2fs/ext2fs_subr.c b/sys/ufs/ext2fs/ext2fs_subr.c index 0c6ce13c12f..7bd25576609 100644 --- a/sys/ufs/ext2fs/ext2fs_subr.c +++ b/sys/ufs/ext2fs/ext2fs_subr.c @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_subr.c,v 1.2 1997/05/30 08:34:02 downsj Exp $ */ /* $NetBSD: ffs_subr.c,v 1.9 1996/10/12 21:58:45 christos Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index bbfa736b6bc..47e016d98a3 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_vfsops.c,v 1.2 1997/05/30 08:34:06 downsj Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.21 1996/10/12 21:58:47 christos Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ @@ -82,7 +83,6 @@ struct vfsops ext2fs_vfsops = { ext2fs_fhtovp, ext2fs_vptofh, ext2fs_init, - ext2fs_mountroot, }; extern u_long ext2gennumber; @@ -152,9 +152,6 @@ ext2fs_mountroot() size_t size; int error; - if (root_device->dv_class != DV_DISK) - return (ENODEV); - /* * Get vnodes for swapdev and rootdev. */ @@ -198,8 +195,8 @@ ext2fs_mountroot() int ext2fs_mount(mp, path, data, ndp, p) register struct mount *mp; - const char *path; - void * data; + char *path; + caddr_t data; struct nameidata *ndp; struct proc *p; { diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index 1ce4efaf3bc..b14f47ef00c 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,3 +1,4 @@ +/* $OpenBSD: ext2fs_vnops.c,v 1.2 1997/05/30 08:34:10 downsj Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.22 1997/01/30 09:52:27 tls Exp $ */ /* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ @@ -61,7 +62,6 @@ #include <vm/vm.h> #include <miscfs/fifofs/fifo.h> -#include <miscfs/genfs/genfs.h> #include <miscfs/specfs/specdev.h> #include <ufs/ufs/quota.h> @@ -227,10 +227,8 @@ ext2fs_getattr(v) register struct vnode *vp = ap->a_vp; register struct inode *ip = VTOI(vp); register struct vattr *vap = ap->a_vap; - struct timespec ts; - TIMEVAL_TO_TIMESPEC(&time, &ts); - EXT2FS_ITIMES(ip, &ts, &ts, &ts); + EXT2FS_ITIMES(ip, &time, &time); /* * Copy from inode table */ @@ -1356,6 +1354,28 @@ bad: } /* + * Synch an open file. + */ +/* ARGSUSED */ +int +ext2fs_fsync(v) + void *v; +{ + struct vop_fsync_args /* { + struct vnode *a_vp; + struct ucred *a_cred; + int a_waitfor; + struct proc *a_p; + } */ *ap = v; + register struct vnode *vp = ap->a_vp; + struct timespec ts; + + vflushbuf(vp, ap->a_waitfor == MNT_WAIT); + TIMEVAL_TO_TIMESPEC(&time, &ts); + return (VOP_UPDATE(ap->a_vp, &ts, &ts, ap->a_waitfor == MNT_WAIT)); +} + +/* * Reclaim an inode so that it can be used for other purposes. */ int @@ -1406,7 +1426,7 @@ struct vnodeopv_entry_desc ext2fs_vnodeop_entries[] = { { &vop_write_desc, ext2fs_write }, /* write */ { &vop_lease_desc, ufs_lease_check }, /* lease */ { &vop_ioctl_desc, ufs_ioctl }, /* ioctl */ - { &vop_poll_desc, ufs_poll }, /* poll */ + { &vop_select_desc, ufs_select }, /* select */ { &vop_mmap_desc, ufs_mmap }, /* mmap */ { &vop_fsync_desc, ext2fs_fsync }, /* fsync */ { &vop_seek_desc, ufs_seek }, /* seek */ @@ -1455,7 +1475,7 @@ struct vnodeopv_entry_desc ext2fs_specop_entries[] = { { &vop_write_desc, ufsspec_write }, /* write */ { &vop_lease_desc, spec_lease_check }, /* lease */ { &vop_ioctl_desc, spec_ioctl }, /* ioctl */ - { &vop_poll_desc, spec_poll }, /* poll */ + { &vop_select_desc, spec_select }, /* poll */ { &vop_mmap_desc, spec_mmap }, /* mmap */ { &vop_fsync_desc, ext2fs_fsync }, /* fsync */ { &vop_seek_desc, spec_seek }, /* seek */ @@ -1505,7 +1525,7 @@ struct vnodeopv_entry_desc ext2fs_fifoop_entries[] = { { &vop_write_desc, ufsfifo_write }, /* write */ { &vop_lease_desc, fifo_lease_check }, /* lease */ { &vop_ioctl_desc, fifo_ioctl }, /* ioctl */ - { &vop_poll_desc, fifo_poll }, /* poll */ + { &vop_select_desc, fifo_select }, /* select */ { &vop_mmap_desc, fifo_mmap }, /* mmap */ { &vop_fsync_desc, ext2fs_fsync }, /* fsync */ { &vop_seek_desc, fifo_seek }, /* seek */ diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index cd81395a3e3..a98f12f7460 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_alloc.c,v 1.5 1997/02/11 06:59:27 millert Exp $ */ +/* $OpenBSD: ffs_alloc.c,v 1.6 1997/05/30 08:34:15 downsj Exp $ */ /* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */ /* @@ -132,7 +132,7 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp) bno = (daddr_t)ffs_hashalloc(ip, cg, (long)bpref, size, ffs_alloccg); if (bno > 0) { - ip->i_blocks += btodb(size); + ip->i_ffs_blocks += btodb(size); ip->i_flag |= IN_CHANGE | IN_UPDATE; *bnp = bno; return (0); @@ -186,7 +186,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) #endif /* DIAGNOSTIC */ if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) <= 0) goto nospace; - if ((bprev = ip->i_db[lbprev]) == 0) { + if ((bprev = ip->i_ffs_db[lbprev]) == 0) { printf("dev = 0x%x, bsize = %d, bprev = %d, fs = %s\n", ip->i_dev, fs->fs_bsize, bprev, fs->fs_fsmnt); panic("ffs_realloccg: bad bprev"); @@ -211,7 +211,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) if ((bno = ffs_fragextend(ip, cg, (long)bprev, osize, nsize)) != 0) { if (bp->b_blkno != fsbtodb(fs, bno)) panic("bad blockno"); - ip->i_blocks += btodb(nsize - osize); + ip->i_ffs_blocks += btodb(nsize - osize); ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); bp->b_flags |= B_DONE; @@ -276,7 +276,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) if (nsize < request) ffs_blkfree(ip, bno + numfrags(fs, nsize), (long)(request - nsize)); - ip->i_blocks += btodb(nsize - osize); + ip->i_ffs_blocks += btodb(nsize - osize); ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); bp->b_flags |= B_DONE; @@ -372,7 +372,7 @@ ffs_reallocblks(v) * Get the starting offset and block map for the first block. */ if (start_lvl == 0) { - sbap = &ip->i_db[0]; + sbap = &ip->i_ffs_db[0]; soff = start_lbn; } else { idp = &start_ap[start_lvl - 1]; @@ -448,7 +448,7 @@ ffs_reallocblks(v) * We can then check below to see if it is set, and do the * synchronous write only when it has been cleared. */ - if (sbap != &ip->i_db[0]) { + if (sbap != &ip->i_ffs_db[0]) { if (doasyncfree) bdwrite(sbp); else @@ -492,7 +492,7 @@ ffs_reallocblks(v) fail: if (ssize < len) brelse(ebp); - if (sbap != &ip->i_db[0]) + if (sbap != &ip->i_ffs_db[0]) brelse(sbp); return (ENOSPC); } @@ -552,26 +552,26 @@ ffs_valloc(v) return (error); } ip = VTOI(*ap->a_vpp); - if (ip->i_mode) { + if (ip->i_ffs_mode) { printf("mode = 0%o, inum = %d, fs = %s\n", - ip->i_mode, ip->i_number, fs->fs_fsmnt); + ip->i_ffs_mode, ip->i_number, fs->fs_fsmnt); panic("ffs_valloc: dup alloc"); } - if (ip->i_blocks) { /* XXX */ + if (ip->i_ffs_blocks) { /* XXX */ printf("free inode %s/%d had %d blocks\n", - fs->fs_fsmnt, ino, ip->i_blocks); - ip->i_blocks = 0; + fs->fs_fsmnt, ino, ip->i_ffs_blocks); + ip->i_ffs_blocks = 0; } - ip->i_flags = 0; + ip->i_ffs_flags = 0; /* * Set up a new generation number for this inode. * XXX - just increment for now, this is wrong! (millert) * Need a way to preserve randomization. */ - if (ip->i_gen == 0 || ++(ip->i_gen) == 0) - ip->i_gen = arc4random(); - if (ip->i_gen == 0 || ip->i_gen == -1) - ip->i_gen = 1; /* shouldn't happen */ + if (ip->i_ffs_gen == 0 || ++(ip->i_ffs_gen) == 0) + ip->i_ffs_gen = arc4random(); + if (ip->i_ffs_gen == 0 || ip->i_ffs_gen == -1) + ip->i_ffs_gen = 1; /* shouldn't happen */ return (0); noinodes: ffs_fserr(fs, ap->a_cred->cr_uid, "out of inodes"); @@ -1237,7 +1237,7 @@ ffs_blkfree(ip, bno, size) cg = dtog(fs, bno); if ((u_int)bno >= fs->fs_size) { printf("bad block %d, ino %d\n", bno, ip->i_number); - ffs_fserr(fs, ip->i_uid, "bad block"); + ffs_fserr(fs, ip->i_ffs_uid, "bad block"); return; } error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c index dfd6468d8e7..5a7dc3afcc2 100644 --- a/sys/ufs/ffs/ffs_balloc.c +++ b/sys/ufs/ffs/ffs_balloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_balloc.c,v 1.2 1996/02/27 07:27:35 niklas Exp $ */ +/* $OpenBSD: ffs_balloc.c,v 1.3 1997/05/30 08:34:19 downsj Exp $ */ /* $NetBSD: ffs_balloc.c,v 1.3 1996/02/09 22:22:21 christos Exp $ */ /* @@ -85,18 +85,18 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) * and the file is currently composed of a fragment * this fragment has to be extended to be a full block. */ - nb = lblkno(fs, ip->i_size); + nb = lblkno(fs, ip->i_ffs_size); if (nb < NDADDR && nb < bn) { osize = blksize(fs, ip, nb); if (osize < fs->fs_bsize && osize > 0) { error = ffs_realloccg(ip, nb, - ffs_blkpref(ip, nb, (int)nb, &ip->i_db[0]), + ffs_blkpref(ip, nb, (int)nb, &ip->i_ffs_db[0]), osize, (int)fs->fs_bsize, cred, &bp); if (error) return (error); - ip->i_size = (nb + 1) * fs->fs_bsize; - vnode_pager_setsize(vp, (u_long)ip->i_size); - ip->i_db[nb] = dbtofsb(fs, bp->b_blkno); + ip->i_ffs_size = (nb + 1) * fs->fs_bsize; + vnode_pager_setsize(vp, (u_long)ip->i_ffs_size); + ip->i_ffs_db[nb] = dbtofsb(fs, bp->b_blkno); ip->i_flag |= IN_CHANGE | IN_UPDATE; if (flags & B_SYNC) bwrite(bp); @@ -108,8 +108,8 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) * The first NDADDR blocks are direct blocks */ if (bn < NDADDR) { - nb = ip->i_db[bn]; - if (nb != 0 && ip->i_size >= (bn + 1) * fs->fs_bsize) { + nb = ip->i_ffs_db[bn]; + if (nb != 0 && ip->i_ffs_size >= (bn + 1) * fs->fs_bsize) { error = bread(vp, bn, fs->fs_bsize, NOCRED, &bp); if (error) { brelse(bp); @@ -122,7 +122,7 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) /* * Consider need to reallocate a fragment. */ - osize = fragroundup(fs, blkoff(fs, ip->i_size)); + osize = fragroundup(fs, blkoff(fs, ip->i_ffs_size)); nsize = fragroundup(fs, size); if (nsize <= osize) { error = bread(vp, bn, osize, NOCRED, &bp); @@ -132,18 +132,18 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) } } else { error = ffs_realloccg(ip, bn, - ffs_blkpref(ip, bn, (int)bn, &ip->i_db[0]), + ffs_blkpref(ip, bn, (int)bn, &ip->i_ffs_db[0]), osize, nsize, cred, &bp); if (error) return (error); } } else { - if (ip->i_size < (bn + 1) * fs->fs_bsize) + if (ip->i_ffs_size < (bn + 1) * fs->fs_bsize) nsize = fragroundup(fs, size); else nsize = fs->fs_bsize; error = ffs_alloc(ip, bn, - ffs_blkpref(ip, bn, (int)bn, &ip->i_db[0]), + ffs_blkpref(ip, bn, (int)bn, &ip->i_ffs_db[0]), nsize, cred, &newb); if (error) return (error); @@ -152,7 +152,7 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) if (flags & B_CLRBUF) clrbuf(bp); } - ip->i_db[bn] = dbtofsb(fs, bp->b_blkno); + ip->i_ffs_db[bn] = dbtofsb(fs, bp->b_blkno); ip->i_flag |= IN_CHANGE | IN_UPDATE; *bpp = bp; return (0); @@ -171,7 +171,7 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) * Fetch the first indirect block allocating if necessary. */ --num; - nb = ip->i_ib[indirs[0].in_off]; + nb = ip->i_ffs_ib[indirs[0].in_off]; if (nb == 0) { pref = ffs_blkpref(ip, lbn, 0, (daddr_t *)0); error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, @@ -190,7 +190,7 @@ ffs_balloc(ip, bn, size, cred, bpp, flags) ffs_blkfree(ip, nb, fs->fs_bsize); return (error); } - ip->i_ib[indirs[0].in_off] = newb; + ip->i_ffs_ib[indirs[0].in_off] = newb; ip->i_flag |= IN_CHANGE | IN_UPDATE; } /* diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 1b1081e5ee2..488841b5e7f 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_inode.c,v 1.5 1997/03/02 09:38:13 millert Exp $ */ +/* $OpenBSD: ffs_inode.c,v 1.6 1997/05/30 08:34:21 downsj Exp $ */ /* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */ /* @@ -104,17 +104,17 @@ ffs_update(v) (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0) return (0); if (ip->i_flag & IN_ACCESS) { - ip->i_atime = ap->a_access->tv_sec; - ip->i_atimensec = ap->a_access->tv_nsec; + ip->i_ffs_atime = ap->a_access->tv_sec; + ip->i_ffs_atimensec = ap->a_access->tv_nsec; } if (ip->i_flag & IN_UPDATE) { - ip->i_mtime = ap->a_modify->tv_sec; - ip->i_mtimensec = ap->a_modify->tv_nsec; + ip->i_ffs_mtime = ap->a_modify->tv_sec; + ip->i_ffs_mtimensec = ap->a_modify->tv_nsec; ip->i_modrev++; } if (ip->i_flag & IN_CHANGE) { - ip->i_ctime = time.tv_sec; - ip->i_ctimensec = time.tv_usec * 1000; + ip->i_ffs_ctime = time.tv_sec; + ip->i_ffs_ctimensec = time.tv_usec * 1000; } ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE); fs = ip->i_fs; @@ -123,8 +123,8 @@ ffs_update(v) * fix until fsck has been changed to do the update. */ if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */ - ip->i_din.di_ouid = ip->i_uid; /* XXX */ - ip->i_din.di_ogid = ip->i_gid; /* XXX */ + ip->i_din.ffs_din.di_ouid = ip->i_ffs_uid; /* XXX */ + ip->i_din.ffs_din.di_ogid = ip->i_ffs_gid; /* XXX */ } /* XXX */ error = bread(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), @@ -134,7 +134,7 @@ ffs_update(v) return (error); } *((struct dinode *)bp->b_data + - ino_to_fsbo(fs, ip->i_number)) = ip->i_din; + ino_to_fsbo(fs, ip->i_number)) = ip->i_din.ffs_din; if (ap->a_waitfor) return (bwrite(bp)); else { @@ -181,19 +181,19 @@ ffs_truncate(v) oip = VTOI(ovp); TIMEVAL_TO_TIMESPEC(&time, &ts); if (ovp->v_type == VLNK && - (oip->i_size < ovp->v_mount->mnt_maxsymlinklen || + (oip->i_ffs_size < ovp->v_mount->mnt_maxsymlinklen || (ovp->v_mount->mnt_maxsymlinklen == 0 && - oip->i_din.di_blocks == 0))) { + oip->i_din.ffs_din.di_blocks == 0))) { #ifdef DIAGNOSTIC if (length != 0) panic("ffs_truncate: partial truncate of symlink"); #endif - bzero((char *)&oip->i_shortlink, (u_int)oip->i_size); - oip->i_size = 0; + bzero((char *)&oip->i_ffs_shortlink, (u_int)oip->i_ffs_size); + oip->i_ffs_size = 0; oip->i_flag |= IN_CHANGE | IN_UPDATE; return (VOP_UPDATE(ovp, &ts, &ts, 1)); } - if (oip->i_size == length) { + if (oip->i_ffs_size == length) { oip->i_flag |= IN_CHANGE | IN_UPDATE; return (VOP_UPDATE(ovp, &ts, &ts, 0)); } @@ -203,7 +203,7 @@ ffs_truncate(v) #endif vnode_pager_setsize(ovp, (u_long)length); fs = oip->i_fs; - osize = oip->i_size; + osize = oip->i_ffs_size; /* * Lengthen the size of the file. We must ensure that the * last byte of the file is allocated. Since the smallest @@ -221,7 +221,7 @@ ffs_truncate(v) aflags); if (error) return (error); - oip->i_size = length; + oip->i_ffs_size = length; (void) vnode_pager_uncache(ovp); if (aflags & B_SYNC) bwrite(bp); @@ -239,7 +239,7 @@ ffs_truncate(v) */ offset = blkoff(fs, length); if (offset == 0) { - oip->i_size = length; + oip->i_ffs_size = length; } else { lbn = lblkno(fs, length); aflags = B_CLRBUF; @@ -248,7 +248,7 @@ ffs_truncate(v) error = ffs_balloc(oip, lbn, offset, ap->a_cred, &bp, aflags); if (error) return (error); - oip->i_size = length; + oip->i_ffs_size = length; size = blksize(fs, oip, lbn); (void) vnode_pager_uncache(ovp); bzero((char *)bp->b_data + offset, (u_int)(size - offset)); @@ -275,14 +275,14 @@ ffs_truncate(v) * will be returned to the free list. lastiblock values are also * normalized to -1 for calls to ffs_indirtrunc below. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)oldblks, sizeof oldblks); + bcopy((caddr_t)&oip->i_ffs_db[0], (caddr_t)oldblks, sizeof oldblks); for (level = TRIPLE; level >= SINGLE; level--) if (lastiblock[level] < 0) { - oip->i_ib[level] = 0; + oip->i_ffs_ib[level] = 0; lastiblock[level] = -1; } for (i = NDADDR - 1; i > lastblock; i--) - oip->i_db[i] = 0; + oip->i_ffs_db[i] = 0; oip->i_flag |= IN_CHANGE | IN_UPDATE; if ((error = VOP_UPDATE(ovp, &ts, &ts, 1)) != 0) allerror = error; @@ -292,9 +292,9 @@ ffs_truncate(v) * Note that we save the new block configuration so we can check it * when we are done. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof newblks); - bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof oldblks); - oip->i_size = osize; + bcopy((caddr_t)&oip->i_ffs_db[0], (caddr_t)newblks, sizeof newblks); + bcopy((caddr_t)oldblks, (caddr_t)&oip->i_ffs_db[0], sizeof oldblks); + oip->i_ffs_size = osize; vflags = ((length > 0) ? V_SAVE : 0) | V_SAVEMETA; allerror = vinvalbuf(ovp, vflags, ap->a_cred, ap->a_p, 0, 0); @@ -305,7 +305,7 @@ ffs_truncate(v) indir_lbn[DOUBLE] = indir_lbn[SINGLE] - NINDIR(fs) - 1; indir_lbn[TRIPLE] = indir_lbn[DOUBLE] - NINDIR(fs) * NINDIR(fs) - 1; for (level = TRIPLE; level >= SINGLE; level--) { - bn = oip->i_ib[level]; + bn = oip->i_ffs_ib[level]; if (bn != 0) { error = ffs_indirtrunc(oip, indir_lbn[level], fsbtodb(fs, bn), lastiblock[level], level, &count); @@ -313,7 +313,7 @@ ffs_truncate(v) allerror = error; blocksreleased += count; if (lastiblock[level] < 0) { - oip->i_ib[level] = 0; + oip->i_ffs_ib[level] = 0; ffs_blkfree(oip, bn, fs->fs_bsize); blocksreleased += nblocks; } @@ -328,10 +328,10 @@ ffs_truncate(v) for (i = NDADDR - 1; i > lastblock; i--) { register long bsize; - bn = oip->i_db[i]; + bn = oip->i_ffs_db[i]; if (bn == 0) continue; - oip->i_db[i] = 0; + oip->i_ffs_db[i] = 0; bsize = blksize(fs, oip, i); ffs_blkfree(oip, bn, bsize); blocksreleased += btodb(bsize); @@ -343,7 +343,7 @@ ffs_truncate(v) * Finally, look for a change in size of the * last direct block; release any frags. */ - bn = oip->i_db[lastblock]; + bn = oip->i_ffs_db[lastblock]; if (bn != 0) { long oldspace, newspace; @@ -352,7 +352,7 @@ ffs_truncate(v) * back as old block size minus new block size. */ oldspace = blksize(fs, oip, lastblock); - oip->i_size = length; + oip->i_ffs_size = length; newspace = blksize(fs, oip, lastblock); if (newspace == 0) panic("itrunc: newspace"); @@ -370,10 +370,10 @@ ffs_truncate(v) done: #ifdef DIAGNOSTIC for (level = SINGLE; level <= TRIPLE; level++) - if (newblks[NDADDR + level] != oip->i_ib[level]) + if (newblks[NDADDR + level] != oip->i_ffs_ib[level]) panic("itrunc1"); for (i = 0; i < NDADDR; i++) - if (newblks[i] != oip->i_db[i]) + if (newblks[i] != oip->i_ffs_db[i]) panic("itrunc2"); if (length == 0 && (ovp->v_dirtyblkhd.lh_first || ovp->v_cleanblkhd.lh_first)) @@ -382,10 +382,10 @@ done: /* * Put back the real size. */ - oip->i_size = length; - oip->i_blocks -= blocksreleased; - if (oip->i_blocks < 0) /* sanity */ - oip->i_blocks = 0; + oip->i_ffs_size = length; + oip->i_ffs_blocks -= blocksreleased; + if (oip->i_ffs_blocks < 0) /* sanity */ + oip->i_ffs_blocks = 0; oip->i_flag |= IN_CHANGE; #ifdef QUOTA (void) chkdq(oip, -blocksreleased, NOCRED, 0); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index a891ede9d9a..f29f5f09b94 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.7 1997/02/11 06:59:28 millert Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.8 1997/05/30 08:34:25 downsj Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -82,14 +82,6 @@ struct vfsops ffs_vfsops = { ffs_init, }; -static struct ufs_dirops ffs_dirops = { - ufs_dirremove, - ufs_direnter, - ufs_dirempty, - ufs_dirrewrite, - ufs_checkpath, -}; - extern u_long nextgennumber; /* @@ -409,7 +401,7 @@ loop: vput(vp); return (error); } - ip->i_din = *((struct dinode *)bp->b_data + + ip->i_din.ffs_din = *((struct dinode *)bp->b_data + ino_to_fsbo(fs, ip->i_number)); brelse(bp); vput(vp); @@ -537,7 +529,6 @@ ffs_mountfs(devvp, mp, p) ump->um_nindir = fs->fs_nindir; ump->um_bptrtodb = fs->fs_fsbtodb; ump->um_seqinc = fs->fs_frag; - ump->um_dirops = &ffs_dirops; for (i = 0; i < MAXQUOTAS; i++) ump->um_quotas[i] = NULLVP; devvp->v_specflags |= SI_MOUNTEDON; @@ -841,7 +832,7 @@ ffs_vget(mp, ino, vpp) *vpp = NULL; return (error); } - ip->i_din = *((struct dinode *)bp->b_data + ino_to_fsbo(fs, ino)); + ip->i_din.ffs_din = *((struct dinode *)bp->b_data + ino_to_fsbo(fs, ino)); brelse(bp); /* @@ -863,10 +854,10 @@ ffs_vget(mp, ino, vpp) * Set up a generation number for this inode if it does not * already have one. This should only happen on old filesystems. */ - if (ip->i_gen == 0) { - ip->i_gen = arc4random(); - if (ip->i_gen == 0 || ip->i_gen == -1) - ip->i_gen = 1; /* shouldn't happen */ + if (ip->i_ffs_gen == 0) { + ip->i_ffs_gen = arc4random(); + if (ip->i_ffs_gen == 0 || ip->i_ffs_gen == -1) + ip->i_ffs_gen = 1; /* shouldn't happen */ if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) ip->i_flag |= IN_MODIFIED; } @@ -875,8 +866,8 @@ ffs_vget(mp, ino, vpp) * fix until fsck has been changed to do the update. */ if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */ - ip->i_uid = ip->i_din.di_ouid; /* XXX */ - ip->i_gid = ip->i_din.di_ogid; /* XXX */ + ip->i_ffs_uid = ip->i_din.ffs_din.di_ouid; /* XXX */ + ip->i_ffs_gid = ip->i_din.ffs_din.di_ogid; /* XXX */ } /* XXX */ *vpp = vp; @@ -929,7 +920,7 @@ ffs_vptofh(vp, fhp) ufhp = (struct ufid *)fhp; ufhp->ufid_len = sizeof(struct ufid); ufhp->ufid_ino = ip->i_number; - ufhp->ufid_gen = ip->i_gen; + ufhp->ufid_gen = ip->i_ffs_gen; return (0); } diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h index 9be61300829..e5a17da3a22 100644 --- a/sys/ufs/ffs/fs.h +++ b/sys/ufs/ffs/fs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fs.h,v 1.3 1997/02/24 14:27:13 niklas Exp $ */ +/* $OpenBSD: fs.h,v 1.4 1997/05/30 08:34:28 downsj Exp $ */ /* $NetBSD: fs.h,v 1.6 1995/04/12 21:21:02 mycroft Exp $ */ /* @@ -482,9 +482,9 @@ struct ocg { * Determining the size of a file block in the file system. */ #define blksize(fs, ip, lbn) \ - (((lbn) >= NDADDR || (ip)->i_size >= ((lbn) + 1) << (fs)->fs_bshift) \ + (((lbn) >= NDADDR || (ip)->i_ffs_size >= ((lbn) + 1) << (fs)->fs_bshift) \ ? (fs)->fs_bsize \ - : (fragroundup(fs, blkoff(fs, (ip)->i_size)))) + : (fragroundup(fs, blkoff(fs, (ip)->i_ffs_size)))) #define dblksize(fs, dip, lbn) \ (((lbn) >= NDADDR || (dip)->di_size >= ((lbn) + 1) << (fs)->fs_bshift) \ ? (fs)->fs_bsize \ diff --git a/sys/ufs/lfs/lfs_alloc.c b/sys/ufs/lfs/lfs_alloc.c index ec177b159ab..0551eaaf982 100644 --- a/sys/ufs/lfs/lfs_alloc.c +++ b/sys/ufs/lfs/lfs_alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_alloc.c,v 1.5 1996/07/01 07:41:47 downsj Exp $ */ +/* $OpenBSD: lfs_alloc.c,v 1.6 1997/05/30 08:34:33 downsj Exp $ */ /* $NetBSD: lfs_alloc.c,v 1.4 1996/03/25 12:53:37 pk Exp $ */ /* @@ -101,10 +101,10 @@ lfs_valloc(v) if (fs->lfs_free == LFS_UNUSED_INUM) { vp = fs->lfs_ivnode; ip = VTOI(vp); - blkno = lblkno(fs, ip->i_size); + blkno = lblkno(fs, ip->i_ffs_size); lfs_balloc(vp, 0, fs->lfs_bsize, blkno, &bp); - ip->i_size += fs->lfs_bsize; - vnode_pager_setsize(vp, (u_long)ip->i_size); + ip->i_ffs_size += fs->lfs_bsize; + vnode_pager_setsize(vp, (u_long)ip->i_ffs_size); vnode_pager_uncache(vp); i = (blkno - fs->lfs_segtabsz - fs->lfs_cleansz) * @@ -129,13 +129,13 @@ lfs_valloc(v) ip = VTOI(vp); /* Zero out the direct and indirect block addresses. */ - bzero(&ip->i_din, sizeof(struct dinode)); - ip->i_din.di_inumber = new_ino; + bzero(&ip->i_din.ffs_din, sizeof(struct dinode)); + ip->i_din.ffs_din.di_inumber = new_ino; /* Set a new generation number for this inode. */ if (++nextgennumber < (u_long)time.tv_sec) nextgennumber = time.tv_sec; - ip->i_gen = nextgennumber; + ip->i_ffs_gen = nextgennumber; /* Insert into the inode hash table. */ ufs_ihashins(ip); @@ -188,7 +188,7 @@ lfs_vcreate(mp, ino, vpp) ip->i_devvp = ump->um_devvp; ip->i_flag = IN_MODIFIED; ip->i_dev = ump->um_dev; - ip->i_number = ip->i_din.di_inumber = ino; + ip->i_number = ip->i_din.ffs_din.di_inumber = ino; ip->i_lfs = ump->um_lfs; #ifdef QUOTA for (i = 0; i < MAXQUOTAS; i++) @@ -196,9 +196,9 @@ lfs_vcreate(mp, ino, vpp) #endif ip->i_lockf = 0; ip->i_diroff = 0; - ip->i_mode = 0; - ip->i_size = 0; - ip->i_blocks = 0; + ip->i_ffs_mode = 0; + ip->i_ffs_size = 0; + ip->i_ffs_blocks = 0; ++ump->um_lfs->lfs_uinodes; return (0); } diff --git a/sys/ufs/lfs/lfs_balloc.c b/sys/ufs/lfs/lfs_balloc.c index 05efd03b9e4..fd01e01adbf 100644 --- a/sys/ufs/lfs/lfs_balloc.c +++ b/sys/ufs/lfs/lfs_balloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_balloc.c,v 1.4 1996/10/18 14:46:23 mickey Exp $ */ +/* $OpenBSD: lfs_balloc.c,v 1.5 1997/05/30 08:34:36 downsj Exp $ */ /* $NetBSD: lfs_balloc.c,v 1.3 1996/02/09 22:28:48 christos Exp $ */ /* @@ -129,7 +129,7 @@ lfs_balloc(vp, offset, iosize, lbn, bpp) brelse(ibp); return(ENOSPC); } else { - ip->i_blocks += bb; + ip->i_ffs_blocks += bb; ip->i_lfs->lfs_bfree -= bb; clrbuf(ibp); if((error = VOP_BWRITE(ibp)) != 0) @@ -182,7 +182,7 @@ lfs_balloc(vp, offset, iosize, lbn, bpp) brelse(bp); return(ENOSPC); } else { - ip->i_blocks += bb; + ip->i_ffs_blocks += bb; ip->i_lfs->lfs_bfree -= bb; if (iosize != fs->lfs_bsize) clrbuf(bp); @@ -236,7 +236,7 @@ lfs_fragextend(vp, osize, nsize, lbn, bpp) return (error); } #endif - ip->i_blocks += bb; + ip->i_ffs_blocks += bb; ip->i_flag |= IN_CHANGE | IN_UPDATE; fs->lfs_bfree -= fragstodb(fs, numfrags(fs, (nsize - osize))); allocbuf(*bpp, nsize); diff --git a/sys/ufs/lfs/lfs_inode.c b/sys/ufs/lfs/lfs_inode.c index e8fd0be7baa..c385e622eae 100644 --- a/sys/ufs/lfs/lfs_inode.c +++ b/sys/ufs/lfs/lfs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_inode.c,v 1.5 1997/03/02 09:38:18 millert Exp $ */ +/* $OpenBSD: lfs_inode.c,v 1.6 1997/05/30 08:34:39 downsj Exp $ */ /* $NetBSD: lfs_inode.c,v 1.5 1996/05/11 18:27:35 mycroft Exp $ */ /* @@ -182,8 +182,8 @@ lfs_truncate(v) if (length != 0) panic("lfs_truncate: partial truncate of symlink"); #endif - bzero((char *)&ip->i_shortlink, (u_int)ip->i_size); - ip->i_size = 0; + bzero((char *)&ip->i_ffs_shortlink, (u_int)ip->i_ffs_size); + ip->i_ffs_size = 0; ip->i_flag |= IN_CHANGE | IN_UPDATE; return (VOP_UPDATE(vp, &ts, &ts, 0)); } @@ -192,7 +192,7 @@ lfs_truncate(v) fs = ip->i_lfs; /* If length is larger than the file, just update the times. */ - if (ip->i_size <= length) { + if (ip->i_ffs_size <= length) { ip->i_flag |= IN_CHANGE | IN_UPDATE; return (VOP_UPDATE(vp, &ts, &ts, 0)); } @@ -203,7 +203,7 @@ lfs_truncate(v) * file is truncated to 0. */ lastblock = lblkno(fs, length + fs->lfs_bsize - 1); - olastblock = lblkno(fs, ip->i_size + fs->lfs_bsize - 1) - 1; + olastblock = lblkno(fs, ip->i_ffs_size + fs->lfs_bsize - 1) - 1; /* * Update the size of the file. If the file is not being truncated to @@ -219,7 +219,7 @@ lfs_truncate(v) /* Now set oldsize to the current size of the current last block */ oldsize_lastblock = blksize(fs, ip, olastblock); if (offset == 0) - ip->i_size = length; + ip->i_ffs_size = length; else { #ifdef QUOTA if ((e1 = getinoquota(ip)) != 0) @@ -227,7 +227,7 @@ lfs_truncate(v) #endif if ((e1 = bread(vp, lbn, fs->lfs_bsize, NOCRED, &bp)) != 0) return (e1); - ip->i_size = length; + ip->i_ffs_size = length; (void)vnode_pager_uncache(vp); newsize = blksize(fs, ip, lbn); bzero((char *)bp->b_data + offset, (u_int)(newsize - offset)); @@ -237,7 +237,7 @@ lfs_truncate(v) } /* * Modify sup->su_nbyte counters for each deleted block; keep track - * of number of blocks removed for ip->i_blocks. + * of number of blocks removed for ip->i_ffs_blocks. */ fragsreleased = 0; num = 0; @@ -255,9 +255,9 @@ lfs_truncate(v) switch (depth) { case 0: /* Direct block. */ - daddr = ip->i_db[lbn]; + daddr = ip->i_ffs_db[lbn]; SEGDEC(freesize); - ip->i_db[lbn] = 0; + ip->i_ffs_db[lbn] = 0; --lbn; break; #ifdef DIAGNOSTIC @@ -298,9 +298,9 @@ lfs_truncate(v) } if (depth == 0 && a[1].in_off == 0) { off = a[0].in_off; - daddr = ip->i_ib[off]; + daddr = ip->i_ffs_ib[off]; SEGDEC(freesize); - ip->i_ib[off] = 0; + ip->i_ffs_ib[off] = 0; } if (lbn == lastblock || lbn <= NDADDR) --lbn; @@ -321,13 +321,13 @@ lfs_truncate(v) } #ifdef DIAGNOSTIC - if (ip->i_blocks < fragstodb(fs, fragsreleased)) { + if (ip->i_ffs_blocks < fragstodb(fs, fragsreleased)) { printf("lfs_truncate: frag count < 0\n"); - fragsreleased = dbtofrags(fs, ip->i_blocks); + fragsreleased = dbtofrags(fs, ip->i_ffs_blocks); panic("lfs_truncate: frag count < 0\n"); } #endif - ip->i_blocks -= fragstodb(fs, fragsreleased); + ip->i_ffs_blocks -= fragstodb(fs, fragsreleased); fs->lfs_bfree += fragstodb(fs, fragsreleased); ip->i_flag |= IN_CHANGE | IN_UPDATE; /* @@ -356,19 +356,19 @@ lfs_truncate(v) } fragsreleased = i_released; #ifdef DIAGNOSTIC - if (fragsreleased > dbtofrags(fs, ip->i_blocks)) { + if (fragsreleased > dbtofrags(fs, ip->i_ffs_blocks)) { printf("lfs_inode: Warning! %s\n", "more frags released from inode than are in inode"); - fragsreleased = dbtofrags(fs, ip->i_blocks); + fragsreleased = dbtofrags(fs, ip->i_ffs_blocks); panic("lfs_inode: Warning. More frags released\n"); } #endif fs->lfs_bfree += fragstodb(fs, fragsreleased); - ip->i_blocks -= fragstodb(fs, fragsreleased); + ip->i_ffs_blocks -= fragstodb(fs, fragsreleased); #ifdef DIAGNOSTIC - if (length == 0 && ip->i_blocks != 0) { + if (length == 0 && ip->i_ffs_blocks != 0) { printf("lfs_inode: Warning! %s%d%s\n", - "Truncation to zero, but ", ip->i_blocks, + "Truncation to zero, but ", ip->i_ffs_blocks, " blocks left on inode"); panic("lfs_inode"); } diff --git a/sys/ufs/lfs/lfs_segment.c b/sys/ufs/lfs/lfs_segment.c index 21834daaa74..8643999f722 100644 --- a/sys/ufs/lfs/lfs_segment.c +++ b/sys/ufs/lfs/lfs_segment.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_segment.c,v 1.5 1996/10/18 14:46:24 mickey Exp $ */ +/* $OpenBSD: lfs_segment.c,v 1.6 1997/05/30 08:34:42 downsj Exp $ */ /* $NetBSD: lfs_segment.c,v 1.4 1996/02/09 22:28:54 christos Exp $ */ /* @@ -432,10 +432,10 @@ lfs_writeinode(fs, sp, ip) /* Update the inode times and copy the inode onto the inode page. */ if (ip->i_flag & IN_MODIFIED) --fs->lfs_uinodes; - ITIMES(ip, &time, &time); + FFS_ITIMES(ip, &time, &time); ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE); bp = sp->ibp; - ((struct dinode *)bp->b_data)[sp->ninodes % INOPB(fs)] = ip->i_din; + ((struct dinode *)bp->b_data)[sp->ninodes % INOPB(fs)] = ip->i_din.ffs_din; /* Increment inode count in segment summary block. */ ++((SEGSUM *)(sp->segsum))->ss_ninos; @@ -626,10 +626,10 @@ lfs_updatemeta(sp) ip = VTOI(vp); switch (num) { case 0: - ip->i_db[lbn] = off; + ip->i_ffs_db[lbn] = off; break; case 1: - ip->i_ib[a[0].in_off] = off; + ip->i_ffs_ib[a[0].in_off] = off; break; default: ap = &a[num - 1]; @@ -641,7 +641,7 @@ lfs_updatemeta(sp) * to get counted for the inode. */ if (bp->b_blkno == -1 && !(bp->b_flags & B_CACHE)) { - ip->i_blocks += fsbtodb(fs, 1); + ip->i_ffs_blocks += fsbtodb(fs, 1); fs->lfs_bfree -= fragstodb(fs, fs->lfs_frag); } ((ufs_daddr_t *)bp->b_data)[ap->in_off] = off; diff --git a/sys/ufs/lfs/lfs_syscalls.c b/sys/ufs/lfs/lfs_syscalls.c index 8c9bf0c5165..b90a6ca524e 100644 --- a/sys/ufs/lfs/lfs_syscalls.c +++ b/sys/ufs/lfs/lfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_syscalls.c,v 1.4 1996/07/01 11:07:35 downsj Exp $ */ +/* $OpenBSD: lfs_syscalls.c,v 1.5 1997/05/30 08:34:45 downsj Exp $ */ /* $NetBSD: lfs_syscalls.c,v 1.10 1996/02/09 22:28:56 christos Exp $ */ /*- @@ -522,7 +522,7 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp) /* Read in the disk contents for the inode, copy into the inode. */ if (dinp) { - error = copyin(dinp, &ip->i_din, sizeof(struct dinode)); + error = copyin(dinp, &ip->i_din.ffs_din, sizeof(struct dinode)); if (error) return (error); } @@ -543,7 +543,7 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp) *vpp = NULL; return (error); } - ip->i_din = + ip->i_din.ffs_din = *lfs_ifind(ump->um_lfs, ino, (struct dinode *)bp->b_data); brelse(bp); } diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c index 6023f14073e..d80b15272f4 100644 --- a/sys/ufs/lfs/lfs_vfsops.c +++ b/sys/ufs/lfs/lfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_vfsops.c,v 1.6 1996/07/01 07:41:55 downsj Exp $ */ +/* $OpenBSD: lfs_vfsops.c,v 1.7 1997/05/30 08:34:48 downsj Exp $ */ /* $NetBSD: lfs_vfsops.c,v 1.11 1996/03/25 12:53:35 pk Exp $ */ /* @@ -79,14 +79,6 @@ struct vfsops lfs_vfsops = { lfs_init, }; -static struct ufs_dirops xlfs_dirops = { - ufs_dirremove, - ufs_direnter, - ufs_dirempty, - ufs_dirrewrite, - ufs_checkpath, -}; - int lfs_mountroot() { @@ -318,7 +310,6 @@ lfs_mountfs(devvp, mp, p) ump->um_bptrtodb = 0; ump->um_seqinc = 1 << fs->lfs_fsbtodb; ump->um_nindir = fs->lfs_nindir; - ump->um_dirops = &xlfs_dirops; for (i = 0; i < MAXQUOTAS; i++) ump->um_quotas[i] = NULLVP; devvp->v_specflags |= SI_MOUNTEDON; @@ -545,7 +536,7 @@ lfs_vget(mp, ino, vpp) *vpp = NULL; return (error); } - ip->i_din = *lfs_ifind(fs, ino, (struct dinode *)bp->b_data); + ip->i_din.ffs_din = *lfs_ifind(fs, ino, (struct dinode *)bp->b_data); brelse(bp); /* @@ -615,7 +606,7 @@ lfs_vptofh(vp, fhp) ufhp = (struct ufid *)fhp; ufhp->ufid_len = sizeof(struct ufid); ufhp->ufid_ino = ip->i_number; - ufhp->ufid_gen = ip->i_gen; + ufhp->ufid_gen = ip->i_ffs_gen; return (0); } diff --git a/sys/ufs/lfs/lfs_vnops.c b/sys/ufs/lfs/lfs_vnops.c index 76bc7608ed1..9e40dbf1b8d 100644 --- a/sys/ufs/lfs/lfs_vnops.c +++ b/sys/ufs/lfs/lfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_vnops.c,v 1.4 1996/07/01 07:41:56 downsj Exp $ */ +/* $OpenBSD: lfs_vnops.c,v 1.5 1997/05/30 08:34:51 downsj Exp $ */ /* $NetBSD: lfs_vnops.c,v 1.11 1996/05/11 18:27:41 mycroft Exp $ */ /* @@ -416,7 +416,7 @@ lfs_rename(v) SET_ENDOP(VTOI(ap->a_fdvp)->i_lfs); return (ret); } -/* XXX hack to avoid calling ITIMES in getattr */ +/* XXX hack to avoid calling FFS_ITIMES in getattr */ int lfs_getattr(v) void *v; @@ -435,20 +435,20 @@ lfs_getattr(v) */ vap->va_fsid = ip->i_dev; vap->va_fileid = ip->i_number; - vap->va_mode = ip->i_mode & ~IFMT; - vap->va_nlink = ip->i_nlink; - vap->va_uid = ip->i_uid; - vap->va_gid = ip->i_gid; - vap->va_rdev = (dev_t)ip->i_rdev; - vap->va_size = ip->i_din.di_size; - vap->va_atime.tv_sec = ip->i_atime; - vap->va_atime.tv_nsec = ip->i_atimensec; - vap->va_mtime.tv_sec = ip->i_mtime; - vap->va_mtime.tv_nsec = ip->i_mtimensec; - vap->va_ctime.tv_sec = ip->i_ctime; - vap->va_ctime.tv_nsec = ip->i_ctimensec; - vap->va_flags = ip->i_flags; - vap->va_gen = ip->i_gen; + vap->va_mode = ip->i_ffs_mode & ~IFMT; + vap->va_nlink = ip->i_ffs_nlink; + vap->va_uid = ip->i_ffs_uid; + vap->va_gid = ip->i_ffs_gid; + vap->va_rdev = (dev_t)ip->i_ffs_rdev; + vap->va_size = ip->i_ffs_size; + vap->va_atime.tv_sec = ip->i_ffs_atime; + vap->va_atime.tv_nsec = ip->i_ffs_atimensec; + vap->va_mtime.tv_sec = ip->i_ffs_mtime; + vap->va_mtime.tv_nsec = ip->i_ffs_mtimensec; + vap->va_ctime.tv_sec = ip->i_ffs_ctime; + vap->va_ctime.tv_nsec = ip->i_ffs_ctimensec; + vap->va_flags = ip->i_ffs_flags; + vap->va_gen = ip->i_ffs_gen; /* this doesn't belong here */ if (vp->v_type == VBLK) vap->va_blocksize = BLKDEV_IOSIZE; @@ -456,7 +456,7 @@ lfs_getattr(v) vap->va_blocksize = MAXBSIZE; else vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize; - vap->va_bytes = dbtob(ip->i_blocks); + vap->va_bytes = dbtob(ip->i_ffs_blocks); vap->va_type = vp->v_type; vap->va_filerev = ip->i_modrev; return (0); @@ -485,7 +485,7 @@ lfs_close(v) if (vp->v_usecount > 1 && !(ip->i_flag & IN_LOCKED)) { mod = ip->i_flag & IN_MODIFIED; - ITIMES(ip, &time, &time); + FFS_ITIMES(ip, &time, &time); if (!mod && ip->i_flag & IN_MODIFIED) ip->i_lfs->lfs_uinodes++; } diff --git a/sys/ufs/ufs/dir.h b/sys/ufs/ufs/dir.h index 7fdf465b6f1..b16c9a9256d 100644 --- a/sys/ufs/ufs/dir.h +++ b/sys/ufs/ufs/dir.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.h,v 1.5 1996/06/27 06:42:08 downsj Exp $ */ +/* $OpenBSD: dir.h,v 1.6 1997/05/30 08:34:56 downsj Exp $ */ /* $NetBSD: dir.h,v 1.8 1996/03/09 19:42:41 scottr Exp $ */ /* @@ -155,44 +155,4 @@ struct odirtemplate { u_int16_t dotdot_namlen; char dotdot_name[4]; /* ditto */ }; - -#ifdef _KERNEL -/* - * For lack of a better place... - * - * This structure defines a set of function pointers, for managing rouge - * ufs-like filesystems in vnop code. Most have to do with directories. - */ - -struct componentname; -struct vnode; -struct inode; -struct ucred; -struct ufs_dirops { - int (*dirremove) __P((struct vnode *, struct componentname *)); - int (*direnter) __P((struct inode *, struct vnode *, - struct componentname *)); - int (*dirempty) __P((struct inode *, ino_t, struct ucred *)); - int (*dirrewrite) __P((struct inode *, struct inode *, - struct componentname *)); - int (*checkpath) __P((struct inode *, struct inode *, - struct ucred *)); -}; - -/* - * Macros for accessing the above. - */ -#define VN_DIRREMOVE(vn, cm) \ - VFSTOUFS(vn->v_mount)->um_dirops->dirremove(vn, cm) -#define VN_DIRENTER(in, vn, cm) \ - VFSTOUFS(vn->v_mount)->um_dirops->direnter(in, vn, cm) -#define VN_DIREMPTY(vn, in, it, uc) \ - VFSTOUFS(vn->v_mount)->um_dirops->dirempty(in, it, uc) -#define VN_DIRREWRITE(vn, in1, in2, cm) \ - VFSTOUFS(vn->v_mount)->um_dirops->dirrewrite(in1, in2, cm) -#define VN_CHECKPATH(vn, in1, in2, uc) \ - VFSTOUFS(vn->v_mount)->um_dirops->checkpath(in1, in2, uc) - -#endif /* _KERNEL */ - #endif /* !_DIR_H_ */ diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 809374c1edd..fc012858882 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: inode.h,v 1.4 1996/06/27 06:42:08 downsj Exp $ */ +/* $OpenBSD: inode.h,v 1.5 1997/05/30 08:34:59 downsj Exp $ */ /* $NetBSD: inode.h,v 1.8 1995/06/15 23:22:50 cgd Exp $ */ /* @@ -43,16 +43,14 @@ #include <ufs/ufs/dinode.h> #include <ufs/ufs/dir.h> +#include <ufs/ext2fs/ext2fs_dinode.h> /* * Per-filesystem inode extensions. */ -struct ext2_inode_ext { - int32_t block_group; - int32_t next_alloc_block; - int32_t next_alloc_goal; - int32_t prealloc_block; - int32_t prealloc_count; +struct ext2fs_inode_ext { + ufs_daddr_t ext2fs_last_lblk; /* last logical block allocated */ + ufs_daddr_t ext2fs_last_blk; /* last block allocated on disk */ }; /* @@ -74,13 +72,13 @@ struct inode { ino_t i_number; /* The identity of the inode. */ union { /* Associated filesystem. */ - struct fs *fs; /* FFS */ - struct lfs *lfs; /* LFS */ - struct ext2_sb_info *e2fs; /* EXT2FS */ + struct fs *fs; /* FFS */ + struct lfs *lfs; /* LFS */ + struct m_ext2fs *e2fs; /* EXT2FS */ } inode_u; #define i_fs inode_u.fs #define i_lfs inode_u.lfs -#define i_e2fs inode_u.e2fs +#define i_e2fs inode_u.e2fs struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */ u_quad_t i_modrev; /* Revision level for NFS lease. */ @@ -96,44 +94,62 @@ struct inode { doff_t i_offset; /* Offset of free space in directory. */ ino_t i_ino; /* Inode number of found directory. */ u_int32_t i_reclen; /* Size of found directory entry. */ - /* - * Inode extensions. + * Inode extensions */ union { /* Other extensions could go here... */ - struct ext2_inode_ext e2ext; + struct ext2fs_inode_ext e2fs; } inode_ext; -#define i_block_group inode_ext.e2ext.block_group -#define i_next_alloc_block inode_ext.e2ext.next_alloc_block -#define i_next_alloc_goal inode_ext.e2ext.next_alloc_goal -#define i_prealloc_block inode_ext.e2ext.prealloc_block -#define i_prealloc_count inode_ext.e2ext.prealloc_count +#define i_e2fs_last_lblk inode_ext.e2fs.ext2fs_last_lblk +#define i_e2fs_last_blk inode_ext.e2fs.ext2fs_last_blk /* * The on-disk dinode itself. */ - struct dinode i_din; /* 128 bytes of the on-disk dinode. */ + union { + struct dinode ffs_din; /* 128 bytes of the on-disk dinode. */ + struct ext2fs_dinode e2fs_din; /* 128 bytes of the on-disk dinode. */ + } i_din; }; -#define i_atime i_din.di_atime -#define i_atimensec i_din.di_atimensec -#define i_blocks i_din.di_blocks -#define i_ctime i_din.di_ctime -#define i_ctimensec i_din.di_ctimensec -#define i_db i_din.di_db -#define i_flags i_din.di_flags -#define i_gen i_din.di_gen -#define i_gid i_din.di_gid -#define i_ib i_din.di_ib -#define i_mode i_din.di_mode -#define i_mtime i_din.di_mtime -#define i_mtimensec i_din.di_mtimensec -#define i_nlink i_din.di_nlink -#define i_rdev i_din.di_rdev -#define i_shortlink i_din.di_shortlink -#define i_size i_din.di_size -#define i_uid i_din.di_uid +#define i_ffs_atime i_din.ffs_din.di_atime +#define i_ffs_atimensec i_din.ffs_din.di_atimensec +#define i_ffs_blocks i_din.ffs_din.di_blocks +#define i_ffs_ctime i_din.ffs_din.di_ctime +#define i_ffs_ctimensec i_din.ffs_din.di_ctimensec +#define i_ffs_db i_din.ffs_din.di_db +#define i_ffs_flags i_din.ffs_din.di_flags +#define i_ffs_gen i_din.ffs_din.di_gen +#define i_ffs_gid i_din.ffs_din.di_gid +#define i_ffs_ib i_din.ffs_din.di_ib +#define i_ffs_mode i_din.ffs_din.di_mode +#define i_ffs_mtime i_din.ffs_din.di_mtime +#define i_ffs_mtimensec i_din.ffs_din.di_mtimensec +#define i_ffs_nlink i_din.ffs_din.di_nlink +#define i_ffs_rdev i_din.ffs_din.di_rdev +#define i_ffs_shortlink i_din.ffs_din.di_shortlink +#define i_ffs_size i_din.ffs_din.di_size +#define i_ffs_uid i_din.ffs_din.di_uid + +#define i_e2fs_mode i_din.e2fs_din.e2di_mode +#define i_e2fs_uid i_din.e2fs_din.e2di_uid +#define i_e2fs_size i_din.e2fs_din.e2di_size +#define i_e2fs_atime i_din.e2fs_din.e2di_atime +#define i_e2fs_ctime i_din.e2fs_din.e2di_ctime +#define i_e2fs_mtime i_din.e2fs_din.e2di_mtime +#define i_e2fs_dtime i_din.e2fs_din.e2di_dtime +#define i_e2fs_gid i_din.e2fs_din.e2di_gid +#define i_e2fs_nlink i_din.e2fs_din.e2di_nlink +#define i_e2fs_nblock i_din.e2fs_din.e2di_nblock +#define i_e2fs_flags i_din.e2fs_din.e2di_flags +#define i_e2fs_blocks i_din.e2fs_din.e2di_blocks +#define i_e2fs_gen i_din.e2fs_din.e2di_gen +#define i_e2fs_facl i_din.e2fs_din.e2di_facl +#define i_e2fs_dacl i_din.e2fs_din.e2di_dacl +#define i_e2fs_faddr i_din.e2fs_din.e2di_faddr +#define i_e2fs_nfrag i_din.e2fs_din.e2di_nfrag +#define i_e2fs_fsize i_din.e2fs_din.e2di_fsize /* These flags are kept in i_flag. */ #define IN_ACCESS 0x0001 /* Access time update request. */ @@ -162,21 +178,44 @@ struct indir { #define VTOI(vp) ((struct inode *)(vp)->v_data) #define ITOV(ip) ((ip)->i_vnode) -#define ITIMES(ip, t1, t2) { \ +#define FFS_ITIMES(ip, t1, t2) { \ if ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) { \ (ip)->i_flag |= IN_MODIFIED; \ if ((ip)->i_flag & IN_ACCESS) \ - (ip)->i_atime = (t1)->tv_sec; \ + (ip)->i_ffs_atime = (t1)->tv_sec; \ if ((ip)->i_flag & IN_UPDATE) { \ - (ip)->i_mtime = (t2)->tv_sec; \ + (ip)->i_ffs_mtime = (t2)->tv_sec; \ (ip)->i_modrev++; \ } \ if ((ip)->i_flag & IN_CHANGE) \ - (ip)->i_ctime = time.tv_sec; \ + (ip)->i_ffs_ctime = time.tv_sec; \ (ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); \ } \ } +#define EXT2FS_ITIMES(ip, t1, t2) { \ + if ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) { \ + (ip)->i_flag |= IN_MODIFIED; \ + if ((ip)->i_flag & IN_ACCESS) \ + (ip)->i_e2fs_atime = (t1)->tv_sec; \ + if ((ip)->i_flag & IN_UPDATE) { \ + (ip)->i_e2fs_mtime = (t2)->tv_sec; \ + (ip)->i_modrev++; \ + } \ + if ((ip)->i_flag & IN_CHANGE) \ + (ip)->i_e2fs_ctime = time.tv_sec; \ + (ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); \ + } \ +} + +#define ITIMES(ip, t1, t2) { \ + if (IS_EXT2_VNODE((ip)->i_vnode)) { \ + EXT2FS_ITIMES(ip, t1, t2); \ + } else { \ + FFS_ITIMES(ip, t1, t2); \ + } \ +} + /* This overlays the fid structure (see mount.h). */ struct ufid { u_int16_t ufid_len; /* Length of structure. */ diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c index 62c7bdd407e..f6c59c9352c 100644 --- a/sys/ufs/ufs/ufs_bmap.c +++ b/sys/ufs/ufs/ufs_bmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_bmap.c,v 1.3 1996/10/18 14:51:15 mickey Exp $ */ +/* $OpenBSD: ufs_bmap.c,v 1.4 1997/05/30 08:35:02 downsj Exp $ */ /* $NetBSD: ufs_bmap.c,v 1.3 1996/02/09 22:36:00 christos Exp $ */ /* @@ -149,19 +149,19 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp) num = *nump; if (num == 0) { - *bnp = blkptrtodb(ump, ip->i_db[bn]); + *bnp = blkptrtodb(ump, ip->i_ffs_db[bn]); if (*bnp == 0) *bnp = -1; else if (runp) for (++bn; bn < NDADDR && *runp < maxrun && - is_sequential(ump, ip->i_db[bn - 1], ip->i_db[bn]); + is_sequential(ump, ip->i_ffs_db[bn - 1], ip->i_ffs_db[bn]); ++bn, ++*runp); return (0); } /* Get disk address out of indirect block array */ - daddr = ip->i_ib[xap->in_off]; + daddr = ip->i_ffs_ib[xap->in_off]; devvp = VFSTOUFS(vp->v_mount)->um_devvp; for (bp = NULL, ++xap; --num; ++xap) { @@ -224,7 +224,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp) * contains the logical block number of the appropriate single, double or * triple indirect block and the offset into the inode indirect block array. * Note, the logical block number of the inode single/double/triple indirect - * block appears twice in the array, once with the offset into the i_ib and + * block appears twice in the array, once with the offset into the i_ffs_ib and * once with the offset into the page itself. */ int diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c index fcc0b25f235..eed08b7f2cf 100644 --- a/sys/ufs/ufs/ufs_inode.c +++ b/sys/ufs/ufs/ufs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_inode.c,v 1.3 1996/05/22 11:47:21 deraadt Exp $ */ +/* $OpenBSD: ufs_inode.c,v 1.4 1997/05/30 08:35:04 downsj Exp $ */ /* $NetBSD: ufs_inode.c,v 1.7 1996/05/11 18:27:52 mycroft Exp $ */ /* @@ -92,7 +92,7 @@ ufs_inactive(v) vprint("ffs_inactive: pushing active", vp); /* Get rid of inodes related to stale file handles. */ - if (ip->i_mode == 0) { + if (ip->i_ffs_mode == 0) { if ((vp->v_flag & VXLOCK) == 0) vgone(vp); return (0); @@ -108,15 +108,15 @@ ufs_inactive(v) ip->i_lockholder = -1; #endif ip->i_flag |= IN_LOCKED; - if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { + if (ip->i_ffs_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { #ifdef QUOTA if (!getinoquota(ip)) (void)chkiq(ip, -1, NOCRED, 0); #endif error = VOP_TRUNCATE(vp, (off_t)0, 0, NOCRED, NULL); - ip->i_rdev = 0; - mode = ip->i_mode; - ip->i_mode = 0; + ip->i_ffs_rdev = 0; + mode = ip->i_ffs_mode; + ip->i_ffs_mode = 0; ip->i_flag |= IN_CHANGE | IN_UPDATE; VOP_VFREE(vp, ip->i_number, mode); } @@ -129,7 +129,7 @@ ufs_inactive(v) * If we are done with the inode, reclaim it * so that it can be reused immediately. */ - if (vp->v_usecount == 0 && ip->i_mode == 0) + if (vp->v_usecount == 0 && ip->i_ffs_mode == 0) vgone(vp); return (error); } diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index 86612a274f7..38d828b987e 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_lookup.c,v 1.3 1996/08/31 09:24:10 pefo Exp $ */ +/* $OpenBSD: ufs_lookup.c,v 1.4 1997/05/30 08:35:08 downsj Exp $ */ /* $NetBSD: ufs_lookup.c,v 1.7 1996/02/09 22:36:06 christos Exp $ */ /* @@ -143,7 +143,7 @@ ufs_lookup(v) /* * Check accessiblity of directory. */ - if ((dp->i_mode & IFMT) != IFDIR) + if ((dp->i_ffs_mode & IFMT) != IFDIR) return (ENOTDIR); if ((error = VOP_ACCESS(vdp, VEXEC, cred, cnp->cn_proc)) != 0) return (error); @@ -228,7 +228,7 @@ ufs_lookup(v) */ bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1; if (nameiop != LOOKUP || dp->i_diroff == 0 || - dp->i_diroff > dp->i_size) { + dp->i_diroff > dp->i_ffs_size) { entryoffsetinblock = 0; dp->i_offset = 0; numdirpasses = 1; @@ -241,7 +241,7 @@ ufs_lookup(v) nchstats.ncs_2passes++; } prevoff = dp->i_offset; - endsearch = roundup(dp->i_size, DIRBLKSIZ); + endsearch = roundup(dp->i_ffs_size, DIRBLKSIZ); enduseful = 0; searchloop: @@ -396,7 +396,7 @@ notfound: (nameiop == DELETE && (ap->a_cnp->cn_flags & DOWHITEOUT) && (ap->a_cnp->cn_flags & ISWHITEOUT))) && - (flags & ISLASTCN) && dp->i_nlink != 0) { + (flags & ISLASTCN) && dp->i_ffs_nlink != 0) { /* * Access for write is interpreted as allowing * creation of files in the directory. @@ -414,7 +414,7 @@ notfound: * dp->i_offset + dp->i_count. */ if (slotstatus == NONE) { - dp->i_offset = roundup(dp->i_size, DIRBLKSIZ); + dp->i_offset = roundup(dp->i_ffs_size, DIRBLKSIZ); dp->i_count = 0; enduseful = dp->i_offset; } else if (nameiop == DELETE) { @@ -463,9 +463,9 @@ found: * Check that directory length properly reflects presence * of this entry. */ - if (entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep) > dp->i_size) { - ufs_dirbad(dp, dp->i_offset, "i_size too small"); - dp->i_size = entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep); + if (entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep) > dp->i_ffs_size) { + ufs_dirbad(dp, dp->i_offset, "i_ffs_size too small"); + dp->i_ffs_size = entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep); dp->i_flag |= IN_CHANGE | IN_UPDATE; } @@ -515,10 +515,10 @@ found: * may not delete it (unless she's root). This * implements append-only directories. */ - if ((dp->i_mode & ISVTX) && + if ((dp->i_ffs_mode & ISVTX) && cred->cr_uid != 0 && - cred->cr_uid != dp->i_uid && - VTOI(tdp)->i_uid != cred->cr_uid) { + cred->cr_uid != dp->i_ffs_uid && + VTOI(tdp)->i_ffs_uid != cred->cr_uid) { vput(tdp); return (EPERM); } @@ -696,7 +696,7 @@ ufs_direnter(ip, dvp, cnp) newdir.d_namlen = cnp->cn_namelen; bcopy(cnp->cn_nameptr, newdir.d_name, (unsigned)cnp->cn_namelen + 1); if (dvp->v_mount->mnt_maxsymlinklen > 0) - newdir.d_type = IFTODT(ip->i_mode); + newdir.d_type = IFTODT(ip->i_ffs_mode); else { newdir.d_type = 0; # if (BYTE_ORDER == LITTLE_ENDIAN) @@ -757,7 +757,7 @@ ufs_direnter2(dvp, dirp, cr, p) /* XXX should grow with balloc() */ panic("ufs_direnter2: frag size"); else if (!error) { - dp->i_size = roundup(dp->i_size, DIRBLKSIZ); + dp->i_ffs_size = roundup(dp->i_ffs_size, DIRBLKSIZ); dp->i_flag |= IN_CHANGE; } return (error); @@ -779,8 +779,8 @@ ufs_direnter2(dvp, dirp, cr, p) * * N.B. - THIS IS AN ARTIFACT OF 4.2 AND SHOULD NEVER HAPPEN. */ - if (dp->i_offset + dp->i_count > dp->i_size) - dp->i_size = dp->i_offset + dp->i_count; + if (dp->i_offset + dp->i_count > dp->i_ffs_size) + dp->i_ffs_size = dp->i_offset + dp->i_count; /* * Get the block containing the space for the new directory entry. */ @@ -832,7 +832,7 @@ ufs_direnter2(dvp, dirp, cr, p) bcopy((caddr_t)dirp, (caddr_t)ep, (u_int)newentrysize); error = VOP_BWRITE(bp); dp->i_flag |= IN_CHANGE | IN_UPDATE; - if (!error && dp->i_endoff && dp->i_endoff < dp->i_size) + if (!error && dp->i_endoff && dp->i_endoff < dp->i_ffs_size) error = VOP_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_SYNC, cr, p); return (error); } @@ -922,7 +922,7 @@ ufs_dirrewrite(dp, ip, cnp) return (error); ep->d_ino = ip->i_number; if (vdp->v_mount->mnt_maxsymlinklen > 0) - ep->d_type = IFTODT(ip->i_mode); + ep->d_type = IFTODT(ip->i_ffs_mode); error = VOP_BWRITE(bp); dp->i_flag |= IN_CHANGE | IN_UPDATE; return (error); @@ -949,7 +949,7 @@ ufs_dirempty(ip, parentino, cred) int error, count, namlen; #define MINDIRSIZ (sizeof (struct dirtemplate) / 2) - m = ip->i_size; + m = ip->i_ffs_size; for (off = 0; off < m; off += dp->d_reclen) { error = vn_rdwr(UIO_READ, ITOV(ip), (caddr_t)dp, MINDIRSIZ, off, UIO_SYSSPACE, IO_NODELOCKED, cred, &count, (struct proc *)0); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index bf17101b9e4..f6ea0606058 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_quota.c,v 1.2 1996/02/27 07:21:29 niklas Exp $ */ +/* $OpenBSD: ufs_quota.c,v 1.3 1997/05/30 08:35:10 downsj Exp $ */ /* $NetBSD: ufs_quota.c,v 1.8 1996/02/09 22:36:09 christos Exp $ */ /* @@ -81,7 +81,7 @@ getinoquota(ip) */ if (ip->i_dquot[USRQUOTA] == NODQUOT && (error = - dqget(vp, ip->i_uid, ump, USRQUOTA, &ip->i_dquot[USRQUOTA])) && + dqget(vp, ip->i_ffs_uid, ump, USRQUOTA, &ip->i_dquot[USRQUOTA])) && error != EINVAL) return (error); /* @@ -90,7 +90,7 @@ getinoquota(ip) */ if (ip->i_dquot[GRPQUOTA] == NODQUOT && (error = - dqget(vp, ip->i_gid, ump, GRPQUOTA, &ip->i_dquot[GRPQUOTA])) && + dqget(vp, ip->i_ffs_gid, ump, GRPQUOTA, &ip->i_dquot[GRPQUOTA])) && error != EINVAL) return (error); return (0); @@ -174,7 +174,7 @@ chkdqchg(ip, change, cred, type) */ if (ncurblocks >= dq->dq_bhardlimit && dq->dq_bhardlimit) { if ((dq->dq_flags & DQ_BLKS) == 0 && - ip->i_uid == cred->cr_uid) { + ip->i_ffs_uid == cred->cr_uid) { uprintf("\n%s: write failed, %s disk limit reached\n", ITOV(ip)->v_mount->mnt_stat.f_mntonname, quotatypes[type]); @@ -190,7 +190,7 @@ chkdqchg(ip, change, cred, type) if (dq->dq_curblocks < dq->dq_bsoftlimit) { dq->dq_btime = time.tv_sec + VFSTOUFS(ITOV(ip)->v_mount)->um_btime[type]; - if (ip->i_uid == cred->cr_uid) + if (ip->i_ffs_uid == cred->cr_uid) uprintf("\n%s: warning, %s %s\n", ITOV(ip)->v_mount->mnt_stat.f_mntonname, quotatypes[type], "disk quota exceeded"); @@ -198,7 +198,7 @@ chkdqchg(ip, change, cred, type) } if (time.tv_sec > dq->dq_btime) { if ((dq->dq_flags & DQ_BLKS) == 0 && - ip->i_uid == cred->cr_uid) { + ip->i_ffs_uid == cred->cr_uid) { uprintf("\n%s: write failed, %s %s\n", ITOV(ip)->v_mount->mnt_stat.f_mntonname, quotatypes[type], @@ -289,7 +289,7 @@ chkiqchg(ip, change, cred, type) */ if (ncurinodes >= dq->dq_ihardlimit && dq->dq_ihardlimit) { if ((dq->dq_flags & DQ_INODS) == 0 && - ip->i_uid == cred->cr_uid) { + ip->i_ffs_uid == cred->cr_uid) { uprintf("\n%s: write failed, %s inode limit reached\n", ITOV(ip)->v_mount->mnt_stat.f_mntonname, quotatypes[type]); @@ -305,7 +305,7 @@ chkiqchg(ip, change, cred, type) if (dq->dq_curinodes < dq->dq_isoftlimit) { dq->dq_itime = time.tv_sec + VFSTOUFS(ITOV(ip)->v_mount)->um_itime[type]; - if (ip->i_uid == cred->cr_uid) + if (ip->i_ffs_uid == cred->cr_uid) uprintf("\n%s: warning, %s %s\n", ITOV(ip)->v_mount->mnt_stat.f_mntonname, quotatypes[type], "inode quota exceeded"); @@ -313,7 +313,7 @@ chkiqchg(ip, change, cred, type) } if (time.tv_sec > dq->dq_itime) { if ((dq->dq_flags & DQ_INODS) == 0 && - ip->i_uid == cred->cr_uid) { + ip->i_ffs_uid == cred->cr_uid) { uprintf("\n%s: write failed, %s %s\n", ITOV(ip)->v_mount->mnt_stat.f_mntonname, quotatypes[type], diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index 80238dbf26c..604c16fcb90 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_readwrite.c,v 1.8 1996/11/04 01:55:18 tholo Exp $ */ +/* $OpenBSD: ufs_readwrite.c,v 1.9 1997/05/30 08:35:13 downsj Exp $ */ /* $NetBSD: ufs_readwrite.c,v 1.9 1996/05/11 18:27:57 mycroft Exp $ */ /*- @@ -36,11 +36,6 @@ * @(#)ufs_readwrite.c 8.11 (Berkeley) 5/8/95 */ -/* - * ext2fs support added to this module by Jason Downs, based on Godmar Back's - * original ext2_readwrite.c. - */ - #ifdef LFS_READWRITE #define BLKSIZE(a, b, c) blksize(a, b, c) #define FS struct lfs @@ -52,17 +47,6 @@ #define fs_bsize lfs_bsize #define MAXFILESIZE fs->lfs_maxfilesize #else -#ifdef EXT2_READWRITE -#define BLKSIZE(a, b, c) blksize(a, b, c) -#define FS struct ext2_sb_info -#define I_FS i_e2fs -#define READ ext2_read -#define READ_S "ext2_read" -#define WRITE ext2_write -#define WRITE_S "ext2_write" -#define fs_bsize s_frag_size -#define MAXFILESIZE ((u_int64_t)0x80000000 * fs->s_frag_size - 1) -#else #define BLKSIZE(a, b, c) blksize(a, b, c) #define FS struct fs #define I_FS i_fs @@ -72,7 +56,6 @@ #define WRITE_S "ffs_write" #define MAXFILESIZE fs->fs_maxfilesize #endif -#endif /* * Vnode op for reading. @@ -101,7 +84,7 @@ READ(v) vp = ap->a_vp; ip = VTOI(vp); - mode = ip->i_mode; + mode = ip->i_ffs_mode; uio = ap->a_uio; #ifdef DIAGNOSTIC @@ -109,9 +92,9 @@ READ(v) panic("%s: mode", READ_S); if (vp->v_type == VLNK) { - if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen || + if ((int)ip->i_ffs_size < vp->v_mount->mnt_maxsymlinklen || (vp->v_mount->mnt_maxsymlinklen == 0 && - ip->i_din.di_blocks == 0)) + ip->i_ffs_blocks == 0)) panic("%s: short symlink", READ_S); } else if (vp->v_type != VREG && vp->v_type != VDIR) panic("%s: type %d", READ_S, vp->v_type); @@ -124,7 +107,7 @@ READ(v) return (0); for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { - if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0) + if ((bytesinfile = ip->i_ffs_size - uio->uio_offset) <= 0) break; lbn = lblkno(fs, uio->uio_offset); nextlbn = lbn + 1; @@ -138,17 +121,14 @@ READ(v) #ifdef LFS_READWRITE (void)lfs_check(vp, lbn); - error = cluster_read(vp, ip->i_size, lbn, size, NOCRED, &bp); + error = cluster_read(vp, ip->i_ffs_size, lbn, size, NOCRED, + &bp); #else -#ifdef EXT2_READWRITE - if (lblktosize(fs, nextlbn) > ip->i_size) -#else - if (lblktosize(fs, nextlbn) >= ip->i_size) -#endif + if (lblktosize(fs, nextlbn) >= ip->i_ffs_size) error = bread(vp, lbn, size, NOCRED, &bp); else if (doclusterread) error = cluster_read(vp, - ip->i_size, lbn, size, NOCRED, &bp); + ip->i_ffs_size, lbn, size, NOCRED, &bp); else if (lbn - 1 == vp->v_lastr) { int nextsize = BLKSIZE(fs, ip, nextlbn); error = breadn(vp, lbn, @@ -222,8 +202,8 @@ WRITE(v) switch (vp->v_type) { case VREG: if (ioflag & IO_APPEND) - uio->uio_offset = ip->i_size; - if ((ip->i_flags & APPEND) && uio->uio_offset != ip->i_size) + uio->uio_offset = ip->i_ffs_size; + if ((ip->i_ffs_flags & APPEND) && uio->uio_offset != ip->i_ffs_size) return (EPERM); /* FALLTHROUGH */ case VLNK: @@ -253,7 +233,7 @@ WRITE(v) } resid = uio->uio_resid; - osize = ip->i_size; + osize = ip->i_ffs_size; flags = ioflag & IO_SYNC ? B_SYNC : 0; for (error = 0; uio->uio_resid > 0;) { @@ -271,18 +251,14 @@ WRITE(v) else flags &= ~B_CLRBUF; -#ifdef EXT2_READWRITE - error = ext2_balloc(ip, -#else error = ffs_balloc(ip, -#endif lbn, blkoffset + xfersize, ap->a_cred, &bp, flags); #endif if (error) break; - if (uio->uio_offset + xfersize > ip->i_size) { - ip->i_size = uio->uio_offset + xfersize; - vnode_pager_setsize(vp, (u_long)ip->i_size); + if (uio->uio_offset + xfersize > ip->i_ffs_size) { + ip->i_ffs_size = uio->uio_offset + xfersize; + vnode_pager_setsize(vp, (u_long)ip->i_ffs_size); } (void)vnode_pager_uncache(vp); @@ -299,7 +275,7 @@ WRITE(v) (void)bwrite(bp); else if (xfersize + blkoffset == fs->fs_bsize) if (doclusterwrite) - cluster_write(bp, ip->i_size); + cluster_write(bp, ip->i_ffs_size); else bawrite(bp); else @@ -315,7 +291,7 @@ WRITE(v) * tampering. */ if (resid > uio->uio_resid && ap->a_cred && ap->a_cred->cr_uid != 0) - ip->i_mode &= ~(ISUID | ISGID); + ip->i_ffs_mode &= ~(ISUID | ISGID); if (error) { if (ioflag & IO_UNIT) { (void)VOP_TRUNCATE(vp, osize, diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index 95406f517a7..0e308fd39dd 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vfsops.c,v 1.2 1996/02/27 07:21:32 niklas Exp $ */ +/* $OpenBSD: ufs_vfsops.c,v 1.3 1997/05/30 08:35:15 downsj Exp $ */ /* $NetBSD: ufs_vfsops.c,v 1.4 1996/02/09 22:36:12 christos Exp $ */ /* @@ -194,7 +194,7 @@ ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp) return (error); } ip = VTOI(nvp); - if (ip->i_mode == 0 || ip->i_gen != ufhp->ufid_gen) { + if (ip->i_ffs_mode == 0 || ip->i_ffs_gen != ufhp->ufid_gen) { vput(nvp); *vpp = NULLVP; return (ESTALE); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 3f3af1316c1..9f130937708 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.8 1996/11/12 15:39:04 mickey Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.9 1997/05/30 08:35:18 downsj Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -67,17 +67,12 @@ #include <ufs/ufs/dir.h> #include <ufs/ufs/ufsmount.h> #include <ufs/ufs/ufs_extern.h> +#include <ufs/ext2fs/ext2fs_extern.h> static int ufs_chmod __P((struct vnode *, int, struct ucred *, struct proc *)); static int ufs_chown __P((struct vnode *, uid_t, gid_t, struct ucred *, struct proc *)); -#ifdef EXT2FS -#include <gnu/ext2fs/ext2_extern.h> -#include <gnu/ext2fs/ext2_fs.h> -#include <gnu/ext2fs/ext2_fs_sb.h> -#endif /* EXT2FS */ - union _qcvt { int64_t qcvt; int32_t val[2]; @@ -143,7 +138,7 @@ ufs_mknod(v) * Want to be able to use this to make badblock * inodes, so don't truncate the dev number. */ - ip->i_rdev = vap->va_rdev; + ip->i_ffs_rdev = vap->va_rdev; } /* * Remove inode so that it will be reloaded by VFS_VGET and @@ -177,7 +172,7 @@ ufs_open(v) /* * Files marked append-only must be opened for appending. */ - if ((VTOI(ap->a_vp)->i_flags & APPEND) && + if ((VTOI(ap->a_vp)->i_ffs_flags & APPEND) && (ap->a_mode & (FWRITE | O_APPEND)) == FWRITE) return (EPERM); return (0); @@ -248,10 +243,11 @@ ufs_access(v) #endif /* If immutable bit set, nobody gets to write it. */ - if ((mode & VWRITE) && (ip->i_flags & IMMUTABLE)) + if ((mode & VWRITE) && (ip->i_ffs_flags & IMMUTABLE)) return (EPERM); - return (vaccess(ip->i_mode, ip->i_uid, ip->i_gid, mode, ap->a_cred)); + return (vaccess(ip->i_ffs_mode, ip->i_ffs_uid, ip->i_ffs_gid, + mode, ap->a_cred)); } /* ARGSUSED */ @@ -275,20 +271,20 @@ ufs_getattr(v) */ vap->va_fsid = ip->i_dev; vap->va_fileid = ip->i_number; - vap->va_mode = ip->i_mode & ~IFMT; - vap->va_nlink = ip->i_nlink; - vap->va_uid = ip->i_uid; - vap->va_gid = ip->i_gid; - vap->va_rdev = (dev_t)ip->i_rdev; - vap->va_size = ip->i_din.di_size; - vap->va_atime.tv_sec = ip->i_atime; - vap->va_atime.tv_nsec = ip->i_atimensec; - vap->va_mtime.tv_sec = ip->i_mtime; - vap->va_mtime.tv_nsec = ip->i_mtimensec; - vap->va_ctime.tv_sec = ip->i_ctime; - vap->va_ctime.tv_nsec = ip->i_ctimensec; - vap->va_flags = ip->i_flags; - vap->va_gen = ip->i_gen; + vap->va_mode = ip->i_ffs_mode & ~IFMT; + vap->va_nlink = ip->i_ffs_nlink; + vap->va_uid = ip->i_ffs_uid; + vap->va_gid = ip->i_ffs_gid; + vap->va_rdev = (dev_t)ip->i_ffs_rdev; + vap->va_size = ip->i_ffs_size; + vap->va_atime.tv_sec = ip->i_ffs_atime; + vap->va_atime.tv_nsec = ip->i_ffs_atimensec; + vap->va_mtime.tv_sec = ip->i_ffs_mtime; + vap->va_mtime.tv_nsec = ip->i_ffs_mtimensec; + vap->va_ctime.tv_sec = ip->i_ffs_ctime; + vap->va_ctime.tv_nsec = ip->i_ffs_ctimensec; + vap->va_flags = ip->i_ffs_flags; + vap->va_gen = ip->i_ffs_gen; /* this doesn't belong here */ if (vp->v_type == VBLK) vap->va_blocksize = BLKDEV_IOSIZE; @@ -296,7 +292,7 @@ ufs_getattr(v) vap->va_blocksize = MAXBSIZE; else vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize; - vap->va_bytes = dbtob(ip->i_blocks); + vap->va_bytes = dbtob(ip->i_ffs_blocks); vap->va_type = vp->v_type; vap->va_filerev = ip->i_modrev; return (0); @@ -332,25 +328,25 @@ ufs_setattr(v) return (EINVAL); } if (vap->va_flags != VNOVAL) { - if (cred->cr_uid != ip->i_uid && + if (cred->cr_uid != ip->i_ffs_uid && (error = suser(cred, &p->p_acflag))) return (error); if (cred->cr_uid == 0) { - if ((ip->i_flags & (SF_IMMUTABLE | SF_APPEND)) && + if ((ip->i_ffs_flags & (SF_IMMUTABLE | SF_APPEND)) && securelevel > 0) return (EPERM); - ip->i_flags = vap->va_flags; + ip->i_ffs_flags = vap->va_flags; } else { - if (ip->i_flags & (SF_IMMUTABLE | SF_APPEND)) + if (ip->i_ffs_flags & (SF_IMMUTABLE | SF_APPEND)) return (EPERM); - ip->i_flags &= SF_SETTABLE; - ip->i_flags |= (vap->va_flags & UF_SETTABLE); + ip->i_ffs_flags &= SF_SETTABLE; + ip->i_ffs_flags |= (vap->va_flags & UF_SETTABLE); } ip->i_flag |= IN_CHANGE; if (vap->va_flags & (IMMUTABLE | APPEND)) return (0); } - if (ip->i_flags & (IMMUTABLE | APPEND)) + if (ip->i_ffs_flags & (IMMUTABLE | APPEND)) return (EPERM); /* * Go through the fields and update if not VNOVAL. @@ -369,7 +365,7 @@ ufs_setattr(v) } ip = VTOI(vp); if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) { - if (cred->cr_uid != ip->i_uid && + if (cred->cr_uid != ip->i_ffs_uid && (error = suser(cred, &p->p_acflag)) && ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || (error = VOP_ACCESS(vp, VWRITE, cred, p)))) @@ -402,19 +398,19 @@ ufs_chmod(vp, mode, cred, p) register struct inode *ip = VTOI(vp); int error; - if (cred->cr_uid != ip->i_uid && + if (cred->cr_uid != ip->i_ffs_uid && (error = suser(cred, &p->p_acflag))) return (error); if (cred->cr_uid) { if (vp->v_type != VDIR && (mode & S_ISTXT)) return (EFTYPE); - if (!groupmember(ip->i_gid, cred) && (mode & ISGID)) + if (!groupmember(ip->i_ffs_gid, cred) && (mode & ISGID)) return (EPERM); } - ip->i_mode &= ~ALLPERMS; - ip->i_mode |= (mode & ALLPERMS); + ip->i_ffs_mode &= ~ALLPERMS; + ip->i_ffs_mode |= (mode & ALLPERMS); ip->i_flag |= IN_CHANGE; - if ((vp->v_flag & VTEXT) && (ip->i_mode & S_ISTXT) == 0) + if ((vp->v_flag & VTEXT) && (ip->i_ffs_mode & S_ISTXT) == 0) (void) vnode_pager_uncache(vp); return (0); } @@ -441,20 +437,20 @@ ufs_chown(vp, uid, gid, cred, p) #endif if (uid == (uid_t)VNOVAL) - uid = ip->i_uid; + uid = ip->i_ffs_uid; if (gid == (gid_t)VNOVAL) - gid = ip->i_gid; + gid = ip->i_ffs_gid; /* * If we don't own the file, are trying to change the owner * of the file, or are not a member of the target group, * the caller must be superuser or the call fails. */ - if ((cred->cr_uid != ip->i_uid || uid != ip->i_uid || - (gid != ip->i_gid && !groupmember((gid_t)gid, cred))) && + if ((cred->cr_uid != ip->i_ffs_uid || uid != ip->i_ffs_uid || + (gid != ip->i_ffs_gid && !groupmember((gid_t)gid, cred))) && (error = suser(cred, &p->p_acflag))) return (error); - ogid = ip->i_gid; - ouid = ip->i_uid; + ogid = ip->i_ffs_gid; + ouid = ip->i_ffs_uid; #ifdef QUOTA if ((error = getinoquota(ip)) != 0) return (error); @@ -466,7 +462,7 @@ ufs_chown(vp, uid, gid, cred, p) dqrele(vp, ip->i_dquot[GRPQUOTA]); ip->i_dquot[GRPQUOTA] = NODQUOT; } - change = ip->i_blocks; + change = ip->i_ffs_blocks; (void) chkdq(ip, -change, cred, CHOWN); (void) chkiq(ip, -1, cred, CHOWN); for (i = 0; i < MAXQUOTAS; i++) { @@ -474,8 +470,8 @@ ufs_chown(vp, uid, gid, cred, p) ip->i_dquot[i] = NODQUOT; } #endif - ip->i_gid = gid; - ip->i_uid = uid; + ip->i_ffs_gid = gid; + ip->i_ffs_uid = uid; #ifdef QUOTA if ((error = getinoquota(ip)) == 0) { if (ouid == uid) { @@ -497,8 +493,8 @@ ufs_chown(vp, uid, gid, cred, p) ip->i_dquot[i] = NODQUOT; } } - ip->i_gid = ogid; - ip->i_uid = ouid; + ip->i_ffs_gid = ogid; + ip->i_ffs_uid = ouid; if (getinoquota(ip) == 0) { if (ouid == uid) { dqrele(vp, ip->i_dquot[USRQUOTA]); @@ -520,9 +516,9 @@ good: if (ouid != uid || ogid != gid) ip->i_flag |= IN_CHANGE; if (ouid != uid && cred->cr_uid != 0) - ip->i_mode &= ~ISUID; + ip->i_ffs_mode &= ~ISUID; if (ogid != gid && cred->cr_uid != 0) - ip->i_mode &= ~ISGID; + ip->i_ffs_mode &= ~ISGID; return (0); } @@ -628,14 +624,13 @@ ufs_remove(v) goto out; } ip = VTOI(vp); - if ((ip->i_flags & (IMMUTABLE | APPEND)) || - (VTOI(dvp)->i_flags & APPEND)) { + if ((ip->i_ffs_flags & (IMMUTABLE | APPEND)) || + (VTOI(dvp)->i_ffs_flags & APPEND)) { error = EPERM; goto out; } - error = VN_DIRREMOVE(dvp, ap->a_cnp); - if (error == 0) { - ip->i_nlink--; + if ((error = ufs_dirremove(dvp, ap->a_cnp)) == 0) { + ip->i_ffs_nlink--; ip->i_flag |= IN_CHANGE; } out: @@ -685,25 +680,24 @@ ufs_link(v) goto out2; } ip = VTOI(vp); - if ((nlink_t)ip->i_nlink >= LINK_MAX) { + if ((nlink_t)ip->i_ffs_nlink >= LINK_MAX) { VOP_ABORTOP(dvp, cnp); error = EMLINK; goto out1; } - if (ip->i_flags & (IMMUTABLE | APPEND)) { + if (ip->i_ffs_flags & (IMMUTABLE | APPEND)) { VOP_ABORTOP(dvp, cnp); error = EPERM; goto out1; } - ip->i_nlink++; + ip->i_ffs_nlink++; ip->i_flag |= IN_CHANGE; TIMEVAL_TO_TIMESPEC(&time, &ts); error = VOP_UPDATE(vp, &ts, &ts, 1); if (!error) - error = VN_DIRENTER(ip, dvp, cnp); - + error = ufs_direnter(ip, dvp, cnp); if (error) { - ip->i_nlink--; + ip->i_ffs_nlink--; ip->i_flag |= IN_CHANGE; } FREE(cnp->cn_pnbuf, M_NAMEI); @@ -752,7 +746,7 @@ ufs_whiteout(v) newdir.d_namlen = cnp->cn_namelen; bcopy(cnp->cn_nameptr, newdir.d_name, (unsigned)cnp->cn_namelen + 1); newdir.d_type = DT_WHT; - error = ufs_direnter2(dvp, &newdir, cnp->cn_cred, cnp->cn_proc); /* FIXME */ + error = ufs_direnter2(dvp, &newdir, cnp->cn_cred, cnp->cn_proc); break; case DELETE: @@ -763,7 +757,7 @@ ufs_whiteout(v) #endif cnp->cn_flags &= ~DOWHITEOUT; - error = VN_DIRREMOVE(dvp, cnp); + error = ufs_dirremove(dvp, cnp); break; } if (cnp->cn_flags & HASBUF) { @@ -851,8 +845,8 @@ abortit: /* * Check if just deleting a link name. */ - if (tvp && ((VTOI(tvp)->i_flags & (IMMUTABLE | APPEND)) || - (VTOI(tdvp)->i_flags & APPEND))) { + if (tvp && ((VTOI(tvp)->i_ffs_flags & (IMMUTABLE | APPEND)) || + (VTOI(tdvp)->i_ffs_flags & APPEND))) { error = EPERM; goto abortit; } @@ -882,12 +876,13 @@ abortit: goto abortit; dp = VTOI(fdvp); ip = VTOI(fvp); - if ((ip->i_flags & (IMMUTABLE | APPEND)) || (dp->i_flags & APPEND)) { + if ((ip->i_ffs_flags & (IMMUTABLE | APPEND)) || + (dp->i_ffs_flags & APPEND)) { VOP_UNLOCK(fvp); error = EPERM; goto abortit; } - if ((ip->i_mode & IFMT) == IFDIR) { + if ((ip->i_ffs_mode & IFMT) == IFDIR) { error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc); if (!error && tvp) error = VOP_ACCESS(tvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc); @@ -927,7 +922,7 @@ abortit: * completing our work, the link count * may be wrong, but correctable. */ - ip->i_nlink++; + ip->i_ffs_nlink++; ip->i_flag |= IN_CHANGE; TIMEVAL_TO_TIMESPEC(&time, &ts); if ((error = VOP_UPDATE(fvp, &ts, &ts, 1)) != 0) { @@ -954,8 +949,7 @@ abortit: goto bad; if (xp != NULL) vput(tvp); - error = VN_CHECKPATH(tdvp, ip, dp, tcnp->cn_cred); - if (error != 0) + if ((error = ufs_checkpath(ip, dp, tcnp->cn_cred)) != 0) goto out; if ((tcnp->cn_flags & SAVESTART) == 0) panic("ufs_rename: lost to startdir"); @@ -982,19 +976,18 @@ abortit: * parent we don't fool with the link count. */ if (doingdirectory && newparent) { - if ((nlink_t)dp->i_nlink >= LINK_MAX) { + if ((nlink_t)dp->i_ffs_nlink >= LINK_MAX) { error = EMLINK; goto bad; } - dp->i_nlink++; + dp->i_ffs_nlink++; dp->i_flag |= IN_CHANGE; if ((error = VOP_UPDATE(tdvp, &ts, &ts, 1)) != 0) goto bad; } - error = VN_DIRENTER(ip, tdvp, tcnp); - if (error != 0) { + if ((error = ufs_direnter(ip, tdvp, tcnp)) != 0) { if (doingdirectory && newparent) { - dp->i_nlink--; + dp->i_ffs_nlink--; dp->i_flag |= IN_CHANGE; (void)VOP_UPDATE(tdvp, &ts, &ts, 1); } @@ -1015,9 +1008,9 @@ abortit: * otherwise the destination may not be changed (except by * root). This implements append-only directories. */ - if ((dp->i_mode & S_ISTXT) && tcnp->cn_cred->cr_uid != 0 && - tcnp->cn_cred->cr_uid != dp->i_uid && - xp->i_uid != tcnp->cn_cred->cr_uid) { + if ((dp->i_ffs_mode & S_ISTXT) && tcnp->cn_cred->cr_uid != 0 && + tcnp->cn_cred->cr_uid != dp->i_ffs_uid && + xp->i_ffs_uid != tcnp->cn_cred->cr_uid) { error = EPERM; goto bad; } @@ -1026,9 +1019,9 @@ abortit: * to it. Also, ensure source and target are compatible * (both directories, or both not directories). */ - if ((xp->i_mode&IFMT) == IFDIR) { - if (!VN_DIREMPTY(ITOV(xp), xp, dp->i_number, - tcnp->cn_cred) || xp->i_nlink > 2) { + if ((xp->i_ffs_mode & IFMT) == IFDIR) { + if (!ufs_dirempty(xp, dp->i_number, tcnp->cn_cred) || + xp->i_ffs_nlink > 2) { error = ENOTEMPTY; goto bad; } @@ -1041,8 +1034,7 @@ abortit: error = EISDIR; goto bad; } - error = VN_DIRREWRITE(ITOV(dp), dp, ip, tcnp); - if (error != 0) + if ((error = ufs_dirrewrite(dp, ip, tcnp)) != 0) goto bad; /* * If the target directory is in the same @@ -1051,7 +1043,7 @@ abortit: * of the target directory. */ if (doingdirectory && !newparent) { - dp->i_nlink--; + dp->i_ffs_nlink--; dp->i_flag |= IN_CHANGE; } vput(tdvp); @@ -1065,9 +1057,9 @@ abortit: * it above, as the remaining link would point to * a directory without "." or ".." entries. */ - xp->i_nlink--; + xp->i_ffs_nlink--; if (doingdirectory) { - if (--xp->i_nlink != 0) + if (--xp->i_ffs_nlink != 0) panic("rename: linked directory"); error = VOP_TRUNCATE(tvp, (off_t)0, IO_SYNC, tcnp->cn_cred, tcnp->cn_proc); @@ -1118,7 +1110,7 @@ abortit: * and ".." set to point to the new parent. */ if (doingdirectory && newparent) { - dp->i_nlink--; + dp->i_ffs_nlink--; dp->i_flag |= IN_CHANGE; error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf, sizeof (struct dirtemplate), (off_t)0, @@ -1133,11 +1125,6 @@ abortit: # else namlen = dirbuf.dotdot_namlen; # endif -#ifdef EXT2FS - if(IS_EXT2_VNODE(fvp)) - namlen = ((struct odirtemplate *) - &dirbuf)->dotdot_namlen; -#endif /* EXT2FS */ if (namlen != 2 || dirbuf.dotdot_name[0] != '.' || dirbuf.dotdot_name[1] != '.') { @@ -1156,9 +1143,9 @@ abortit: } } } - error = VN_DIRREMOVE(fdvp, fcnp); + error = ufs_dirremove(fdvp, fcnp); if (!error) { - xp->i_nlink--; + xp->i_ffs_nlink--; xp->i_flag |= IN_CHANGE; } xp->i_flag &= ~IN_RENAME; @@ -1178,7 +1165,7 @@ out: if (doingdirectory) ip->i_flag &= ~IN_RENAME; if (VOP_LOCK(fvp) == 0) { - ip->i_nlink--; + ip->i_ffs_nlink--; ip->i_flag |= IN_CHANGE; vput(fvp); } else @@ -1225,7 +1212,7 @@ ufs_mkdir(v) panic("ufs_mkdir: no name"); #endif dp = VTOI(dvp); - if ((nlink_t)dp->i_nlink >= LINK_MAX) { + if ((nlink_t)dp->i_ffs_nlink >= LINK_MAX) { error = EMLINK; goto out; } @@ -1239,8 +1226,8 @@ ufs_mkdir(v) if ((error = VOP_VALLOC(dvp, dmode, cnp->cn_cred, &tvp)) != 0) goto out; ip = VTOI(tvp); - ip->i_uid = cnp->cn_cred->cr_uid; - ip->i_gid = dp->i_gid; + ip->i_ffs_uid = cnp->cn_cred->cr_uid; + ip->i_ffs_gid = dp->i_ffs_gid; #ifdef QUOTA if ((error = getinoquota(ip)) || (error = chkiq(ip, 1, cnp->cn_cred, 0))) { @@ -1252,11 +1239,11 @@ ufs_mkdir(v) } #endif ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; - ip->i_mode = dmode; + ip->i_ffs_mode = dmode; tvp->v_type = VDIR; /* Rest init'd in getnewvnode(). */ - ip->i_nlink = 2; + ip->i_ffs_nlink = 2; if (cnp->cn_flags & ISWHITEOUT) - ip->i_flags |= UF_OPAQUE; + ip->i_ffs_flags |= UF_OPAQUE; TIMEVAL_TO_TIMESPEC(&time, &ts); error = VOP_UPDATE(tvp, &ts, &ts, 1); @@ -1266,53 +1253,37 @@ ufs_mkdir(v) * be done before reference is created * so reparation is possible if we crash. */ - dp->i_nlink++; + dp->i_ffs_nlink++; dp->i_flag |= IN_CHANGE; if ((error = VOP_UPDATE(dvp, &ts, &ts, 1)) != 0) goto bad; /* Initialize directory with "." and ".." from static template. */ - if (dvp->v_mount->mnt_maxsymlinklen > 0 -#ifdef EXT2FS - /* omastertemplate is want we want for EXT2 */ - && !IS_EXT2_VNODE(dvp) -#endif /* EXT2FS */ - ) + if (dvp->v_mount->mnt_maxsymlinklen > 0) dtp = &mastertemplate; else dtp = (struct dirtemplate *)&omastertemplate; dirtemplate = *dtp; dirtemplate.dot_ino = ip->i_number; dirtemplate.dotdot_ino = dp->i_number; -#ifdef EXT2FS - /* note that in ext2 DIRBLKSIZ == blocksize, not DEV_BSIZE - * so let's just redefine it - for this function only - */ -#undef DIRBLKSIZ -#define DIRBLKSIZ (IS_EXT2_VNODE(dvp) ? \ - VTOI(dvp)->i_e2fs->s_blocksize : DEV_BSIZE) - if(IS_EXT2_VNODE(dvp)) - dirtemplate.dotdot_reclen = DIRBLKSIZ - 12; -#endif /* EXT2FS */ error = vn_rdwr(UIO_WRITE, tvp, (caddr_t)&dirtemplate, sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0, (struct proc *)0); if (error) { - dp->i_nlink--; + dp->i_ffs_nlink--; dp->i_flag |= IN_CHANGE; goto bad; } if (DIRBLKSIZ > VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_bsize) panic("ufs_mkdir: blksize"); /* XXX should grow with balloc() */ else { - ip->i_size = DIRBLKSIZ; + ip->i_ffs_size = DIRBLKSIZ; ip->i_flag |= IN_CHANGE; } /* Directory set up, now install it's entry in the parent directory. */ - error = VN_DIRENTER(ip, dvp, cnp); - if (error != 0) { - dp->i_nlink--; + if ((error = ufs_direnter(ip, dvp, cnp)) != 0) { + dp->i_ffs_nlink--; dp->i_flag |= IN_CHANGE; } bad: @@ -1321,7 +1292,7 @@ bad: * for us because we set the link count to 0. */ if (error) { - ip->i_nlink = 0; + ip->i_ffs_nlink = 0; ip->i_flag |= IN_CHANGE; vput(tvp); } else @@ -1330,10 +1301,6 @@ out: FREE(cnp->cn_pnbuf, M_NAMEI); vput(dvp); return (error); -#ifdef EXT2FS -#undef DIRBLKSIZ -#define DIRBLKSIZ DEV_BSIZE -#endif /* EXT2FS */ } /* @@ -1372,12 +1339,13 @@ ufs_rmdir(v) * non-empty.) */ error = 0; - if (ip->i_nlink != 2 || - !VN_DIREMPTY(ITOV(ip), ip, dp->i_number, cnp->cn_cred)) { + if (ip->i_ffs_nlink != 2 || + !ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) { error = ENOTEMPTY; goto out; } - if ((dp->i_flags & APPEND) || (ip->i_flags & (IMMUTABLE | APPEND))) { + if ((dp->i_ffs_flags & APPEND) || + (ip->i_ffs_flags & (IMMUTABLE | APPEND))) { error = EPERM; goto out; } @@ -1386,10 +1354,9 @@ ufs_rmdir(v) * inode. If we crash in between, the directory * will be reattached to lost+found, */ - error = VN_DIRREMOVE(dvp, cnp); - if (error != 0) + if ((error = ufs_dirremove(dvp, cnp)) != 0) goto out; - dp->i_nlink--; + dp->i_ffs_nlink--; dp->i_flag |= IN_CHANGE; cache_purge(dvp); vput(dvp); @@ -1405,7 +1372,7 @@ ufs_rmdir(v) * other hard links so decrement by 2 and * worry about them later. */ - ip->i_nlink -= 2; + ip->i_ffs_nlink -= 2; error = VOP_TRUNCATE(vp, (off_t)0, IO_SYNC, cnp->cn_cred, cnp->cn_proc); cache_purge(ITOV(ip)); @@ -1442,8 +1409,8 @@ ufs_symlink(v) len = strlen(ap->a_target); if (len < vp->v_mount->mnt_maxsymlinklen) { ip = VTOI(vp); - bcopy(ap->a_target, (char *)ip->i_shortlink, len); - ip->i_size = len; + bcopy(ap->a_target, (char *)ip->i_ffs_shortlink, len); + ip->i_ffs_size = len; ip->i_flag |= IN_CHANGE | IN_UPDATE; } else error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0, @@ -1554,7 +1521,7 @@ ufs_readdir(v) uio->uio_offset = off; } uio->uio_resid += lost; - *ap->a_eofflag = VTOI(ap->a_vp)->i_size <= uio->uio_offset; + *ap->a_eofflag = VTOI(ap->a_vp)->i_ffs_size <= uio->uio_offset; return (error); } @@ -1574,10 +1541,10 @@ ufs_readlink(v) register struct inode *ip = VTOI(vp); int isize; - isize = ip->i_size; + isize = ip->i_ffs_size; if (isize < vp->v_mount->mnt_maxsymlinklen || - (vp->v_mount->mnt_maxsymlinklen == 0 && ip->i_din.di_blocks == 0)) { - uiomove((char *)ip->i_shortlink, isize, ap->a_uio); + (vp->v_mount->mnt_maxsymlinklen == 0 && ip->i_ffs_blocks == 0)) { + uiomove((char *)ip->i_ffs_shortlink, isize, ap->a_uio); return (0); } return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred)); @@ -1961,7 +1928,7 @@ ufs_advlock(v) } */ *ap = v; register struct inode *ip = VTOI(ap->a_vp); - return (lf_advlock(&ip->i_lockf, ip->i_size, ap->a_id, ap->a_op, + return (lf_advlock(&ip->i_lockf, ip->i_ffs_size, ap->a_id, ap->a_op, ap->a_fl, ap->a_flags)); } @@ -1981,11 +1948,11 @@ ufs_vinit(mntp, specops, fifoops, vpp) vp = *vpp; ip = VTOI(vp); - switch(vp->v_type = IFTOVT(ip->i_mode)) { + switch(vp->v_type = IFTOVT(ip->i_ffs_mode)) { case VCHR: case VBLK: vp->v_op = specops; - if ((nvp = checkalias(vp, ip->i_rdev, mntp)) != NULL) { + if ((nvp = checkalias(vp, ip->i_ffs_rdev, mntp)) != NULL) { /* * Discard unneeded vnode, but save its inode. */ @@ -2060,8 +2027,8 @@ ufs_makeinode(mode, dvp, vpp, cnp) return (error); } ip = VTOI(tvp); - ip->i_gid = pdir->i_gid; - ip->i_uid = cnp->cn_cred->cr_uid; + ip->i_ffs_gid = pdir->i_ffs_gid; + ip->i_ffs_uid = cnp->cn_cred->cr_uid; #ifdef QUOTA if ((error = getinoquota(ip)) || (error = chkiq(ip, 1, cnp->cn_cred, 0))) { @@ -2073,15 +2040,16 @@ ufs_makeinode(mode, dvp, vpp, cnp) } #endif ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; - ip->i_mode = mode; + ip->i_ffs_mode = mode; tvp->v_type = IFTOVT(mode); /* Rest init'd in getnewvnode(). */ - ip->i_nlink = 1; - if ((ip->i_mode & ISGID) && !groupmember(ip->i_gid, cnp->cn_cred) && + ip->i_ffs_nlink = 1; + if ((ip->i_ffs_mode & ISGID) && + !groupmember(ip->i_ffs_gid, cnp->cn_cred) && suser(cnp->cn_cred, NULL)) - ip->i_mode &= ~ISGID; + ip->i_ffs_mode &= ~ISGID; if (cnp->cn_flags & ISWHITEOUT) - ip->i_flags |= UF_OPAQUE; + ip->i_ffs_flags |= UF_OPAQUE; /* * Make sure inode goes to disk before directory entry. @@ -2089,8 +2057,7 @@ ufs_makeinode(mode, dvp, vpp, cnp) TIMEVAL_TO_TIMESPEC(&time, &ts); if ((error = VOP_UPDATE(tvp, &ts, &ts, 1)) != 0) goto bad; - error = VN_DIRENTER(ip, dvp, cnp); - if (error != 0) + if ((error = ufs_direnter(ip, dvp, cnp)) != 0) goto bad; if ((cnp->cn_flags & SAVESTART) == 0) FREE(cnp->cn_pnbuf, M_NAMEI); @@ -2105,7 +2072,7 @@ bad: */ free(cnp->cn_pnbuf, M_NAMEI); vput(dvp); - ip->i_nlink = 0; + ip->i_ffs_nlink = 0; ip->i_flag |= IN_CHANGE; vput(tvp); return (error); diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h index cc4f2308b06..732ad0d0e21 100644 --- a/sys/ufs/ufs/ufsmount.h +++ b/sys/ufs/ufs/ufsmount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ufsmount.h,v 1.3 1996/06/27 06:42:09 downsj Exp $ */ +/* $OpenBSD: ufsmount.h,v 1.4 1997/05/30 08:35:22 downsj Exp $ */ /* $NetBSD: ufsmount.h,v 1.4 1994/12/21 20:00:23 mycroft Exp $ */ /* @@ -54,11 +54,11 @@ struct ufsmount { union { /* pointer to superblock */ struct fs *fs; /* FFS */ struct lfs *lfs; /* LFS */ - struct ext2_sb_info *e2fs; /* EXT2FS */ + struct m_ext2fs *e2fs; /* EXT2FS */ } ufsmount_u; #define um_fs ufsmount_u.fs #define um_lfs ufsmount_u.lfs -#define um_e2fs ufsmount_u.e2fs +#define um_e2fs ufsmount_u.e2fs #define um_e2fsb ufsmount_u.e2fs->s_es struct vnode *um_quotas[MAXQUOTAS]; /* pointer to quota files */ @@ -71,7 +71,6 @@ struct ufsmount { char um_qflags[MAXQUOTAS]; /* quota specific flags */ struct netexport um_export; /* export information */ u_int64_t um_savedmaxfilesize; /* XXX - limit maxfilesize */ - struct ufs_dirops *um_dirops; /* per-fs directory ops. */ }; /* |