Home | History | Annotate | Line # | Download | only in gdbscripts
vchain revision 1.10
      1 #	$NetBSD: vchain,v 1.10 2019/12/06 01:01:02 mrg 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 $me=mountlist.tqh_first
     57 	while ($me)
     58 		if ($me->me_type == ME_MOUNT)
     59 			set $mp = $me->me_mount
     60 			printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
     61 			    $mp->mnt_stat->f_mntfromname, \
     62 			    $mp->mnt_stat->f_mntonname, \
     63 			    $mp->mnt_op->vfs_name, $mp, $mp->mnt_data
     64 		end
     65 		set $me=$me->me_list.tqe_next
     66 		if ((const void *)$me == (const void *)&mountlist)
     67 			set $me = 0
     68 		end
     69 	end
     70 end
     71