summaryrefslogtreecommitdiffstats
path: root/cddl/contrib
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2013-04-06 10:39:38 +0000
committermm <mm@FreeBSD.org>2013-04-06 10:39:38 +0000
commit696d961cbd8bcba286545fef03c51a896b56d229 (patch)
tree557b6db8b3be2ff65382b43d2ae9edd99d502a44 /cddl/contrib
parentf25063da0770fd0a9b4ed6ffdd6687e7de116255 (diff)
parent70e6431e93f13270d6907ce23de3c7da99803278 (diff)
downloadFreeBSD-src-696d961cbd8bcba286545fef03c51a896b56d229.zip
FreeBSD-src-696d961cbd8bcba286545fef03c51a896b56d229.tar.gz
MFV r248217:
Merge change from vendor to reduce diff only. ZFS dtrace probes are not supported on FreeBSD yet. Illumos ZFS issues: 3598 want to dtrace when errors are generated in zfs MFC after: 3 weeks
Diffstat (limited to 'cddl/contrib')
-rw-r--r--cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h50
-rw-r--r--cddl/contrib/opensolaris/lib/libzpool/common/zfs.d36
2 files changed, 81 insertions, 5 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
index f026fb3..2107505 100644
--- a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
+++ b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
@@ -86,6 +87,9 @@ extern "C" {
#include <sys/sysevent/dev.h>
#include <machine/atomic.h>
#include <sys/debug.h>
+#ifdef illumos
+#include "zfs.h"
+#endif
#define ZFS_EXPORTS_PATH "/etc/zfs/exports"
@@ -133,28 +137,64 @@ extern int aok;
#ifdef DTRACE_PROBE
#undef DTRACE_PROBE
-#define DTRACE_PROBE(a) ((void)0)
#endif /* DTRACE_PROBE */
+#ifdef illumos
+#define DTRACE_PROBE(a) \
+ ZFS_PROBE0(#a)
+#endif
#ifdef DTRACE_PROBE1
#undef DTRACE_PROBE1
-#define DTRACE_PROBE1(a, b, c) ((void)0)
#endif /* DTRACE_PROBE1 */
+#ifdef illumos
+#define DTRACE_PROBE1(a, b, c) \
+ ZFS_PROBE1(#a, (unsigned long)c)
+#endif
#ifdef DTRACE_PROBE2
#undef DTRACE_PROBE2
-#define DTRACE_PROBE2(a, b, c, d, e) ((void)0)
#endif /* DTRACE_PROBE2 */
+#ifdef illumos
+#define DTRACE_PROBE2(a, b, c, d, e) \
+ ZFS_PROBE2(#a, (unsigned long)c, (unsigned long)e)
+#endif
#ifdef DTRACE_PROBE3
#undef DTRACE_PROBE3
-#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0)
#endif /* DTRACE_PROBE3 */
+#ifdef illumos
+#define DTRACE_PROBE3(a, b, c, d, e, f, g) \
+ ZFS_PROBE3(#a, (unsigned long)c, (unsigned long)e, (unsigned long)g)
+#endif
#ifdef DTRACE_PROBE4
#undef DTRACE_PROBE4
-#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0)
#endif /* DTRACE_PROBE4 */
+#ifdef illumos
+#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) \
+ ZFS_PROBE4(#a, (unsigned long)c, (unsigned long)e, (unsigned long)g, \
+ (unsigned long)i)
+#endif
+
+#ifdef illumos
+/*
+ * We use the comma operator so that this macro can be used without much
+ * additional code. For example, "return (EINVAL);" becomes
+ * "return (SET_ERROR(EINVAL));". Note that the argument will be evaluated
+ * twice, so it should not have side effects (e.g. something like:
+ * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
+ */
+#define SET_ERROR(err) (ZFS_SET_ERROR(err), err)
+#else /* !illumos */
+
+#define DTRACE_PROBE(a) ((void)0)
+#define DTRACE_PROBE1(a, b, c) ((void)0)
+#define DTRACE_PROBE2(a, b, c, d, e) ((void)0)
+#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0)
+#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0)
+
+#define SET_ERROR(err) (err)
+#endif /* !illumos */
/*
* Threads
diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/zfs.d b/cddl/contrib/opensolaris/lib/libzpool/common/zfs.d
new file mode 100644
index 0000000..1351733
--- /dev/null
+++ b/cddl/contrib/opensolaris/lib/libzpool/common/zfs.d
@@ -0,0 +1,36 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2013 by Delphix. All rights reserved.
+ */
+
+provider zfs {
+ probe probe0(char *probename);
+ probe probe1(char *probename, unsigned long arg1);
+ probe probe2(char *probename, unsigned long arg1, unsigned long arg2);
+ probe probe3(char *probename, unsigned long arg1, unsigned long arg2,
+ unsigned long arg3);
+ probe probe4(char *probename, unsigned long arg1, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4);
+
+ probe set__error(int err);
+};
+
+#pragma D attributes Evolving/Evolving/ISA provider zfs provider
+#pragma D attributes Private/Private/Unknown provider zfs module
+#pragma D attributes Private/Private/Unknown provider zfs function
+#pragma D attributes Evolving/Evolving/ISA provider zfs name
+#pragma D attributes Evolving/Evolving/ISA provider zfs args
OpenPOWER on IntegriCloud