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