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