Move CD9660 to GEOM backing instead of DEVFS.
For details, please see src/sys/ufs/ffs/ffs_vfsops.c 1.250.
This commit is contained in:
parent
429c018a9f
commit
bf7e2ae1c4
@ -70,7 +70,7 @@ cd9660_bmap(ap)
|
||||
* to physical mapping is requested.
|
||||
*/
|
||||
if (ap->a_vpp != NULL)
|
||||
*ap->a_vpp = ip->i_devvp;
|
||||
*ap->a_vpp = ip->i_mnt->im_devvp;
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
|
||||
|
@ -216,10 +216,8 @@ cd9660_reclaim(ap)
|
||||
/*
|
||||
* Purge old data structures associated with the inode.
|
||||
*/
|
||||
if (ip->i_devvp) {
|
||||
vrele(ip->i_devvp);
|
||||
ip->i_devvp = 0;
|
||||
}
|
||||
if (ip->i_mnt->im_devvp)
|
||||
vrele(ip->i_mnt->im_devvp);
|
||||
FREE(vp->v_data, M_ISOFSNODE);
|
||||
vp->v_data = NULL;
|
||||
return (0);
|
||||
|
@ -59,7 +59,6 @@ typedef struct {
|
||||
struct iso_node {
|
||||
struct iso_node *i_next, **i_prev; /* hash chain */
|
||||
struct vnode *i_vnode; /* vnode associated with this inode */
|
||||
struct vnode *i_devvp; /* vnode for block I/O */
|
||||
u_long i_flag; /* see below */
|
||||
struct cdev *i_dev; /* device where inode resides */
|
||||
ino_t i_number; /* the identity of the inode */
|
||||
|
@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/iconv.h>
|
||||
|
||||
|
||||
#include <isofs/cd9660/iso.h>
|
||||
#include <isofs/cd9660/iso_rrip.h>
|
||||
#include <isofs/cd9660/cd9660_node.h>
|
||||
#include <isofs/cd9660/cd9660_mount.h>
|
||||
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_vfs.h>
|
||||
|
||||
MALLOC_DEFINE(M_ISOFSMNT, "ISOFS mount", "ISOFS mount structure");
|
||||
MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part");
|
||||
|
||||
@ -87,7 +89,6 @@ static struct vfsops cd9660_vfsops = {
|
||||
VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY);
|
||||
MODULE_VERSION(cd9660, 1);
|
||||
|
||||
|
||||
/*
|
||||
* Called by vfs_mountroot when iso is going to be mounted as root.
|
||||
*/
|
||||
@ -282,7 +283,6 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
struct buf *pribp = NULL, *supbp = NULL;
|
||||
struct cdev *dev = devvp->v_rdev;
|
||||
int error = EINVAL;
|
||||
int needclose = 0;
|
||||
int high_sierra = 0;
|
||||
int iso_bsize;
|
||||
int iso_blknum;
|
||||
@ -293,25 +293,18 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
struct iso_supplementary_descriptor *sup = NULL;
|
||||
struct iso_directory_record *rootp;
|
||||
int logical_block_size;
|
||||
struct g_consumer *cp;
|
||||
struct bufobj *bo;
|
||||
|
||||
if (!(mp->mnt_flag & MNT_RDONLY))
|
||||
return EROFS;
|
||||
|
||||
/*
|
||||
* Disallow multiple mounts of the same device.
|
||||
* Disallow mounting of a device that is currently in use
|
||||
* (except for root, which might share swap device for miniroot).
|
||||
* Flush out any old buffers remaining from a previous use.
|
||||
*/
|
||||
if ((error = vfs_mountedon(devvp)))
|
||||
return error;
|
||||
if (vcount(devvp) > 1)
|
||||
return EBUSY;
|
||||
if ((error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0)))
|
||||
return (error);
|
||||
|
||||
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
error = VOP_OPEN(devvp, FREAD, FSCRED, td, -1);
|
||||
DROP_GIANT();
|
||||
g_topology_lock();
|
||||
error = g_vfs_open(devvp, &cp, "cd9660", 0);
|
||||
g_topology_unlock();
|
||||
PICKUP_GIANT();
|
||||
VOP_UNLOCK(devvp, 0, td);
|
||||
if (error)
|
||||
return error;
|
||||
@ -320,7 +313,9 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
if (mp->mnt_iosize_max > MAXPHYS)
|
||||
mp->mnt_iosize_max = MAXPHYS;
|
||||
|
||||
needclose = 1;
|
||||
bo = &devvp->v_bufobj;
|
||||
bo->bo_private = cp;
|
||||
bo->bo_ops = g_vfs_bufops;
|
||||
|
||||
/* This is the "logical sector size". The standard says this
|
||||
* should be 2048 or the physical sector size on the device,
|
||||
@ -416,6 +411,8 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
pri->root_directory_record);
|
||||
|
||||
isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK | M_ZERO);
|
||||
isomp->im_cp = cp;
|
||||
isomp->im_bo = bo;
|
||||
isomp->logical_block_size = logical_block_size;
|
||||
isomp->volume_space_size =
|
||||
isonum_733 (high_sierra?
|
||||
@ -451,8 +448,6 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
isomp->im_dev = dev;
|
||||
isomp->im_devvp = devvp;
|
||||
|
||||
devvp->v_rdev->si_mountpoint = mp;
|
||||
|
||||
/* Check the Rock Ridge Extention support */
|
||||
if (!(argp->flags & ISOFSMNT_NORRIP)) {
|
||||
if ((error = bread(isomp->im_devvp,
|
||||
@ -527,15 +522,19 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
|
||||
return 0;
|
||||
out:
|
||||
devvp->v_rdev->si_mountpoint = NULL;
|
||||
if (bp)
|
||||
brelse(bp);
|
||||
if (pribp)
|
||||
brelse(pribp);
|
||||
if (supbp)
|
||||
brelse(supbp);
|
||||
if (needclose)
|
||||
(void)VOP_CLOSE(devvp, FREAD, NOCRED, td);
|
||||
if (cp != NULL) {
|
||||
DROP_GIANT();
|
||||
g_topology_lock();
|
||||
g_wither_geom_close(cp->geom, ENXIO);
|
||||
g_topology_unlock();
|
||||
PICKUP_GIANT();
|
||||
}
|
||||
if (isomp) {
|
||||
free((caddr_t)isomp, M_ISOFSMNT);
|
||||
mp->mnt_data = (qaddr_t)0;
|
||||
@ -573,8 +572,11 @@ cd9660_unmount(mp, mntflags, td)
|
||||
if (isomp->im_l2d)
|
||||
cd9660_iconv->close(isomp->im_l2d);
|
||||
}
|
||||
isomp->im_devvp->v_rdev->si_mountpoint = NULL;
|
||||
error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED, td);
|
||||
DROP_GIANT();
|
||||
g_topology_lock();
|
||||
g_wither_geom_close(isomp->im_cp->geom, ENXIO);
|
||||
g_topology_unlock();
|
||||
PICKUP_GIANT();
|
||||
vrele(isomp->im_devvp);
|
||||
free((caddr_t)isomp, M_ISOFSMNT);
|
||||
mp->mnt_data = (qaddr_t)0;
|
||||
@ -813,8 +815,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
|
||||
bp = 0;
|
||||
|
||||
ip->i_mnt = imp;
|
||||
ip->i_devvp = imp->im_devvp;
|
||||
VREF(ip->i_devvp);
|
||||
VREF(imp->im_devvp);
|
||||
|
||||
if (relocated) {
|
||||
/*
|
||||
|
@ -716,6 +716,7 @@ cd9660_strategy(ap)
|
||||
struct buf *bp = ap->a_bp;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct iso_node *ip;
|
||||
struct bufobj *bo;
|
||||
|
||||
ip = VTOI(vp);
|
||||
if (vp->v_type == VBLK || vp->v_type == VCHR)
|
||||
@ -730,10 +731,9 @@ cd9660_strategy(ap)
|
||||
bufdone(bp);
|
||||
return (0);
|
||||
}
|
||||
vp = ip->i_devvp;
|
||||
bp->b_dev = vp->v_rdev;
|
||||
bp->b_iooffset = dbtob(bp->b_blkno);
|
||||
VOP_SPECSTRATEGY(vp, bp);
|
||||
bo = ip->i_mnt->im_bo;
|
||||
bo->bo_ops->bop_strategy(bo, bp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -226,6 +226,9 @@ struct iso_mnt {
|
||||
struct cdev *im_dev;
|
||||
struct vnode *im_devvp;
|
||||
|
||||
struct g_consumer *im_cp;
|
||||
struct bufobj *im_bo;
|
||||
|
||||
int logical_block_size;
|
||||
int im_bshift;
|
||||
int im_bmask;
|
||||
|
@ -70,7 +70,7 @@ cd9660_bmap(ap)
|
||||
* to physical mapping is requested.
|
||||
*/
|
||||
if (ap->a_vpp != NULL)
|
||||
*ap->a_vpp = ip->i_devvp;
|
||||
*ap->a_vpp = ip->i_mnt->im_devvp;
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
|
||||
|
@ -216,10 +216,8 @@ cd9660_reclaim(ap)
|
||||
/*
|
||||
* Purge old data structures associated with the inode.
|
||||
*/
|
||||
if (ip->i_devvp) {
|
||||
vrele(ip->i_devvp);
|
||||
ip->i_devvp = 0;
|
||||
}
|
||||
if (ip->i_mnt->im_devvp)
|
||||
vrele(ip->i_mnt->im_devvp);
|
||||
FREE(vp->v_data, M_ISOFSNODE);
|
||||
vp->v_data = NULL;
|
||||
return (0);
|
||||
|
@ -59,7 +59,6 @@ typedef struct {
|
||||
struct iso_node {
|
||||
struct iso_node *i_next, **i_prev; /* hash chain */
|
||||
struct vnode *i_vnode; /* vnode associated with this inode */
|
||||
struct vnode *i_devvp; /* vnode for block I/O */
|
||||
u_long i_flag; /* see below */
|
||||
struct cdev *i_dev; /* device where inode resides */
|
||||
ino_t i_number; /* the identity of the inode */
|
||||
|
@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/iconv.h>
|
||||
|
||||
|
||||
#include <isofs/cd9660/iso.h>
|
||||
#include <isofs/cd9660/iso_rrip.h>
|
||||
#include <isofs/cd9660/cd9660_node.h>
|
||||
#include <isofs/cd9660/cd9660_mount.h>
|
||||
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_vfs.h>
|
||||
|
||||
MALLOC_DEFINE(M_ISOFSMNT, "ISOFS mount", "ISOFS mount structure");
|
||||
MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part");
|
||||
|
||||
@ -87,7 +89,6 @@ static struct vfsops cd9660_vfsops = {
|
||||
VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY);
|
||||
MODULE_VERSION(cd9660, 1);
|
||||
|
||||
|
||||
/*
|
||||
* Called by vfs_mountroot when iso is going to be mounted as root.
|
||||
*/
|
||||
@ -282,7 +283,6 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
struct buf *pribp = NULL, *supbp = NULL;
|
||||
struct cdev *dev = devvp->v_rdev;
|
||||
int error = EINVAL;
|
||||
int needclose = 0;
|
||||
int high_sierra = 0;
|
||||
int iso_bsize;
|
||||
int iso_blknum;
|
||||
@ -293,25 +293,18 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
struct iso_supplementary_descriptor *sup = NULL;
|
||||
struct iso_directory_record *rootp;
|
||||
int logical_block_size;
|
||||
struct g_consumer *cp;
|
||||
struct bufobj *bo;
|
||||
|
||||
if (!(mp->mnt_flag & MNT_RDONLY))
|
||||
return EROFS;
|
||||
|
||||
/*
|
||||
* Disallow multiple mounts of the same device.
|
||||
* Disallow mounting of a device that is currently in use
|
||||
* (except for root, which might share swap device for miniroot).
|
||||
* Flush out any old buffers remaining from a previous use.
|
||||
*/
|
||||
if ((error = vfs_mountedon(devvp)))
|
||||
return error;
|
||||
if (vcount(devvp) > 1)
|
||||
return EBUSY;
|
||||
if ((error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0)))
|
||||
return (error);
|
||||
|
||||
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
error = VOP_OPEN(devvp, FREAD, FSCRED, td, -1);
|
||||
DROP_GIANT();
|
||||
g_topology_lock();
|
||||
error = g_vfs_open(devvp, &cp, "cd9660", 0);
|
||||
g_topology_unlock();
|
||||
PICKUP_GIANT();
|
||||
VOP_UNLOCK(devvp, 0, td);
|
||||
if (error)
|
||||
return error;
|
||||
@ -320,7 +313,9 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
if (mp->mnt_iosize_max > MAXPHYS)
|
||||
mp->mnt_iosize_max = MAXPHYS;
|
||||
|
||||
needclose = 1;
|
||||
bo = &devvp->v_bufobj;
|
||||
bo->bo_private = cp;
|
||||
bo->bo_ops = g_vfs_bufops;
|
||||
|
||||
/* This is the "logical sector size". The standard says this
|
||||
* should be 2048 or the physical sector size on the device,
|
||||
@ -416,6 +411,8 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
pri->root_directory_record);
|
||||
|
||||
isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK | M_ZERO);
|
||||
isomp->im_cp = cp;
|
||||
isomp->im_bo = bo;
|
||||
isomp->logical_block_size = logical_block_size;
|
||||
isomp->volume_space_size =
|
||||
isonum_733 (high_sierra?
|
||||
@ -451,8 +448,6 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
isomp->im_dev = dev;
|
||||
isomp->im_devvp = devvp;
|
||||
|
||||
devvp->v_rdev->si_mountpoint = mp;
|
||||
|
||||
/* Check the Rock Ridge Extention support */
|
||||
if (!(argp->flags & ISOFSMNT_NORRIP)) {
|
||||
if ((error = bread(isomp->im_devvp,
|
||||
@ -527,15 +522,19 @@ iso_mountfs(devvp, mp, td, argp)
|
||||
|
||||
return 0;
|
||||
out:
|
||||
devvp->v_rdev->si_mountpoint = NULL;
|
||||
if (bp)
|
||||
brelse(bp);
|
||||
if (pribp)
|
||||
brelse(pribp);
|
||||
if (supbp)
|
||||
brelse(supbp);
|
||||
if (needclose)
|
||||
(void)VOP_CLOSE(devvp, FREAD, NOCRED, td);
|
||||
if (cp != NULL) {
|
||||
DROP_GIANT();
|
||||
g_topology_lock();
|
||||
g_wither_geom_close(cp->geom, ENXIO);
|
||||
g_topology_unlock();
|
||||
PICKUP_GIANT();
|
||||
}
|
||||
if (isomp) {
|
||||
free((caddr_t)isomp, M_ISOFSMNT);
|
||||
mp->mnt_data = (qaddr_t)0;
|
||||
@ -573,8 +572,11 @@ cd9660_unmount(mp, mntflags, td)
|
||||
if (isomp->im_l2d)
|
||||
cd9660_iconv->close(isomp->im_l2d);
|
||||
}
|
||||
isomp->im_devvp->v_rdev->si_mountpoint = NULL;
|
||||
error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED, td);
|
||||
DROP_GIANT();
|
||||
g_topology_lock();
|
||||
g_wither_geom_close(isomp->im_cp->geom, ENXIO);
|
||||
g_topology_unlock();
|
||||
PICKUP_GIANT();
|
||||
vrele(isomp->im_devvp);
|
||||
free((caddr_t)isomp, M_ISOFSMNT);
|
||||
mp->mnt_data = (qaddr_t)0;
|
||||
@ -813,8 +815,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
|
||||
bp = 0;
|
||||
|
||||
ip->i_mnt = imp;
|
||||
ip->i_devvp = imp->im_devvp;
|
||||
VREF(ip->i_devvp);
|
||||
VREF(imp->im_devvp);
|
||||
|
||||
if (relocated) {
|
||||
/*
|
||||
|
@ -716,6 +716,7 @@ cd9660_strategy(ap)
|
||||
struct buf *bp = ap->a_bp;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct iso_node *ip;
|
||||
struct bufobj *bo;
|
||||
|
||||
ip = VTOI(vp);
|
||||
if (vp->v_type == VBLK || vp->v_type == VCHR)
|
||||
@ -730,10 +731,9 @@ cd9660_strategy(ap)
|
||||
bufdone(bp);
|
||||
return (0);
|
||||
}
|
||||
vp = ip->i_devvp;
|
||||
bp->b_dev = vp->v_rdev;
|
||||
bp->b_iooffset = dbtob(bp->b_blkno);
|
||||
VOP_SPECSTRATEGY(vp, bp);
|
||||
bo = ip->i_mnt->im_bo;
|
||||
bo->bo_ops->bop_strategy(bo, bp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -226,6 +226,9 @@ struct iso_mnt {
|
||||
struct cdev *im_dev;
|
||||
struct vnode *im_devvp;
|
||||
|
||||
struct g_consumer *im_cp;
|
||||
struct bufobj *im_bo;
|
||||
|
||||
int logical_block_size;
|
||||
int im_bshift;
|
||||
int im_bmask;
|
||||
|
Loading…
x
Reference in New Issue
Block a user