vchain revision 1.8
11.8Shannken#	$NetBSD: vchain,v 1.8 2016/12/14 15:48:55 hannken 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.1Sgwr	set $vp=(struct vnode *)$arg0
101.8Shannken	set $vi=(struct vnode_impl *)$arg0
111.1Sgwr	while ($vp)
121.8Shannken		printf "vp: 0x%lx lrulist_next: 0x%lx usecount: %d flags: i:0x%x v:0x%x u:0x%x\n",\
131.8Shannken		       $vp, $vi->vi_lrulist.tqe_next, $vp->v_uobj.uo_refs, \
141.6Seeh		       $vp->v_iflag, $vp->v_vflag, $vp->v_uflag
151.1Sgwr		set $num++
161.5Spooka		set $vp = $vp->v_mntvnodes.tqe_next
171.1Sgwr	end
181.1Sgwr	printf "Number of vnodes: %d\n", $num
191.1Sgwrend
201.1Sgwr
211.6Seehdocument vchain
221.6SeehGiven a vnode, follow its mount pointers
231.6Seehend
241.6Seeh
251.1Sgwrdefine vprint
261.1Sgwr	set $vp=(struct vnode *)$arg0
271.1Sgwr	set $ip=(struct inode *)$vp->v_data
281.1Sgwrend
291.1Sgwr
301.3Spookadefine mp_vchain
311.3Spooka	set $mp = (struct mount *)$arg0
321.5Spooka	vchain $mp->mnt_vnodelist.tqh_first
331.3Spookaend
341.6Seehdocument mp_vchain
351.6Seehprint the vnode chain for a given mount point
361.6Seehend
371.3Spooka
381.1Sgwrdefine vall
391.7Sriz	set $mp=mountlist.tqh_first
401.1Sgwr	while ($mp)
411.3Spooka		printf "\tmount point at 0x%x\n", $mp
421.3Spooka		mp_vchain $mp
431.7Sriz		set $mp=$mp->mnt_list.tqe_next
441.3Spooka
451.3Spooka		# "break"
461.3Spooka		if ((const void *)$mp == (const void *)&mountlist)
471.3Spooka			set $mp = 0
481.3Spooka		end
491.1Sgwr	end
501.1Sgwrend
511.6Seehdocument vall
521.6Seehprint vnode chains for all mount points
531.6Seehend
541.4Spooka
551.4Spookadefine mountdump
561.7Sriz	set $mp=mountlist.tqh_first
571.4Spooka	while ($mp)
581.4Spooka		printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
591.4Spooka		    $mp->mnt_stat->f_mntfromname, $mp->mnt_stat->f_mntonname, \
601.4Spooka		    $mp->mnt_op->vfs_name, $mp, $mp->mnt_data
611.7Sriz		set $mp=$mp->mnt_list.tqe_next
621.4Spooka		if ((const void *)$mp == (const void *)&mountlist)
631.4Spooka			set $mp = 0
641.4Spooka		end
651.4Spooka	end
661.7Srizend
67