1# $NetBSD: vchain,v 1.7 2013/11/23 16:15:25 riz Exp $ 2 3# @(#)vchain 8.1 (Berkeley) 6/10/93 4# 5 6define vchain 7 set $num = 0 8 9 set $vp=(struct vnode *)$arg0 10 while ($vp) 11 printf "vp: 0x%lx freelist_next: 0x%lx usecount: %d flags: i:0x%x v:0x%x u:0x%x\n",\ 12 $vp, $vp->v_freelist.tqe_next, $vp->v_uobj.uo_refs, \ 13 $vp->v_iflag, $vp->v_vflag, $vp->v_uflag 14 set $num++ 15 set $vp = $vp->v_mntvnodes.tqe_next 16 end 17 printf "Number of vnodes: %d\n", $num 18end 19 20document vchain 21Given a vnode, follow its mount pointers 22end 23 24define vprint 25 set $vp=(struct vnode *)$arg0 26 set $ip=(struct inode *)$vp->v_data 27end 28 29define mp_vchain 30 set $mp = (struct mount *)$arg0 31 vchain $mp->mnt_vnodelist.tqh_first 32end 33document mp_vchain 34print the vnode chain for a given mount point 35end 36 37define vall 38 set $mp=mountlist.tqh_first 39 while ($mp) 40 printf "\tmount point at 0x%x\n", $mp 41 mp_vchain $mp 42 set $mp=$mp->mnt_list.tqe_next 43 44 # "break" 45 if ((const void *)$mp == (const void *)&mountlist) 46 set $mp = 0 47 end 48 end 49end 50document vall 51print vnode chains for all mount points 52end 53 54define mountdump 55 set $mp=mountlist.tqh_first 56 while ($mp) 57 printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \ 58 $mp->mnt_stat->f_mntfromname, $mp->mnt_stat->f_mntonname, \ 59 $mp->mnt_op->vfs_name, $mp, $mp->mnt_data 60 set $mp=$mp->mnt_list.tqe_next 61 if ((const void *)$mp == (const void *)&mountlist) 62 set $mp = 0 63 end 64 end 65end 66