vchain revision 1.4
11.4Spooka# $NetBSD: vchain,v 1.4 2006/11/04 20:29:30 pooka Exp $ 21.2Sgwr 31.1Sgwr# @(#)vchain 8.1 (Berkeley) 6/10/93 41.1Sgwr# 51.1Sgwr# Given a vnode, follow its mount pointers 61.1Sgwrdefine vchain 71.1Sgwr set $num = 0 81.1Sgwr 91.1Sgwr set $vp=(struct vnode *)$arg0 101.1Sgwr while ($vp) 111.3Spooka printf "vp: 0x%x freelist_next: 0x%x usecount: %d flags: 0x%x\n", $vp, $vp->v_freelist.tqe_next, $vp->v_uobj.uo_refs, $vp->v_flag 121.1Sgwr set $num++ 131.3Spooka set $vp = $vp->v_mntvnodes.le_next 141.1Sgwr end 151.1Sgwr printf "Number of vnodes: %d\n", $num 161.1Sgwrend 171.1Sgwr 181.1Sgwrdefine vprint 191.1Sgwr set $vp=(struct vnode *)$arg0 201.1Sgwr set $ip=(struct inode *)$vp->v_data 211.1Sgwrend 221.1Sgwr 231.3Spooka# print the vnode chain for a given mount point 241.3Spookadefine mp_vchain 251.3Spooka set $mp = (struct mount *)$arg0 261.3Spooka vchain $mp->mnt_vnodelist.lh_first 271.3Spookaend 281.3Spooka 291.3Spooka# print vnode chains for all mount points 301.1Sgwrdefine vall 311.3Spooka set $mp=mountlist.cqh_first 321.1Sgwr while ($mp) 331.3Spooka printf "\tmount point at 0x%x\n", $mp 341.3Spooka mp_vchain $mp 351.3Spooka set $mp=$mp->mnt_list.cqe_next 361.3Spooka 371.3Spooka # "break" 381.3Spooka if ((const void *)$mp == (const void *)&mountlist) 391.3Spooka set $mp = 0 401.3Spooka end 411.1Sgwr end 421.1Sgwrend 431.4Spooka 441.4Spookadefine mountdump 451.4Spooka set $mp=mountlist.cqh_first 461.4Spooka while ($mp) 471.4Spooka printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \ 481.4Spooka $mp->mnt_stat->f_mntfromname, $mp->mnt_stat->f_mntonname, \ 491.4Spooka $mp->mnt_op->vfs_name, $mp, $mp->mnt_data 501.4Spooka set $mp=$mp->mnt_list.cqe_next 511.4Spooka if ((const void *)$mp == (const void *)&mountlist) 521.4Spooka set $mp = 0 531.4Spooka end 541.4Spooka end 55