Home | History | Annotate | Line # | Download | only in gdbscripts
vchain revision 1.7.6.1
      1 #	$NetBSD: vchain,v 1.7.6.1 2017/02/05 13:40:56 skrll Exp $
      2 
      3 #	@(#)vchain	8.1 (Berkeley) 6/10/93
      4 #
      5 
      6 define vchain
      7 	set $num = 0
      8 
      9 	set $vp=(struct vnode *)$arg0
     10 	set $vi=(struct vnode_impl *)$arg0
     11 	while ($vp)
     12 		printf "vp: 0x%lx lrulist_next: 0x%lx usecount: %d flags: i:0x%x v:0x%x u:0x%x\n",\
     13 		       $vp, $vi->vi_lrulist.tqe_next, $vp->v_uobj.uo_refs, \
     14 		       $vp->v_iflag, $vp->v_vflag, $vp->v_uflag
     15 		set $num++
     16 		set $vp = $vp->v_mntvnodes.tqe_next
     17 	end
     18 	printf "Number of vnodes: %d\n", $num
     19 end
     20 
     21 document vchain
     22 Given a vnode, follow its mount pointers
     23 end
     24 
     25 define vprint
     26 	set $vp=(struct vnode *)$arg0
     27 	set $ip=(struct inode *)$vp->v_data
     28 end
     29 
     30 define mp_vchain
     31 	set $mp = (struct mount *)$arg0
     32 	vchain $mp->mnt_vnodelist.tqh_first
     33 end
     34 document mp_vchain
     35 print the vnode chain for a given mount point
     36 end
     37 
     38 define vall
     39 	set $mp=mountlist.tqh_first
     40 	while ($mp)
     41 		printf "\tmount point at 0x%x\n", $mp
     42 		mp_vchain $mp
     43 		set $mp=$mp->mnt_list.tqe_next
     44 
     45 		# "break"
     46 		if ((const void *)$mp == (const void *)&mountlist)
     47 			set $mp = 0
     48 		end
     49 	end
     50 end
     51 document vall
     52 print vnode chains for all mount points
     53 end
     54 
     55 define mountdump
     56 	set $mp=mountlist.tqh_first
     57 	while ($mp)
     58 		printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
     59 		    $mp->mnt_stat->f_mntfromname, $mp->mnt_stat->f_mntonname, \
     60 		    $mp->mnt_op->vfs_name, $mp, $mp->mnt_data
     61 		set $mp=$mp->mnt_list.tqe_next
     62 		if ((const void *)$mp == (const void *)&mountlist)
     63 			set $mp = 0
     64 		end
     65 	end
     66 end
     67