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