xref: /illumos-gate/usr/src/cmd/smbsrv/testoplock/tol_all.d (revision 5328fc53d11d7151861fa272e4fb0248b8f0e145)
1 #!/usr/sbin/dtrace -s
2 /*
3  * This file and its contents are supplied under the terms of the
4  * Common Development and Distribution License ("CDDL"), version 1.0.
5  * You may only use this file in accordance with the terms of version
6  * 1.0 of the CDDL.
7  *
8  * A full copy of the text of the CDDL should have accompanied this
9  * source.  A copy of the CDDL is also available via the Internet at
10  * http://www.illumos.org/license/CDDL.
11  */
12 
13 /*
14  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
15  */
16 
17 /*
18  * User-level dtrace for testoplock
19  * Usage: dtrace -s tol.d -c ./testoplock
20  */
21 
22 #pragma D option flowindent
23 
24 self int trace;
25 self int mask;
26 
27 /*
28  * Trace almost everything
29  */
30 pid$target:testoplock::entry
31 {
32   self->trace++;
33 }
34 
35 /*
36  * If traced and not masked, print entry/return
37  */
38 pid$target:testoplock::entry
39 /self->trace > 0 && self->mask == 0/
40 {
41   printf("\t0x%x", arg0);
42   printf("\t0x%x", arg1);
43   printf("\t0x%x", arg2);
44   printf("\t0x%x", arg3);
45   printf("\t0x%x", arg4);
46   printf("\t0x%x", arg5);
47 }
48 
49 /* Skip the bsearch calls. */
50 pid$target:testoplock:xlate_nt_status:entry
51 {
52   self->mask++;
53 }
54 
55 pid$target:testoplock:xlate_nt_status:return
56 {
57   self->mask--;
58 }
59 
60 pid$target:testoplock::return
61 /self->trace > 0 && self->mask == 0/
62 {
63   printf("\t0x%x", arg1);
64 }
65 
66 pid$target:testoplock::return
67 {
68   self->trace--;
69 }
70 
71 /* ---------------------- */
72 
73 pid$target::smb_oplock_request:entry
74 {
75 	self->sr = arg0;
76 	self->of = arg1;
77 	self->statep = arg2;
78 	this->state = *(uint32_t *)copyin(self->statep, 4);
79 	printf(" entry state=0x%x\n", this->state);
80 }
81 
82 pid$target::smb_oplock_request:return
83 {
84 	this->sr = (userland pid`smb_request_t *)self->sr;
85 	this->state = *(uint32_t *)copyin(self->statep, 4);
86 	printf(" return state=0x%x\n", this->state);
87 	printf("\nsr->arg.open = ");
88 	print(this->sr->arg.open);
89 }
90 
91 pid$target::smb_oplock_break_cmn:entry
92 {
93 	this->node = (userland pid`smb_node_t *)arg0;
94 	this->ofile = (userland pid`smb_ofile_t *)arg1;
95 	printf("\nnode->n_oplock = ");
96 	print(this->node->n_oplock);
97 	printf("\nofile->f_oplock = ");
98 	print(this->ofile->f_oplock);
99 }
100 
101 pid$target::smb_oplock_ind_break:entry
102 {
103 	this->ofile = (userland pid`smb_ofile_t *)arg0;
104 	printf("\nofile->f_oplock = ");
105 	print(this->ofile->f_oplock);
106 }
107