11.11Smrg# $NetBSD: vchain,v 1.11 2019/12/06 02:37:53 mrg Exp $ 21.2Sgwr 31.1Sgwr# @(#)vchain 8.1 (Berkeley) 6/10/93 41.1Sgwr# 51.6Seeh 61.1Sgwrdefine vchain 71.1Sgwr set $num = 0 81.1Sgwr 91.11Smrg set $vi = (struct vnode_impl *)$arg0 101.11Smrg printf "lrulist_next: 0x%lx\n", $vi->vi_lrulist.tqe_next 111.11Smrg while ($vi) 121.11Smrg set $vp = &$vi->vi_vnode 131.11Smrg printf "vp: 0x%lx usecount: %d flags: i:0x%x v:0x%x u:0x%x\n",\ 141.11Smrg $vp, $vp->v_uobj.uo_refs, \ 151.6Seeh $vp->v_iflag, $vp->v_vflag, $vp->v_uflag 161.1Sgwr set $num++ 171.11Smrg set $vi = $vi->vi_mntvnodes.tqe_next 181.1Sgwr end 191.1Sgwr printf "Number of vnodes: %d\n", $num 201.1Sgwrend 211.1Sgwr 221.6Seehdocument vchain 231.6SeehGiven a vnode, follow its mount pointers 241.6Seehend 251.6Seeh 261.1Sgwrdefine vprint 271.1Sgwr set $vp=(struct vnode *)$arg0 281.1Sgwr set $ip=(struct inode *)$vp->v_data 291.1Sgwrend 301.1Sgwr 311.3Spookadefine mp_vchain 321.11Smrg set $mp = $arg0->me_mount 331.11Smrg set $first = $mp->mnt_vnodelist.tqh_first 341.11Smrg if ($first) 351.11Smrg vchain $mp->mnt_vnodelist.tqh_first 361.11Smrg end 371.3Spookaend 381.6Seehdocument mp_vchain 391.6Seehprint the vnode chain for a given mount point 401.6Seehend 411.3Spooka 421.1Sgwrdefine vall 431.11Smrg set $mpe=mountlist.tqh_first 441.11Smrg while ($mpe) 451.11Smrg printf "\tmount point at 0x%lx\n", $mpe 461.11Smrg mp_vchain $mpe 471.11Smrg set $mpe = $mpe->me_list.tqe_next 481.3Spooka 491.3Spooka # "break" 501.11Smrg if ((const void *)$mpe == (const void *)&mountlist) 511.11Smrg set $mpe = 0 521.3Spooka end 531.1Sgwr end 541.1Sgwrend 551.6Seehdocument vall 561.6Seehprint vnode chains for all mount points 571.6Seehend 581.4Spooka 591.4Spookadefine mountdump 601.10Smrg set $me=mountlist.tqh_first 611.9Shannken while ($me) 621.9Shannken if ($me->me_type == ME_MOUNT) 631.9Shannken set $mp = $me->me_mount 641.11Smrg printf "%s on %s type %s, (mp 0x%lx, privdata 0x%lx)\n", \ 651.9Shannken $mp->mnt_stat->f_mntfromname, \ 661.9Shannken $mp->mnt_stat->f_mntonname, \ 671.9Shannken $mp->mnt_op->vfs_name, $mp, $mp->mnt_data 681.9Shannken end 691.9Shannken set $me=$me->me_list.tqe_next 701.10Smrg if ((const void *)$me == (const void *)&mountlist) 711.9Shannken set $me = 0 721.4Spooka end 731.4Spooka end 741.7Srizend 75