root / hw / virtio-9p-debug.c @ 6d65516f
History | View | Annotate | Download (18.8 kB)
1 | 9f107513 | Anthony Liguori | /*
|
---|---|---|---|
2 | 9f107513 | Anthony Liguori | * Virtio 9p PDU debug
|
3 | 9f107513 | Anthony Liguori | *
|
4 | 9f107513 | Anthony Liguori | * Copyright IBM, Corp. 2010
|
5 | 9f107513 | Anthony Liguori | *
|
6 | 9f107513 | Anthony Liguori | * Authors:
|
7 | 9f107513 | Anthony Liguori | * Anthony Liguori <aliguori@us.ibm.com>
|
8 | 9f107513 | Anthony Liguori | *
|
9 | 9f107513 | Anthony Liguori | * This work is licensed under the terms of the GNU GPL, version 2. See
|
10 | 9f107513 | Anthony Liguori | * the COPYING file in the top-level directory.
|
11 | 9f107513 | Anthony Liguori | *
|
12 | 9f107513 | Anthony Liguori | */
|
13 | 9f107513 | Anthony Liguori | #include "virtio.h" |
14 | 9f107513 | Anthony Liguori | #include "pc.h" |
15 | 9f107513 | Anthony Liguori | #include "virtio-9p.h" |
16 | 9f107513 | Anthony Liguori | #include "virtio-9p-debug.h" |
17 | 9f107513 | Anthony Liguori | |
18 | 9f107513 | Anthony Liguori | #define BUG_ON(cond) assert(!(cond))
|
19 | 9f107513 | Anthony Liguori | |
20 | 9f107513 | Anthony Liguori | static FILE *llogfile;
|
21 | 9f107513 | Anthony Liguori | |
22 | 9f107513 | Anthony Liguori | static struct iovec *get_sg(V9fsPDU *pdu, int rx) |
23 | 9f107513 | Anthony Liguori | { |
24 | 9f107513 | Anthony Liguori | if (rx) {
|
25 | 9f107513 | Anthony Liguori | return pdu->elem.in_sg;
|
26 | 9f107513 | Anthony Liguori | } |
27 | 9f107513 | Anthony Liguori | return pdu->elem.out_sg;
|
28 | 9f107513 | Anthony Liguori | } |
29 | 9f107513 | Anthony Liguori | |
30 | 9f107513 | Anthony Liguori | static int get_sg_count(V9fsPDU *pdu, int rx) |
31 | 9f107513 | Anthony Liguori | { |
32 | 9f107513 | Anthony Liguori | if (rx) {
|
33 | 9f107513 | Anthony Liguori | return pdu->elem.in_num;
|
34 | 9f107513 | Anthony Liguori | } |
35 | 9f107513 | Anthony Liguori | return pdu->elem.out_num;
|
36 | 9f107513 | Anthony Liguori | |
37 | 9f107513 | Anthony Liguori | } |
38 | 9f107513 | Anthony Liguori | |
39 | 9f107513 | Anthony Liguori | static void pprint_int8(V9fsPDU *pdu, int rx, size_t *offsetp, |
40 | 9f107513 | Anthony Liguori | const char *name) |
41 | 9f107513 | Anthony Liguori | { |
42 | 9f107513 | Anthony Liguori | size_t copied; |
43 | 9f107513 | Anthony Liguori | int count = get_sg_count(pdu, rx);
|
44 | 9f107513 | Anthony Liguori | size_t offset = *offsetp; |
45 | 9f107513 | Anthony Liguori | struct iovec *sg = get_sg(pdu, rx);
|
46 | 9f107513 | Anthony Liguori | int8_t value; |
47 | 9f107513 | Anthony Liguori | |
48 | 9f107513 | Anthony Liguori | copied = do_pdu_unpack(&value, sg, count, offset, sizeof(value));
|
49 | 9f107513 | Anthony Liguori | |
50 | 9f107513 | Anthony Liguori | BUG_ON(copied != sizeof(value));
|
51 | 9f107513 | Anthony Liguori | offset += sizeof(value);
|
52 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s=0x%x", name, value);
|
53 | 9f107513 | Anthony Liguori | *offsetp = offset; |
54 | 9f107513 | Anthony Liguori | } |
55 | 9f107513 | Anthony Liguori | |
56 | 9f107513 | Anthony Liguori | static void pprint_int16(V9fsPDU *pdu, int rx, size_t *offsetp, |
57 | 9f107513 | Anthony Liguori | const char *name) |
58 | 9f107513 | Anthony Liguori | { |
59 | 9f107513 | Anthony Liguori | size_t copied; |
60 | 9f107513 | Anthony Liguori | int count = get_sg_count(pdu, rx);
|
61 | 9f107513 | Anthony Liguori | struct iovec *sg = get_sg(pdu, rx);
|
62 | 9f107513 | Anthony Liguori | size_t offset = *offsetp; |
63 | 9f107513 | Anthony Liguori | int16_t value; |
64 | 9f107513 | Anthony Liguori | |
65 | 9f107513 | Anthony Liguori | |
66 | 9f107513 | Anthony Liguori | copied = do_pdu_unpack(&value, sg, count, offset, sizeof(value));
|
67 | 9f107513 | Anthony Liguori | |
68 | 9f107513 | Anthony Liguori | BUG_ON(copied != sizeof(value));
|
69 | 9f107513 | Anthony Liguori | offset += sizeof(value);
|
70 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s=0x%x", name, value);
|
71 | 9f107513 | Anthony Liguori | *offsetp = offset; |
72 | 9f107513 | Anthony Liguori | } |
73 | 9f107513 | Anthony Liguori | |
74 | 9f107513 | Anthony Liguori | static void pprint_int32(V9fsPDU *pdu, int rx, size_t *offsetp, |
75 | 9f107513 | Anthony Liguori | const char *name) |
76 | 9f107513 | Anthony Liguori | { |
77 | 9f107513 | Anthony Liguori | size_t copied; |
78 | 9f107513 | Anthony Liguori | int count = get_sg_count(pdu, rx);
|
79 | 9f107513 | Anthony Liguori | struct iovec *sg = get_sg(pdu, rx);
|
80 | 9f107513 | Anthony Liguori | size_t offset = *offsetp; |
81 | 9f107513 | Anthony Liguori | int32_t value; |
82 | 9f107513 | Anthony Liguori | |
83 | 9f107513 | Anthony Liguori | |
84 | 9f107513 | Anthony Liguori | copied = do_pdu_unpack(&value, sg, count, offset, sizeof(value));
|
85 | 9f107513 | Anthony Liguori | |
86 | 9f107513 | Anthony Liguori | BUG_ON(copied != sizeof(value));
|
87 | 9f107513 | Anthony Liguori | offset += sizeof(value);
|
88 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s=0x%x", name, value);
|
89 | 9f107513 | Anthony Liguori | *offsetp = offset; |
90 | 9f107513 | Anthony Liguori | } |
91 | 9f107513 | Anthony Liguori | |
92 | 9f107513 | Anthony Liguori | static void pprint_int64(V9fsPDU *pdu, int rx, size_t *offsetp, |
93 | 9f107513 | Anthony Liguori | const char *name) |
94 | 9f107513 | Anthony Liguori | { |
95 | 9f107513 | Anthony Liguori | size_t copied; |
96 | 9f107513 | Anthony Liguori | int count = get_sg_count(pdu, rx);
|
97 | 9f107513 | Anthony Liguori | struct iovec *sg = get_sg(pdu, rx);
|
98 | 9f107513 | Anthony Liguori | size_t offset = *offsetp; |
99 | 9f107513 | Anthony Liguori | int64_t value; |
100 | 9f107513 | Anthony Liguori | |
101 | 9f107513 | Anthony Liguori | |
102 | 9f107513 | Anthony Liguori | copied = do_pdu_unpack(&value, sg, count, offset, sizeof(value));
|
103 | 9f107513 | Anthony Liguori | |
104 | 9f107513 | Anthony Liguori | BUG_ON(copied != sizeof(value));
|
105 | 9f107513 | Anthony Liguori | offset += sizeof(value);
|
106 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s=0x%" PRIx64, name, value);
|
107 | 9f107513 | Anthony Liguori | *offsetp = offset; |
108 | 9f107513 | Anthony Liguori | } |
109 | 9f107513 | Anthony Liguori | |
110 | 9f107513 | Anthony Liguori | static void pprint_str(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) |
111 | 9f107513 | Anthony Liguori | { |
112 | 9f107513 | Anthony Liguori | int sg_count = get_sg_count(pdu, rx);
|
113 | 9f107513 | Anthony Liguori | struct iovec *sg = get_sg(pdu, rx);
|
114 | 9f107513 | Anthony Liguori | size_t offset = *offsetp; |
115 | 9f107513 | Anthony Liguori | uint16_t tmp_size, size; |
116 | 9f107513 | Anthony Liguori | size_t result; |
117 | 9f107513 | Anthony Liguori | size_t copied = 0;
|
118 | 9f107513 | Anthony Liguori | int i = 0; |
119 | 9f107513 | Anthony Liguori | |
120 | 9f107513 | Anthony Liguori | /* get the size */
|
121 | 9f107513 | Anthony Liguori | copied = do_pdu_unpack(&tmp_size, sg, sg_count, offset, sizeof(tmp_size));
|
122 | 9f107513 | Anthony Liguori | BUG_ON(copied != sizeof(tmp_size));
|
123 | 9f107513 | Anthony Liguori | size = le16_to_cpupu(&tmp_size); |
124 | 9f107513 | Anthony Liguori | offset += copied; |
125 | 9f107513 | Anthony Liguori | |
126 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s=", name);
|
127 | 9f107513 | Anthony Liguori | for (i = 0; size && i < sg_count; i++) { |
128 | 9f107513 | Anthony Liguori | size_t len; |
129 | 9f107513 | Anthony Liguori | if (offset >= sg[i].iov_len) {
|
130 | 9f107513 | Anthony Liguori | /* skip this sg */
|
131 | 9f107513 | Anthony Liguori | offset -= sg[i].iov_len; |
132 | 9f107513 | Anthony Liguori | continue;
|
133 | 9f107513 | Anthony Liguori | } else {
|
134 | 9f107513 | Anthony Liguori | len = MIN(sg[i].iov_len - offset, size); |
135 | 9f107513 | Anthony Liguori | result = fwrite(sg[i].iov_base + offset, 1, len, llogfile);
|
136 | 9f107513 | Anthony Liguori | BUG_ON(result != len); |
137 | 9f107513 | Anthony Liguori | size -= len; |
138 | 9f107513 | Anthony Liguori | copied += len; |
139 | 9f107513 | Anthony Liguori | if (size) {
|
140 | 9f107513 | Anthony Liguori | offset = 0;
|
141 | 9f107513 | Anthony Liguori | continue;
|
142 | 9f107513 | Anthony Liguori | } |
143 | 9f107513 | Anthony Liguori | } |
144 | 9f107513 | Anthony Liguori | } |
145 | 9f107513 | Anthony Liguori | *offsetp += copied; |
146 | 9f107513 | Anthony Liguori | } |
147 | 9f107513 | Anthony Liguori | |
148 | 9f107513 | Anthony Liguori | static void pprint_qid(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) |
149 | 9f107513 | Anthony Liguori | { |
150 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s={", name);
|
151 | 9f107513 | Anthony Liguori | pprint_int8(pdu, rx, offsetp, "type");
|
152 | 9f107513 | Anthony Liguori | pprint_int32(pdu, rx, offsetp, ", version");
|
153 | 9f107513 | Anthony Liguori | pprint_int64(pdu, rx, offsetp, ", path");
|
154 | 9f107513 | Anthony Liguori | fprintf(llogfile, "}");
|
155 | 9f107513 | Anthony Liguori | } |
156 | 9f107513 | Anthony Liguori | |
157 | 9f107513 | Anthony Liguori | static void pprint_stat(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) |
158 | 9f107513 | Anthony Liguori | { |
159 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s={", name);
|
160 | 9f107513 | Anthony Liguori | pprint_int16(pdu, rx, offsetp, "size");
|
161 | 9f107513 | Anthony Liguori | pprint_int16(pdu, rx, offsetp, ", type");
|
162 | 9f107513 | Anthony Liguori | pprint_int32(pdu, rx, offsetp, ", dev");
|
163 | 9f107513 | Anthony Liguori | pprint_qid(pdu, rx, offsetp, ", qid");
|
164 | 9f107513 | Anthony Liguori | pprint_int32(pdu, rx, offsetp, ", mode");
|
165 | 9f107513 | Anthony Liguori | pprint_int32(pdu, rx, offsetp, ", atime");
|
166 | 9f107513 | Anthony Liguori | pprint_int32(pdu, rx, offsetp, ", mtime");
|
167 | 9f107513 | Anthony Liguori | pprint_int64(pdu, rx, offsetp, ", length");
|
168 | 9f107513 | Anthony Liguori | pprint_str(pdu, rx, offsetp, ", name");
|
169 | 9f107513 | Anthony Liguori | pprint_str(pdu, rx, offsetp, ", uid");
|
170 | 9f107513 | Anthony Liguori | pprint_str(pdu, rx, offsetp, ", gid");
|
171 | 9f107513 | Anthony Liguori | pprint_str(pdu, rx, offsetp, ", muid");
|
172 | cf03eb2c | Arun R Bharadwaj | pprint_str(pdu, rx, offsetp, ", extension");
|
173 | cf03eb2c | Arun R Bharadwaj | pprint_int32(pdu, rx, offsetp, ", uid");
|
174 | cf03eb2c | Arun R Bharadwaj | pprint_int32(pdu, rx, offsetp, ", gid");
|
175 | cf03eb2c | Arun R Bharadwaj | pprint_int32(pdu, rx, offsetp, ", muid");
|
176 | 9f107513 | Anthony Liguori | fprintf(llogfile, "}");
|
177 | 9f107513 | Anthony Liguori | } |
178 | 9f107513 | Anthony Liguori | |
179 | 00ede4c2 | Sripathi Kodi | static void pprint_stat_dotl(V9fsPDU *pdu, int rx, size_t *offsetp, |
180 | 00ede4c2 | Sripathi Kodi | const char *name) |
181 | 00ede4c2 | Sripathi Kodi | { |
182 | 00ede4c2 | Sripathi Kodi | fprintf(llogfile, "%s={", name);
|
183 | 00ede4c2 | Sripathi Kodi | pprint_qid(pdu, rx, offsetp, "qid");
|
184 | 00ede4c2 | Sripathi Kodi | pprint_int32(pdu, rx, offsetp, ", st_mode");
|
185 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", st_nlink");
|
186 | 00ede4c2 | Sripathi Kodi | pprint_int32(pdu, rx, offsetp, ", st_uid");
|
187 | 00ede4c2 | Sripathi Kodi | pprint_int32(pdu, rx, offsetp, ", st_gid");
|
188 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", st_rdev");
|
189 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", st_size");
|
190 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", st_blksize");
|
191 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", st_blocks");
|
192 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", atime");
|
193 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", atime_nsec");
|
194 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", mtime");
|
195 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", mtime_nsec");
|
196 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", ctime");
|
197 | 00ede4c2 | Sripathi Kodi | pprint_int64(pdu, rx, offsetp, ", ctime_nsec");
|
198 | 00ede4c2 | Sripathi Kodi | fprintf(llogfile, "}");
|
199 | 00ede4c2 | Sripathi Kodi | } |
200 | 00ede4c2 | Sripathi Kodi | |
201 | 00ede4c2 | Sripathi Kodi | |
202 | 00ede4c2 | Sripathi Kodi | |
203 | 9f107513 | Anthony Liguori | static void pprint_strs(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) |
204 | 9f107513 | Anthony Liguori | { |
205 | 9f107513 | Anthony Liguori | int sg_count = get_sg_count(pdu, rx);
|
206 | 9f107513 | Anthony Liguori | struct iovec *sg = get_sg(pdu, rx);
|
207 | 9f107513 | Anthony Liguori | size_t offset = *offsetp; |
208 | 9f107513 | Anthony Liguori | uint16_t tmp_count, count, i; |
209 | 9f107513 | Anthony Liguori | size_t copied = 0;
|
210 | 9f107513 | Anthony Liguori | |
211 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s={", name);
|
212 | 9f107513 | Anthony Liguori | |
213 | 9f107513 | Anthony Liguori | /* Get the count */
|
214 | 9f107513 | Anthony Liguori | copied = do_pdu_unpack(&tmp_count, sg, sg_count, offset, sizeof(tmp_count));
|
215 | 9f107513 | Anthony Liguori | BUG_ON(copied != sizeof(tmp_count));
|
216 | 9f107513 | Anthony Liguori | count = le16_to_cpupu(&tmp_count); |
217 | 9f107513 | Anthony Liguori | offset += copied; |
218 | 9f107513 | Anthony Liguori | |
219 | 9f107513 | Anthony Liguori | for (i = 0; i < count; i++) { |
220 | 9f107513 | Anthony Liguori | char str[512]; |
221 | 9f107513 | Anthony Liguori | if (i) {
|
222 | 9f107513 | Anthony Liguori | fprintf(llogfile, ", ");
|
223 | 9f107513 | Anthony Liguori | } |
224 | 9f107513 | Anthony Liguori | snprintf(str, sizeof(str), "[%d]", i); |
225 | 9f107513 | Anthony Liguori | pprint_str(pdu, rx, &offset, str); |
226 | 9f107513 | Anthony Liguori | } |
227 | 9f107513 | Anthony Liguori | |
228 | 9f107513 | Anthony Liguori | fprintf(llogfile, "}");
|
229 | 9f107513 | Anthony Liguori | |
230 | 9f107513 | Anthony Liguori | *offsetp = offset; |
231 | 9f107513 | Anthony Liguori | } |
232 | 9f107513 | Anthony Liguori | |
233 | 9f107513 | Anthony Liguori | static void pprint_qids(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) |
234 | 9f107513 | Anthony Liguori | { |
235 | 9f107513 | Anthony Liguori | int sg_count = get_sg_count(pdu, rx);
|
236 | 9f107513 | Anthony Liguori | struct iovec *sg = get_sg(pdu, rx);
|
237 | 9f107513 | Anthony Liguori | size_t offset = *offsetp; |
238 | 9f107513 | Anthony Liguori | uint16_t tmp_count, count, i; |
239 | 9f107513 | Anthony Liguori | size_t copied = 0;
|
240 | 9f107513 | Anthony Liguori | |
241 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s={", name);
|
242 | 9f107513 | Anthony Liguori | |
243 | 9f107513 | Anthony Liguori | copied = do_pdu_unpack(&tmp_count, sg, sg_count, offset, sizeof(tmp_count));
|
244 | 9f107513 | Anthony Liguori | BUG_ON(copied != sizeof(tmp_count));
|
245 | 9f107513 | Anthony Liguori | count = le16_to_cpupu(&tmp_count); |
246 | 9f107513 | Anthony Liguori | offset += copied; |
247 | 9f107513 | Anthony Liguori | |
248 | 9f107513 | Anthony Liguori | for (i = 0; i < count; i++) { |
249 | 9f107513 | Anthony Liguori | char str[512]; |
250 | 9f107513 | Anthony Liguori | if (i) {
|
251 | 9f107513 | Anthony Liguori | fprintf(llogfile, ", ");
|
252 | 9f107513 | Anthony Liguori | } |
253 | 9f107513 | Anthony Liguori | snprintf(str, sizeof(str), "[%d]", i); |
254 | 9f107513 | Anthony Liguori | pprint_qid(pdu, rx, &offset, str); |
255 | 9f107513 | Anthony Liguori | } |
256 | 9f107513 | Anthony Liguori | |
257 | 9f107513 | Anthony Liguori | fprintf(llogfile, "}");
|
258 | 9f107513 | Anthony Liguori | |
259 | 9f107513 | Anthony Liguori | *offsetp = offset; |
260 | 9f107513 | Anthony Liguori | } |
261 | 9f107513 | Anthony Liguori | |
262 | 9f107513 | Anthony Liguori | static void pprint_sg(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) |
263 | 9f107513 | Anthony Liguori | { |
264 | 9f107513 | Anthony Liguori | struct iovec *sg = get_sg(pdu, rx);
|
265 | 9f107513 | Anthony Liguori | unsigned int count; |
266 | 9f107513 | Anthony Liguori | int i;
|
267 | 9f107513 | Anthony Liguori | |
268 | 9f107513 | Anthony Liguori | if (rx) {
|
269 | 9f107513 | Anthony Liguori | count = pdu->elem.in_num; |
270 | 9f107513 | Anthony Liguori | } else {
|
271 | 9f107513 | Anthony Liguori | count = pdu->elem.out_num; |
272 | 9f107513 | Anthony Liguori | } |
273 | 9f107513 | Anthony Liguori | |
274 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s={", name);
|
275 | 9f107513 | Anthony Liguori | for (i = 0; i < count; i++) { |
276 | 9f107513 | Anthony Liguori | if (i) {
|
277 | 9f107513 | Anthony Liguori | fprintf(llogfile, ", ");
|
278 | 9f107513 | Anthony Liguori | } |
279 | 9f107513 | Anthony Liguori | fprintf(llogfile, "(%p, 0x%zx)", sg[i].iov_base, sg[i].iov_len);
|
280 | 9f107513 | Anthony Liguori | } |
281 | 9f107513 | Anthony Liguori | fprintf(llogfile, "}");
|
282 | 9f107513 | Anthony Liguori | } |
283 | 9f107513 | Anthony Liguori | |
284 | 9f107513 | Anthony Liguori | /* FIXME: read from a directory fid returns serialized stat_t's */
|
285 | 9f107513 | Anthony Liguori | #ifdef DEBUG_DATA
|
286 | 9f107513 | Anthony Liguori | static void pprint_data(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) |
287 | 9f107513 | Anthony Liguori | { |
288 | 9f107513 | Anthony Liguori | struct iovec *sg = get_sg(pdu, rx);
|
289 | 9f107513 | Anthony Liguori | size_t offset = *offsetp; |
290 | 9f107513 | Anthony Liguori | unsigned int count; |
291 | 9f107513 | Anthony Liguori | int32_t size; |
292 | 9f107513 | Anthony Liguori | int total, i, j;
|
293 | 9f107513 | Anthony Liguori | ssize_t len; |
294 | 9f107513 | Anthony Liguori | |
295 | 9f107513 | Anthony Liguori | if (rx) {
|
296 | 9f107513 | Anthony Liguori | count = pdu->elem.in_num; |
297 | 9f107513 | Anthony Liguori | } else
|
298 | 9f107513 | Anthony Liguori | count = pdu->elem.out_num; |
299 | 9f107513 | Anthony Liguori | } |
300 | 9f107513 | Anthony Liguori | |
301 | 9f107513 | Anthony Liguori | BUG_ON((offset + sizeof(size)) > sg[0].iov_len); |
302 | 9f107513 | Anthony Liguori | |
303 | 9f107513 | Anthony Liguori | memcpy(&size, sg[0].iov_base + offset, sizeof(size)); |
304 | 9f107513 | Anthony Liguori | offset += sizeof(size);
|
305 | 9f107513 | Anthony Liguori | |
306 | 9f107513 | Anthony Liguori | fprintf(llogfile, "size: %x\n", size);
|
307 | 9f107513 | Anthony Liguori | |
308 | 9f107513 | Anthony Liguori | sg[0].iov_base += 11; /* skip header */ |
309 | 9f107513 | Anthony Liguori | sg[0].iov_len -= 11; |
310 | 9f107513 | Anthony Liguori | |
311 | 9f107513 | Anthony Liguori | total = 0;
|
312 | 9f107513 | Anthony Liguori | for (i = 0; i < count; i++) { |
313 | 9f107513 | Anthony Liguori | total += sg[i].iov_len; |
314 | 9f107513 | Anthony Liguori | if (total >= size) {
|
315 | 9f107513 | Anthony Liguori | /* trim sg list so writev does the right thing */
|
316 | 9f107513 | Anthony Liguori | sg[i].iov_len -= (total - size); |
317 | 9f107513 | Anthony Liguori | i++; |
318 | 9f107513 | Anthony Liguori | break;
|
319 | 9f107513 | Anthony Liguori | } |
320 | 9f107513 | Anthony Liguori | } |
321 | 9f107513 | Anthony Liguori | |
322 | 9f107513 | Anthony Liguori | fprintf(llogfile, "%s={\"", name);
|
323 | 9f107513 | Anthony Liguori | fflush(llogfile); |
324 | 9f107513 | Anthony Liguori | for (j = 0; j < i; j++) { |
325 | 9f107513 | Anthony Liguori | if (j) {
|
326 | 9f107513 | Anthony Liguori | fprintf(llogfile, "\", \"");
|
327 | 9f107513 | Anthony Liguori | fflush(llogfile); |
328 | 9f107513 | Anthony Liguori | } |
329 | 9f107513 | Anthony Liguori | |
330 | 9f107513 | Anthony Liguori | do {
|
331 | 9f107513 | Anthony Liguori | len = writev(fileno(llogfile), &sg[j], 1);
|
332 | 9f107513 | Anthony Liguori | } while (len == -1 && errno == EINTR); |
333 | 9f107513 | Anthony Liguori | fprintf(llogfile, "len == %ld: %m\n", len);
|
334 | 9f107513 | Anthony Liguori | BUG_ON(len != sg[j].iov_len); |
335 | 9f107513 | Anthony Liguori | } |
336 | 9f107513 | Anthony Liguori | fprintf(llogfile, "\"}");
|
337 | 9f107513 | Anthony Liguori | |
338 | 9f107513 | Anthony Liguori | sg[0].iov_base -= 11; |
339 | 9f107513 | Anthony Liguori | sg[0].iov_len += 11; |
340 | 9f107513 | Anthony Liguori | |
341 | 9f107513 | Anthony Liguori | } |
342 | 9f107513 | Anthony Liguori | #endif
|
343 | 9f107513 | Anthony Liguori | |
344 | 9f107513 | Anthony Liguori | void pprint_pdu(V9fsPDU *pdu)
|
345 | 9f107513 | Anthony Liguori | { |
346 | 9f107513 | Anthony Liguori | size_t offset = 7;
|
347 | 9f107513 | Anthony Liguori | |
348 | 9f107513 | Anthony Liguori | if (llogfile == NULL) { |
349 | 9f107513 | Anthony Liguori | llogfile = fopen("/tmp/pdu.log", "w"); |
350 | 9f107513 | Anthony Liguori | } |
351 | 9f107513 | Anthony Liguori | |
352 | a03c54f1 | Sripathi Kodi | BUG_ON(!llogfile); |
353 | a03c54f1 | Sripathi Kodi | |
354 | 9f107513 | Anthony Liguori | switch (pdu->id) {
|
355 | c18e2f94 | Sripathi Kodi | case P9_TREADDIR:
|
356 | c18e2f94 | Sripathi Kodi | fprintf(llogfile, "TREADDIR: (");
|
357 | c18e2f94 | Sripathi Kodi | pprint_int32(pdu, 0, &offset, "fid"); |
358 | c18e2f94 | Sripathi Kodi | pprint_int64(pdu, 0, &offset, ", initial offset"); |
359 | c18e2f94 | Sripathi Kodi | pprint_int32(pdu, 0, &offset, ", max count"); |
360 | c18e2f94 | Sripathi Kodi | break;
|
361 | c18e2f94 | Sripathi Kodi | case P9_RREADDIR:
|
362 | c18e2f94 | Sripathi Kodi | fprintf(llogfile, "RREADDIR: (");
|
363 | c18e2f94 | Sripathi Kodi | pprint_int32(pdu, 1, &offset, "count"); |
364 | c18e2f94 | Sripathi Kodi | #ifdef DEBUG_DATA
|
365 | c18e2f94 | Sripathi Kodi | pprint_data(pdu, 1, &offset, ", data"); |
366 | c18e2f94 | Sripathi Kodi | #endif
|
367 | c18e2f94 | Sripathi Kodi | break;
|
368 | b67592ea | M. Mohan Kumar | case P9_TMKDIR:
|
369 | b67592ea | M. Mohan Kumar | fprintf(llogfile, "TMKDIR: (");
|
370 | b67592ea | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "fid"); |
371 | b67592ea | M. Mohan Kumar | pprint_str(pdu, 0, &offset, "name"); |
372 | b67592ea | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "mode"); |
373 | b67592ea | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "gid"); |
374 | b67592ea | M. Mohan Kumar | break;
|
375 | b67592ea | M. Mohan Kumar | case P9_RMKDIR:
|
376 | b67592ea | M. Mohan Kumar | fprintf(llogfile, "RMKDIR: (");
|
377 | b67592ea | M. Mohan Kumar | pprint_qid(pdu, 0, &offset, "qid"); |
378 | b67592ea | M. Mohan Kumar | break;
|
379 | 9f107513 | Anthony Liguori | case P9_TVERSION:
|
380 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TVERSION: (");
|
381 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "msize"); |
382 | 9f107513 | Anthony Liguori | pprint_str(pdu, 0, &offset, ", version"); |
383 | 9f107513 | Anthony Liguori | break;
|
384 | 9f107513 | Anthony Liguori | case P9_RVERSION:
|
385 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RVERSION: (");
|
386 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 1, &offset, "msize"); |
387 | 9f107513 | Anthony Liguori | pprint_str(pdu, 1, &offset, ", version"); |
388 | 9f107513 | Anthony Liguori | break;
|
389 | 00ede4c2 | Sripathi Kodi | case P9_TGETATTR:
|
390 | 00ede4c2 | Sripathi Kodi | fprintf(llogfile, "TGETATTR: (");
|
391 | 00ede4c2 | Sripathi Kodi | pprint_int32(pdu, 0, &offset, "fid"); |
392 | 00ede4c2 | Sripathi Kodi | break;
|
393 | 00ede4c2 | Sripathi Kodi | case P9_RGETATTR:
|
394 | 00ede4c2 | Sripathi Kodi | fprintf(llogfile, "RGETATTR: (");
|
395 | 00ede4c2 | Sripathi Kodi | pprint_stat_dotl(pdu, 1, &offset, "getattr"); |
396 | 00ede4c2 | Sripathi Kodi | break;
|
397 | 9f107513 | Anthony Liguori | case P9_TAUTH:
|
398 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TAUTH: (");
|
399 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "afid"); |
400 | 9f107513 | Anthony Liguori | pprint_str(pdu, 0, &offset, ", uname"); |
401 | 9f107513 | Anthony Liguori | pprint_str(pdu, 0, &offset, ", aname"); |
402 | cf03eb2c | Arun R Bharadwaj | pprint_int32(pdu, 0, &offset, ", n_uname"); |
403 | 9f107513 | Anthony Liguori | break;
|
404 | 9f107513 | Anthony Liguori | case P9_RAUTH:
|
405 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RAUTH: (");
|
406 | 9f107513 | Anthony Liguori | pprint_qid(pdu, 1, &offset, "qid"); |
407 | 9f107513 | Anthony Liguori | break;
|
408 | 9f107513 | Anthony Liguori | case P9_TATTACH:
|
409 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TATTACH: (");
|
410 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
411 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, ", afid"); |
412 | 9f107513 | Anthony Liguori | pprint_str(pdu, 0, &offset, ", uname"); |
413 | 9f107513 | Anthony Liguori | pprint_str(pdu, 0, &offset, ", aname"); |
414 | cf03eb2c | Arun R Bharadwaj | pprint_int32(pdu, 0, &offset, ", n_uname"); |
415 | 9f107513 | Anthony Liguori | break;
|
416 | 9f107513 | Anthony Liguori | case P9_RATTACH:
|
417 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RATTACH: (");
|
418 | 9f107513 | Anthony Liguori | pprint_qid(pdu, 1, &offset, "qid"); |
419 | 9f107513 | Anthony Liguori | break;
|
420 | 9f107513 | Anthony Liguori | case P9_TERROR:
|
421 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TERROR: (");
|
422 | 9f107513 | Anthony Liguori | break;
|
423 | 9f107513 | Anthony Liguori | case P9_RERROR:
|
424 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RERROR: (");
|
425 | 9f107513 | Anthony Liguori | pprint_str(pdu, 1, &offset, "ename"); |
426 | cf03eb2c | Arun R Bharadwaj | pprint_int32(pdu, 1, &offset, ", ecode"); |
427 | 9f107513 | Anthony Liguori | break;
|
428 | 9f107513 | Anthony Liguori | case P9_TFLUSH:
|
429 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TFLUSH: (");
|
430 | 9f107513 | Anthony Liguori | pprint_int16(pdu, 0, &offset, "oldtag"); |
431 | 9f107513 | Anthony Liguori | break;
|
432 | 9f107513 | Anthony Liguori | case P9_RFLUSH:
|
433 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RFLUSH: (");
|
434 | 9f107513 | Anthony Liguori | break;
|
435 | 9f107513 | Anthony Liguori | case P9_TWALK:
|
436 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TWALK: (");
|
437 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
438 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, ", newfid"); |
439 | 9f107513 | Anthony Liguori | pprint_strs(pdu, 0, &offset, ", wnames"); |
440 | 9f107513 | Anthony Liguori | break;
|
441 | 9f107513 | Anthony Liguori | case P9_RWALK:
|
442 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RWALK: (");
|
443 | 9f107513 | Anthony Liguori | pprint_qids(pdu, 1, &offset, "wqids"); |
444 | 9f107513 | Anthony Liguori | break;
|
445 | 9f107513 | Anthony Liguori | case P9_TOPEN:
|
446 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TOPEN: (");
|
447 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
448 | 9f107513 | Anthony Liguori | pprint_int8(pdu, 0, &offset, ", mode"); |
449 | 9f107513 | Anthony Liguori | break;
|
450 | 9f107513 | Anthony Liguori | case P9_ROPEN:
|
451 | 9f107513 | Anthony Liguori | fprintf(llogfile, "ROPEN: (");
|
452 | 9f107513 | Anthony Liguori | pprint_qid(pdu, 1, &offset, "qid"); |
453 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 1, &offset, ", iounit"); |
454 | 9f107513 | Anthony Liguori | break;
|
455 | 9f107513 | Anthony Liguori | case P9_TCREATE:
|
456 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TCREATE: (");
|
457 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
458 | 9f107513 | Anthony Liguori | pprint_str(pdu, 0, &offset, ", name"); |
459 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, ", perm"); |
460 | 9f107513 | Anthony Liguori | pprint_int8(pdu, 0, &offset, ", mode"); |
461 | cf03eb2c | Arun R Bharadwaj | pprint_str(pdu, 0, &offset, ", extension"); |
462 | 9f107513 | Anthony Liguori | break;
|
463 | 9f107513 | Anthony Liguori | case P9_RCREATE:
|
464 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RCREATE: (");
|
465 | 9f107513 | Anthony Liguori | pprint_qid(pdu, 1, &offset, "qid"); |
466 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 1, &offset, ", iounit"); |
467 | 9f107513 | Anthony Liguori | break;
|
468 | 08c60fc9 | Venkateswararao Jujjuri (JV) | case P9_TSYMLINK:
|
469 | 08c60fc9 | Venkateswararao Jujjuri (JV) | fprintf(llogfile, "TSYMLINK: (");
|
470 | 08c60fc9 | Venkateswararao Jujjuri (JV) | pprint_int32(pdu, 0, &offset, "fid"); |
471 | 08c60fc9 | Venkateswararao Jujjuri (JV) | pprint_str(pdu, 0, &offset, ", name"); |
472 | 08c60fc9 | Venkateswararao Jujjuri (JV) | pprint_str(pdu, 0, &offset, ", symname"); |
473 | 08c60fc9 | Venkateswararao Jujjuri (JV) | pprint_int32(pdu, 0, &offset, ", gid"); |
474 | 08c60fc9 | Venkateswararao Jujjuri (JV) | break;
|
475 | 08c60fc9 | Venkateswararao Jujjuri (JV) | case P9_RSYMLINK:
|
476 | 08c60fc9 | Venkateswararao Jujjuri (JV) | fprintf(llogfile, "RSYMLINK: (");
|
477 | 08c60fc9 | Venkateswararao Jujjuri (JV) | pprint_qid(pdu, 1, &offset, "qid"); |
478 | 08c60fc9 | Venkateswararao Jujjuri (JV) | break;
|
479 | c1568af5 | Venkateswararao Jujjuri (JV) | case P9_TLCREATE:
|
480 | c1568af5 | Venkateswararao Jujjuri (JV) | fprintf(llogfile, "TLCREATE: (");
|
481 | c1568af5 | Venkateswararao Jujjuri (JV) | pprint_int32(pdu, 0, &offset, "dfid"); |
482 | c1568af5 | Venkateswararao Jujjuri (JV) | pprint_str(pdu, 0, &offset, ", name"); |
483 | c1568af5 | Venkateswararao Jujjuri (JV) | pprint_int32(pdu, 0, &offset, ", flags"); |
484 | c1568af5 | Venkateswararao Jujjuri (JV) | pprint_int32(pdu, 0, &offset, ", mode"); |
485 | c1568af5 | Venkateswararao Jujjuri (JV) | pprint_int32(pdu, 0, &offset, ", gid"); |
486 | c1568af5 | Venkateswararao Jujjuri (JV) | break;
|
487 | c1568af5 | Venkateswararao Jujjuri (JV) | case P9_RLCREATE:
|
488 | c1568af5 | Venkateswararao Jujjuri (JV) | fprintf(llogfile, "RLCREATE: (");
|
489 | c1568af5 | Venkateswararao Jujjuri (JV) | pprint_qid(pdu, 1, &offset, "qid"); |
490 | c1568af5 | Venkateswararao Jujjuri (JV) | pprint_int32(pdu, 1, &offset, ", iounit"); |
491 | c1568af5 | Venkateswararao Jujjuri (JV) | break;
|
492 | 5268cecc | M. Mohan Kumar | case P9_TMKNOD:
|
493 | 5268cecc | M. Mohan Kumar | fprintf(llogfile, "TMKNOD: (");
|
494 | 5268cecc | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "fid"); |
495 | 5268cecc | M. Mohan Kumar | pprint_str(pdu, 0, &offset, "name"); |
496 | 5268cecc | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "mode"); |
497 | 5268cecc | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "major"); |
498 | 5268cecc | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "minor"); |
499 | 5268cecc | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "gid"); |
500 | 5268cecc | M. Mohan Kumar | break;
|
501 | 5268cecc | M. Mohan Kumar | case P9_RMKNOD:
|
502 | 5268cecc | M. Mohan Kumar | fprintf(llogfile, "RMKNOD: )");
|
503 | 5268cecc | M. Mohan Kumar | pprint_qid(pdu, 0, &offset, "qid"); |
504 | 5268cecc | M. Mohan Kumar | break;
|
505 | df0973a4 | M. Mohan Kumar | case P9_TREADLINK:
|
506 | df0973a4 | M. Mohan Kumar | fprintf(llogfile, "TREADLINK: (");
|
507 | df0973a4 | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "fid"); |
508 | df0973a4 | M. Mohan Kumar | break;
|
509 | df0973a4 | M. Mohan Kumar | case P9_RREADLINK:
|
510 | df0973a4 | M. Mohan Kumar | fprintf(llogfile, "RREADLINK: (");
|
511 | df0973a4 | M. Mohan Kumar | pprint_str(pdu, 0, &offset, "target"); |
512 | df0973a4 | M. Mohan Kumar | break;
|
513 | 9f107513 | Anthony Liguori | case P9_TREAD:
|
514 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TREAD: (");
|
515 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
516 | 9f107513 | Anthony Liguori | pprint_int64(pdu, 0, &offset, ", offset"); |
517 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, ", count"); |
518 | 9f107513 | Anthony Liguori | pprint_sg(pdu, 0, &offset, ", sg"); |
519 | 9f107513 | Anthony Liguori | break;
|
520 | 9f107513 | Anthony Liguori | case P9_RREAD:
|
521 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RREAD: (");
|
522 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 1, &offset, "count"); |
523 | 9f107513 | Anthony Liguori | pprint_sg(pdu, 1, &offset, ", sg"); |
524 | 9f107513 | Anthony Liguori | offset = 7;
|
525 | 9f107513 | Anthony Liguori | #ifdef DEBUG_DATA
|
526 | 9f107513 | Anthony Liguori | pprint_data(pdu, 1, &offset, ", data"); |
527 | 9f107513 | Anthony Liguori | #endif
|
528 | 9f107513 | Anthony Liguori | break;
|
529 | 9f107513 | Anthony Liguori | case P9_TWRITE:
|
530 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TWRITE: (");
|
531 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
532 | 9f107513 | Anthony Liguori | pprint_int64(pdu, 0, &offset, ", offset"); |
533 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, ", count"); |
534 | 9f107513 | Anthony Liguori | break;
|
535 | 9f107513 | Anthony Liguori | case P9_RWRITE:
|
536 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RWRITE: (");
|
537 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 1, &offset, "count"); |
538 | 9f107513 | Anthony Liguori | break;
|
539 | 9f107513 | Anthony Liguori | case P9_TCLUNK:
|
540 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TCLUNK: (");
|
541 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
542 | 9f107513 | Anthony Liguori | break;
|
543 | 9f107513 | Anthony Liguori | case P9_RCLUNK:
|
544 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RCLUNK: (");
|
545 | 9f107513 | Anthony Liguori | break;
|
546 | b41e95d3 | Venkateswararao Jujjuri (JV) | case P9_TFSYNC:
|
547 | b41e95d3 | Venkateswararao Jujjuri (JV) | fprintf(llogfile, "TFSYNC: (");
|
548 | b41e95d3 | Venkateswararao Jujjuri (JV) | pprint_int32(pdu, 0, &offset, "fid"); |
549 | b41e95d3 | Venkateswararao Jujjuri (JV) | break;
|
550 | b41e95d3 | Venkateswararao Jujjuri (JV) | case P9_RFSYNC:
|
551 | b41e95d3 | Venkateswararao Jujjuri (JV) | fprintf(llogfile, "RFSYNC: (");
|
552 | b41e95d3 | Venkateswararao Jujjuri (JV) | break;
|
553 | b2c224be | Venkateswararao Jujjuri (JV) | case P9_TLINK:
|
554 | b2c224be | Venkateswararao Jujjuri (JV) | fprintf(llogfile, "TLINK: (");
|
555 | d04e2826 | Harsh Prateek Bora | pprint_int32(pdu, 0, &offset, "dfid"); |
556 | d04e2826 | Harsh Prateek Bora | pprint_int32(pdu, 0, &offset, ", fid"); |
557 | b2c224be | Venkateswararao Jujjuri (JV) | pprint_str(pdu, 0, &offset, ", newpath"); |
558 | b2c224be | Venkateswararao Jujjuri (JV) | break;
|
559 | b2c224be | Venkateswararao Jujjuri (JV) | case P9_RLINK:
|
560 | b2c224be | Venkateswararao Jujjuri (JV) | fprintf(llogfile, "RLINK: (");
|
561 | b2c224be | Venkateswararao Jujjuri (JV) | break;
|
562 | 9f107513 | Anthony Liguori | case P9_TREMOVE:
|
563 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TREMOVE: (");
|
564 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
565 | 9f107513 | Anthony Liguori | break;
|
566 | 9f107513 | Anthony Liguori | case P9_RREMOVE:
|
567 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RREMOVE: (");
|
568 | 9f107513 | Anthony Liguori | break;
|
569 | 9f107513 | Anthony Liguori | case P9_TSTAT:
|
570 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TSTAT: (");
|
571 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
572 | 9f107513 | Anthony Liguori | break;
|
573 | 9f107513 | Anthony Liguori | case P9_RSTAT:
|
574 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RSTAT: (");
|
575 | 9f107513 | Anthony Liguori | offset += 2; /* ignored */ |
576 | 9f107513 | Anthony Liguori | pprint_stat(pdu, 1, &offset, "stat"); |
577 | 9f107513 | Anthony Liguori | break;
|
578 | 9f107513 | Anthony Liguori | case P9_TWSTAT:
|
579 | 9f107513 | Anthony Liguori | fprintf(llogfile, "TWSTAT: (");
|
580 | 9f107513 | Anthony Liguori | pprint_int32(pdu, 0, &offset, "fid"); |
581 | 9f107513 | Anthony Liguori | offset += 2; /* ignored */ |
582 | 9f107513 | Anthony Liguori | pprint_stat(pdu, 0, &offset, ", stat"); |
583 | 9f107513 | Anthony Liguori | break;
|
584 | 9f107513 | Anthony Liguori | case P9_RWSTAT:
|
585 | 9f107513 | Anthony Liguori | fprintf(llogfile, "RWSTAT: (");
|
586 | 9f107513 | Anthony Liguori | break;
|
587 | fa32ef88 | Aneesh Kumar K.V | case P9_TXATTRWALK:
|
588 | fa32ef88 | Aneesh Kumar K.V | fprintf(llogfile, "TXATTRWALK: (");
|
589 | fa32ef88 | Aneesh Kumar K.V | pprint_int32(pdu, 0, &offset, "fid"); |
590 | fa32ef88 | Aneesh Kumar K.V | pprint_int32(pdu, 0, &offset, ", newfid"); |
591 | fa32ef88 | Aneesh Kumar K.V | pprint_str(pdu, 0, &offset, ", xattr name"); |
592 | fa32ef88 | Aneesh Kumar K.V | break;
|
593 | fa32ef88 | Aneesh Kumar K.V | case P9_RXATTRWALK:
|
594 | fa32ef88 | Aneesh Kumar K.V | fprintf(llogfile, "RXATTRWALK: (");
|
595 | fa32ef88 | Aneesh Kumar K.V | pprint_int64(pdu, 1, &offset, "xattrsize"); |
596 | 10b468bd | Aneesh Kumar K.V | case P9_TXATTRCREATE:
|
597 | 10b468bd | Aneesh Kumar K.V | fprintf(llogfile, "TXATTRCREATE: (");
|
598 | 10b468bd | Aneesh Kumar K.V | pprint_int32(pdu, 0, &offset, "fid"); |
599 | 10b468bd | Aneesh Kumar K.V | pprint_str(pdu, 0, &offset, ", name"); |
600 | 10b468bd | Aneesh Kumar K.V | pprint_int64(pdu, 0, &offset, ", xattrsize"); |
601 | 10b468bd | Aneesh Kumar K.V | pprint_int32(pdu, 0, &offset, ", flags"); |
602 | 10b468bd | Aneesh Kumar K.V | break;
|
603 | 10b468bd | Aneesh Kumar K.V | case P9_RXATTRCREATE:
|
604 | 10b468bd | Aneesh Kumar K.V | fprintf(llogfile, "RXATTRCREATE: (");
|
605 | fa32ef88 | Aneesh Kumar K.V | break;
|
606 | 82cc3ee8 | M. Mohan Kumar | case P9_TLOCK:
|
607 | 82cc3ee8 | M. Mohan Kumar | fprintf(llogfile, "TLOCK: (");
|
608 | 82cc3ee8 | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "fid"); |
609 | 82cc3ee8 | M. Mohan Kumar | pprint_int8(pdu, 0, &offset, ", type"); |
610 | 82cc3ee8 | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, ", flags"); |
611 | 82cc3ee8 | M. Mohan Kumar | pprint_int64(pdu, 0, &offset, ", start"); |
612 | 82cc3ee8 | M. Mohan Kumar | pprint_int64(pdu, 0, &offset, ", length"); |
613 | 82cc3ee8 | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, ", proc_id"); |
614 | 82cc3ee8 | M. Mohan Kumar | pprint_str(pdu, 0, &offset, ", client_id"); |
615 | 82cc3ee8 | M. Mohan Kumar | break;
|
616 | 82cc3ee8 | M. Mohan Kumar | case P9_RLOCK:
|
617 | 82cc3ee8 | M. Mohan Kumar | fprintf(llogfile, "RLOCK: (");
|
618 | 82cc3ee8 | M. Mohan Kumar | pprint_int8(pdu, 0, &offset, "status"); |
619 | 82cc3ee8 | M. Mohan Kumar | break;
|
620 | 8f354003 | M. Mohan Kumar | case P9_TGETLOCK:
|
621 | 8f354003 | M. Mohan Kumar | fprintf(llogfile, "TGETLOCK: (");
|
622 | 8f354003 | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, "fid"); |
623 | 8f354003 | M. Mohan Kumar | pprint_int8(pdu, 0, &offset, ", type"); |
624 | 8f354003 | M. Mohan Kumar | pprint_int64(pdu, 0, &offset, ", start"); |
625 | 8f354003 | M. Mohan Kumar | pprint_int64(pdu, 0, &offset, ", length"); |
626 | 8f354003 | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, ", proc_id"); |
627 | 8f354003 | M. Mohan Kumar | pprint_str(pdu, 0, &offset, ", client_id"); |
628 | 8f354003 | M. Mohan Kumar | break;
|
629 | 8f354003 | M. Mohan Kumar | case P9_RGETLOCK:
|
630 | 8f354003 | M. Mohan Kumar | fprintf(llogfile, "RGETLOCK: (");
|
631 | 8f354003 | M. Mohan Kumar | pprint_int8(pdu, 0, &offset, "type"); |
632 | 8f354003 | M. Mohan Kumar | pprint_int64(pdu, 0, &offset, ", start"); |
633 | 8f354003 | M. Mohan Kumar | pprint_int64(pdu, 0, &offset, ", length"); |
634 | 8f354003 | M. Mohan Kumar | pprint_int32(pdu, 0, &offset, ", proc_id"); |
635 | 8f354003 | M. Mohan Kumar | pprint_str(pdu, 0, &offset, ", client_id"); |
636 | 8f354003 | M. Mohan Kumar | break;
|
637 | 9f107513 | Anthony Liguori | default:
|
638 | 9f107513 | Anthony Liguori | fprintf(llogfile, "unknown(%d): (", pdu->id);
|
639 | 9f107513 | Anthony Liguori | break;
|
640 | 9f107513 | Anthony Liguori | } |
641 | 9f107513 | Anthony Liguori | |
642 | 9f107513 | Anthony Liguori | fprintf(llogfile, ")\n");
|
643 | 0db09dd2 | Venkateswararao Jujjuri (JV) | /* Flush the log message out */
|
644 | 0db09dd2 | Venkateswararao Jujjuri (JV) | fflush(llogfile); |
645 | 9f107513 | Anthony Liguori | } |