diff options
Diffstat (limited to 'sys/gnu/fs')
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_alloc.c | 43 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_extern.h | 8 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_inode.c | 29 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_lookup.c | 14 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_mount.h | 11 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_readwrite.c | 2 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_subr.c | 26 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vfsops.c | 4 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vnops.c | 7 |
9 files changed, 70 insertions, 74 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_alloc.c b/sys/gnu/fs/ext2fs/ext2_alloc.c index 64e9b87..f78b6a5 100644 --- a/sys/gnu/fs/ext2fs/ext2_alloc.c +++ b/sys/gnu/fs/ext2fs/ext2_alloc.c @@ -56,6 +56,7 @@ #include <ufs/ufs/quota.h> #include <ufs/ufs/inode.h> +#include <ufs/ufs/ufsmount.h> #include <gnu/ext2fs/ext2_fs.h> #include <gnu/ext2fs/ext2_fs_sb.h> @@ -383,26 +384,22 @@ fail: * ext2_new_inode(), to make sure we get the policies right */ int -ext2_valloc(ap) - struct vop_valloc_args /* { - struct vnode *a_pvp; - int a_mode; - struct ucred *a_cred; - struct vnode **a_vpp; - } */ *ap; +ext2_valloc(pvp, mode, cred, vpp) + struct vnode *pvp; + int mode; + struct ucred *cred; + struct vnode **vpp; { - register struct vnode *pvp = ap->a_pvp; register struct inode *pip; register struct ext2_sb_info *fs; register struct inode *ip; - mode_t mode = ap->a_mode; ino_t ino; int i, error; #if !defined(__FreeBSD__) struct timeval time; #endif - *ap->a_vpp = NULL; + *vpp = NULL; pip = VTOI(pvp); fs = pip->i_e2fs; if (fs->s_es->s_free_inodes_count == 0) @@ -413,12 +410,12 @@ ext2_valloc(ap) if (ino == 0) goto noinodes; - error = VFS_VGET(pvp->v_mount, ino, ap->a_vpp); + error = VFS_VGET(pvp->v_mount, ino, vpp); if (error) { - VOP_VFREE(pvp, ino, mode); + UFS_VFREE(pvp, ino, mode); return (error); } - ip = VTOI(*ap->a_vpp); + ip = VTOI(*vpp); /* the question is whether using VGET was such good idea at all - @@ -448,7 +445,7 @@ printf("ext2_valloc: allocated inode %d\n", ino); */ return (0); noinodes: - ext2_fserr(fs, ap->a_cred->cr_uid, "out of inodes"); + ext2_fserr(fs, cred->cr_uid, "out of inodes"); uprintf("\n%s: create/symlink failed, no inodes free\n", fs->fs_fsmnt); return (ENOSPC); } @@ -525,25 +522,21 @@ ext2_blkfree(ip, bno, size) * the maintenance of the actual bitmaps is again up to the linux code */ int -ext2_vfree(ap) - struct vop_vfree_args /* { - struct vnode *a_pvp; - ino_t a_ino; - int a_mode; - } */ *ap; +ext2_vfree(pvp, ino, mode) + struct vnode *pvp; + ino_t ino; + int mode; { register struct ext2_sb_info *fs; register struct inode *pip; - ino_t ino = ap->a_ino; - int mode; - pip = VTOI(ap->a_pvp); + pip = VTOI(pvp); fs = pip->i_e2fs; if ((u_int)ino >= fs->s_inodes_per_group * fs->s_groups_count) panic("ifree: range: dev = 0x%x, ino = %d, fs = %s", pip->i_dev, ino, fs->fs_fsmnt); -/* ext2_debug("ext2_vfree (%d, %d) called\n", pip->i_number, ap->a_mode); +/* ext2_debug("ext2_vfree (%d, %d) called\n", pip->i_number, mode); */ ext2_discard_prealloc(pip); @@ -553,7 +546,7 @@ ext2_vfree(ap) 'set i_mode to zero to denote an unused inode' is */ mode = pip->i_mode; - pip->i_mode = ap->a_mode; + pip->i_mode = mode; ext2_free_inode(pip); pip->i_mode = mode; return (0); diff --git a/sys/gnu/fs/ext2fs/ext2_extern.h b/sys/gnu/fs/ext2fs/ext2_extern.h index 4c32799..b185f52 100644 --- a/sys/gnu/fs/ext2fs/ext2_extern.h +++ b/sys/gnu/fs/ext2fs/ext2_extern.h @@ -53,7 +53,7 @@ int ext2_alloc __P((struct inode *, daddr_t, daddr_t, int, struct ucred *, daddr_t *)); int ext2_balloc __P((struct inode *, daddr_t, int, struct ucred *, struct buf **, int)); -int ext2_blkatoff __P((struct vop_blkatoff_args *)); +int ext2_blkatoff __P((struct vnode *, off_t, char **, struct buf **)); void ext2_blkfree __P((struct inode *, daddr_t, long)); daddr_t ext2_blkpref __P((struct inode *, daddr_t, int, daddr_t *, daddr_t)); int ext2_bmap __P((struct vop_bmap_args *)); @@ -61,10 +61,10 @@ int ext2_init __P((struct vfsconf *)); int ext2_reallocblks __P((struct vop_reallocblks_args *)); int ext2_reclaim __P((struct vop_reclaim_args *)); void ext2_setblock __P((struct ext2_sb_info *, u_char *, daddr_t)); -int ext2_truncate __P((struct vop_truncate_args *)); +int ext2_truncate __P((struct vnode *, off_t, int, struct ucred *, struct proc *)); int ext2_update __P((struct vop_update_args *)); -int ext2_valloc __P((struct vop_valloc_args *)); -int ext2_vfree __P((struct vop_vfree_args *)); +int ext2_valloc __P((struct vnode *, int, struct ucred *, struct vnode **)); +int ext2_vfree __P((struct vnode *, ino_t, int)); int ext2_lookup __P((struct vop_cachedlookup_args *)); int ext2_readdir __P((struct vop_readdir_args *)); void ext2_print_dinode __P((struct dinode *)); diff --git a/sys/gnu/fs/ext2fs/ext2_inode.c b/sys/gnu/fs/ext2fs/ext2_inode.c index bc2b1e6..0514022 100644 --- a/sys/gnu/fs/ext2fs/ext2_inode.c +++ b/sys/gnu/fs/ext2fs/ext2_inode.c @@ -156,21 +156,18 @@ ext2_update(ap) * disk blocks. */ int -ext2_truncate(ap) - struct vop_truncate_args /* { - struct vnode *a_vp; - off_t a_length; - int a_flags; - struct ucred *a_cred; - struct proc *a_p; - } */ *ap; +ext2_truncate(vp, length, flags, cred, p) + struct vnode *vp; + off_t length; + int flags; + struct ucred *cred; + struct proc *p; { - register struct vnode *ovp = ap->a_vp; + register struct vnode *ovp = vp; register daddr_t lastblock; register struct inode *oip; daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR]; daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; - off_t length = ap->a_length; register struct ext2_sb_info *fs; struct buf *bp; int offset, size, level; @@ -180,7 +177,7 @@ ext2_truncate(ap) int aflags, error, allerror; off_t osize; /* -printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, ap->a_length); +printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length); */ /* * negative file sizes will totally break the code below and * are not meaningful anyways. @@ -221,10 +218,10 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, ap->a_length); offset = blkoff(fs, length - 1); lbn = lblkno(fs, length - 1); aflags = B_CLRBUF; - if (ap->a_flags & IO_SYNC) + if (flags & IO_SYNC) aflags |= B_SYNC; vnode_pager_setsize(ovp, length); - if (error = ext2_balloc(oip, lbn, offset + 1, ap->a_cred, &bp, + if (error = ext2_balloc(oip, lbn, offset + 1, cred, &bp, aflags)) return (error); oip->i_size = length; @@ -252,9 +249,9 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, ap->a_length); } else { lbn = lblkno(fs, length); aflags = B_CLRBUF; - if (ap->a_flags & IO_SYNC) + if (flags & IO_SYNC) aflags |= B_SYNC; - if (error = ext2_balloc(oip, lbn, offset, ap->a_cred, &bp, + if (error = ext2_balloc(oip, lbn, offset, cred, &bp, aflags)) return (error); oip->i_size = length; @@ -307,7 +304,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, ap->a_length); bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof oldblks); oip->i_size = osize; vflags = ((length > 0) ? V_SAVE : 0) | V_SAVEMETA; - allerror = vinvalbuf(ovp, vflags, ap->a_cred, ap->a_p, 0, 0); + allerror = vinvalbuf(ovp, vflags, cred, p, 0, 0); /* * Indirect blocks first. diff --git a/sys/gnu/fs/ext2fs/ext2_lookup.c b/sys/gnu/fs/ext2fs/ext2_lookup.c index 07991e9..686e89d 100644 --- a/sys/gnu/fs/ext2fs/ext2_lookup.c +++ b/sys/gnu/fs/ext2fs/ext2_lookup.c @@ -349,7 +349,7 @@ ext2_lookup(ap) } else { dp->i_offset = dp->i_diroff; if ((entryoffsetinblock = dp->i_offset & bmask) && - (error = VOP_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp))) + (error = UFS_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp))) return (error); numdirpasses = 2; nchstats.ncs_2passes++; @@ -367,7 +367,7 @@ searchloop: if (bp != NULL) brelse(bp); if (error = - VOP_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp)) + UFS_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp)) return (error); entryoffsetinblock = 0; } @@ -802,7 +802,7 @@ ext2_direnter(ip, dvp, cnp) /* * Get the block containing the space for the new directory entry. */ - if (error = VOP_BLKATOFF(dvp, (off_t)dp->i_offset, &dirbuf, &bp)) + if (error = UFS_BLKATOFF(dvp, (off_t)dp->i_offset, &dirbuf, &bp)) return (error); /* * Find space for the new entry. In the simple case, the entry at @@ -848,7 +848,7 @@ ext2_direnter(ip, dvp, cnp) error = VOP_BWRITE(bp); dp->i_flag |= IN_CHANGE | IN_UPDATE; if (!error && dp->i_endoff && dp->i_endoff < dp->i_size) - error = VOP_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_SYNC, + error = UFS_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_SYNC, cnp->cn_cred, cnp->cn_proc); return (error); } @@ -881,7 +881,7 @@ ext2_dirremove(dvp, cnp) * First entry in block: set d_ino to zero. */ if (error = - VOP_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep, &bp)) + UFS_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep, &bp)) return (error); ep->inode = 0; error = VOP_BWRITE(bp); @@ -891,7 +891,7 @@ ext2_dirremove(dvp, cnp) /* * Collapse new free space into previous entry. */ - if (error = VOP_BLKATOFF(dvp, (off_t)(dp->i_offset - dp->i_count), + if (error = UFS_BLKATOFF(dvp, (off_t)(dp->i_offset - dp->i_count), (char **)&ep, &bp)) return (error); ep->rec_len += dp->i_reclen; @@ -915,7 +915,7 @@ ext2_dirrewrite(dp, ip, cnp) struct vnode *vdp = ITOV(dp); int error; - if (error = VOP_BLKATOFF(vdp, (off_t)dp->i_offset, (char **)&ep, &bp)) + if (error = UFS_BLKATOFF(vdp, (off_t)dp->i_offset, (char **)&ep, &bp)) return (error); ep->inode = ip->i_number; error = VOP_BWRITE(bp); diff --git a/sys/gnu/fs/ext2fs/ext2_mount.h b/sys/gnu/fs/ext2fs/ext2_mount.h index d57dd59..50bfe57 100644 --- a/sys/gnu/fs/ext2fs/ext2_mount.h +++ b/sys/gnu/fs/ext2fs/ext2_mount.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ufsmount.h 8.6 (Berkeley) 3/30/95 - * $Id: ufsmount.h,v 1.9 1997/10/10 18:18:13 phk Exp $ + * $Id: ufsmount.h,v 1.10 1997/10/12 20:26:28 phk Exp $ */ #ifndef _UFS_UFS_UFSMOUNT_H_ @@ -97,8 +97,17 @@ struct ufsmount { struct netexport um_export; /* export information */ int64_t um_savedmaxfilesize; /* XXX - limit maxfilesize */ struct malloc_type *um_malloctype; /* The inodes malloctype */ + int (*um_blkatoff) __P((struct vnode *, off_t, char **, struct buf **)); + int (*um_truncate) __P((struct vnode *, off_t, int, struct ucred *, struct proc *)); + int (*um_valloc) __P((struct vnode *, int, struct ucred *, struct vnode **)); + int (*um_vfree) __P((struct vnode *, ino_t, int)); }; +#define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd) +#define UFS_TRUNCATE(aa, bb, cc, dd, ee) VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd, ee) +#define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd) +#define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc) + /* * Flags describing the state of quotas. */ diff --git a/sys/gnu/fs/ext2fs/ext2_readwrite.c b/sys/gnu/fs/ext2fs/ext2_readwrite.c index 986bc14..e1ab506 100644 --- a/sys/gnu/fs/ext2fs/ext2_readwrite.c +++ b/sys/gnu/fs/ext2fs/ext2_readwrite.c @@ -307,7 +307,7 @@ WRITE(ap) ip->i_mode &= ~(ISUID | ISGID); if (error) { if (ioflag & IO_UNIT) { - (void)VOP_TRUNCATE(vp, osize, + (void)UFS_TRUNCATE(vp, osize, ioflag & IO_SYNC, ap->a_cred, uio->uio_procp); uio->uio_offset -= resid - uio->uio_resid; uio->uio_resid = resid; diff --git a/sys/gnu/fs/ext2fs/ext2_subr.c b/sys/gnu/fs/ext2fs/ext2_subr.c index 399f973..8083b96 100644 --- a/sys/gnu/fs/ext2fs/ext2_subr.c +++ b/sys/gnu/fs/ext2fs/ext2_subr.c @@ -56,13 +56,11 @@ * remaining space in the directory. */ int -ext2_blkatoff(ap) - struct vop_blkatoff_args /* { - struct vnode *a_vp; - off_t a_offset; - char **a_res; - struct buf **a_bpp; - } */ *ap; +ext2_blkatoff(vp, offset, res, bpp) + struct vnode *vp; + off_t offset; + char **res; + struct buf **bpp; { struct inode *ip; register struct ext2_sb_info *fs; @@ -70,19 +68,19 @@ ext2_blkatoff(ap) daddr_t lbn; int bsize, error; - ip = VTOI(ap->a_vp); + ip = VTOI(vp); fs = ip->i_e2fs; - lbn = lblkno(fs, ap->a_offset); + lbn = lblkno(fs, offset); bsize = blksize(fs, ip, lbn); - *ap->a_bpp = NULL; - if (error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) { + *bpp = NULL; + if (error = bread(vp, lbn, bsize, NOCRED, &bp)) { brelse(bp); return (error); } - if (ap->a_res) - *ap->a_res = (char *)bp->b_data + blkoff(fs, ap->a_offset); - *ap->a_bpp = bp; + if (res) + *res = (char *)bp->b_data + blkoff(fs, offset); + *bpp = bp; return (0); } diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 9338279..95ffa52 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -621,6 +621,10 @@ ext2_mountfs(devvp, mp, p) ump = bsd_malloc(sizeof *ump, M_UFSMNT, M_WAITOK); bzero((caddr_t)ump, sizeof *ump); ump->um_malloctype = M_EXT2NODE; + ump->um_blkatoff = ext2_blkatoff; + ump->um_truncate = ext2_truncate; + ump->um_valloc = ext2_valloc; + ump->um_vfree = ext2_vfree; /* I don't know whether this is the right strategy. Note that we dynamically allocate both a ext2_sb_info and a ext2_super_block while Linux keeps the super block in a locked buffer diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c index 97225aa..48b5907 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -69,6 +69,7 @@ #endif #include <ufs/ufs/quota.h> #include <ufs/ufs/inode.h> +#include <ufs/ufs/ufsmount.h> #include <ufs/ufs/ufs_extern.h> #include <ufs/ffs/ffs_extern.h> @@ -84,17 +85,13 @@ static int ext2_write __P((struct vop_write_args *)); vop_t **ext2_vnodeop_p; static struct vnodeopv_entry_desc ext2_vnodeop_entries[] = { { &vop_default_desc, (vop_t *) ufs_vnoperate }, - { &vop_blkatoff_desc, (vop_t *) ext2_blkatoff }, { &vop_cachedlookup_desc, (vop_t *) ext2_lookup }, { &vop_fsync_desc, (vop_t *) ext2_fsync }, { &vop_inactive_desc, (vop_t *) ext2_inactive }, { &vop_read_desc, (vop_t *) ext2_read }, { &vop_readdir_desc, (vop_t *) ext2_readdir }, { &vop_reallocblks_desc, (vop_t *) ext2_reallocblks }, - { &vop_truncate_desc, (vop_t *) ext2_truncate }, { &vop_update_desc, (vop_t *) ext2_update }, - { &vop_valloc_desc, (vop_t *) ext2_valloc }, - { &vop_vfree_desc, (vop_t *) ext2_vfree }, { &vop_write_desc, (vop_t *) ext2_write }, { NULL, NULL } }; @@ -107,7 +104,6 @@ static struct vnodeopv_entry_desc ext2_specop_entries[] = { { &vop_fsync_desc, (vop_t *) ext2_fsync }, { &vop_inactive_desc, (vop_t *) ext2_inactive }, { &vop_update_desc, (vop_t *) ext2_update }, - { &vop_vfree_desc, (vop_t *) ext2_vfree }, { NULL, NULL } }; static struct vnodeopv_desc ext2fs_specop_opv_desc = @@ -119,7 +115,6 @@ static struct vnodeopv_entry_desc ext2_fifoop_entries[] = { { &vop_fsync_desc, (vop_t *) ext2_fsync }, { &vop_inactive_desc, (vop_t *) ext2_inactive }, { &vop_update_desc, (vop_t *) ext2_update }, - { &vop_vfree_desc, (vop_t *) ext2_vfree }, { NULL, NULL } }; static struct vnodeopv_desc ext2fs_fifoop_opv_desc = |