summaryrefslogtreecommitdiffstats
path: root/sys/isofs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-10-29 10:41:44 +0000
committerphk <phk@FreeBSD.org>2004-10-29 10:41:44 +0000
commite172d33222a3bbc7f97ab392f18ef13ed0a1116b (patch)
treef2ec249b9eca34b1a52932d3d496347f84fcd02e /sys/isofs
parent6dbcd5fd091cd06ac853f27276cb7f316af8eab9 (diff)
downloadFreeBSD-src-e172d33222a3bbc7f97ab392f18ef13ed0a1116b.zip
FreeBSD-src-e172d33222a3bbc7f97ab392f18ef13ed0a1116b.tar.gz
Move CD9660 to GEOM backing instead of DEVFS.
For details, please see src/sys/ufs/ffs/ffs_vfsops.c 1.250.
Diffstat (limited to 'sys/isofs')
-rw-r--r--sys/isofs/cd9660/cd9660_bmap.c2
-rw-r--r--sys/isofs/cd9660/cd9660_node.c6
-rw-r--r--sys/isofs/cd9660/cd9660_node.h1
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c55
-rw-r--r--sys/isofs/cd9660/cd9660_vnops.c6
-rw-r--r--sys/isofs/cd9660/iso.h3
6 files changed, 37 insertions, 36 deletions
diff --git a/sys/isofs/cd9660/cd9660_bmap.c b/sys/isofs/cd9660/cd9660_bmap.c
index b23c0fb..a256313 100644
--- a/sys/isofs/cd9660/cd9660_bmap.c
+++ b/sys/isofs/cd9660/cd9660_bmap.c
@@ -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);
diff --git a/sys/isofs/cd9660/cd9660_node.c b/sys/isofs/cd9660/cd9660_node.c
index 5091378..dd5aaa4 100644
--- a/sys/isofs/cd9660/cd9660_node.c
+++ b/sys/isofs/cd9660/cd9660_node.c
@@ -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);
diff --git a/sys/isofs/cd9660/cd9660_node.h b/sys/isofs/cd9660/cd9660_node.h
index fb74f39..a482181 100644
--- a/sys/isofs/cd9660/cd9660_node.h
+++ b/sys/isofs/cd9660/cd9660_node.h
@@ -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 */
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 1da9893..e998f61 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -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) {
/*
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c
index 5407dff..b53c013 100644
--- a/sys/isofs/cd9660/cd9660_vnops.c
+++ b/sys/isofs/cd9660/cd9660_vnops.c
@@ -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);
}
diff --git a/sys/isofs/cd9660/iso.h b/sys/isofs/cd9660/iso.h
index 412f130..d748063 100644
--- a/sys/isofs/cd9660/iso.h
+++ b/sys/isofs/cd9660/iso.h
@@ -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;
OpenPOWER on IntegriCloud