2006-11-04 23:33:17 +03:00
|
|
|
# $NetBSD: vchain,v 1.5 2006/11/04 20:33:17 pooka Exp $
|
1997-02-13 02:35:06 +03:00
|
|
|
|
1997-02-13 01:09:45 +03:00
|
|
|
# @(#)vchain 8.1 (Berkeley) 6/10/93
|
|
|
|
#
|
|
|
|
# Given a vnode, follow its mount pointers
|
|
|
|
define vchain
|
|
|
|
set $num = 0
|
|
|
|
|
|
|
|
set $vp=(struct vnode *)$arg0
|
|
|
|
while ($vp)
|
2006-09-29 19:43:06 +04:00
|
|
|
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
|
1997-02-13 01:09:45 +03:00
|
|
|
set $num++
|
2006-11-04 23:33:17 +03:00
|
|
|
set $vp = $vp->v_mntvnodes.tqe_next
|
1997-02-13 01:09:45 +03:00
|
|
|
end
|
|
|
|
printf "Number of vnodes: %d\n", $num
|
|
|
|
end
|
|
|
|
|
|
|
|
define vprint
|
|
|
|
set $vp=(struct vnode *)$arg0
|
|
|
|
set $ip=(struct inode *)$vp->v_data
|
|
|
|
end
|
|
|
|
|
2006-09-29 19:43:06 +04:00
|
|
|
# print the vnode chain for a given mount point
|
|
|
|
define mp_vchain
|
|
|
|
set $mp = (struct mount *)$arg0
|
2006-11-04 23:33:17 +03:00
|
|
|
vchain $mp->mnt_vnodelist.tqh_first
|
2006-09-29 19:43:06 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
# print vnode chains for all mount points
|
1997-02-13 01:09:45 +03:00
|
|
|
define vall
|
2006-09-29 19:43:06 +04:00
|
|
|
set $mp=mountlist.cqh_first
|
1997-02-13 01:09:45 +03:00
|
|
|
while ($mp)
|
2006-09-29 19:43:06 +04:00
|
|
|
printf "\tmount point at 0x%x\n", $mp
|
|
|
|
mp_vchain $mp
|
|
|
|
set $mp=$mp->mnt_list.cqe_next
|
|
|
|
|
|
|
|
# "break"
|
|
|
|
if ((const void *)$mp == (const void *)&mountlist)
|
|
|
|
set $mp = 0
|
|
|
|
end
|
1997-02-13 01:09:45 +03:00
|
|
|
end
|
|
|
|
end
|
2006-11-04 23:29:30 +03:00
|
|
|
|
|
|
|
define mountdump
|
|
|
|
set $mp=mountlist.cqh_first
|
|
|
|
while ($mp)
|
|
|
|
printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
|
|
|
|
$mp->mnt_stat->f_mntfromname, $mp->mnt_stat->f_mntonname, \
|
|
|
|
$mp->mnt_op->vfs_name, $mp, $mp->mnt_data
|
|
|
|
set $mp=$mp->mnt_list.cqe_next
|
|
|
|
if ((const void *)$mp == (const void *)&mountlist)
|
|
|
|
set $mp = 0
|
|
|
|
end
|
|
|
|
end
|