cd9660_lookup.c (76117) | cd9660_lookup.c (83366) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley 6 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension 7 * Support code is derived from software contributed to Berkeley 8 * by Atsushi Murai (amurai@spec.co.jp). --- 24 unchanged lines hidden (view full) --- 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 * from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91 39 * 40 * @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94 | 1/*- 2 * Copyright (c) 1989, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley 6 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension 7 * Support code is derived from software contributed to Berkeley 8 * by Atsushi Murai (amurai@spec.co.jp). --- 24 unchanged lines hidden (view full) --- 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 * from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91 39 * 40 * @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94 |
41 * $FreeBSD: head/sys/fs/cd9660/cd9660_lookup.c 76117 2001-04-29 02:45:39Z grog $ | 41 * $FreeBSD: head/sys/fs/cd9660/cd9660_lookup.c 83366 2001-09-12 08:38:13Z julian $ |
42 */ 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/namei.h> 47#include <sys/bio.h> 48#include <sys/buf.h> 49#include <sys/vnode.h> --- 65 unchanged lines hidden (view full) --- 115 char altname[NAME_MAX]; 116 int res; 117 int assoc, len; 118 char *name; 119 struct vnode **vpp = ap->a_vpp; 120 struct componentname *cnp = ap->a_cnp; 121 int flags = cnp->cn_flags; 122 int nameiop = cnp->cn_nameiop; | 42 */ 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/namei.h> 47#include <sys/bio.h> 48#include <sys/buf.h> 49#include <sys/vnode.h> --- 65 unchanged lines hidden (view full) --- 115 char altname[NAME_MAX]; 116 int res; 117 int assoc, len; 118 char *name; 119 struct vnode **vpp = ap->a_vpp; 120 struct componentname *cnp = ap->a_cnp; 121 int flags = cnp->cn_flags; 122 int nameiop = cnp->cn_nameiop; |
123 struct proc *p = cnp->cn_proc; | 123 struct thread *td = cnp->cn_thread; |
124 125 bp = NULL; 126 *vpp = NULL; 127 vdp = ap->a_dvp; 128 dp = VTOI(vdp); 129 imp = dp->i_mnt; 130 lockparent = flags & LOCKPARENT; 131 wantparent = flags & (LOCKPARENT|WANTPARENT); --- 214 unchanged lines hidden (view full) --- 346 * that point backwards in the directory structure. 347 */ 348 pdp = vdp; 349 /* 350 * If ino is different from dp->i_ino, 351 * it's a relocated directory. 352 */ 353 if (flags & ISDOTDOT) { | 124 125 bp = NULL; 126 *vpp = NULL; 127 vdp = ap->a_dvp; 128 dp = VTOI(vdp); 129 imp = dp->i_mnt; 130 lockparent = flags & LOCKPARENT; 131 wantparent = flags & (LOCKPARENT|WANTPARENT); --- 214 unchanged lines hidden (view full) --- 346 * that point backwards in the directory structure. 347 */ 348 pdp = vdp; 349 /* 350 * If ino is different from dp->i_ino, 351 * it's a relocated directory. 352 */ 353 if (flags & ISDOTDOT) { |
354 VOP_UNLOCK(pdp, 0, p); /* race to get the inode */ | 354 VOP_UNLOCK(pdp, 0, td); /* race to get the inode */ |
355 error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, &tdp, 356 dp->i_ino != ino, ep); 357 brelse(bp); 358 if (error) { | 355 error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, &tdp, 356 dp->i_ino != ino, ep); 357 brelse(bp); 358 if (error) { |
359 vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p); | 359 vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td); |
360 return (error); 361 } 362 if (lockparent && (flags & ISLASTCN)) { | 360 return (error); 361 } 362 if (lockparent && (flags & ISLASTCN)) { |
363 if ((error = vn_lock(pdp, LK_EXCLUSIVE, p)) != 0) { | 363 if ((error = vn_lock(pdp, LK_EXCLUSIVE, td)) != 0) { |
364 cnp->cn_flags |= PDIRUNLOCK; 365 vput(tdp); 366 return (error); 367 } 368 } else 369 cnp->cn_flags |= PDIRUNLOCK; 370 *vpp = tdp; 371 } else if (dp->i_number == dp->i_ino) { 372 brelse(bp); 373 VREF(vdp); /* we want ourself, ie "." */ 374 *vpp = vdp; 375 } else { 376 error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, &tdp, 377 dp->i_ino != ino, ep); 378 brelse(bp); 379 if (error) 380 return (error); 381 if (!lockparent || !(flags & ISLASTCN)) { 382 cnp->cn_flags |= PDIRUNLOCK; | 364 cnp->cn_flags |= PDIRUNLOCK; 365 vput(tdp); 366 return (error); 367 } 368 } else 369 cnp->cn_flags |= PDIRUNLOCK; 370 *vpp = tdp; 371 } else if (dp->i_number == dp->i_ino) { 372 brelse(bp); 373 VREF(vdp); /* we want ourself, ie "." */ 374 *vpp = vdp; 375 } else { 376 error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, &tdp, 377 dp->i_ino != ino, ep); 378 brelse(bp); 379 if (error) 380 return (error); 381 if (!lockparent || !(flags & ISLASTCN)) { 382 cnp->cn_flags |= PDIRUNLOCK; |
383 VOP_UNLOCK(pdp, 0, p); | 383 VOP_UNLOCK(pdp, 0, td); |
384 } 385 *vpp = tdp; 386 } 387 388 /* 389 * Insert name into cache if appropriate. 390 */ 391 if (cnp->cn_flags & MAKEENTRY) --- 37 unchanged lines hidden --- | 384 } 385 *vpp = tdp; 386 } 387 388 /* 389 * Insert name into cache if appropriate. 390 */ 391 if (cnp->cn_flags & MAKEENTRY) --- 37 unchanged lines hidden --- |