vchain revision 1.9
11.9Shannken#	$NetBSD: vchain,v 1.9 2017/04/13 09:52:18 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.9Shannken	set $me=mount_list.tqh_first
571.9Shannken	while ($me)
581.9Shannken		if ($me->me_type == ME_MOUNT)
591.9Shannken			set $mp = $me->me_mount
601.9Shannken			printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
611.9Shannken			    $mp->mnt_stat->f_mntfromname, \
621.9Shannken			    $mp->mnt_stat->f_mntonname, \
631.9Shannken			    $mp->mnt_op->vfs_name, $mp, $mp->mnt_data
641.9Shannken		end
651.9Shannken		set $me=$me->me_list.tqe_next
661.9Shannken		if ((const void *)$me == (const void *)&mount_list)
671.9Shannken			set $me = 0
681.4Spooka		end
691.4Spooka	end
701.7Srizend
71