diff options
author | phk <phk@FreeBSD.org> | 1997-10-16 10:50:27 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1997-10-16 10:50:27 +0000 |
commit | d166441755d9516e482ede0d988b7989be25b10a (patch) | |
tree | ad2fb706565dc877eddf12a6581bfa2467513503 /sys/fs/cd9660 | |
parent | efcfb5d9cd2ecb3d30ec4c7701bfe737dc1b4606 (diff) | |
download | FreeBSD-src-d166441755d9516e482ede0d988b7989be25b10a.zip FreeBSD-src-d166441755d9516e482ede0d988b7989be25b10a.tar.gz |
VFS mega cleanup commit (x/N)
1. Add new file "sys/kern/vfs_default.c" where default actions for
VOPs go. Implement proper defaults for ABORTOP, BWRITE, LEASE,
POLL, REVOKE and STRATEGY. Various stuff spread over the entire
tree belongs here.
2. Change VOP_BLKATOFF to a normal function in cd9660.
3. Kill VOP_BLKATOFF, VOP_TRUNCATE, VOP_VFREE, VOP_VALLOC. These
are private interface functions between UFS and the underlying
storage manager layer (FFS/LFS/MFS/EXT2FS). The functions now
live in struct ufsmount instead.
4. Remove a kludge of VOP_ functions in all filesystems, that did
nothing but obscure the simplicity and break the expandability.
If a filesystem doesn't implement VOP_FOO, it shouldn't have an
entry for it in its vnops table. The system will try to DTRT
if it is not implemented. There are still some cruft left, but
the bulk of it is done.
5. Fix another VCALL in vfs_cache.c (thanks Bruce!)
Diffstat (limited to 'sys/fs/cd9660')
-rw-r--r-- | sys/fs/cd9660/cd9660_lookup.c | 34 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_node.c | 6 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_node.h | 5 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_vfsops.c | 6 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_vnops.c | 69 |
5 files changed, 28 insertions, 92 deletions
diff --git a/sys/fs/cd9660/cd9660_lookup.c b/sys/fs/cd9660/cd9660_lookup.c index d416a98..cf36e92 100644 --- a/sys/fs/cd9660/cd9660_lookup.c +++ b/sys/fs/cd9660/cd9660_lookup.c @@ -38,7 +38,7 @@ * from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91 * * @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94 - * $Id: cd9660_lookup.c,v 1.17 1997/08/26 07:32:30 phk Exp $ + * $Id: cd9660_lookup.c,v 1.18 1997/09/10 19:43:15 phk Exp $ */ #include <sys/param.h> @@ -165,7 +165,7 @@ cd9660_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 = cd9660_blkatoff(vdp, (off_t)dp->i_offset, NULL, &bp))) return (error); numdirpasses = 2; nchstats.ncs_2passes++; @@ -183,7 +183,7 @@ searchloop: if (bp != NULL) brelse(bp); if (error = - VOP_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp)) + cd9660_blkatoff(vdp, (off_t)dp->i_offset, NULL, &bp)) return (error); entryoffsetinblock = 0; } @@ -280,7 +280,7 @@ foundino: lblkno(imp, saveoffset)) { if (bp != NULL) brelse(bp); - if (error = VOP_BLKATOFF(vdp, + if (error = cd9660_blkatoff(vdp, (off_t)saveoffset, NULL, &bp)) return (error); } @@ -394,13 +394,11 @@ found: * remaining space in the directory. */ int -cd9660_blkatoff(ap) - struct vop_blkatoff_args /* { - struct vnode *a_vp; - off_t a_offset; - char **a_res; - struct buf **a_bpp; - } */ *ap; +cd9660_blkatoff(vp, offset, res, bpp) + struct vnode *vp; + off_t offset; + char **res; + struct buf **bpp; { struct iso_node *ip; register struct iso_mnt *imp; @@ -408,18 +406,18 @@ cd9660_blkatoff(ap) daddr_t lbn; int bsize, error; - ip = VTOI(ap->a_vp); + ip = VTOI(vp); imp = ip->i_mnt; - lbn = lblkno(imp, ap->a_offset); + lbn = lblkno(imp, offset); bsize = blksize(imp, ip, lbn); - if (error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) { + if (error = bread(vp, lbn, bsize, NOCRED, &bp)) { brelse(bp); - *ap->a_bpp = NULL; + *bpp = NULL; return (error); } - if (ap->a_res) - *ap->a_res = (char *)bp->b_data + blkoff(imp, ap->a_offset); - *ap->a_bpp = bp; + if (res) + *res = (char *)bp->b_data + blkoff(imp, offset); + *bpp = bp; return (0); } diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c index 8db9633..0ac56f8 100644 --- a/sys/fs/cd9660/cd9660_node.c +++ b/sys/fs/cd9660/cd9660_node.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94 - * $Id: cd9660_node.c,v 1.19 1997/04/14 18:15:45 phk Exp $ + * $Id: cd9660_node.c,v 1.20 1997/08/02 14:31:18 bde Exp $ */ #include <sys/param.h> @@ -241,7 +241,7 @@ cd9660_defattr(isodir, inop, bp, ftype) if (!bp && ((imp = inop->i_mnt)->im_flags & ISOFSMNT_EXTATT) && (off = isonum_711(isodir->ext_attr_length))) { - VOP_BLKATOFF(ITOV(inop), (off_t)-(off << imp->im_bshift), NULL, + cd9660_blkatoff(ITOV(inop), (off_t)-(off << imp->im_bshift), NULL, &bp2); bp = bp2; } @@ -293,7 +293,7 @@ cd9660_deftstamp(isodir,inop,bp,ftype) if (!bp && ((imp = inop->i_mnt)->im_flags & ISOFSMNT_EXTATT) && (off = isonum_711(isodir->ext_attr_length))) { - VOP_BLKATOFF(ITOV(inop), (off_t)-(off << imp->im_bshift), NULL, + cd9660_blkatoff(ITOV(inop), (off_t)-(off << imp->im_bshift), NULL, &bp2); bp = bp2; } diff --git a/sys/fs/cd9660/cd9660_node.h b/sys/fs/cd9660/cd9660_node.h index 92e214f..5c0b721 100644 --- a/sys/fs/cd9660/cd9660_node.h +++ b/sys/fs/cd9660/cd9660_node.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_node.h 8.6 (Berkeley) 5/14/95 - * $Id: cd9660_node.h,v 1.12 1997/08/26 07:32:31 phk Exp $ + * $Id: cd9660_node.h,v 1.13 1997/10/12 20:23:36 phk Exp $ */ /* @@ -105,8 +105,7 @@ int cd9660_inactive __P((struct vop_inactive_args *)); int cd9660_reclaim __P((struct vop_reclaim_args *)); int cd9660_bmap __P((struct vop_bmap_args *)); int cd9660_pathconf __P((struct vop_pathconf_args *)); -int cd9660_blkatoff __P((struct vop_blkatoff_args *)); -#define cd9660_revoke vop_revoke +int cd9660_blkatoff __P((struct vnode *vp, off_t offset, char **res, struct buf **bpp)); void cd9660_defattr __P((struct iso_directory_record *, struct iso_node *, struct buf *, enum ISO_FTYPE)); diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 3d23f09..d3db4a1 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95 - * $Id: cd9660_vfsops.c,v 1.29 1997/09/27 13:38:48 kato Exp $ + * $Id: cd9660_vfsops.c,v 1.30 1997/10/12 20:23:38 phk Exp $ */ #include <sys/param.h> @@ -765,7 +765,7 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir) ip->iso_start = ino >> imp->im_bshift; if (bp != 0) brelse(bp); - if (error = VOP_BLKATOFF(vp, (off_t)0, NULL, &bp)) { + if (error = cd9660_blkatoff(vp, (off_t)0, NULL, &bp)) { vput(vp); return (error); } @@ -787,7 +787,7 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir) int off; if ((imp->im_flags & ISOFSMNT_EXTATT) && (off = isonum_711(isodir->ext_attr_length))) - VOP_BLKATOFF(vp, (off_t)-(off << imp->im_bshift), NULL, + cd9660_blkatoff(vp, (off_t)-(off << imp->im_bshift), NULL, &bp2); else bp2 = NULL; diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 607d7d6..b794436 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95 - * $Id: cd9660_vnops.c,v 1.42 1997/10/15 10:03:58 phk Exp $ + * $Id: cd9660_vnops.c,v 1.43 1997/10/15 13:22:39 phk Exp $ */ #include <sys/param.h> @@ -569,7 +569,7 @@ cd9660_readdir(ap) idp->curroff = uio->uio_offset; if ((entryoffsetinblock = idp->curroff & bmask) && - (error = VOP_BLKATOFF(vdp, (off_t)idp->curroff, NULL, &bp))) { + (error = cd9660_blkatoff(vdp, (off_t)idp->curroff, NULL, &bp))) { FREE(idp, M_TEMP); return (error); } @@ -585,7 +585,7 @@ cd9660_readdir(ap) if (bp != NULL) brelse(bp); if (error = - VOP_BLKATOFF(vdp, (off_t)idp->curroff, NULL, &bp)) + cd9660_blkatoff(vdp, (off_t)idp->curroff, NULL, &bp)) break; entryoffsetinblock = 0; } @@ -953,44 +953,6 @@ cd9660_pathconf(ap) } /* - * Global vfs data structures for isofs - */ -#define cd9660_create \ - ((int (*) __P((struct vop_create_args *)))eopnotsupp) -#define cd9660_mknod ((int (*) __P((struct vop_mknod_args *)))eopnotsupp) -#define cd9660_write ((int (*) __P((struct vop_write_args *)))eopnotsupp) -#ifdef NFS -#define cd9660_lease_check lease_check -#else -#define cd9660_lease_check ((int (*) __P((struct vop_lease_args *)))nullop) -#endif -#define cd9660_poll vop_nopoll -#define cd9660_fsync ((int (*) __P((struct vop_fsync_args *)))nullop) -#define cd9660_remove \ - ((int (*) __P((struct vop_remove_args *)))eopnotsupp) -#define cd9660_link ((int (*) __P((struct vop_link_args *)))eopnotsupp) -#define cd9660_rename \ - ((int (*) __P((struct vop_rename_args *)))eopnotsupp) -#define cd9660_mkdir ((int (*) __P((struct vop_mkdir_args *)))eopnotsupp) -#define cd9660_rmdir ((int (*) __P((struct vop_rmdir_args *)))eopnotsupp) -#define cd9660_symlink \ - ((int (*) __P((struct vop_symlink_args *)))eopnotsupp) -#define cd9660_advlock \ - ((int (*) __P((struct vop_advlock_args *)))eopnotsupp) -#define cd9660_valloc ((int(*) __P(( \ - struct vnode *pvp, \ - int mode, \ - struct ucred *cred, \ - struct vnode **vpp))) eopnotsupp) -#define cd9660_vfree ((int (*) __P((struct vop_vfree_args *)))eopnotsupp) -#define cd9660_truncate \ - ((int (*) __P((struct vop_truncate_args *)))eopnotsupp) -#define cd9660_update \ - ((int (*) __P((struct vop_update_args *)))eopnotsupp) -#define cd9660_bwrite \ - ((int (*) __P((struct vop_bwrite_args *)))eopnotsupp) - -/* * Global vfs data structures for cd9660 */ vop_t **cd9660_vnodeop_p; @@ -998,47 +960,28 @@ struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { { &vop_default_desc, (vop_t *) vn_default_error }, { &vop_abortop_desc, (vop_t *) cd9660_abortop }, { &vop_access_desc, (vop_t *) cd9660_access }, - { &vop_advlock_desc, (vop_t *) cd9660_advlock }, - { &vop_blkatoff_desc, (vop_t *) cd9660_blkatoff }, { &vop_bmap_desc, (vop_t *) cd9660_bmap }, - { &vop_bwrite_desc, (vop_t *) vn_bwrite }, { &vop_cachedlookup_desc, (vop_t *) cd9660_lookup }, { &vop_close_desc, (vop_t *) cd9660_close }, - { &vop_create_desc, (vop_t *) cd9660_create }, - { &vop_fsync_desc, (vop_t *) cd9660_fsync }, + { &vop_fsync_desc, (vop_t *) nullop }, { &vop_getattr_desc, (vop_t *) cd9660_getattr }, { &vop_inactive_desc, (vop_t *) cd9660_inactive }, { &vop_ioctl_desc, (vop_t *) cd9660_ioctl }, { &vop_islocked_desc, (vop_t *) cd9660_islocked }, - { &vop_lease_desc, (vop_t *) cd9660_lease_check }, - { &vop_link_desc, (vop_t *) cd9660_link }, { &vop_lock_desc, (vop_t *) cd9660_lock }, { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_mkdir_desc, (vop_t *) cd9660_mkdir }, - { &vop_mknod_desc, (vop_t *) cd9660_mknod }, { &vop_mmap_desc, (vop_t *) cd9660_mmap }, { &vop_open_desc, (vop_t *) cd9660_open }, { &vop_pathconf_desc, (vop_t *) cd9660_pathconf }, - { &vop_poll_desc, (vop_t *) cd9660_poll }, { &vop_print_desc, (vop_t *) cd9660_print }, { &vop_read_desc, (vop_t *) cd9660_read }, { &vop_readdir_desc, (vop_t *) cd9660_readdir }, { &vop_readlink_desc, (vop_t *) cd9660_readlink }, { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, - { &vop_remove_desc, (vop_t *) cd9660_remove }, - { &vop_rename_desc, (vop_t *) cd9660_rename }, - { &vop_revoke_desc, (vop_t *) cd9660_revoke }, - { &vop_rmdir_desc, (vop_t *) cd9660_rmdir }, { &vop_seek_desc, (vop_t *) cd9660_seek }, { &vop_setattr_desc, (vop_t *) cd9660_setattr }, { &vop_strategy_desc, (vop_t *) cd9660_strategy }, - { &vop_symlink_desc, (vop_t *) cd9660_symlink }, - { &vop_truncate_desc, (vop_t *) cd9660_truncate }, { &vop_unlock_desc, (vop_t *) cd9660_unlock }, - { &vop_update_desc, (vop_t *) cd9660_update }, - { &vop_valloc_desc, (vop_t *) cd9660_valloc }, - { &vop_vfree_desc, (vop_t *) cd9660_vfree }, - { &vop_write_desc, (vop_t *) cd9660_write }, { NULL, NULL } }; static struct vnodeopv_desc cd9660_vnodeop_opv_desc = @@ -1052,7 +995,6 @@ vop_t **cd9660_specop_p; struct vnodeopv_entry_desc cd9660_specop_entries[] = { { &vop_default_desc, (vop_t *) spec_vnoperate }, { &vop_access_desc, (vop_t *) cd9660_access }, - { &vop_bwrite_desc, (vop_t *) vn_bwrite }, { &vop_getattr_desc, (vop_t *) cd9660_getattr }, { &vop_inactive_desc, (vop_t *) cd9660_inactive }, { &vop_islocked_desc, (vop_t *) cd9660_islocked }, @@ -1061,7 +1003,6 @@ struct vnodeopv_entry_desc cd9660_specop_entries[] = { { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, { &vop_setattr_desc, (vop_t *) cd9660_setattr }, { &vop_unlock_desc, (vop_t *) cd9660_unlock }, - { &vop_update_desc, (vop_t *) cd9660_update }, { NULL, NULL } }; static struct vnodeopv_desc cd9660_specop_opv_desc = @@ -1072,7 +1013,6 @@ vop_t **cd9660_fifoop_p; struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { { &vop_default_desc, (vop_t *) fifo_vnoperate }, { &vop_access_desc, (vop_t *) cd9660_access }, - { &vop_bwrite_desc, (vop_t *) vn_bwrite }, { &vop_getattr_desc, (vop_t *) cd9660_getattr }, { &vop_inactive_desc, (vop_t *) cd9660_inactive }, { &vop_islocked_desc, (vop_t *) cd9660_islocked }, @@ -1081,7 +1021,6 @@ struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, { &vop_setattr_desc, (vop_t *) cd9660_setattr }, { &vop_unlock_desc, (vop_t *) cd9660_unlock }, - { &vop_update_desc, (vop_t *) cd9660_update }, { NULL, NULL } }; static struct vnodeopv_desc cd9660_fifoop_opv_desc = |