1# $NetBSD: vchain,v 1.9 2017/04/13 09:52:18 hannken 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 set $vi=(struct vnode_impl *)$arg0 11 while ($vp) 12 printf "vp: 0x%lx lrulist_next: 0x%lx usecount: %d flags: i:0x%x v:0x%x u:0x%x\n",\ 13 $vp, $vi->vi_lrulist.tqe_next, $vp->v_uobj.uo_refs, \ 14 $vp->v_iflag, $vp->v_vflag, $vp->v_uflag 15 set $num++ 16 set $vp = $vp->v_mntvnodes.tqe_next 17 end 18 printf "Number of vnodes: %d\n", $num 19end 20 21document vchain 22Given a vnode, follow its mount pointers 23end 24 25define vprint 26 set $vp=(struct vnode *)$arg0 27 set $ip=(struct inode *)$vp->v_data 28end 29 30define mp_vchain 31 set $mp = (struct mount *)$arg0 32 vchain $mp->mnt_vnodelist.tqh_first 33end 34document mp_vchain 35print the vnode chain for a given mount point 36end 37 38define vall 39 set $mp=mountlist.tqh_first 40 while ($mp) 41 printf "\tmount point at 0x%x\n", $mp 42 mp_vchain $mp 43 set $mp=$mp->mnt_list.tqe_next 44 45 # "break" 46 if ((const void *)$mp == (const void *)&mountlist) 47 set $mp = 0 48 end 49 end 50end 51document vall 52print vnode chains for all mount points 53end 54 55define mountdump 56 set $me=mount_list.tqh_first 57 while ($me) 58 if ($me->me_type == ME_MOUNT) 59 set $mp = $me->me_mount 60 printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \ 61 $mp->mnt_stat->f_mntfromname, \ 62 $mp->mnt_stat->f_mntonname, \ 63 $mp->mnt_op->vfs_name, $mp, $mp->mnt_data 64 end 65 set $me=$me->me_list.tqe_next 66 if ((const void *)$me == (const void *)&mount_list) 67 set $me = 0 68 end 69 end 70end 71