vfs_subr.c (47445) | vfs_subr.c (47640) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 |
39 * $Id: vfs_subr.c,v 1.198 1999/05/14 20:40:15 luoqi Exp $ | 39 * $Id: vfs_subr.c,v 1.199 1999/05/24 00:34:10 jb Exp $ |
40 */ 41 42/* 43 * External virtual filesystem routines 44 */ 45#include "opt_ddb.h" 46 47#include <sys/param.h> --- 271 unchanged lines hidden (view full) --- 319{ 320 static u_short xxxfs_mntid; 321 322 fsid_t tfsid; 323 int mtype; 324 325 simple_lock(&mntid_slock); 326 mtype = mp->mnt_vfc->vfc_typenum; | 40 */ 41 42/* 43 * External virtual filesystem routines 44 */ 45#include "opt_ddb.h" 46 47#include <sys/param.h> --- 271 unchanged lines hidden (view full) --- 319{ 320 static u_short xxxfs_mntid; 321 322 fsid_t tfsid; 323 int mtype; 324 325 simple_lock(&mntid_slock); 326 mtype = mp->mnt_vfc->vfc_typenum; |
327 mp->mnt_stat.f_fsid.val[0] = (nblkdev + mtype) * 256; | 327 mp->mnt_stat.f_fsid.val[0] = (256 + mtype) * 256; |
328 mp->mnt_stat.f_fsid.val[1] = mtype; 329 if (xxxfs_mntid == 0) 330 ++xxxfs_mntid; | 328 mp->mnt_stat.f_fsid.val[1] = mtype; 329 if (xxxfs_mntid == 0) 330 ++xxxfs_mntid; |
331 tfsid.val[0] = (nblkdev + mtype) * 256 | xxxfs_mntid; | 331 tfsid.val[0] = (256 + mtype) * 256 | xxxfs_mntid; |
332 tfsid.val[1] = mtype; 333 if (mountlist.cqh_first != (void *)&mountlist) { 334 while (vfs_getvfs(&tfsid)) { 335 tfsid.val[0]++; 336 xxxfs_mntid++; 337 } 338 } 339 mp->mnt_stat.f_fsid.val[0] = tfsid.val[0]; --- 830 unchanged lines hidden (view full) --- 1170bdevvp(dev, vpp) 1171 dev_t dev; 1172 struct vnode **vpp; 1173{ 1174 register struct vnode *vp; 1175 struct vnode *nvp; 1176 int error; 1177 | 332 tfsid.val[1] = mtype; 333 if (mountlist.cqh_first != (void *)&mountlist) { 334 while (vfs_getvfs(&tfsid)) { 335 tfsid.val[0]++; 336 xxxfs_mntid++; 337 } 338 } 339 mp->mnt_stat.f_fsid.val[0] = tfsid.val[0]; --- 830 unchanged lines hidden (view full) --- 1170bdevvp(dev, vpp) 1171 dev_t dev; 1172 struct vnode **vpp; 1173{ 1174 register struct vnode *vp; 1175 struct vnode *nvp; 1176 int error; 1177 |
1178 if (dev == NODEV || major(dev) >= nblkdev) { | 1178 if (dev == NODEV) { |
1179 *vpp = NULLVP; 1180 return (ENXIO); 1181 } 1182 error = getnewvnode(VT_NON, (struct mount *)0, spec_vnodeop_p, &nvp); 1183 if (error) { 1184 *vpp = NULLVP; 1185 return (error); 1186 } --- 19 unchanged lines hidden (view full) --- 1206checkalias(nvp, nvp_rdev, mp) 1207 register struct vnode *nvp; 1208 udev_t nvp_rdev; 1209 struct mount *mp; 1210{ 1211 struct proc *p = curproc; /* XXX */ 1212 struct vnode *vp; 1213 struct vnode **vpp; | 1179 *vpp = NULLVP; 1180 return (ENXIO); 1181 } 1182 error = getnewvnode(VT_NON, (struct mount *)0, spec_vnodeop_p, &nvp); 1183 if (error) { 1184 *vpp = NULLVP; 1185 return (error); 1186 } --- 19 unchanged lines hidden (view full) --- 1206checkalias(nvp, nvp_rdev, mp) 1207 register struct vnode *nvp; 1208 udev_t nvp_rdev; 1209 struct mount *mp; 1210{ 1211 struct proc *p = curproc; /* XXX */ 1212 struct vnode *vp; 1213 struct vnode **vpp; |
1214 int rmaj = umajor(nvp_rdev); | |
1215 dev_t dev; 1216 1217 if (nvp->v_type != VBLK && nvp->v_type != VCHR) 1218 return (NULLVP); 1219 1220 dev = udev2dev(nvp_rdev, 2); 1221 1222 vpp = &speclisth[SPECHASH(dev)]; --- 47 unchanged lines hidden (view full) --- 1270 sinfo->si_bsize_best = BLKDEV_IOSIZE; 1271 sinfo->si_bsize_max = MAXBSIZE; 1272 1273 /* 1274 * Ask the device to fix up specinfo. Typically the 1275 * si_bsize_* parameters may need fixing up. 1276 */ 1277 | 1214 dev_t dev; 1215 1216 if (nvp->v_type != VBLK && nvp->v_type != VCHR) 1217 return (NULLVP); 1218 1219 dev = udev2dev(nvp_rdev, 2); 1220 1221 vpp = &speclisth[SPECHASH(dev)]; --- 47 unchanged lines hidden (view full) --- 1269 sinfo->si_bsize_best = BLKDEV_IOSIZE; 1270 sinfo->si_bsize_max = MAXBSIZE; 1271 1272 /* 1273 * Ask the device to fix up specinfo. Typically the 1274 * si_bsize_* parameters may need fixing up. 1275 */ 1276 |
1278 if (nvp->v_type == VBLK && rmaj < nblkdev) { | 1277 if (nvp->v_type == VBLK) { |
1279 if (bdevsw(dev) && bdevsw(dev)->d_parms) 1280 (*bdevsw(dev)->d_parms)(dev, sinfo, DPARM_GET); | 1278 if (bdevsw(dev) && bdevsw(dev)->d_parms) 1279 (*bdevsw(dev)->d_parms)(dev, sinfo, DPARM_GET); |
1281 } else if (nvp->v_type == VCHR && rmaj < nchrdev) { | 1280 } else if (nvp->v_type == VCHR) { |
1282 if (devsw(dev) && devsw(dev)->d_parms) 1283 (*devsw(dev)->d_parms)(dev, sinfo, DPARM_GET); 1284 } 1285 1286 simple_unlock(&spechash_slock); 1287 *vpp = nvp; 1288 if (vp != NULLVP) { 1289 nvp->v_flag |= VALIASED; --- 1289 unchanged lines hidden (view full) --- 2579 return 0; 2580 2581retry: 2582 if ((object = vp->v_object) == NULL) { 2583 if (vp->v_type == VREG) { 2584 if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0) 2585 goto retn; 2586 object = vnode_pager_alloc(vp, vat.va_size, 0, 0); | 1281 if (devsw(dev) && devsw(dev)->d_parms) 1282 (*devsw(dev)->d_parms)(dev, sinfo, DPARM_GET); 1283 } 1284 1285 simple_unlock(&spechash_slock); 1286 *vpp = nvp; 1287 if (vp != NULLVP) { 1288 nvp->v_flag |= VALIASED; --- 1289 unchanged lines hidden (view full) --- 2578 return 0; 2579 2580retry: 2581 if ((object = vp->v_object) == NULL) { 2582 if (vp->v_type == VREG) { 2583 if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0) 2584 goto retn; 2585 object = vnode_pager_alloc(vp, vat.va_size, 0, 0); |
2587 } else if (major(vp->v_rdev) < nblkdev && 2588 bdevsw(vp->v_rdev) != NULL) { | 2586 } else if (bdevsw(vp->v_rdev) != NULL) { |
2589 /* 2590 * This simply allocates the biggest object possible 2591 * for a VBLK vnode. This should be fixed, but doesn't 2592 * cause any problems (yet). 2593 */ 2594 object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0); 2595 } else { 2596 goto retn; --- 324 unchanged lines hidden --- | 2587 /* 2588 * This simply allocates the biggest object possible 2589 * for a VBLK vnode. This should be fixed, but doesn't 2590 * cause any problems (yet). 2591 */ 2592 object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0); 2593 } else { 2594 goto retn; --- 324 unchanged lines hidden --- |