# $NetBSD: vchain,v 1.11 2019/12/06 02:37:53 mrg Exp $ # @(#)vchain 8.1 (Berkeley) 6/10/93 # define vchain set $num = 0 set $vi = (struct vnode_impl *)$arg0 printf "lrulist_next: 0x%lx\n", $vi->vi_lrulist.tqe_next while ($vi) set $vp = &$vi->vi_vnode printf "vp: 0x%lx usecount: %d flags: i:0x%x v:0x%x u:0x%x\n",\ $vp, $vp->v_uobj.uo_refs, \ $vp->v_iflag, $vp->v_vflag, $vp->v_uflag set $num++ set $vi = $vi->vi_mntvnodes.tqe_next end printf "Number of vnodes: %d\n", $num end document vchain Given a vnode, follow its mount pointers end define vprint set $vp=(struct vnode *)$arg0 set $ip=(struct inode *)$vp->v_data end define mp_vchain set $mp = $arg0->me_mount set $first = $mp->mnt_vnodelist.tqh_first if ($first) vchain $mp->mnt_vnodelist.tqh_first end end document mp_vchain print the vnode chain for a given mount point end define vall set $mpe=mountlist.tqh_first while ($mpe) printf "\tmount point at 0x%lx\n", $mpe mp_vchain $mpe set $mpe = $mpe->me_list.tqe_next # "break" if ((const void *)$mpe == (const void *)&mountlist) set $mpe = 0 end end end document vall print vnode chains for all mount points end define mountdump set $me=mountlist.tqh_first while ($me) if ($me->me_type == ME_MOUNT) set $mp = $me->me_mount printf "%s on %s type %s, (mp 0x%lx, privdata 0x%lx)\n", \ $mp->mnt_stat->f_mntfromname, \ $mp->mnt_stat->f_mntonname, \ $mp->mnt_op->vfs_name, $mp, $mp->mnt_data end set $me=$me->me_list.tqe_next if ((const void *)$me == (const void *)&mountlist) set $me = 0 end end end |