193bc28dbSGordon Ross /* 293bc28dbSGordon Ross * CDDL HEADER START 393bc28dbSGordon Ross * 493bc28dbSGordon Ross * The contents of this file are subject to the terms of the 593bc28dbSGordon Ross * Common Development and Distribution License (the "License"). 693bc28dbSGordon Ross * You may not use this file except in compliance with the License. 793bc28dbSGordon Ross * 893bc28dbSGordon Ross * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 993bc28dbSGordon Ross * or http://www.opensolaris.org/os/licensing. 1093bc28dbSGordon Ross * See the License for the specific language governing permissions 1193bc28dbSGordon Ross * and limitations under the License. 1293bc28dbSGordon Ross * 1393bc28dbSGordon Ross * When distributing Covered Code, include this CDDL HEADER in each 1493bc28dbSGordon Ross * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1593bc28dbSGordon Ross * If applicable, add the following below this CDDL HEADER, with the 1693bc28dbSGordon Ross * fields enclosed by brackets "[]" replaced with your own identifying 1793bc28dbSGordon Ross * information: Portions Copyright [yyyy] [name of copyright owner] 1893bc28dbSGordon Ross * 1993bc28dbSGordon Ross * CDDL HEADER END 2093bc28dbSGordon Ross */ 2193bc28dbSGordon Ross /* 2293bc28dbSGordon Ross * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2393bc28dbSGordon Ross * Copyright (c) 2013 by Delphix. All rights reserved. 24*25fee679SGordon Ross * Copyright 2017-2021 Tintri by DDN, Inc. All rights reserved. 2593bc28dbSGordon Ross */ 2693bc28dbSGordon Ross 2793bc28dbSGordon Ross #ifndef _SYS_SDT_H 2893bc28dbSGordon Ross #define _SYS_SDT_H 2993bc28dbSGordon Ross 3093bc28dbSGordon Ross #include <sys/stdint.h> 3193bc28dbSGordon Ross #include <fksmb_dt.h> 3293bc28dbSGordon Ross 3393bc28dbSGordon Ross #ifdef __cplusplus 3493bc28dbSGordon Ross extern "C" { 3593bc28dbSGordon Ross #endif 3693bc28dbSGordon Ross 3793bc28dbSGordon Ross #ifdef _KERNEL 3893bc28dbSGordon Ross #error "libfksmbsrv/common/sys/sdt.h in kernel?" 3993bc28dbSGordon Ross #endif 4093bc28dbSGordon Ross 4193bc28dbSGordon Ross /* 4293bc28dbSGordon Ross * DTrace SDT probes have different signatures in userland than they do in 4393bc28dbSGordon Ross * the kernel. This file is strictly for libfksmbsrv, where we compile the 4493bc28dbSGordon Ross * smbsrv kernel code for user space. In "fksmbd", we can use the probes 4593bc28dbSGordon Ross * defined for the (real, in-kernel) "smb" and "smb2" SDT provider by 4693bc28dbSGordon Ross * mapping them onto the USDT proviver defined in ../fksmb_dt.d 4793bc28dbSGordon Ross * 4893bc28dbSGordon Ross * An example of how to use these probes can be found in: 4993bc28dbSGordon Ross * $SRC/cmd/smbsrv/fksmbd/Watch-fksmb.d 5093bc28dbSGordon Ross */ 5193bc28dbSGordon Ross 5293bc28dbSGordon Ross /* 5393bc28dbSGordon Ross * Map "smb" provider probes. 5493bc28dbSGordon Ross */ 5593bc28dbSGordon Ross 5693bc28dbSGordon Ross #define DTRACE_SMB_START(name, type1, arg1) \ 5793bc28dbSGordon Ross FKSMB_SMB_START(#name, (unsigned long)arg1) 5893bc28dbSGordon Ross #define DTRACE_SMB_DONE(name, type1, arg1) \ 5993bc28dbSGordon Ross FKSMB_SMB_DONE(#name, (unsigned long)arg1) 6093bc28dbSGordon Ross 6193bc28dbSGordon Ross /* 6293bc28dbSGordon Ross * Map "smb2" provider probes. 6393bc28dbSGordon Ross */ 6493bc28dbSGordon Ross 6593bc28dbSGordon Ross #define DTRACE_SMB2_START(name, type1, arg1) \ 6693bc28dbSGordon Ross FKSMB_SMB2_START(#name, (unsigned long)arg1) 6793bc28dbSGordon Ross #define DTRACE_SMB2_DONE(name, type1, arg1) \ 6893bc28dbSGordon Ross FKSMB_SMB2_DONE(#name, (unsigned long)arg1) 6993bc28dbSGordon Ross 7093bc28dbSGordon Ross /* 7193bc28dbSGordon Ross * These are for the other (specialized) dtrace SDT probes sprinkled 7293bc28dbSGordon Ross * through the smbsrv code. These are less often used. 7393bc28dbSGordon Ross */ 7493bc28dbSGordon Ross 7593bc28dbSGordon Ross #define DTRACE_PROBE(name, type1, arg1) \ 7693bc28dbSGordon Ross FKSMB_PROBE0(#name) 7793bc28dbSGordon Ross 7893bc28dbSGordon Ross #define DTRACE_PROBE1(name, type1, arg1) \ 7993bc28dbSGordon Ross FKSMB_PROBE1(#name, (unsigned long)arg1) 8093bc28dbSGordon Ross 8193bc28dbSGordon Ross #define DTRACE_PROBE2(name, type1, arg1, type2, arg2) \ 8293bc28dbSGordon Ross FKSMB_PROBE2(#name, (unsigned long)arg1, (unsigned long)arg2) 8393bc28dbSGordon Ross 8493bc28dbSGordon Ross #define DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) \ 8593bc28dbSGordon Ross FKSMB_PROBE3(#name, (unsigned long)arg1, (unsigned long)arg2, \ 8693bc28dbSGordon Ross (unsigned long)arg3) 8793bc28dbSGordon Ross 88*25fee679SGordon Ross /* 89*25fee679SGordon Ross * We use the comma operator so that this macro can be used without much 90*25fee679SGordon Ross * additional code. For example, "return (EINVAL);" becomes 91*25fee679SGordon Ross * "return (SET_ERROR(EINVAL));". Note that the argument will be evaluated 92*25fee679SGordon Ross * twice, so it should not have side effects (e.g. something like: 93*25fee679SGordon Ross * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice). 94*25fee679SGordon Ross */ 95*25fee679SGordon Ross #define SET_ERROR(err) (FKSMB_SET_ERROR(err), err) 96*25fee679SGordon Ross 9793bc28dbSGordon Ross #ifdef __cplusplus 9893bc28dbSGordon Ross } 9993bc28dbSGordon Ross #endif 10093bc28dbSGordon Ross 10193bc28dbSGordon Ross #endif /* _SYS_SDT_H */ 102