]> git.proxmox.com Git - mirror_zfs.git/blob - include/sys/sdt.h
ztest: scrub ddt repair
[mirror_zfs.git] / include / sys / sdt.h
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, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _SYS_SDT_H
28 #define _SYS_SDT_H
29
30 #ifndef _KERNEL
31
32 #define ZFS_PROBE(a) ((void) 0)
33 #define ZFS_PROBE1(a, c) ((void) 0)
34 #define ZFS_PROBE2(a, c, e) ((void) 0)
35 #define ZFS_PROBE3(a, c, e, g) ((void) 0)
36 #define ZFS_PROBE4(a, c, e, g, i) ((void) 0)
37
38 #endif /* _KERNEL */
39
40 /*
41 * The set-error SDT probe is extra static, in that we declare its fake
42 * function literally, rather than with the DTRACE_PROBE1() macro. This is
43 * necessary so that SET_ERROR() can evaluate to a value, which wouldn't
44 * be possible if it required multiple statements (to declare the function
45 * and then call it).
46 *
47 * SET_ERROR() uses the comma operator so that it can be used without much
48 * additional code. For example, "return (EINVAL);" becomes
49 * "return (SET_ERROR(EINVAL));". Note that the argument will be evaluated
50 * twice, so it should not have side effects (e.g. something like:
51 * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
52 */
53 extern void __set_error(const char *file, const char *func, int line, int err);
54 #undef SET_ERROR
55 #define SET_ERROR(err) \
56 (__set_error(__FILE__, __func__, __LINE__, err), err)
57
58 #endif /* _SYS_SDT_H */