Home | History | Annotate | Line # | Download | only in gdbscripts
vchain revision 1.2.102.1
      1  1.2.102.1   ad #	$NetBSD: vchain,v 1.2.102.1 2006/11/18 21:39:21 ad Exp $
      2        1.2  gwr 
      3        1.1  gwr #	@(#)vchain	8.1 (Berkeley) 6/10/93
      4        1.1  gwr #
      5        1.1  gwr # Given a vnode, follow its mount pointers
      6        1.1  gwr define vchain
      7        1.1  gwr 	set $num = 0
      8        1.1  gwr 
      9        1.1  gwr 	set $vp=(struct vnode *)$arg0
     10        1.1  gwr 	while ($vp)
     11  1.2.102.1   ad 		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
     12        1.1  gwr 		set $num++
     13  1.2.102.1   ad 		set $vp = $vp->v_mntvnodes.tqe_next
     14        1.1  gwr 	end
     15        1.1  gwr 	printf "Number of vnodes: %d\n", $num
     16        1.1  gwr end
     17        1.1  gwr 
     18        1.1  gwr define vprint
     19        1.1  gwr 	set $vp=(struct vnode *)$arg0
     20        1.1  gwr 	set $ip=(struct inode *)$vp->v_data
     21        1.1  gwr end
     22        1.1  gwr 
     23  1.2.102.1   ad # print the vnode chain for a given mount point
     24  1.2.102.1   ad define mp_vchain
     25  1.2.102.1   ad 	set $mp = (struct mount *)$arg0
     26  1.2.102.1   ad 	vchain $mp->mnt_vnodelist.tqh_first
     27  1.2.102.1   ad end
     28  1.2.102.1   ad 
     29  1.2.102.1   ad # print vnode chains for all mount points
     30        1.1  gwr define vall
     31  1.2.102.1   ad 	set $mp=mountlist.cqh_first
     32        1.1  gwr 	while ($mp)
     33  1.2.102.1   ad 		printf "\tmount point at 0x%x\n", $mp
     34  1.2.102.1   ad 		mp_vchain $mp
     35  1.2.102.1   ad 		set $mp=$mp->mnt_list.cqe_next
     36  1.2.102.1   ad 
     37  1.2.102.1   ad 		# "break"
     38  1.2.102.1   ad 		if ((const void *)$mp == (const void *)&mountlist)
     39  1.2.102.1   ad 			set $mp = 0
     40  1.2.102.1   ad 		end
     41        1.1  gwr 	end
     42        1.1  gwr end
     43  1.2.102.1   ad 
     44  1.2.102.1   ad define mountdump
     45  1.2.102.1   ad 	set $mp=mountlist.cqh_first
     46  1.2.102.1   ad 	while ($mp)
     47  1.2.102.1   ad 		printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
     48  1.2.102.1   ad 		    $mp->mnt_stat->f_mntfromname, $mp->mnt_stat->f_mntonname, \
     49  1.2.102.1   ad 		    $mp->mnt_op->vfs_name, $mp, $mp->mnt_data
     50  1.2.102.1   ad 		set $mp=$mp->mnt_list.cqe_next
     51  1.2.102.1   ad 		if ((const void *)$mp == (const void *)&mountlist)
     52  1.2.102.1   ad 			set $mp = 0
     53  1.2.102.1   ad 		end
     54  1.2.102.1   ad 	end
     55