diff options
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs.h | 16 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_alloc.c | 40 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_balloc.c | 16 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_bmap.c | 22 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_dinode.h | 12 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_dir.h | 10 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_extern.h | 18 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_inode.c | 130 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_lookup.c | 18 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_readwrite.c | 36 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_subr.c | 16 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vfsops.c | 8 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vnops.c | 54 |
13 files changed, 203 insertions, 193 deletions
diff --git a/sys/ufs/ext2fs/ext2fs.h b/sys/ufs/ext2fs/ext2fs.h index 8828d3be6ef..e1d7b8c4842 100644 --- a/sys/ufs/ext2fs/ext2fs.h +++ b/sys/ufs/ext2fs/ext2fs.h @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs.h,v 1.3 1997/06/12 21:09:30 downsj Exp $ */ +/* $NetBSD: ext2fs.h,v 1.1 1997/06/11 09:33:37 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -36,6 +35,7 @@ * SUCH DAMAGE. * * @(#)fs.h 8.10 (Berkeley) 10/27/94 + * Modified for ext2fs by Manuel Bouyer. */ /* @@ -166,7 +166,7 @@ struct m_ext2fs { * Filesystem clean flags */ #define E2FS_ISCLEAN 0x01 -#define E2FS_ERRORS 0x02 +#define E2FS_ERRORS 0x02 /* ext2 file system block group descriptor */ @@ -191,9 +191,9 @@ struct ext2_gd { /* * Macros for handling inode numbers: - * inode number to file system block offset. - * inode number to cylinder group number. - * inode number to file system block address. + * inode number to file system block offset. + * inode number to cylinder group number. + * inode number to file system block address. */ #define ino_to_cg(fs, x) (((x) - 1) / (fs)->e2fs.e2fs_ipg) #define ino_to_fsba(fs, x) \ diff --git a/sys/ufs/ext2fs/ext2fs_alloc.c b/sys/ufs/ext2fs/ext2fs_alloc.c index 598756da9e6..d22c9b46eaf 100644 --- a/sys/ufs/ext2fs/ext2fs_alloc.c +++ b/sys/ufs/ext2fs/ext2fs_alloc.c @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_alloc.c,v 1.3 1997/06/12 21:09:31 downsj Exp $ */ +/* $NetBSD: ext2fs_alloc.c,v 1.1 1997/06/11 09:33:41 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -36,6 +35,7 @@ * SUCH DAMAGE. * * @(#)ffs_alloc.c 8.11 (Berkeley) 10/27/94 + * Modified for ext2fs by Manuel Bouyer. */ #include <sys/param.h> @@ -63,7 +63,7 @@ static u_long ext2fs_dirpref __P((struct m_ext2fs *)); static void ext2fs_fserr __P((struct m_ext2fs *, u_int, char *)); static u_long ext2fs_hashalloc __P((struct inode *, int, long, int, daddr_t (*)(struct inode *, int, daddr_t, - int))); + int))); static daddr_t ext2fs_nodealloccg __P((struct inode *, int, daddr_t, int)); static daddr_t ext2fs_mapsearch __P((struct m_ext2fs *, char *, daddr_t)); @@ -76,13 +76,13 @@ static daddr_t ext2fs_mapsearch __P((struct m_ext2fs *, char *, daddr_t)); * 2) allocate a rotationally optimal block in the same cylinder. * 3) allocate a block in the same cylinder group. * 4) quadradically rehash into other cylinder groups, until an - * available block is located. + * available block is located. * If no block preference is given the following heirarchy is used * to allocate a block: * 1) allocate a block in the cylinder group that contains the - * inode for the file. + * inode for the file. * 2) quadradically rehash into other cylinder groups, until an - * available block is located. + * available block is located. */ int ext2fs_alloc(ip, lbn, bpref, cred, bnp) @@ -111,8 +111,8 @@ ext2fs_alloc(ip, lbn, bpref, cred, bnp) cg = ino_to_cg(fs, ip->i_number); else cg = dtog(fs, bpref); - bno = (daddr_t)ext2fs_hashalloc(ip, cg, (long)bpref, fs->e2fs_bsize, - ext2fs_alloccg); + bno = (daddr_t)ext2fs_hashalloc(ip, cg, bpref, fs->e2fs_bsize, + ext2fs_alloccg); if (bno > 0) { ip->i_e2fs_nblock += btodb(fs->e2fs_bsize); ip->i_flag |= IN_CHANGE | IN_UPDATE; @@ -133,12 +133,12 @@ nospace: * 1) allocate the preferred inode. * 2) allocate an inode in the same cylinder group. * 3) quadradically rehash into other cylinder groups, until an - * available inode is located. + * available inode is located. * If no inode preference is given the following heirarchy is used * to allocate an inode: * 1) allocate an inode in cylinder group 0. * 2) quadradically rehash into other cylinder groups, until an - * available inode is located. + * available inode is located. */ int ext2fs_valloc(v) @@ -168,7 +168,7 @@ ext2fs_valloc(v) cg = ext2fs_dirpref(fs); else cg = ino_to_cg(fs, pip->i_number); - ipref = cg * fs->e2fs.e2fs_ipg; + ipref = cg * fs->e2fs.e2fs_ipg + 1; ino = (ino_t)ext2fs_hashalloc(pip, cg, (long)ipref, mode, ext2fs_nodealloccg); if (ino == 0) goto noinodes; @@ -180,7 +180,7 @@ ext2fs_valloc(v) ip = VTOI(*ap->a_vpp); if (ip->i_e2fs_mode && ip->i_e2fs_nlink != 0) { printf("mode = 0%o, nlinks %d, inum = %d, fs = %s\n", - ip->i_e2fs_mode, ip->i_e2fs_nlink, ip->i_number, fs->e2fs_fsmnt); + ip->i_e2fs_mode, ip->i_e2fs_nlink, ip->i_number, fs->e2fs_fsmnt); panic("ext2fs_valloc: dup alloc"); } @@ -422,7 +422,7 @@ gotit: * allocate it using the following policy: * 1) allocate the requested inode. * 2) allocate the next available inode after the requested - * inode in the specified cylinder group. + * inode in the specified cylinder group. */ static daddr_t ext2fs_nodealloccg(ip, cg, ipref, mode) @@ -461,7 +461,7 @@ ext2fs_nodealloccg(ip, cg, ipref, mode) loc = skpc(0xff, len, &ibp[0]); if (loc == 0) { printf("cg = %d, ipref = %d, fs = %s\n", - cg, ipref, fs->e2fs_fsmnt); + cg, ipref, fs->e2fs_fsmnt); panic("ext2fs_nodealloccg: map corrupted"); /* NOTREACHED */ } @@ -522,7 +522,7 @@ ext2fs_blkfree(ip, bno) bno = dtogd(fs, bno); if (isclr(bbp, bno)) { printf("dev = 0x%x, block = %d, fs = %s\n", - ip->i_dev, bno, fs->e2fs_fsmnt); + ip->i_dev, bno, fs->e2fs_fsmnt); panic("blkfree: freeing free block"); } clrbit(bbp, bno); @@ -558,7 +558,7 @@ ext2fs_vfree(v) fs = pip->i_e2fs; if ((u_int)ino >= fs->e2fs.e2fs_icount || (u_int)ino < EXT2_FIRSTINO) panic("ifree: range: dev = 0x%x, ino = %d, fs = %s\n", - pip->i_dev, ino, fs->e2fs_fsmnt); + pip->i_dev, ino, fs->e2fs_fsmnt); cg = ino_to_cg(fs, ino); error = bread(pip->i_devvp, fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap), (int)fs->e2fs_bsize, NOCRED, &bp); @@ -570,7 +570,7 @@ ext2fs_vfree(v) ino = (ino - 1) % fs->e2fs.e2fs_ipg; if (isclr(ibp, ino)) { printf("dev = 0x%x, ino = %d, fs = %s\n", - pip->i_dev, ino, fs->e2fs_fsmnt); + pip->i_dev, ino, fs->e2fs_fsmnt); if (fs->e2fs_ronly == 0) panic("ifree: freeing free inode"); } @@ -617,7 +617,7 @@ ext2fs_mapsearch(fs, bbp, bpref) loc = skpc(0xff, len, &bbp[start]); if (loc == 0) { printf("start = %d, len = %d, fs = %s\n", - start, len, fs->e2fs_fsmnt); + start, len, fs->e2fs_fsmnt); panic("ext2fs_alloccg: map corrupted"); /* NOTREACHED */ } diff --git a/sys/ufs/ext2fs/ext2fs_balloc.c b/sys/ufs/ext2fs/ext2fs_balloc.c index 0f99c452516..29ebe7bb059 100644 --- a/sys/ufs/ext2fs/ext2fs_balloc.c +++ b/sys/ufs/ext2fs/ext2fs_balloc.c @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_balloc.c,v 1.3 1997/06/12 21:09:31 downsj Exp $ */ +/* $NetBSD: ext2fs_balloc.c,v 1.1 1997/06/11 09:33:44 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -36,6 +35,7 @@ * SUCH DAMAGE. * * @(#)ffs_balloc.c 8.4 (Berkeley) 9/23/93 + * Modified for ext2fs by Manuel Bouyer. */ #include <sys/param.h> @@ -97,8 +97,8 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) return (0); } else { error = ext2fs_alloc(ip, bn, - ext2fs_blkpref(ip, bn, (int)bn, &ip->i_e2fs_blocks[0]), - cred, &newb); + ext2fs_blkpref(ip, bn, (int)bn, &ip->i_e2fs_blocks[0]), + cred, &newb); if (error) return (error); ip->i_e2fs_last_lblk = lbn; @@ -130,7 +130,7 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) nb = ip->i_e2fs_blocks[NDADDR + indirs[0].in_off]; if (nb == 0) { pref = ext2fs_blkpref(ip, lbn, 0, (daddr_t *)0); - error = ext2fs_alloc(ip, lbn, pref, + error = ext2fs_alloc(ip, lbn, pref, cred, &newb); if (error) return (error); @@ -155,7 +155,7 @@ ext2fs_balloc(ip, bn, size, cred, bpp, flags) */ for (i = 1;;) { error = bread(vp, - indirs[i].in_lbn, (int)fs->e2fs_bsize, NOCRED, &bp); + indirs[i].in_lbn, (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return (error); diff --git a/sys/ufs/ext2fs/ext2fs_bmap.c b/sys/ufs/ext2fs/ext2fs_bmap.c index 942ac9b3165..d64eddf39d6 100644 --- a/sys/ufs/ext2fs/ext2fs_bmap.c +++ b/sys/ufs/ext2fs/ext2fs_bmap.c @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_bmap.c,v 1.3 1997/06/12 21:09:31 downsj Exp $ */ +/* $NetBSD: ext2fs_bmap.c,v 1.1 1997/06/11 09:33:46 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -41,6 +40,7 @@ * SUCH DAMAGE. * * @(#)ufs_bmap.c 8.6 (Berkeley) 1/21/94 + * Modified for ext2fs by Manuel Bouyer. */ #include <sys/param.h> @@ -89,7 +89,7 @@ ext2fs_bmap(v) return (0); return (ext2fs_bmaparray(ap->a_vp, ap->a_bn, ap->a_bnp, NULL, NULL, - ap->a_runp)); + ap->a_runp)); } /* @@ -157,9 +157,9 @@ ext2fs_bmaparray(vp, bn, bnp, ap, nump, runp) *bnp = -1; else if (runp) for (++bn; bn < NDADDR && *runp < maxrun && - is_sequential(ump, ip->i_e2fs_blocks[bn - 1], + is_sequential(ump, ip->i_e2fs_blocks[bn - 1], ip->i_e2fs_blocks[bn]); - ++bn, ++*runp); + ++bn, ++*runp); return (0); } @@ -209,10 +209,10 @@ ext2fs_bmaparray(vp, bn, bnp, ap, nump, runp) daddr = ((daddr_t *)bp->b_data)[xap->in_off]; if (num == 1 && daddr && runp) for (bn = xap->in_off + 1; - bn < MNINDIR(ump) && *runp < maxrun && - is_sequential(ump, ((daddr_t *)bp->b_data)[bn - 1], - ((daddr_t *)bp->b_data)[bn]); - ++bn, ++*runp); + bn < MNINDIR(ump) && *runp < maxrun && + is_sequential(ump, ((daddr_t *)bp->b_data)[bn - 1], + ((daddr_t *)bp->b_data)[bn]); + ++bn, ++*runp); } if (bp) brelse(bp); diff --git a/sys/ufs/ext2fs/ext2fs_dinode.h b/sys/ufs/ext2fs/ext2fs_dinode.h index 4320b50cd6f..5215322d30f 100644 --- a/sys/ufs/ext2fs/ext2fs_dinode.h +++ b/sys/ufs/ext2fs/ext2fs_dinode.h @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_dinode.h,v 1.3 1997/06/12 21:09:32 downsj Exp $ */ +/* $NetBSD: ext2fs_dinode.h,v 1.1 1997/06/11 09:33:48 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1982, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -41,6 +40,7 @@ * SUCH DAMAGE. * * @(#)dinode.h 8.6 (Berkeley) 9/13/94 + * Modified for ext2fs by Manuel Bouyer. */ #include <sys/stat.h> @@ -129,5 +129,5 @@ struct ext2fs_dinode { * di_db area. */ -#define e2di_rdev e2di_blocks[0] -#define e2di_shortlink e2di_blocks +#define e2di_rdev e2di_blocks[0] +#define e2di_shortlink e2di_blocks diff --git a/sys/ufs/ext2fs/ext2fs_dir.h b/sys/ufs/ext2fs/ext2fs_dir.h index ec926a6544d..c959023414b 100644 --- a/sys/ufs/ext2fs/ext2fs_dir.h +++ b/sys/ufs/ext2fs/ext2fs_dir.h @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_dir.h,v 1.3 1997/06/12 21:09:32 downsj Exp $ */ +/* $NetBSD: ext2fs_dir.h,v 1.1 1997/06/11 09:33:50 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -41,6 +40,7 @@ * SUCH DAMAGE. * * @(#)dir.h 8.4 (Berkeley) 8/10/94 + * Modified for ext2fs by Manuel Bouyer. */ #ifndef _EXT2FS_DIR_H_ @@ -95,7 +95,7 @@ struct ext2fs_direct { * terminating null byte, rounded up to a 4 byte boundary. */ #define EXT2FS_DIRSIZ(len) \ - (( 8 + len + 3) &~ 3) + (( 8 + len + 3) &~ 3) /* * Template for manipulating directories. Should use struct direct's, diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h index 09f52e68a12..8531676cb01 100644 --- a/sys/ufs/ext2fs/ext2fs_extern.h +++ b/sys/ufs/ext2fs/ext2fs_extern.h @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_extern.h,v 1.3 1997/06/12 21:09:33 downsj Exp $ */ +/* $NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $ */ /*- + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -36,6 +35,7 @@ * SUCH DAMAGE. * * @(#)ffs_extern.h 8.3 (Berkeley) 4/16/94 + * Modified for ext2fs by Manuel Bouyer. */ struct buf; @@ -60,7 +60,7 @@ __BEGIN_DECLS int ext2fs_alloc __P((struct inode *, daddr_t, daddr_t , struct ucred *, daddr_t *)); int ext2fs_realloccg __P((struct inode *, daddr_t, daddr_t, int, int , - struct ucred *, struct buf **)); + struct ucred *, struct buf **)); int ext2fs_reallocblks __P((void *)); int ext2fs_valloc __P((void *)); daddr_t ext2fs_blkpref __P((struct inode *, daddr_t, int, daddr_t *)); @@ -69,7 +69,7 @@ int ext2fs_vfree __P((void *)); /* ext2fs_balloc.c */ int ext2fs_balloc __P((struct inode *, daddr_t, int, struct ucred *, - struct buf **, int)); + struct buf **, int)); /* ext2fs_bmap.c */ int ext2fs_bmap __P((void *)); @@ -110,7 +110,7 @@ int ext2fs_statfs __P((struct mount *, struct statfs *, struct proc *)); int ext2fs_sync __P((struct mount *, int, struct ucred *, struct proc *)); int ext2fs_vget __P((struct mount *, ino_t, struct vnode **)); int ext2fs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); + struct vnode **, int *, struct ucred **)); int ext2fs_vptofh __P((struct vnode *, struct fid *)); int ext2fs_sbupdate __P((struct ufsmount *, int)); int ext2fs_cgupdate __P((struct ufsmount *, int)); @@ -134,8 +134,8 @@ int ext2fs_rmdir __P((void *)); int ext2fs_symlink __P((void *)); int ext2fs_readlink __P((void *)); int ext2fs_advlock __P((void *)); -int ext2fs_vinit __P(( struct mount *, int (**specops) __P((void *)), - int (**fifoops) __P((void *)), struct vnode **)); +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 *)); diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c index 32c6eea5ea1..7fa471e7814 100644 --- a/sys/ufs/ext2fs/ext2fs_inode.c +++ b/sys/ufs/ext2fs/ext2fs_inode.c @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_inode.c,v 1.3 1997/06/12 21:09:33 downsj Exp $ */ +/* $NetBSD: ext2fs_inode.c,v 1.1 1997/06/11 09:33:56 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -36,6 +35,7 @@ * SUCH DAMAGE. * * @(#)ffs_inode.c 8.8 (Berkeley) 10/19/94 + * Modified for ext2fs by Manuel Bouyer. */ #include <sys/param.h> @@ -66,13 +66,13 @@ static int ext2fs_indirtrunc __P((struct inode *, daddr_t, daddr_t, void ext2fs_init() { - static int done = 0; + static int done = 0; - if (done) - return; - done = 1; - ufs_ihashinit(); - return; + if (done) + return; + done = 1; + ufs_ihashinit(); + return; } /* @@ -80,55 +80,55 @@ ext2fs_init() */ int ext2fs_inactive(v) - void *v; + void *v; { - struct vop_inactive_args /* { - struct vnode *a_vp; - } */ *ap = v; - register struct vnode *vp = ap->a_vp; - register struct inode *ip = VTOI(vp); - struct timespec ts; - int error; - extern int prtactive; - - if (prtactive && vp->v_usecount != 0) - vprint("ffs_inactive: pushing active", vp); - /* Get rid of inodes related to stale file handles. */ - if (ip->i_e2fs_mode == 0 || ip->i_e2fs_dtime != 0) { - if ((vp->v_flag & VXLOCK) == 0) - vgone(vp); - return (0); - } - - error = 0; + struct vop_inactive_args /* { + struct vnode *a_vp; + } */ *ap = v; + register struct vnode *vp = ap->a_vp; + register struct inode *ip = VTOI(vp); + struct timespec ts; + int error; + extern int prtactive; + + if (prtactive && vp->v_usecount != 0) + vprint("ffs_inactive: pushing active", vp); + /* Get rid of inodes related to stale file handles. */ + if (ip->i_e2fs_mode == 0 || ip->i_e2fs_dtime != 0) { + if ((vp->v_flag & VXLOCK) == 0) + vgone(vp); + return (0); + } + + error = 0; #ifdef DIAGNOSTIC - if (VOP_ISLOCKED(vp)) - panic("ffs_inactive: locked inode"); - if (curproc) - ip->i_lockholder = curproc->p_pid; - else - ip->i_lockholder = -1; + if (VOP_ISLOCKED(vp)) + panic("ffs_inactive: locked inode"); + if (curproc) + ip->i_lockholder = curproc->p_pid; + else + ip->i_lockholder = -1; #endif - ip->i_flag |= IN_LOCKED; - if (ip->i_e2fs_nlink == 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { - error = VOP_TRUNCATE(vp, (off_t)0, 0, NOCRED, NULL); + ip->i_flag |= IN_LOCKED; + if (ip->i_e2fs_nlink == 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { + error = VOP_TRUNCATE(vp, (off_t)0, 0, NOCRED, NULL); TIMEVAL_TO_TIMESPEC(&time, &ts); ip->i_e2fs_dtime = ts.tv_sec; - ip->i_flag |= IN_CHANGE | IN_UPDATE; - VOP_VFREE(vp, ip->i_number, ip->i_e2fs_mode); - } - if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) { - TIMEVAL_TO_TIMESPEC(&time, &ts); - VOP_UPDATE(vp, &ts, &ts, 0); - } - VOP_UNLOCK(vp); - /* - * If we are done with the inode, reclaim it - * so that it can be reused immediately. - */ - if (vp->v_usecount == 0 && ip->i_e2fs_dtime != 0) - vgone(vp); - return (error); + ip->i_flag |= IN_CHANGE | IN_UPDATE; + VOP_VFREE(vp, ip->i_number, ip->i_e2fs_mode); + } + if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) { + TIMEVAL_TO_TIMESPEC(&time, &ts); + VOP_UPDATE(vp, &ts, &ts, 0); + } + VOP_UNLOCK(vp); + /* + * If we are done with the inode, reclaim it + * so that it can be reused immediately. + */ + if (vp->v_usecount == 0 && ip->i_e2fs_dtime != 0) + vgone(vp); + return (error); } @@ -165,8 +165,8 @@ ext2fs_update(v) ip->i_flag &= ~IN_MODIFIED; fs = ip->i_e2fs; error = bread(ip->i_devvp, - fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), - (int)fs->e2fs_bsize, NOCRED, &bp); + fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), + (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return (error); @@ -221,9 +221,9 @@ ext2fs_truncate(v) oip = VTOI(ovp); TIMEVAL_TO_TIMESPEC(&time, &ts); if (ovp->v_type == VLNK && - (oip->i_e2fs_size < ovp->v_mount->mnt_maxsymlinklen || - (ovp->v_mount->mnt_maxsymlinklen == 0 && - oip->i_e2fs_nblock == 0))) { + (oip->i_e2fs_size < ovp->v_mount->mnt_maxsymlinklen || + (ovp->v_mount->mnt_maxsymlinklen == 0 && + oip->i_e2fs_nblock == 0))) { #ifdef DIAGNOSTIC if (length != 0) panic("ext2fs_truncate: partial truncate of symlink"); @@ -348,7 +348,7 @@ ext2fs_truncate(v) bn = oip->i_e2fs_blocks[NDADDR + level]; if (bn != 0) { error = ext2fs_indirtrunc(oip, indir_lbn[level], - fsbtodb(fs, bn), lastiblock[level], level, &count); + fsbtodb(fs, bn), lastiblock[level], level, &count); if (error) allerror = error; blocksreleased += count; @@ -385,7 +385,7 @@ done: if (newblks[i] != oip->i_e2fs_blocks[i]) panic("itrunc2"); if (length == 0 && - (ovp->v_dirtyblkhd.lh_first || ovp->v_cleanblkhd.lh_first)) + (ovp->v_dirtyblkhd.lh_first || ovp->v_cleanblkhd.lh_first)) panic("itrunc3"); #endif /* DIAGNOSTIC */ /* @@ -484,14 +484,14 @@ ext2fs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) */ for (i = NINDIR(fs) - 1, nlbn = lbn + 1 - i * factor; i > last; - i--, nlbn += factor) { + i--, nlbn += factor) { nb = bap[i]; if (nb == 0) continue; if (level > SINGLE) { error = ext2fs_indirtrunc(ip, nlbn, fsbtodb(fs, nb), - (daddr_t)-1, level - 1, - &blkcount); + (daddr_t)-1, level - 1, + &blkcount); if (error) allerror = error; blocksreleased += blkcount; @@ -508,7 +508,7 @@ ext2fs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) nb = bap[i]; if (nb != 0) { error = ext2fs_indirtrunc(ip, nlbn, fsbtodb(fs, nb), - last, level - 1, &blkcount); + last, level - 1, &blkcount); if (error) allerror = error; blocksreleased += blkcount; diff --git a/sys/ufs/ext2fs/ext2fs_lookup.c b/sys/ufs/ext2fs/ext2fs_lookup.c index 1af31ab1869..66f53d55a33 100644 --- a/sys/ufs/ext2fs/ext2fs_lookup.c +++ b/sys/ufs/ext2fs/ext2fs_lookup.c @@ -1,7 +1,11 @@ -/* $OpenBSD: ext2fs_lookup.c,v 1.1 1997/05/30 05:18:51 downsj Exp $ */ - -/* Modified for EXT2FS on NetBSD by Manuel Bouyer, April 1997 */ +/* $OpenBSD: ext2fs_lookup.c,v 1.2 1997/06/12 21:09:34 downsj Exp $ */ +/* $NetBSD: ext2fs_lookup.c,v 1.1 1997/06/11 09:33:59 bouyer Exp $ */ +/* + * Modified for NetBSD 1.2E + * May 1997, Manuel Bouyer + * Laboratoire d'informatique de Paris VI + */ /* * modified for Lites 1.1 * @@ -281,8 +285,6 @@ ext2fs_lookup(v) /* * Check accessiblity of directory. */ - if ((dp->i_e2fs_mode & IFMT) != IFDIR) - return (ENOTDIR); if ((error = VOP_ACCESS(vdp, VEXEC, cred, cnp->cn_proc)) != 0) return (error); @@ -496,6 +498,12 @@ searchloop: if ((nameiop == CREATE || nameiop == RENAME) && (flags & ISLASTCN) && dp->i_e2fs_nlink != 0) { /* + * Creation of files on a read-only mounted file system + * is pointless, so don't proceed any further. + */ + if (vdp->v_mount->mnt_flag & MNT_RDONLY) + return (EROFS); + /* * Access for write is interpreted as allowing * creation of files in the directory. */ diff --git a/sys/ufs/ext2fs/ext2fs_readwrite.c b/sys/ufs/ext2fs/ext2fs_readwrite.c index 07719439534..dc9325b5f6d 100644 --- a/sys/ufs/ext2fs/ext2fs_readwrite.c +++ b/sys/ufs/ext2fs/ext2fs_readwrite.c @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_readwrite.c,v 1.3 1997/06/12 21:09:34 downsj Exp $ */ +/* $NetBSD: ext2fs_readwrite.c,v 1.1 1997/06/11 09:34:01 bouyer Exp $ */ /*- + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * @@ -36,6 +35,7 @@ * SUCH DAMAGE. * * @(#)ufs_readwrite.c 8.8 (Berkeley) 8/4/94 + * Modified for ext2fs by Manuel Bouyer. */ #include <sys/param.h> @@ -99,16 +99,18 @@ ext2fs_read(v) if (vp->v_type == VLNK) { if ((int)ip->i_e2fs_size < vp->v_mount->mnt_maxsymlinklen || - (vp->v_mount->mnt_maxsymlinklen == 0 && - ip->i_e2fs_nblock == 0)) + (vp->v_mount->mnt_maxsymlinklen == 0 && + ip->i_e2fs_nblock == 0)) panic("%s: short symlink", "ext2fs_read"); } else if (vp->v_type != VREG && vp->v_type != VDIR) panic("%s: type %d", "ext2fs_read", vp->v_type); #endif fs = ip->i_e2fs; - if ((u_int64_t)uio->uio_offset > + if ((u_int64_t)uio->uio_offset > ((u_int64_t)0x80000000 * fs->e2fs_bsize - 1)) return (EFBIG); + if (uio->uio_resid == 0) + return (0); for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { if ((bytesinfile = ip->i_e2fs_size - uio->uio_offset) <= 0) @@ -123,15 +125,15 @@ ext2fs_read(v) if (bytesinfile < xfersize) xfersize = bytesinfile; - if (lblktosize(fs, nextlbn) >= ip->i_e2fs_size) + if (lblktosize(fs, nextlbn) >= ip->i_e2fs_size) error = bread(vp, lbn, size, NOCRED, &bp); else if (doclusterread) error = cluster_read(vp, - ip->i_e2fs_size, lbn, size, NOCRED, &bp); + ip->i_e2fs_size, lbn, size, NOCRED, &bp); else if (lbn - 1 == vp->v_lastr) { int nextsize = fs->e2fs_bsize; error = breadn(vp, lbn, - size, &nextlbn, &nextsize, 1, NOCRED, &bp); + size, &nextlbn, &nextsize, 1, NOCRED, &bp); } else error = bread(vp, lbn, size, NOCRED, &bp); if (error) @@ -218,7 +220,7 @@ ext2fs_write(v) fs = ip->i_e2fs; if (uio->uio_offset < 0 || - (u_int64_t)uio->uio_offset + uio->uio_resid > + (u_int64_t)uio->uio_offset + uio->uio_resid > ((u_int64_t)0x80000000 * fs->e2fs_bsize - 1)) return (EFBIG); /* @@ -227,8 +229,8 @@ ext2fs_write(v) */ p = uio->uio_procp; if (vp->v_type == VREG && p && - uio->uio_offset + uio->uio_resid > - p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { + uio->uio_offset + uio->uio_resid > + p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { psignal(p, SIGXFSZ); return (EFBIG); } @@ -248,8 +250,8 @@ ext2fs_write(v) else flags &= ~B_CLRBUF; - error = ext2fs_balloc(ip, - lbn, blkoffset + xfersize, ap->a_cred, &bp, flags); + error = ext2fs_balloc(ip, + lbn, blkoffset + xfersize, ap->a_cred, &bp, flags); if (error) break; if (uio->uio_offset + xfersize > ip->i_e2fs_size) { @@ -263,7 +265,7 @@ ext2fs_write(v) xfersize = size; error = - uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); + uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); if (ioflag & IO_SYNC) (void)bwrite(bp); else if (xfersize + blkoffset == fs->e2fs_bsize) @@ -287,7 +289,7 @@ ext2fs_write(v) if (error) { if (ioflag & IO_UNIT) { (void)VOP_TRUNCATE(vp, osize, - ioflag & IO_SYNC, ap->a_cred, uio->uio_procp); + ioflag & IO_SYNC, ap->a_cred, uio->uio_procp); uio->uio_offset -= resid - uio->uio_resid; uio->uio_resid = resid; } diff --git a/sys/ufs/ext2fs/ext2fs_subr.c b/sys/ufs/ext2fs/ext2fs_subr.c index 7bd25576609..886079ab2e3 100644 --- a/sys/ufs/ext2fs/ext2fs_subr.c +++ b/sys/ufs/ext2fs/ext2fs_subr.c @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_subr.c,v 1.3 1997/06/12 21:09:35 downsj Exp $ */ +/* $NetBSD: ext2fs_subr.c,v 1.1 1997/06/11 09:34:03 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -36,6 +35,7 @@ * SUCH DAMAGE. * * @(#)ffs_subr.c 8.2 (Berkeley) 9/21/93 + * Modified for ext2fs by Manuel Bouyer. */ #include <sys/param.h> @@ -101,7 +101,7 @@ ext2fs_checkoverlap(bp, ip) last = start + btodb(bp->b_bcount) - 1; for (ep = buf; ep < ebp; ep++) { if (ep == bp || (ep->b_flags & B_INVAL) || - ep->b_vp == NULLVP) + ep->b_vp == NULLVP) continue; if (VOP_BMAP(ep->b_vp, (daddr_t)0, &vp, (daddr_t)0, NULL)) continue; @@ -109,12 +109,12 @@ ext2fs_checkoverlap(bp, ip) continue; /* look for overlap */ if (ep->b_bcount == 0 || ep->b_blkno > last || - ep->b_blkno + btodb(ep->b_bcount) <= start) + ep->b_blkno + btodb(ep->b_bcount) <= start) continue; vprint("Disk overlap", vp); printf("\tstart %d, end %d overlap start %d, end %ld\n", - start, last, ep->b_blkno, - ep->b_blkno + btodb(ep->b_bcount) - 1); + start, last, ep->b_blkno, + ep->b_blkno + btodb(ep->b_bcount) - 1); panic("Disk buffer overlap"); } } diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 47e016d98a3..310b70c0ef8 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.3 1997/06/12 21:09:35 downsj Exp $ */ +/* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1989, 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -36,6 +35,7 @@ * SUCH DAMAGE. * * @(#)ffs_vfsops.c 8.14 (Berkeley) 11/28/94 + * Modified for ext2fs by Manuel Bouyer. */ #include <sys/param.h> diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index b14f47ef00c..399791c3895 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,9 +1,8 @@ -/* $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 */ +/* $OpenBSD: ext2fs_vnops.c,v 1.3 1997/06/12 21:09:36 downsj Exp $ */ +/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */ /* + * Copyright (c) 1997 Manuel Bouyer. * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -41,6 +40,7 @@ * SUCH DAMAGE. * * @(#)ufs_vnops.c 8.14 (Berkeley) 10/26/94 + * Modified for ext2fs by Manuel Bouyer. */ #include <sys/param.h> @@ -110,7 +110,7 @@ ext2fs_create(v) struct vattr *a_vap; } */ *ap = v; return - ext2fs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode), + ext2fs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode), ap->a_dvp, ap->a_vpp, ap->a_cnp); } @@ -134,8 +134,8 @@ ext2fs_mknod(v) int error; if ((error = - ext2fs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), - ap->a_dvp, vpp, ap->a_cnp)) != 0) + ext2fs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), + ap->a_dvp, vpp, ap->a_cnp)) != 0) return (error); ip = VTOI(*vpp); ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; @@ -179,7 +179,7 @@ ext2fs_open(v) * Files marked append-only must be opened for appending. */ if ((VTOI(ap->a_vp)->i_e2fs_flags & EXT2_APPEND) && - (ap->a_mode & (FWRITE | O_APPEND)) == FWRITE) + (ap->a_mode & (FWRITE | O_APPEND)) == FWRITE) return (EPERM); return (0); } @@ -209,8 +209,8 @@ ext2fs_access(v) if ((mode & VWRITE) && (ip->i_e2fs_flags & EXT2_IMMUTABLE)) return (EPERM); - return (vaccess(ip->i_e2fs_mode, ip->i_e2fs_uid, ip->i_e2fs_gid, mode, - ap->a_cred)); + return (vaccess(vp->v_type, ip->i_e2fs_uid, ip->i_e2fs_gid, mode, + ap->a_cred)); } /* ARGSUSED */ @@ -234,7 +234,7 @@ ext2fs_getattr(v) */ vap->va_fsid = ip->i_dev; vap->va_fileid = ip->i_number; - vap->va_mode = ip->i_e2fs_mode & ~IFMT; + vap->va_mode = ip->i_e2fs_mode & ALLPERMS; vap->va_nlink = ip->i_e2fs_nlink; vap->va_uid = ip->i_e2fs_uid; vap->va_gid = ip->i_e2fs_gid; @@ -291,23 +291,23 @@ ext2fs_setattr(v) * Check for unsettable attributes. */ if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) || - (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) || - (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) || - ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) { + (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) || + (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) || + ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) { return (EINVAL); } if (vap->va_flags != VNOVAL) { if (cred->cr_uid != ip->i_e2fs_uid && - (error = suser(cred, &p->p_acflag))) + (error = suser(cred, &p->p_acflag))) return (error); #ifdef EXT2FS_SYSTEM_FLAGS if (cred->cr_uid == 0) { if ((ip->i_e2fs_flags & (EXT2_APPEND | EXT2_IMMUTABLE)) && - securelevel > 0) + securelevel > 0) return (EPERM); ip->i_e2fs_flags &= ~(EXT2_APPEND | EXT2_IMMUTABLE); ip->i_e2fs_flags |= (vap->va_flags & SF_APPEND) ? EXT2_APPEND : 0 | - (vap->va_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0; + (vap->va_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0; } else { return (EPERM); } @@ -340,9 +340,9 @@ ext2fs_setattr(v) ip = VTOI(vp); if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) { if (cred->cr_uid != ip->i_e2fs_uid && - (error = suser(cred, &p->p_acflag)) && - ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || - (error = VOP_ACCESS(vp, VWRITE, cred, p)))) + (error = suser(cred, &p->p_acflag)) && + ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || + (error = VOP_ACCESS(vp, VWRITE, cred, p)))) return (error); if (vap->va_atime.tv_sec != VNOVAL) if (!(vp->v_mount->mnt_flag & MNT_NOATIME)) @@ -374,7 +374,7 @@ ext2fs_chmod(vp, mode, cred, p) int error; if (cred->cr_uid != ip->i_e2fs_uid && - (error = suser(cred, &p->p_acflag))) + (error = suser(cred, &p->p_acflag))) return (error); if (cred->cr_uid) { if (vp->v_type != VDIR && (mode & S_ISTXT)) @@ -417,8 +417,8 @@ ext2fs_chown(vp, uid, gid, cred, p) * the caller must be superuser or the call fails. */ if ((cred->cr_uid != ip->i_e2fs_uid || uid != ip->i_e2fs_uid || - (gid != ip->i_e2fs_gid && !groupmember((gid_t)gid, cred))) && - (error = suser(cred, &p->p_acflag))) + (gid != ip->i_e2fs_gid && !groupmember((gid_t)gid, cred))) && + (error = suser(cred, &p->p_acflag))) return (error); ogid = ip->i_e2fs_gid; ouid = ip->i_e2fs_uid; @@ -454,12 +454,12 @@ ext2fs_remove(v) } ip = VTOI(vp); if ((ip->i_e2fs_flags & (EXT2_IMMUTABLE | EXT2_APPEND)) || - (VTOI(dvp)->i_e2fs_flags & EXT2_APPEND)) { + (VTOI(dvp)->i_e2fs_flags & EXT2_APPEND)) { error = EPERM; goto out; } - error = ext2fs_dirremove(dvp, ap->a_cnp); - if (error == 0) { + error = ext2fs_dirremove(dvp, ap->a_cnp); + if (error == 0) { ip->i_e2fs_nlink--; ip->i_flag |= IN_CHANGE; } @@ -979,7 +979,7 @@ ext2fs_mkdir(v) error = EMLINK; goto out; } - dmode = vap->va_mode & 0777; + dmode = vap->va_mode & ACCESSPERMS; dmode |= IFDIR; /* * Must simulate part of ext2fs_makeinode here to acquire the inode, |