vchain revision 1.6
11.6Seeh#	$NetBSD: vchain,v 1.6 2009/11/18 18:04:26 eeh 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.1Sgwr	while ($vp)
111.6Seeh		printf "vp: 0x%lx freelist_next: 0x%lx usecount: %d flags: i:0x%x v:0x%x u:0x%x\n",\
121.6Seeh		       $vp, $vp->v_freelist.tqe_next, $vp->v_uobj.uo_refs, \
131.6Seeh		       $vp->v_iflag, $vp->v_vflag, $vp->v_uflag
141.1Sgwr		set $num++
151.5Spooka		set $vp = $vp->v_mntvnodes.tqe_next
161.1Sgwr	end
171.1Sgwr	printf "Number of vnodes: %d\n", $num
181.1Sgwrend
191.1Sgwr
201.6Seehdocument vchain
211.6SeehGiven a vnode, follow its mount pointers
221.6Seehend
231.6Seeh
241.1Sgwrdefine vprint
251.1Sgwr	set $vp=(struct vnode *)$arg0
261.1Sgwr	set $ip=(struct inode *)$vp->v_data
271.1Sgwrend
281.1Sgwr
291.3Spookadefine mp_vchain
301.3Spooka	set $mp = (struct mount *)$arg0
311.5Spooka	vchain $mp->mnt_vnodelist.tqh_first
321.3Spookaend
331.6Seehdocument mp_vchain
341.6Seehprint the vnode chain for a given mount point
351.6Seehend
361.3Spooka
371.1Sgwrdefine vall
381.3Spooka	set $mp=mountlist.cqh_first
391.1Sgwr	while ($mp)
401.3Spooka		printf "\tmount point at 0x%x\n", $mp
411.3Spooka		mp_vchain $mp
421.3Spooka		set $mp=$mp->mnt_list.cqe_next
431.3Spooka
441.3Spooka		# "break"
451.3Spooka		if ((const void *)$mp == (const void *)&mountlist)
461.3Spooka			set $mp = 0
471.3Spooka		end
481.1Sgwr	end
491.1Sgwrend
501.6Seehdocument vall
511.6Seehprint vnode chains for all mount points
521.6Seehend
531.4Spooka
541.4Spookadefine mountdump
551.4Spooka	set $mp=mountlist.cqh_first
561.4Spooka	while ($mp)
571.4Spooka		printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
581.4Spooka		    $mp->mnt_stat->f_mntfromname, $mp->mnt_stat->f_mntonname, \
591.4Spooka		    $mp->mnt_op->vfs_name, $mp, $mp->mnt_data
601.4Spooka		set $mp=$mp->mnt_list.cqe_next
611.4Spooka		if ((const void *)$mp == (const void *)&mountlist)
621.4Spooka			set $mp = 0
631.4Spooka		end
641.4Spooka	end
651.6Seehend