opdump.c revision 1.2 1 /* $NetBSD: opdump.c,v 1.2 2006/10/23 00:22:24 christos Exp $ */
2
3 /*
4 * Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
5 *
6 * Development of this software was supported by the
7 * Google Summer of Code program and the Ulla Tuominen Foundation.
8 * The Google SoC project was mentored by Bill Studenmund.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. The name of the company nor the name of the author may be used to
19 * endorse or promote products derived from this software without specific
20 * prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
23 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35 /* Pretty-printing helper routines for VFS/VOP request contents */
36
37 #include <sys/cdefs.h>
38 #if !defined(lint)
39 __RCSID("$NetBSD: opdump.c,v 1.2 2006/10/23 00:22:24 christos Exp $");
40 #endif /* !lint */
41
42 #include <puffs.h>
43 #include <puffsdump.h>
44 #include <stdio.h>
45
46 /* XXX! */
47 const char *vnop_revmap[] = {
48 "PUFFS_LOOKUP",
49 "PUFFS_CREATE",
50 "PUFFS_MKNOD",
51 "PUFFS_OPEN",
52 "PUFFS_CLOSE",
53 "PUFFS_ACCESS",
54 "PUFFS_GETATTR",
55 "PUFFS_SETATTR",
56 "PUFFS_READ",
57 "PUFFS_WRITE",
58 "PUFFS_IOCTL",
59 "PUFFS_FCNTL",
60 "PUFFS_POLL",
61 "PUFFS_KQFILTER",
62 "PUFFS_REVOKE",
63 "PUFFS_MMAP",
64 "PUFFS_FSYNC",
65 "PUFFS_SEEK",
66 "PUFFS_REMOVE",
67 "PUFFS_LINK",
68 "PUFFS_RENAME",
69 "PUFFS_MKDIR",
70 "PUFFS_RMDIR",
71 "PUFFS_SYMLINK",
72 "PUFFS_READDIR",
73 "PUFFS_READLINK",
74 "PUFFS_ABORTOP",
75 "PUFFS_INACTIVE",
76 "PUFFS_RECLAIM",
77 "PUFFS_LOCK",
78 "PUFFS_UNLOCK",
79 "PUFFS_BMAP",
80 "PUFFS_STRATEGY",
81 "PUFFS_PRINT",
82 "PUFFS_ISLOCKED",
83 "PUFFS_PATHCONF",
84 "PUFFS_ADVLOCK",
85 "PUFFS_LEASE",
86 "PUFFS_WHITEOUT",
87 "PUFFS_GETPAGES",
88 "PUFFS_PUTPAGES",
89 "PUFFS_BWRITE",
90 "PUFFS_GETEXTATTR",
91 "PUFFS_LISTEXTATTR",
92 "PUFFS_OPENEXTATTR",
93 "PUFFS_DELETEEXTATTR",
94 "PUFFS_SETEXTATTR",
95 };
96
97 void
98 puffsdump_req(struct puffs_req *preq)
99 {
100
101 printf("\treqid: %llu, opclass %d, optype: %s, cookie: %p,\n"
102 "\t\taux: %p, auxlen: %d\n",
103 preq->preq_id, preq->preq_opclass, vnop_revmap[preq->preq_optype],
104 preq->preq_cookie, preq->preq_aux, preq->preq_auxlen);
105 }
106
107 void
108 puffsdump_cookie(void *c, const char *cookiename)
109 {
110
111 printf("\t%scookie: at %p\n", cookiename, c);
112 }
113
114 #if 0
115 static const char *cn_opnames[] = {
116 "LOOKUP",
117 "CREATE",
118 "DELETE",
119 "RENAME"
120 };
121 void
122 puffsdump_cn(struct puffs_cn *pcn)
123 {
124
125 printf("\tpuffs_cn: %s (%sfollow)\n",
126 cn_opnames[pcn->pcn_nameio & PUFFSLOOKUP_OPMASK],
127 pcn->pcn_nameio&PUFFSLOOKUP_OPTIONS==PUFFSLOOKUP_NOFOLLOW?"no":"");
128 /*
129 TOFINISH
130 */
131 }
132 #endif
133
134 void
135 /*ARGSUSED*/
136 puffsdump_creds(struct puffs_cred *pcr)
137 {
138
139 }
140
141 void
142 puffsdump_int(int value, const char *name)
143 {
144
145 printf("\tint (%s): %d\n", name, value);
146 }
147