xref: /illumos-gate/usr/src/lib/smbsrv/libfksmbsrv/common/sys/sdt.h (revision 5328fc53d11d7151861fa272e4fb0248b8f0e145)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23  * Copyright (c) 2013 by Delphix. All rights reserved.
24  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
25  */
26 
27 #ifndef _SYS_SDT_H
28 #define	_SYS_SDT_H
29 
30 #include <sys/stdint.h>
31 #include <fksmb_dt.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #ifdef _KERNEL
38 #error "libfksmbsrv/common/sys/sdt.h in kernel?"
39 #endif
40 
41 /*
42  * DTrace SDT probes have different signatures in userland than they do in
43  * the kernel.  This file is strictly for libfksmbsrv, where we compile the
44  * smbsrv kernel code for user space.  In "fksmbd", we can use the probes
45  * defined for the (real, in-kernel) "smb" and "smb2" SDT provider by
46  * mapping them onto the USDT proviver defined in ../fksmb_dt.d
47  *
48  * An example of how to use these probes can be found in:
49  *	$SRC/cmd/smbsrv/fksmbd/Watch-fksmb.d
50  */
51 
52 /*
53  * Map "smb" provider probes.
54  */
55 
56 #define	DTRACE_SMB_START(name, type1, arg1) \
57 	FKSMB_SMB_START(#name, (unsigned long)arg1)
58 #define	DTRACE_SMB_DONE(name, type1, arg1) \
59 	FKSMB_SMB_DONE(#name, (unsigned long)arg1)
60 
61 /*
62  * Map "smb2" provider probes.
63  */
64 
65 #define	DTRACE_SMB2_START(name, type1, arg1) \
66 	FKSMB_SMB2_START(#name, (unsigned long)arg1)
67 #define	DTRACE_SMB2_DONE(name, type1, arg1) \
68 	FKSMB_SMB2_DONE(#name, (unsigned long)arg1)
69 
70 /*
71  * These are for the other (specialized) dtrace SDT probes sprinkled
72  * through the smbsrv code.  These are less often used.
73  */
74 
75 #define	DTRACE_PROBE(name, type1, arg1) \
76 	FKSMB_PROBE0(#name)
77 
78 #define	DTRACE_PROBE1(name, type1, arg1) \
79 	FKSMB_PROBE1(#name, (unsigned long)arg1)
80 
81 #define	DTRACE_PROBE2(name, type1, arg1, type2, arg2) \
82 	FKSMB_PROBE2(#name, (unsigned long)arg1, (unsigned long)arg2)
83 
84 #define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) \
85 	FKSMB_PROBE3(#name, (unsigned long)arg1, (unsigned long)arg2, \
86 		(unsigned long)arg3)
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif	/* _SYS_SDT_H */
93