vchain revision 1.4 1 1.4 pooka # $NetBSD: vchain,v 1.4 2006/11/04 20:29:30 pooka 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.3 pooka 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.3 pooka set $vp = $vp->v_mntvnodes.le_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.3 pooka # print the vnode chain for a given mount point
24 1.3 pooka define mp_vchain
25 1.3 pooka set $mp = (struct mount *)$arg0
26 1.3 pooka vchain $mp->mnt_vnodelist.lh_first
27 1.3 pooka end
28 1.3 pooka
29 1.3 pooka # print vnode chains for all mount points
30 1.1 gwr define vall
31 1.3 pooka set $mp=mountlist.cqh_first
32 1.1 gwr while ($mp)
33 1.3 pooka printf "\tmount point at 0x%x\n", $mp
34 1.3 pooka mp_vchain $mp
35 1.3 pooka set $mp=$mp->mnt_list.cqe_next
36 1.3 pooka
37 1.3 pooka # "break"
38 1.3 pooka if ((const void *)$mp == (const void *)&mountlist)
39 1.3 pooka set $mp = 0
40 1.3 pooka end
41 1.1 gwr end
42 1.1 gwr end
43 1.4 pooka
44 1.4 pooka define mountdump
45 1.4 pooka set $mp=mountlist.cqh_first
46 1.4 pooka while ($mp)
47 1.4 pooka printf "%s on %s type %s, (mp 0x%x, privdata 0x%x)\n", \
48 1.4 pooka $mp->mnt_stat->f_mntfromname, $mp->mnt_stat->f_mntonname, \
49 1.4 pooka $mp->mnt_op->vfs_name, $mp, $mp->mnt_data
50 1.4 pooka set $mp=$mp->mnt_list.cqe_next
51 1.4 pooka if ((const void *)$mp == (const void *)&mountlist)
52 1.4 pooka set $mp = 0
53 1.4 pooka end
54 1.4 pooka end
55