master
h 936 lines 26.8 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 p9log.h
8
9 Abstract:
10
11 This file contains the plan9 logging implementation.
12
13 --*/
14
15 #pragma once
16
17 namespace p9fs {
18
19 // Outputs a log message to stdout with the contents of the specified message.
20 inline void TraceLogMessage([[maybe_unused]] gsl::span<const gsl::byte> message)
21 {
22
23 if (!Plan9TraceLoggingProvider::IsEnabled(TRACE_LEVEL_VERBOSE))
24 {
25 return;
26 }
27
28 SpanReader reader{message};
29 reader.U32(); // size (unused)
30 auto messageType = static_cast<MessageType>(reader.U8());
31 auto tag = reader.U16();
32 LogMessageBuilder text;
33
34 switch (messageType)
35 {
36 case MessageType::Tversion:
37 {
38 // size[4] Tversion tag[2] msize[4] version[s]
39 text.AddName(">>Tversion");
40 text.AddField("tag", tag);
41 auto msize = reader.U32();
42 text.AddField("msize", msize);
43 auto version = reader.String();
44 text.AddField("version", version);
45 break;
46 }
47
48 case MessageType::Rversion:
49 {
50 // size[4] Rversion tag[2] msize[4] version[s]
51 text.AddName("<<Rversion");
52 text.AddField("tag", tag);
53 auto msize = reader.U32();
54 text.AddField("msize", msize);
55 auto version = reader.String();
56 text.AddField("version", version);
57 break;
58 }
59
60 case MessageType::Tflush:
61 {
62 // size[4] Tflush tag[2] oldtag[2]
63 text.AddName(">>Tflush");
64 text.AddField("tag", tag);
65 auto oldtag = reader.U16();
66 text.AddField("oldtag", oldtag);
67 break;
68 }
69
70 case MessageType::Rflush:
71 {
72 // size[4] Rflush tag[2]
73 text.AddName("<<Rflush");
74 text.AddField("tag", tag);
75 break;
76 }
77
78 case MessageType::Twalk:
79 {
80 // size[4] Twalk tag[2] fid[4] newfid[4] nwname[2] nwname*(wname[s])
81 text.AddName(">>Twalk");
82 text.AddField("tag", tag);
83 auto fid = reader.U32();
84 text.AddField("fid", fid);
85 auto newfid = reader.U32();
86 text.AddField("newfid", newfid);
87 auto nwname = reader.U16();
88 text.AddField("nwname", nwname);
89 for (UINT32 i = 0; i < nwname; ++i)
90 {
91 auto wname = reader.String();
92 text.AddValue(wname);
93 }
94 break;
95 }
96
97 case MessageType::Rwalk:
98 {
99 // size[4] Rwalk tag[2] nwqid[2] nwqid*(wqid[13])
100 text.AddName("<<Rwalk");
101 text.AddField("tag", tag);
102 auto nwqid = reader.U16();
103 text.AddField("nwqid", nwqid);
104 for (UINT32 i = 0; i < nwqid; ++i)
105 {
106 auto wqid = reader.Qid();
107 text.AddValue(wqid);
108 }
109 break;
110 }
111
112 case MessageType::Tread:
113 {
114 // size[4] Tread tag[2] fid[4] offset[8] count[4]
115 text.AddName(">>Tread");
116 text.AddField("tag", tag);
117 auto fid = reader.U32();
118 text.AddField("fid", fid);
119 auto offset = reader.U64();
120 text.AddField("offset", offset);
121 auto count = reader.U32();
122 text.AddField("count", count);
123 break;
124 }
125
126 case MessageType::Rread:
127 {
128 // size[4] Rread tag[2] count[4] data[count]
129 text.AddName("<<Rread");
130 text.AddField("tag", tag);
131 auto count = reader.U32();
132 text.AddField("count", count);
133 break;
134 }
135
136 case MessageType::Twrite:
137 {
138 // size[4] Twrite tag[2] fid[4] offset[8] count[4] data[count]
139 text.AddName(">>Twrite");
140 text.AddField("tag", tag);
141 auto fid = reader.U32();
142 text.AddField("fid", fid);
143 auto offset = reader.U64();
144 text.AddField("offset", offset);
145 auto count = reader.U32();
146 text.AddField("count", count);
147 break;
148 }
149
150 case MessageType::Rwrite:
151 {
152 // size[4] Rwrite tag[2] count[4]
153 text.AddName("<<Rwrite");
154 text.AddField("tag", tag);
155 auto count = reader.U32();
156 text.AddField("count", count);
157 break;
158 }
159
160 case MessageType::Tclunk:
161 {
162 // size[4] Tclunk tag[2] fid[4]
163 text.AddName(">>Tclunk");
164 text.AddField("tag", tag);
165 auto fid = reader.U32();
166 text.AddField("fid", fid);
167 break;
168 }
169
170 case MessageType::Rclunk:
171 {
172 // size[4] Rclunk tag[2]
173 text.AddName("<<Rclunk");
174 text.AddField("tag", tag);
175 break;
176 }
177
178 case MessageType::Tremove:
179 {
180 // size[4] Tremove tag[2] fid[4]
181 text.AddName(">>Tremove");
182 text.AddField("tag", tag);
183 auto fid = reader.U32();
184 text.AddField("fid", fid);
185 break;
186 }
187
188 case MessageType::Rremove:
189 {
190 // size[4] Rremove tag[2]
191 text.AddName("<<Rremove");
192 text.AddField("tag", tag);
193 break;
194 }
195
196 case MessageType::Tauth:
197 {
198 // size[4] Tauth tag[2] afid[4] uname[s] aname[s] n_uname[4]
199 text.AddName(">>Tauth");
200 text.AddField("tag", tag);
201 auto afid = reader.U32();
202 text.AddField("afid", afid);
203 auto uname = reader.String();
204 text.AddField("uname", uname);
205 auto aname = reader.String();
206 text.AddField("aname", aname);
207 auto n_uname = reader.U32();
208 text.AddField("n_uname", n_uname);
209 break;
210 }
211
212 case MessageType::Rauth:
213 {
214 // size[4] Rauth tag[2] aqid[13]
215 text.AddName("<<Rauth");
216 text.AddField("tag", tag);
217 auto aqid = reader.Qid();
218 text.AddField("aqid", aqid);
219 break;
220 }
221
222 case MessageType::Tattach:
223 {
224 // size[4] Tattach tag[2] fid[4] afid[4] uname[s] aname[s] n_uname[4]
225 text.AddName(">>Tattach");
226 text.AddField("tag", tag);
227 auto fid = reader.U32();
228 text.AddField("fid", fid);
229 auto afid = reader.U32();
230 text.AddField("afid", afid);
231 auto uname = reader.String();
232 text.AddField("uname", uname);
233 auto aname = reader.String();
234 text.AddField("aname", aname);
235 auto n_uname = reader.U32();
236 text.AddField("n_uname", n_uname);
237 break;
238 }
239
240 case MessageType::Rattach:
241 {
242 // size[4] Rattach tag[2] qid[13]
243 text.AddName("<<Rattach");
244 text.AddField("tag", tag);
245 auto qid = reader.Qid();
246 text.AddField("qid", qid);
247 break;
248 }
249
250 case MessageType::Rlerror:
251 {
252 // size[4] Rlerror tag[2] ecode[4]
253 text.AddName("<<Rlerror");
254 text.AddField("tag", tag);
255 auto ecode = reader.U32();
256 text.AddField("ecode", ecode);
257 break;
258 }
259
260 case MessageType::Tstatfs:
261 {
262 // size[4] Tstatfs tag[2] fid[4]
263 text.AddName(">>Tstatfs");
264 text.AddField("tag", tag);
265 auto fid = reader.U32();
266 text.AddField("fid", fid);
267 break;
268 }
269
270 case MessageType::Rstatfs:
271 {
272 // size[4] Rstatfs tag[2] type[4] bsize[4] blocks[8] bfree[8] bavail[8] files[8] ffree[8] fsid[8] namelen[4]
273 text.AddName("<<Rstatfs");
274 text.AddField("tag", tag);
275 auto type = reader.U32();
276 text.AddField("type", type);
277 auto bsize = reader.U32();
278 text.AddField("bsize", bsize);
279 auto blocks = reader.U64();
280 text.AddField("blocks", blocks);
281 auto bfree = reader.U64();
282 text.AddField("bfree", bfree);
283 auto bavail = reader.U64();
284 text.AddField("bavail", bavail);
285 auto files = reader.U64();
286 text.AddField("files", files);
287 auto ffree = reader.U64();
288 text.AddField("ffree", ffree);
289 auto fsid = reader.U64();
290 text.AddField("fsid", fsid);
291 auto namelen = reader.U32();
292 text.AddField("namelen", namelen);
293 break;
294 }
295
296 case MessageType::Tlopen:
297 {
298 // size[4] Tlopen tag[2] fid[4] flags[4]
299 text.AddName(">>Tlopen");
300 text.AddField("tag", tag);
301 auto fid = reader.U32();
302 text.AddField("fid", fid);
303 auto flags = reader.U32();
304 text.AddField("flags", flags);
305 break;
306 }
307
308 case MessageType::Rlopen:
309 {
310 // size[4] Rlopen tag[2] qid[13] iounit[4]
311 text.AddName("<<Rlopen");
312 text.AddField("tag", tag);
313 auto qid = reader.Qid();
314 text.AddField("qid", qid);
315 auto iounit = reader.U32();
316 text.AddField("iounit", iounit);
317 break;
318 }
319
320 case MessageType::Tlcreate:
321 {
322 // size[4] Tlcreate tag[2] fid[4] name[s] flags[4] mode[4] gid[4]
323 text.AddName(">>Tlcreate");
324 text.AddField("tag", tag);
325 auto fid = reader.U32();
326 text.AddField("fid", fid);
327 auto name = reader.String();
328 text.AddField("name", name);
329 auto flags = reader.U32();
330 text.AddField("flags", flags);
331 auto mode = reader.U32();
332 text.AddField("mode", mode);
333 auto gid = reader.U32();
334 text.AddField("gid", gid);
335 break;
336 }
337
338 case MessageType::Rlcreate:
339 {
340 // size[4] Rlcreate tag[2] qid[13] iounit[4]
341 text.AddName("<<Rlcreate");
342 text.AddField("tag", tag);
343 auto qid = reader.Qid();
344 text.AddField("qid", qid);
345 auto iounit = reader.U32();
346 text.AddField("iounit", iounit);
347 break;
348 }
349
350 case MessageType::Tsymlink:
351 {
352 // size[4] Tsymlink tag[2] fid[4] name[s] symtgt[s] gid[4]
353 text.AddName(">>Tsymlink");
354 text.AddField("tag", tag);
355 auto fid = reader.U32();
356 text.AddField("fid", fid);
357 auto name = reader.String();
358 text.AddField("name", name);
359 auto symtgt = reader.String();
360 text.AddField("symtgt", symtgt);
361 auto gid = reader.U32();
362 text.AddField("gid", gid);
363 break;
364 }
365
366 case MessageType::Rsymlink:
367 {
368 // size[4] Rsymlink tag[2] qid[13]
369 text.AddName("<<Rsymlink");
370 text.AddField("tag", tag);
371 auto qid = reader.Qid();
372 text.AddField("qid", qid);
373 break;
374 }
375
376 case MessageType::Tmknod:
377 {
378 // size[4] Tmknod tag[2] dfid[4] name[s] mode[4] major[4] minor[4] gid[4]
379 text.AddName(">>Tmknod");
380 text.AddField("tag", tag);
381 auto dfid = reader.U32();
382 text.AddField("dfid", dfid);
383 auto name = reader.String();
384 text.AddField("name", name);
385 auto mode = reader.U32();
386 text.AddField("mode", mode);
387 auto major = reader.U32();
388 text.AddField("major", major);
389 auto minor = reader.U32();
390 text.AddField("minor", minor);
391 auto gid = reader.U32();
392 text.AddField("gid", gid);
393 break;
394 }
395
396 case MessageType::Rmknod:
397 {
398 // size[4] Rmknod tag[2] qid[13]
399 text.AddName("<<Rmknod");
400 text.AddField("tag", tag);
401 auto qid = reader.Qid();
402 text.AddField("qid", qid);
403 break;
404 }
405
406 case MessageType::Trename:
407 {
408 // size[4] Trename tag[2] fid[4] dfid[4] name[s]
409 text.AddName(">>Trename");
410 text.AddField("tag", tag);
411 auto fid = reader.U32();
412 text.AddField("fid", fid);
413 auto dfid = reader.U32();
414 text.AddField("dfid", dfid);
415 auto name = reader.String();
416 text.AddField("name", name);
417 break;
418 }
419
420 case MessageType::Rrename:
421 {
422 // size[4] Rrename tag[2]
423 text.AddName("<<Rrename");
424 text.AddField("tag", tag);
425 break;
426 }
427
428 case MessageType::Treadlink:
429 {
430 // size[4] Treadlink tag[2] fid[4]
431 text.AddName(">>Treadlink");
432 text.AddField("tag", tag);
433 auto fid = reader.U32();
434 text.AddField("fid", fid);
435 break;
436 }
437
438 case MessageType::Rreadlink:
439 {
440 // size[4] Rreadlink tag[2] target[s]
441 text.AddName("<<Rreadlink");
442 text.AddField("tag", tag);
443 auto target = reader.String();
444 text.AddField("target", target);
445 break;
446 }
447
448 case MessageType::Tgetattr:
449 {
450 // size[4] Tgetattr tag[2] fid[4] request_mask[8]
451 text.AddName(">>Tgetattr");
452 text.AddField("tag", tag);
453 auto fid = reader.U32();
454 text.AddField("fid", fid);
455 auto request_mask = reader.U64();
456 text.AddField("request_mask", request_mask);
457 break;
458 }
459
460 case MessageType::Rgetattr:
461 {
462 // size[4] Rgetattr tag[2] valid[8] qid[13] mode[4] uid[4] gid[4] nlink[8] rdev[8] size[8] blksize[8] blocks[8] atime_sec[8] atime_nsec[8] mtime_sec[8] mtime_nsec[8] ctime_sec[8] ctime_nsec[8] btime_sec[8] btime_nsec[8] gen[8] data_version[8]
463 text.AddName("<<Rgetattr");
464 text.AddField("tag", tag);
465 auto valid = reader.U64();
466 text.AddField("valid", valid);
467 auto qid = reader.Qid();
468 text.AddField("qid", qid);
469 auto mode = reader.U32();
470 text.AddField("mode", mode);
471 auto uid = reader.U32();
472 text.AddField("uid", uid);
473 auto gid = reader.U32();
474 text.AddField("gid", gid);
475 auto nlink = reader.U64();
476 text.AddField("nlink", nlink);
477 auto rdev = reader.U64();
478 text.AddField("rdev", rdev);
479 auto size = reader.U64();
480 text.AddField("size", size);
481 auto blksize = reader.U64();
482 text.AddField("blksize", blksize);
483 auto blocks = reader.U64();
484 text.AddField("blocks", blocks);
485 auto atime_sec = reader.U64();
486 text.AddField("atime_sec", atime_sec);
487 auto atime_nsec = reader.U64();
488 text.AddField("atime_nsec", atime_nsec);
489 auto mtime_sec = reader.U64();
490 text.AddField("mtime_sec", mtime_sec);
491 auto mtime_nsec = reader.U64();
492 text.AddField("mtime_nsec", mtime_nsec);
493 auto ctime_sec = reader.U64();
494 text.AddField("ctime_sec", ctime_sec);
495 auto ctime_nsec = reader.U64();
496 text.AddField("ctime_nsec", ctime_nsec);
497 auto btime_sec = reader.U64();
498 text.AddField("btime_sec", btime_sec);
499 auto btime_nsec = reader.U64();
500 text.AddField("btime_nsec", btime_nsec);
501 auto gen = reader.U64();
502 text.AddField("gen", gen);
503 auto data_version = reader.U64();
504 text.AddField("data_version", data_version);
505 break;
506 }
507
508 case MessageType::Tsetattr:
509 {
510 // size[4] Tsetattr tag[2] fid[4] valid[4] mode[4] uid[4] gid[4] size[8] atime_sec[8] atime_nsec[8] mtime_sec[8] mtime_nsec[8]
511 text.AddName(">>Tsetattr");
512 text.AddField("tag", tag);
513 auto fid = reader.U32();
514 text.AddField("fid", fid);
515 auto valid = reader.U32();
516 text.AddField("valid", valid);
517 auto mode = reader.U32();
518 text.AddField("mode", mode);
519 auto uid = reader.U32();
520 text.AddField("uid", uid);
521 auto gid = reader.U32();
522 text.AddField("gid", gid);
523 auto size = reader.U64();
524 text.AddField("size", size);
525 auto atime_sec = reader.U64();
526 text.AddField("atime_sec", atime_sec);
527 auto atime_nsec = reader.U64();
528 text.AddField("atime_nsec", atime_nsec);
529 auto mtime_sec = reader.U64();
530 text.AddField("mtime_sec", mtime_sec);
531 auto mtime_nsec = reader.U64();
532 text.AddField("mtime_nsec", mtime_nsec);
533 break;
534 }
535
536 case MessageType::Rsetattr:
537 {
538 // size[4] Rsetattr tag[2]
539 text.AddName("<<Rsetattr");
540 text.AddField("tag", tag);
541 break;
542 }
543
544 case MessageType::Txattrwalk:
545 {
546 // size[4] Txattrwalk tag[2] fid[4] newfid[4] name[s]
547 text.AddName(">>Txattrwalk");
548 text.AddField("tag", tag);
549 auto fid = reader.U32();
550 text.AddField("fid", fid);
551 auto newfid = reader.U32();
552 text.AddField("newfid", newfid);
553 auto name = reader.String();
554 text.AddField("name", name);
555 break;
556 }
557
558 case MessageType::Rxattrwalk:
559 {
560 // size[4] Rxattrwalk tag[2] size[8]
561 text.AddName("<<Rxattrwalk");
562 text.AddField("tag", tag);
563 auto size = reader.U64();
564 text.AddField("size", size);
565 break;
566 }
567
568 case MessageType::Txattrcreate:
569 {
570 // size[4] Txattrcreate tag[2] fid[4] name[s] attr_size[8] flags[4]
571 text.AddName(">>Txattrcreate");
572 text.AddField("tag", tag);
573 auto fid = reader.U32();
574 text.AddField("fid", fid);
575 auto name = reader.String();
576 text.AddField("name", name);
577 auto attr_size = reader.U64();
578 text.AddField("attr_size", attr_size);
579 auto flags = reader.U32();
580 text.AddField("flags", flags);
581 break;
582 }
583
584 case MessageType::Rxattrcreate:
585 {
586 // size[4] Rxattrcreate tag[2]
587 text.AddName("<<Rxattrcreate");
588 text.AddField("tag", tag);
589 break;
590 }
591
592 case MessageType::Treaddir:
593 {
594 // size[4] Treaddir tag[2] fid[4] offset[8] count[4]
595 text.AddName(">>Treaddir");
596 text.AddField("tag", tag);
597 auto fid = reader.U32();
598 text.AddField("fid", fid);
599 auto offset = reader.U64();
600 text.AddField("offset", offset);
601 auto count = reader.U32();
602 text.AddField("count", count);
603 break;
604 }
605
606 case MessageType::Rreaddir:
607 {
608 // size[4] Rreaddir tag[2] count[4] data[count]
609 text.AddName("<<Rreaddir");
610 text.AddField("tag", tag);
611 auto count = reader.U32();
612 text.AddField("count", count);
613 break;
614 }
615
616 case MessageType::Tfsync:
617 {
618 // size[4] Tfsync tag[2] fid[4]
619 text.AddName(">>Tfsync");
620 text.AddField("tag", tag);
621 auto fid = reader.U32();
622 text.AddField("fid", fid);
623 break;
624 }
625
626 case MessageType::Rfsync:
627 {
628 // size[4] Rfsync tag[2]
629 text.AddName("<<Rfsync");
630 text.AddField("tag", tag);
631 break;
632 }
633
634 case MessageType::Tlock:
635 {
636 // size[4] Tlock tag[2] fid[4] type[1] flags[4] start[8] length[8] proc_id[4] client_id[s]
637 text.AddName(">>Tlock");
638 text.AddField("tag", tag);
639 auto fid = reader.U32();
640 text.AddField("fid", fid);
641 auto type = reader.U8();
642 text.AddField("type", type);
643 auto flags = reader.U32();
644 text.AddField("flags", flags);
645 auto start = reader.U64();
646 text.AddField("start", start);
647 auto length = reader.U64();
648 text.AddField("length", length);
649 auto proc_id = reader.U32();
650 text.AddField("proc_id", proc_id);
651 auto client_id = reader.String();
652 text.AddField("client_id", client_id);
653 break;
654 }
655
656 case MessageType::Rlock:
657 {
658 // size[4] Rlock tag[2] status[1]
659 text.AddName("<<Rlock");
660 text.AddField("tag", tag);
661 auto status = reader.U8();
662 text.AddField("status", status);
663 break;
664 }
665
666 case MessageType::Tgetlock:
667 {
668 // size[4] Tgetlock tag[2] fid[4] type[1] start[8] length[8] proc_id[4] client_id[s]
669 text.AddName(">>Tgetlock");
670 text.AddField("tag", tag);
671 auto fid = reader.U32();
672 text.AddField("fid", fid);
673 auto type = reader.U8();
674 text.AddField("type", type);
675 auto start = reader.U64();
676 text.AddField("start", start);
677 auto length = reader.U64();
678 text.AddField("length", length);
679 auto proc_id = reader.U32();
680 text.AddField("proc_id", proc_id);
681 auto client_id = reader.String();
682 text.AddField("client_id", client_id);
683 break;
684 }
685
686 case MessageType::Rgetlock:
687 {
688 // size[4] Rgetlock tag[2] type[1] start[8] length[8] proc_id[4] client_id[s]
689 text.AddName("<<Rgetlock");
690 text.AddField("tag", tag);
691 auto type = reader.U8();
692 text.AddField("type", type);
693 auto start = reader.U64();
694 text.AddField("start", start);
695 auto length = reader.U64();
696 text.AddField("length", length);
697 auto proc_id = reader.U32();
698 text.AddField("proc_id", proc_id);
699 auto client_id = reader.String();
700 text.AddField("client_id", client_id);
701 break;
702 }
703
704 case MessageType::Tlink:
705 {
706 // size[4] Tlink tag[2] dfid[4] fid[4] name[s]
707 text.AddName(">>Tlink");
708 text.AddField("tag", tag);
709 auto dfid = reader.U32();
710 text.AddField("dfid", dfid);
711 auto fid = reader.U32();
712 text.AddField("fid", fid);
713 auto name = reader.String();
714 text.AddField("name", name);
715 break;
716 }
717
718 case MessageType::Rlink:
719 {
720 // size[4] Rlink tag[2]
721 text.AddName("<<Rlink");
722 text.AddField("tag", tag);
723 break;
724 }
725
726 case MessageType::Tmkdir:
727 {
728 // size[4] Tmkdir tag[2] dfid[4] name[s] mode[4] gid[4]
729 text.AddName(">>Tmkdir");
730 text.AddField("tag", tag);
731 auto dfid = reader.U32();
732 text.AddField("dfid", dfid);
733 auto name = reader.String();
734 text.AddField("name", name);
735 auto mode = reader.U32();
736 text.AddField("mode", mode);
737 auto gid = reader.U32();
738 text.AddField("gid", gid);
739 break;
740 }
741
742 case MessageType::Rmkdir:
743 {
744 // size[4] Rmkdir tag[2] qid[13]
745 text.AddName("<<Rmkdir");
746 text.AddField("tag", tag);
747 auto qid = reader.Qid();
748 text.AddField("qid", qid);
749 break;
750 }
751
752 case MessageType::Trenameat:
753 {
754 // size[4] Trenameat tag[2] olddirfid[4] oldname[s] newdirfid[4] newname[s]
755 text.AddName(">>Trenameat");
756 text.AddField("tag", tag);
757 auto olddirfid = reader.U32();
758 text.AddField("olddirfid", olddirfid);
759 auto oldname = reader.String();
760 text.AddField("oldname", oldname);
761 auto newdirfid = reader.U32();
762 text.AddField("newdirfid", newdirfid);
763 auto newname = reader.String();
764 text.AddField("newname", newname);
765 break;
766 }
767
768 case MessageType::Rrenameat:
769 {
770 // size[4] Rrenameat tag[2]
771 text.AddName("<<Rrenameat");
772 text.AddField("tag", tag);
773 break;
774 }
775
776 case MessageType::Tunlinkat:
777 {
778 // size[4] Tunlinkat tag[2] dirfd[4] name[s] flags[4]
779 text.AddName(">>Tunlinkat");
780 text.AddField("tag", tag);
781 auto dirfd = reader.U32();
782 text.AddField("dirfd", dirfd);
783 auto name = reader.String();
784 text.AddField("name", name);
785 auto flags = reader.U32();
786 text.AddField("flags", flags);
787 break;
788 }
789
790 case MessageType::Runlinkat:
791 {
792 // size[4] Runlinkat tag[2]
793 text.AddName("<<Runlinkat");
794 text.AddField("tag", tag);
795 break;
796 }
797
798 case MessageType::Taccess:
799 {
800 // size[4] Taccess tag[2] fid[4] flags[4]
801 text.AddName(">>Taccess");
802 text.AddField("tag", tag);
803 auto fid = reader.U32();
804 text.AddField("fid", fid);
805 auto flags = reader.U32();
806 text.AddField("flags", flags);
807 break;
808 }
809
810 case MessageType::Raccess:
811 {
812 // size[4] Raccess tag[2]
813 text.AddName("<<Raccess");
814 text.AddField("tag", tag);
815 break;
816 }
817
818 case MessageType::Twreaddir:
819 {
820 // size[4] Twreaddir tag[2] fid[4] offset[8] count[4]
821 text.AddName(">>Twreaddir");
822 text.AddField("tag", tag);
823 auto fid = reader.U32();
824 text.AddField("fid", fid);
825 auto offset = reader.U64();
826 text.AddField("offset", offset);
827 auto count = reader.U32();
828 text.AddField("count", count);
829 break;
830 }
831
832 case MessageType::Rwreaddir:
833 {
834 // size[4] Rwreaddir tag[2] count[4] data[count]
835 text.AddName("<<Rwreaddir");
836 text.AddField("tag", tag);
837 auto count = reader.U32();
838 text.AddField("count", count);
839 break;
840 }
841
842 case MessageType::Twopen:
843 {
844 // size[4] Twopen tag[2] fid[4] newfid[4] flags[4] wflags[4] mode[4] gid[4] attr_mask[8] nwname[2] nwname*(wname[s])
845 text.AddName(">>Twopen");
846 text.AddField("tag", tag);
847 auto fid = reader.U32();
848 text.AddField("fid", fid);
849 auto newfid = reader.U32();
850 text.AddField("newfid", newfid);
851 auto flags = reader.U32();
852 text.AddField("flags", flags);
853 auto wflags = reader.U32();
854 text.AddField("wflags", wflags);
855 auto mode = reader.U32();
856 text.AddField("mode", mode);
857 auto gid = reader.U32();
858 text.AddField("gid", gid);
859 auto attr_mask = reader.U64();
860 text.AddField("attr_mask", attr_mask);
861 auto nwname = reader.U16();
862 text.AddField("nwname", nwname);
863 for (UINT32 i = 0; i < nwname; ++i)
864 {
865 auto wname = reader.String();
866 text.AddValue(wname);
867 }
868 break;
869 }
870
871 case MessageType::Rwopen:
872 {
873 // size[4] Rwopen tag[2] status[1] walked[2] qid[13] symlink_target[s] iounit[4] mode[4] uid[4] gid[4] nlink[8] rdev[8] size[8] blksize[8] blocks[8] atime_sec[8] atime_nsec[8] mtime_sec[8] mtime_nsec[8] ctime_sec[8] ctime_nsec[8] btime_sec[8] btime_nsec[8] gen[8] data_version[8]
874 text.AddName("<<Rwopen");
875 text.AddField("tag", tag);
876 auto status = reader.U8();
877 text.AddField("status", status);
878 auto walked = reader.U16();
879 text.AddField("walked", walked);
880 auto qid = reader.Qid();
881 text.AddField("qid", qid);
882 auto symlink_target = reader.String();
883 text.AddField("symlink_target", symlink_target);
884 auto iounit = reader.U32();
885 text.AddField("iounit", iounit);
886 auto mode = reader.U32();
887 text.AddField("mode", mode);
888 auto uid = reader.U32();
889 text.AddField("uid", uid);
890 auto gid = reader.U32();
891 text.AddField("gid", gid);
892 auto nlink = reader.U64();
893 text.AddField("nlink", nlink);
894 auto rdev = reader.U64();
895 text.AddField("rdev", rdev);
896 auto size = reader.U64();
897 text.AddField("size", size);
898 auto blksize = reader.U64();
899 text.AddField("blksize", blksize);
900 auto blocks = reader.U64();
901 text.AddField("blocks", blocks);
902 auto atime_sec = reader.U64();
903 text.AddField("atime_sec", atime_sec);
904 auto atime_nsec = reader.U64();
905 text.AddField("atime_nsec", atime_nsec);
906 auto mtime_sec = reader.U64();
907 text.AddField("mtime_sec", mtime_sec);
908 auto mtime_nsec = reader.U64();
909 text.AddField("mtime_nsec", mtime_nsec);
910 auto ctime_sec = reader.U64();
911 text.AddField("ctime_sec", ctime_sec);
912 auto ctime_nsec = reader.U64();
913 text.AddField("ctime_nsec", ctime_nsec);
914 auto btime_sec = reader.U64();
915 text.AddField("btime_sec", btime_sec);
916 auto btime_nsec = reader.U64();
917 text.AddField("btime_nsec", btime_nsec);
918 auto gen = reader.U64();
919 text.AddField("gen", gen);
920 auto data_version = reader.U64();
921 text.AddField("data_version", data_version);
922 break;
923 }
924
925 default:
926 {
927 text.AddName("Unknown");
928 text.AddField("tag", tag);
929 text.AddField("type", static_cast<UINT32>(messageType));
930 break;
931 }
932 }
933
934 Plan9TraceLoggingProvider::LogMessage(text.String());
935 }
936 } // namespace p9fs