[Midnightbsd-cvs] src [10167] trunk/sys/cddl: sync

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Jun 1 18:49:18 EDT 2018


Revision: 10167
          http://svnweb.midnightbsd.org/src/?rev=10167
Author:   laffer1
Date:     2018-06-01 18:49:17 -0400 (Fri, 01 Jun 2018)
Log Message:
-----------
sync

Modified Paths:
--------------
    trunk/sys/cddl/boot/zfs/README
    trunk/sys/cddl/boot/zfs/lz4.c
    trunk/sys/cddl/boot/zfs/zfsimpl.h
    trunk/sys/cddl/boot/zfs/zfssubr.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_string.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_sysevent.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c
    trunk/sys/cddl/compat/opensolaris/rpc/xdr.h
    trunk/sys/cddl/compat/opensolaris/sys/acl.h
    trunk/sys/cddl/compat/opensolaris/sys/assfail.h
    trunk/sys/cddl/compat/opensolaris/sys/atomic.h
    trunk/sys/cddl/compat/opensolaris/sys/bitmap.h
    trunk/sys/cddl/compat/opensolaris/sys/byteorder.h
    trunk/sys/cddl/compat/opensolaris/sys/cmn_err.h
    trunk/sys/cddl/compat/opensolaris/sys/cpupart.h
    trunk/sys/cddl/compat/opensolaris/sys/cpuvar.h
    trunk/sys/cddl/compat/opensolaris/sys/cpuvar_defs.h
    trunk/sys/cddl/compat/opensolaris/sys/cred.h
    trunk/sys/cddl/compat/opensolaris/sys/cyclic.h
    trunk/sys/cddl/compat/opensolaris/sys/cyclic_impl.h
    trunk/sys/cddl/compat/opensolaris/sys/debug.h
    trunk/sys/cddl/compat/opensolaris/sys/dirent.h
    trunk/sys/cddl/compat/opensolaris/sys/dkio.h
    trunk/sys/cddl/compat/opensolaris/sys/dnlc.h
    trunk/sys/cddl/compat/opensolaris/sys/elf.h
    trunk/sys/cddl/compat/opensolaris/sys/feature_tests.h
    trunk/sys/cddl/compat/opensolaris/sys/file.h
    trunk/sys/cddl/compat/opensolaris/sys/kcondvar.h
    trunk/sys/cddl/compat/opensolaris/sys/kidmap.h
    trunk/sys/cddl/compat/opensolaris/sys/kmem.h
    trunk/sys/cddl/compat/opensolaris/sys/kobj.h
    trunk/sys/cddl/compat/opensolaris/sys/kstat.h
    trunk/sys/cddl/compat/opensolaris/sys/lock.h
    trunk/sys/cddl/compat/opensolaris/sys/misc.h
    trunk/sys/cddl/compat/opensolaris/sys/mman.h
    trunk/sys/cddl/compat/opensolaris/sys/mntent.h
    trunk/sys/cddl/compat/opensolaris/sys/mnttab.h
    trunk/sys/cddl/compat/opensolaris/sys/modctl.h
    trunk/sys/cddl/compat/opensolaris/sys/mount.h
    trunk/sys/cddl/compat/opensolaris/sys/mutex.h
    trunk/sys/cddl/compat/opensolaris/sys/objfs.h
    trunk/sys/cddl/compat/opensolaris/sys/param.h
    trunk/sys/cddl/compat/opensolaris/sys/pathname.h
    trunk/sys/cddl/compat/opensolaris/sys/pcpu.h
    trunk/sys/cddl/compat/opensolaris/sys/policy.h
    trunk/sys/cddl/compat/opensolaris/sys/proc.h
    trunk/sys/cddl/compat/opensolaris/sys/random.h
    trunk/sys/cddl/compat/opensolaris/sys/refstr.h
    trunk/sys/cddl/compat/opensolaris/sys/rwlock.h
    trunk/sys/cddl/compat/opensolaris/sys/sdt.h
    trunk/sys/cddl/compat/opensolaris/sys/sema.h
    trunk/sys/cddl/compat/opensolaris/sys/sid.h
    trunk/sys/cddl/compat/opensolaris/sys/sig.h
    trunk/sys/cddl/compat/opensolaris/sys/stat.h
    trunk/sys/cddl/compat/opensolaris/sys/string.h
    trunk/sys/cddl/compat/opensolaris/sys/sunddi.h
    trunk/sys/cddl/compat/opensolaris/sys/systeminfo.h
    trunk/sys/cddl/compat/opensolaris/sys/systm.h
    trunk/sys/cddl/compat/opensolaris/sys/taskq.h
    trunk/sys/cddl/compat/opensolaris/sys/time.h
    trunk/sys/cddl/compat/opensolaris/sys/types.h
    trunk/sys/cddl/compat/opensolaris/sys/uio.h
    trunk/sys/cddl/compat/opensolaris/sys/varargs.h
    trunk/sys/cddl/compat/opensolaris/sys/vfs.h
    trunk/sys/cddl/compat/opensolaris/sys/vnode.h
    trunk/sys/cddl/compat/opensolaris/sys/zone.h
    trunk/sys/cddl/dev/cyclic/i386/cyclic_machdep.c

Added Paths:
-----------
    trunk/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c
    trunk/sys/cddl/compat/opensolaris/sys/callo.h
    trunk/sys/cddl/compat/opensolaris/sys/debug_compat.h
    trunk/sys/cddl/compat/opensolaris/sys/disp.h
    trunk/sys/cddl/compat/opensolaris/sys/vm.h

Property Changed:
----------------
    trunk/sys/cddl/boot/zfs/README

Modified: trunk/sys/cddl/boot/zfs/README
===================================================================
--- trunk/sys/cddl/boot/zfs/README	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/boot/zfs/README	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,4 +1,4 @@
-$FreeBSD: release/9.2.0/sys/cddl/boot/zfs/README 247309 2013-02-26 05:58:05Z delphij $
+$FreeBSD: stable/10/sys/cddl/boot/zfs/README 268649 2014-07-15 04:53:34Z delphij $
 
 This directory contains various files derived from CDDL sources that
 are used by the ZFS bootstrap:
@@ -7,9 +7,10 @@
     sha256.c			checksum support
     lz4.c			compression support
     lzjb.c			compression support
+    blkptr.c			ZFS embedded-data block pointers support
     zfssubr.c			checksum, compression and raidz support
     zfsimpl.h			mostly describing the physical layout
 
-The files fletcher.c, lzjb.c and sha256.c are largely identical to the
-ZFS base code (with write support removed) and could be shared but
-that might complicate future imports from OpenSolaris.
+The files fletcher.c, lzjb.c, lz4.c, sha256.c and blkptr.c are largely identical
+to the ZFS base code (with write support removed) and could be shared but that
+might complicate future imports from Illumos.


Property changes on: trunk/sys/cddl/boot/zfs/README
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sys/cddl/boot/zfs/lz4.c
===================================================================
--- trunk/sys/cddl/boot/zfs/lz4.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/boot/zfs/lz4.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -32,9 +32,11 @@
  * - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
  * - LZ4 source repository : http://code.google.com/p/lz4/
  *
- * $FreeBSD: release/9.2.0/sys/cddl/boot/zfs/lz4.c 247309 2013-02-26 05:58:05Z delphij $
+ * $FreeBSD: stable/10/sys/cddl/boot/zfs/lz4.c 301608 2016-06-08 13:21:17Z ngie $
  */
 
+#include <arpa/inet.h>
+
 static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest,
 					    int isize, int maxOutputSize);
 
@@ -53,7 +55,7 @@
 	 * Returns 0 on success (decompression function returned non-negative)
 	 * and non-zero on failure (decompression function returned negative).
 	 */
-	return (LZ4_uncompress_unknownOutputSize(s_start + 4, d_start, bufsiz,
+	return (LZ4_uncompress_unknownOutputSize((const char *)s_start + 4, d_start, bufsiz,
 	    d_len) < 0);
 }
 
@@ -84,6 +86,17 @@
 #endif
 
 /*
+ * Unaligned memory access is automatically enabled for "common" CPU,
+ * such as x86. For others CPU, the compiler will be more cautious, and
+ * insert extra code to ensure aligned access is respected. If you know
+ * your target CPU supports unaligned memory access, you may want to
+ * force this option manually to improve performance
+ */
+#if defined(__ARM_FEATURE_UNALIGNED)
+#define	LZ4_FORCE_UNALIGNED_ACCESS 1
+#endif
+
+/*
  * Compiler Options
  */
 #if __STDC_VERSION__ >= 199901L	/* C99 */
@@ -114,6 +127,10 @@
 #define	S32	int32_t
 #define	U64	uint64_t
 
+#ifndef LZ4_FORCE_UNALIGNED_ACCESS
+#pragma pack(1)
+#endif
+
 typedef struct _U16_S {
 	U16 v;
 } U16_S;
@@ -124,6 +141,10 @@
 	U64 v;
 } U64_S;
 
+#ifndef LZ4_FORCE_UNALIGNED_ACCESS
+#pragma pack()
+#endif
+
 #define	A64(x)	(((U64_S *)(x))->v)
 #define	A32(x)	(((U32_S *)(x))->v)
 #define	A16(x)	(((U16_S *)(x))->v)

Modified: trunk/sys/cddl/boot/zfs/zfsimpl.h
===================================================================
--- trunk/sys/cddl/boot/zfs/zfsimpl.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/boot/zfs/zfsimpl.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -56,9 +56,14 @@
 /*
  * Copyright 2013 by Saso Kiselkov. All rights reserved.
  */
+/*
+ * Copyright (c) 2013 by Delphix. All rights reserved.
+ */
 
 #define	MAXNAMELEN	256
 
+#define _NOTE(s)
+
 /* CRC64 table */
 #define	ZFS_CRC64_POLY	0xC96C5795D7870F42ULL	/* ECMA-182, reflected form */
 
@@ -109,9 +114,8 @@
 #define	BSWAP_64(x)	((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32))
 
 /*
- * We currently support nine block sizes, from 512 bytes to 128K.
- * We could go higher, but the benefits are near-zero and the cost
- * of COWing a giant block to modify one byte would become excessive.
+ * Note: the boot loader can't actually read blocks larger than 128KB,
+ * due to lack of memory.  Therefore its SPA_MAXBLOCKSIZE is still 128KB.
  */
 #define	SPA_MINBLOCKSHIFT	9
 #define	SPA_MAXBLOCKSHIFT	17
@@ -118,8 +122,6 @@
 #define	SPA_MINBLOCKSIZE	(1ULL << SPA_MINBLOCKSHIFT)
 #define	SPA_MAXBLOCKSIZE	(1ULL << SPA_MAXBLOCKSHIFT)
 
-#define	SPA_BLOCKSIZES		(SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1)
-
 /*
  * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB.
  * The ASIZE encoding should be at least 64 times larger (6 more bits)
@@ -164,7 +166,7 @@
  *	+-------+-------+-------+-------+-------+-------+-------+-------+
  * 5	|G|			 offset3				|
  *	+-------+-------+-------+-------+-------+-------+-------+-------+
- * 6	|BDX|lvl| type	| cksum | comp	|     PSIZE	|     LSIZE	|
+ * 6	|BDX|lvl| type	| cksum |E| comp|    PSIZE	|     LSIZE	|
  *	+-------+-------+-------+-------+-------+-------+-------+-------+
  * 7	|			padding					|
  *	+-------+-------+-------+-------+-------+-------+-------+-------+
@@ -198,7 +200,8 @@
  * G		gang block indicator
  * B		byteorder (endianness)
  * D		dedup
- * X		unused
+ * X		encryption (on version 30, which is not supported)
+ * E		blkptr_t contains embedded data (see below)
  * lvl		level of indirection
  * type		DMU object type
  * phys birth	txg of block allocation; zero if same as logical birth txg
@@ -206,6 +209,100 @@
  * fill count	number of non-zero blocks under this bp
  * checksum[4]	256-bit checksum of the data this bp describes
  */
+
+/*
+ * "Embedded" blkptr_t's don't actually point to a block, instead they
+ * have a data payload embedded in the blkptr_t itself.  See the comment
+ * in blkptr.c for more details.
+ *
+ * The blkptr_t is laid out as follows:
+ *
+ *	64	56	48	40	32	24	16	8	0
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 0	|      payload                                                  |
+ * 1	|      payload                                                  |
+ * 2	|      payload                                                  |
+ * 3	|      payload                                                  |
+ * 4	|      payload                                                  |
+ * 5	|      payload                                                  |
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 6	|BDX|lvl| type	| etype |E| comp| PSIZE|              LSIZE	|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * 7	|      payload                                                  |
+ * 8	|      payload                                                  |
+ * 9	|      payload                                                  |
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * a	|			logical birth txg			|
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ * b	|      payload                                                  |
+ * c	|      payload                                                  |
+ * d	|      payload                                                  |
+ * e	|      payload                                                  |
+ * f	|      payload                                                  |
+ *	+-------+-------+-------+-------+-------+-------+-------+-------+
+ *
+ * Legend:
+ *
+ * payload		contains the embedded data
+ * B (byteorder)	byteorder (endianness)
+ * D (dedup)		padding (set to zero)
+ * X			encryption (set to zero; see above)
+ * E (embedded)		set to one
+ * lvl			indirection level
+ * type			DMU object type
+ * etype		how to interpret embedded data (BP_EMBEDDED_TYPE_*)
+ * comp			compression function of payload
+ * PSIZE		size of payload after compression, in bytes
+ * LSIZE		logical size of payload, in bytes
+ *			note that 25 bits is enough to store the largest
+ *			"normal" BP's LSIZE (2^16 * 2^9) in bytes
+ * log. birth		transaction group in which the block was logically born
+ *
+ * Note that LSIZE and PSIZE are stored in bytes, whereas for non-embedded
+ * bp's they are stored in units of SPA_MINBLOCKSHIFT.
+ * Generally, the generic BP_GET_*() macros can be used on embedded BP's.
+ * The B, D, X, lvl, type, and comp fields are stored the same as with normal
+ * BP's so the BP_SET_* macros can be used with them.  etype, PSIZE, LSIZE must
+ * be set with the BPE_SET_* macros.  BP_SET_EMBEDDED() should be called before
+ * other macros, as they assert that they are only used on BP's of the correct
+ * "embedded-ness".
+ */
+
+#define	BPE_GET_ETYPE(bp)	\
+	(ASSERT(BP_IS_EMBEDDED(bp)), \
+	BF64_GET((bp)->blk_prop, 40, 8))
+#define	BPE_SET_ETYPE(bp, t)	do { \
+	ASSERT(BP_IS_EMBEDDED(bp)); \
+	BF64_SET((bp)->blk_prop, 40, 8, t); \
+_NOTE(CONSTCOND) } while (0)
+
+#define	BPE_GET_LSIZE(bp)	\
+	(ASSERT(BP_IS_EMBEDDED(bp)), \
+	BF64_GET_SB((bp)->blk_prop, 0, 25, 0, 1))
+#define	BPE_SET_LSIZE(bp, x)	do { \
+	ASSERT(BP_IS_EMBEDDED(bp)); \
+	BF64_SET_SB((bp)->blk_prop, 0, 25, 0, 1, x); \
+_NOTE(CONSTCOND) } while (0)
+
+#define	BPE_GET_PSIZE(bp)	\
+	(ASSERT(BP_IS_EMBEDDED(bp)), \
+	BF64_GET_SB((bp)->blk_prop, 25, 7, 0, 1))
+#define	BPE_SET_PSIZE(bp, x)	do { \
+	ASSERT(BP_IS_EMBEDDED(bp)); \
+	BF64_SET_SB((bp)->blk_prop, 25, 7, 0, 1, x); \
+_NOTE(CONSTCOND) } while (0)
+
+typedef enum bp_embedded_type {
+	BP_EMBEDDED_TYPE_DATA,
+	BP_EMBEDDED_TYPE_RESERVED, /* Reserved for an unintegrated feature. */
+	NUM_BP_EMBEDDED_TYPES = BP_EMBEDDED_TYPE_RESERVED
+} bp_embedded_type_t;
+
+#define	BPE_NUM_WORDS 14
+#define	BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof (uint64_t))
+#define	BPE_IS_PAYLOADWORD(bp, wp) \
+	((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth)
+
 #define	SPA_BLKPTRSHIFT	7		/* blkptr_t is 128 bytes	*/
 #define	SPA_DVAS_PER_BP	3		/* Number of DVAs in a bp	*/
 
@@ -223,9 +320,10 @@
  * Macros to get and set fields in a bp or DVA.
  */
 #define	DVA_GET_ASIZE(dva)	\
-	BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0)
+	BF64_GET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, SPA_MINBLOCKSHIFT, 0)
 #define	DVA_SET_ASIZE(dva, x)	\
-	BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x)
+	BF64_SET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, \
+	SPA_MINBLOCKSHIFT, 0, x)
 
 #define	DVA_GET_GRID(dva)	BF64_GET((dva)->dva_word[0], 24, 8)
 #define	DVA_SET_GRID(dva, x)	BF64_SET((dva)->dva_word[0], 24, 8, x)
@@ -242,18 +340,22 @@
 #define	DVA_SET_GANG(dva, x)	BF64_SET((dva)->dva_word[1], 63, 1, x)
 
 #define	BP_GET_LSIZE(bp)	\
-	(BP_IS_HOLE(bp) ? 0 : \
-	BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1))
-#define	BP_SET_LSIZE(bp, x)	\
-	BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x)
+	(BP_IS_EMBEDDED(bp) ?	\
+	(BPE_GET_ETYPE(bp) == BP_EMBEDDED_TYPE_DATA ? BPE_GET_LSIZE(bp) : 0): \
+	BF64_GET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1))
+#define	BP_SET_LSIZE(bp, x)	do { \
+	ASSERT(!BP_IS_EMBEDDED(bp)); \
+	BF64_SET_SB((bp)->blk_prop, \
+	    0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x); \
+_NOTE(CONSTCOND) } while (0)
 
 #define	BP_GET_PSIZE(bp)	\
-	BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1)
+	BF64_GET_SB((bp)->blk_prop, 16, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1)
 #define	BP_SET_PSIZE(bp, x)	\
-	BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x)
+	BF64_SET_SB((bp)->blk_prop, 16, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x)
 
-#define	BP_GET_COMPRESS(bp)	BF64_GET((bp)->blk_prop, 32, 8)
-#define	BP_SET_COMPRESS(bp, x)	BF64_SET((bp)->blk_prop, 32, 8, x)
+#define	BP_GET_COMPRESS(bp)	BF64_GET((bp)->blk_prop, 32, 7)
+#define	BP_SET_COMPRESS(bp, x)	BF64_SET((bp)->blk_prop, 32, 7, x)
 
 #define	BP_GET_CHECKSUM(bp)	BF64_GET((bp)->blk_prop, 40, 8)
 #define	BP_SET_CHECKSUM(bp, x)	BF64_SET((bp)->blk_prop, 40, 8, x)
@@ -264,10 +366,12 @@
 #define	BP_GET_LEVEL(bp)	BF64_GET((bp)->blk_prop, 56, 5)
 #define	BP_SET_LEVEL(bp, x)	BF64_SET((bp)->blk_prop, 56, 5, x)
 
+#define	BP_IS_EMBEDDED(bp)	BF64_GET((bp)->blk_prop, 39, 1)
+
 #define	BP_GET_DEDUP(bp)	BF64_GET((bp)->blk_prop, 62, 1)
 #define	BP_SET_DEDUP(bp, x)	BF64_SET((bp)->blk_prop, 62, 1, x)
 
-#define	BP_GET_BYTEORDER(bp)	(0 - BF64_GET((bp)->blk_prop, 63, 1))
+#define	BP_GET_BYTEORDER(bp)	BF64_GET((bp)->blk_prop, 63, 1)
 #define	BP_SET_BYTEORDER(bp, x)	BF64_SET((bp)->blk_prop, 63, 1, x)
 
 #define	BP_PHYSICAL_BIRTH(bp)		\
@@ -286,11 +390,6 @@
 	!!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
 	!!DVA_GET_ASIZE(&(bp)->blk_dva[2]))
 
-#define	BP_COUNT_GANG(bp)	\
-	(DVA_GET_GANG(&(bp)->blk_dva[0]) + \
-	DVA_GET_GANG(&(bp)->blk_dva[1]) + \
-	DVA_GET_GANG(&(bp)->blk_dva[2]))
-
 #define	DVA_EQUAL(dva1, dva2)	\
 	((dva1)->dva_word[1] == (dva2)->dva_word[1] && \
 	(dva1)->dva_word[0] == (dva2)->dva_word[0])
@@ -314,7 +413,9 @@
 
 #define	BP_IDENTITY(bp)		(&(bp)->blk_dva[0])
 #define	BP_IS_GANG(bp)		DVA_GET_GANG(BP_IDENTITY(bp))
-#define	BP_IS_HOLE(bp)		((bp)->blk_birth == 0)
+#define	DVA_IS_EMPTY(dva)	((dva)->dva_word[0] == 0ULL &&  \
+	(dva)->dva_word[1] == 0ULL)
+#define	BP_IS_HOLE(bp)		DVA_IS_EMPTY(BP_IDENTITY(bp))
 #define	BP_IS_OLDER(bp, txg)	(!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg))
 
 #define	BP_ZERO(bp)				\
@@ -334,6 +435,11 @@
 	ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0);	\
 }
 
+#define	BPE_NUM_WORDS 14
+#define	BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof (uint64_t))
+#define	BPE_IS_PAYLOADWORD(bp, wp) \
+	((wp) != &(bp)->blk_prop && (wp) != &(bp)->blk_birth)
+
 /*
  * Embedded checksum
  */
@@ -732,7 +838,7 @@
  * Fixed constants.
  */
 #define	DNODE_SHIFT		9	/* 512 bytes */
-#define	DN_MIN_INDBLKSHIFT	10	/* 1k */
+#define	DN_MIN_INDBLKSHIFT	12	/* 4k */
 #define	DN_MAX_INDBLKSHIFT	14	/* 16k */
 #define	DNODE_BLOCK_SHIFT	14	/* 16k */
 #define	DNODE_CORE_SIZE		64	/* 64 bytes for dnode sans blkptrs */
@@ -1344,3 +1450,5 @@
 	objset_phys_t	spa_mos;	/* MOS for this pool */
 	int		spa_inited;	/* initialized */
 } spa_t;
+
+static void decode_embedded_bp_compressed(const blkptr_t *, void *);

Modified: trunk/sys/cddl/boot/zfs/zfssubr.c
===================================================================
--- trunk/sys/cddl/boot/zfs/zfssubr.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/boot/zfs/zfssubr.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -25,15 +25,17 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/boot/zfs/zfssubr.c 247309 2013-02-26 05:58:05Z delphij $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/boot/zfs/zfssubr.c 268649 2014-07-15 04:53:34Z delphij $");
 
 static uint64_t zfs_crc64_table[256];
 
 #define	ECKSUM	666
 
-#define	ASSERT(...)	do { } while (0)
-#define	ASSERT3U(...)	do { } while (0)
-#define	ASSERT3S(...)	do { } while (0)
+#define	ASSERT3S(x, y, z)	((void)0)
+#define	ASSERT3U(x, y, z)	((void)0)
+#define	ASSERT3P(x, y, z)	((void)0)
+#define	ASSERT0(x)		((void)0)
+#define	ASSERT(x)		((void)0)
 
 #define	panic(...)	do {						\
 	printf(__VA_ARGS__);						\
@@ -83,6 +85,8 @@
 	const char	*ci_name;	/* descriptive name */
 } zio_checksum_info_t;
 
+#include "blkptr.c"
+
 #include "fletcher.c"
 #include "sha256.c"
 

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright 2007 John Birrell <jb at FreeBSD.org>
  *
@@ -22,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris.c 222670 2011-06-04 07:02:06Z avg $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris.c 222670 2011-06-04 07:02:06Z avg $
  *
  */
 

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c 216084 2010-11-30 21:04:05Z trasz $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c 290893 2015-11-15 23:54:34Z ngie $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -64,6 +65,8 @@
 			    ACL_ENTRY_NO_PROPAGATE_INHERIT},
 			{ACE_INHERIT_ONLY_ACE,
 			    ACL_ENTRY_INHERIT_ONLY},
+			{ACE_INHERITED_ACE,
+			    ACL_ENTRY_INHERITED},
 			{ACE_SUCCESSFUL_ACCESS_ACE_FLAG,
 			    ACL_ENTRY_SUCCESSFUL_ACCESS},
 			{ACE_FAILED_ACCESS_ACE_FLAG,

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c 219089 2011-02-27 19:41:40Z pjd $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c 269798 2014-08-11 02:20:24Z ian $");
 
 #include <sys/param.h>
 #include <sys/lock.h>
@@ -52,7 +53,7 @@
 }
 #endif
 
-#if !defined(__LP64__) && !defined(__mips_n32)
+#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64)
 void
 atomic_add_64(volatile uint64_t *target, int64_t delta)
 {

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -18,7 +19,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c 252460 2013-07-01 08:24:14Z smh $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c 252392 2013-06-29 23:39:38Z smh $
  */
 /*
  * Copyright 2007 John Birrell <jb at FreeBSD.org>. All rights reserved.

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006-2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c 219089 2011-02-27 19:41:40Z pjd $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c 272875 2014-10-10 00:12:16Z smh $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -62,6 +63,8 @@
 MTX_SYSINIT(kmem_items_mtx, &kmem_items_mtx, "kmem_items", MTX_DEF);
 #endif	/* KMEM_DEBUG */
 
+#include <sys/vmem.h>
+
 void *
 zfs_kmem_alloc(size_t size, int kmflags)
 {
@@ -131,13 +134,6 @@
 	return (kmem_size_val);
 }
 
-uint64_t
-kmem_used(void)
-{
-
-	return (kmem_map->size);
-}
-
 static int
 kmem_std_constructor(void *mem, int size __unused, void *private, int flags)
 {

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c 218665 2011-02-13 19:46:55Z marcel $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c 241896 2012-10-22 17:50:54Z kib $");
 
 #include <sys/types.h>
 #include <sys/systm.h>
@@ -69,7 +70,7 @@
 	struct thread *td = curthread;
 	struct filedesc *fd;
 	struct nameidata nd;
-	int error, flags, vfslocked;
+	int error, flags;
 
 	fd = td->td_proc->p_fd;
 	FILEDESC_XLOCK(fd);
@@ -84,15 +85,13 @@
 	FILEDESC_XUNLOCK(fd);
 
 	flags = FREAD | O_NOFOLLOW;
-	NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
+	NDINIT(&nd, LOOKUP, 0, UIO_SYSSPACE, file, td);
 	error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL);
 	if (error != 0)
 		return (NULL);
-	vfslocked = NDHASGIANT(&nd);
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 	/* We just unlock so we hold a reference. */
 	VOP_UNLOCK(nd.ni_vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (nd.ni_vp);
 }
 
@@ -130,15 +129,13 @@
 {
 	struct vnode *vp = file->ptr;
 	struct vattr va;
-	int error, vfslocked;
+	int error;
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	vn_lock(vp, LK_SHARED | LK_RETRY);
 	error = VOP_GETATTR(vp, &va, curthread->td_ucred);
 	VOP_UNLOCK(vp, 0);
 	if (error == 0)
 		*size = (uint64_t)va.va_size;
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error);
 }
 
@@ -171,7 +168,7 @@
 	struct thread *td = curthread;
 	struct uio auio;
 	struct iovec aiov;
-	int error, vfslocked;
+	int error;
 
 	bzero(&aiov, sizeof(aiov));
 	bzero(&auio, sizeof(auio));
@@ -187,11 +184,9 @@
 	auio.uio_resid = size;
 	auio.uio_td = td;
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	vn_lock(vp, LK_SHARED | LK_RETRY);
 	error = VOP_READ(vp, &auio, IO_UNIT | IO_SYNC, td->td_ucred);
 	VOP_UNLOCK(vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error != 0 ? -1 : size - auio.uio_resid);
 }
 
@@ -221,14 +216,7 @@
 kobj_close_file(struct _buf *file)
 {
 
-	if (file->mounted) {
-		struct vnode *vp = file->ptr;
-		struct thread *td = curthread;
-		int vfslocked;
-
-		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
-		vn_close(vp, FREAD, td->td_ucred, td);
-		VFS_UNLOCK_GIANT(vfslocked);
-	}
+	if (file->mounted)
+		vn_close(file->ptr, FREAD, curthread->td_ucred, curthread);
 	kmem_free(file, sizeof(*file));
 }

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c 251419 2013-06-05 13:03:47Z smh $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c 244155 2012-12-12 16:14:14Z smh $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c 243484 2012-11-24 12:42:29Z avg $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c 315844 2017-03-23 08:16:29Z avg $");
  
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -54,7 +55,7 @@
 	vref(startvp);
 	ltype = VOP_ISLOCKED(startvp);
 	VOP_UNLOCK(startvp, 0);
-	NDINIT_ATVP(&nd, LOOKUP, LOCKLEAF | MPSAFE | follow, seg, dirname,
+	NDINIT_ATVP(&nd, LOOKUP, LOCKLEAF | follow, seg, dirname,
 	    startvp, curthread);
 	error = namei(&nd);
 	*compvpp = nd.ni_vp;
@@ -62,54 +63,3 @@
 	vn_lock(startvp, ltype | LK_RETRY);
 	return (error);
 }
-
-int
-traverse(vnode_t **cvpp, int lktype)
-{
-	vnode_t *cvp;
-	vnode_t *tvp;
-	vfs_t *vfsp;
-	int error;
-
-	cvp = *cvpp;
-	tvp = NULL;
-
-	/*
-	 * If this vnode is mounted on, then we transparently indirect
-	 * to the vnode which is the root of the mounted file system.
-	 * Before we do this we must check that an unmount is not in
-	 * progress on this vnode.
-	 */
-
-	for (;;) {
-		/*
-		 * Reached the end of the mount chain?
-		 */
-		vfsp = vn_mountedvfs(cvp);
-		if (vfsp == NULL)
-			break;
-		error = vfs_busy(vfsp, 0);
-		/*
-		 * tvp is NULL for *cvpp vnode, which we can't unlock.
-		 */
-		if (tvp != NULL)
-			vput(cvp);
-		else
-			vrele(cvp);
-		if (error)
-			return (error);
-
-		/*
-		 * The read lock must be held across the call to VFS_ROOT() to
-		 * prevent a concurrent unmount from destroying the vfs.
-		 */
-		error = VFS_ROOT(vfsp, lktype, &tvp);
-		vfs_unbusy(vfsp);
-		if (error != 0)
-			return (error);
-		cvp = tvp;
-	}
-
-	*cvpp = cvp;
-	return (0);
-}

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c 219089 2011-02-27 19:41:40Z pjd $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c 219089 2011-02-27 19:41:40Z pjd $");
 
 #include <sys/param.h>
 #include <sys/jail.h>

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c 219089 2011-02-27 19:41:40Z pjd $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c 219089 2011-02-27 19:41:40Z pjd $");
 
 #include <sys/param.h>
 #include <sys/priv.h>

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_string.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_string.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_string.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -18,7 +19,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_string.c 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_string.c 219089 2011-02-27 19:41:40Z pjd $
  */
 /*
  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2010 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c 219092 2011-02-28 05:45:31Z pjd $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c 324745 2017-10-19 07:21:45Z avg $");
 
 #include <sys/param.h>
 #include <sys/jail.h>
@@ -41,10 +42,6 @@
 {
 
 	*result = strtol(str, nptr, base);
-	if (*result == 0)
-		return (EINVAL);
-	else if (*result == LONG_MIN || *result == LONG_MAX)
-		return (ERANGE);
 	return (0);
 }
 
@@ -58,10 +55,6 @@
 	}
 
 	*result = strtoul(str, nptr, base);
-	if (*result == 0)
-		return (EINVAL);
-	else if (*result == ULONG_MAX)
-		return (ERANGE);
 	return (0);
 }
 
@@ -70,10 +63,6 @@
 {
 
 	*result = (unsigned long long)strtouq(str, nptr, base);
-	if (*result == 0)
-		return (EINVAL);
-	else if (*result == ULLONG_MAX)
-		return (ERANGE);
 	return (0);
 }
 

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_sysevent.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_sysevent.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_sysevent.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2010 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_sysevent.c 222343 2011-05-27 08:34:31Z pjd $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_sysevent.c 222343 2011-05-27 08:34:31Z pjd $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2009 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c 222267 2011-05-24 20:07:15Z pjd $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c 262070 2014-02-17 15:38:10Z avg $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -46,7 +47,7 @@
 system_taskq_init(void *arg)
 {
 
-	taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask),
+	taskq_zone = uma_zcreate("taskq_zone", sizeof(taskq_ent_t),
 	    NULL, NULL, NULL, NULL, 0, 0);
 	system_taskq = taskq_create("system_taskq", mp_ncpus, 0, 0, 0, 0);
 }
@@ -104,9 +105,9 @@
 static void
 taskq_run(void *arg, int pending __unused)
 {
-	struct ostask *task = arg;
+	taskq_ent_t *task = arg;
 
-	task->ost_func(task->ost_arg);
+	task->tqent_func(task->tqent_arg);
 
 	uma_zfree(taskq_zone, task);
 }
@@ -114,7 +115,7 @@
 taskqid_t
 taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
 {
-	struct ostask *task;
+	taskq_ent_t *task;
 	int mflag, prio;
 
 	if ((flags & (TQ_SLEEP | TQ_NOQUEUE)) == TQ_SLEEP)
@@ -121,7 +122,7 @@
 		mflag = M_WAITOK;
 	else
 		mflag = M_NOWAIT;
-	/* 
+	/*
 	 * If TQ_FRONT is given, we want higher priority for this task, so it
 	 * can go at the front of the queue.
 	 */
@@ -131,42 +132,44 @@
 	if (task == NULL)
 		return (0);
 
-	task->ost_func = func;
-	task->ost_arg = arg;
+	task->tqent_func = func;
+	task->tqent_arg = arg;
 
-	TASK_INIT(&task->ost_task, prio, taskq_run, task);
-	taskqueue_enqueue(tq->tq_queue, &task->ost_task);
+	TASK_INIT(&task->tqent_task, prio, taskq_run, task);
+	taskqueue_enqueue(tq->tq_queue, &task->tqent_task);
 
 	return ((taskqid_t)(void *)task);
 }
 
-#define	TASKQ_MAGIC	0x74541c
-
 static void
-taskq_run_safe(void *arg, int pending __unused)
+taskq_run_ent(void *arg, int pending __unused)
 {
-	struct ostask *task = arg;
+	taskq_ent_t *task = arg;
 
-	task->ost_func(task->ost_arg);
+	task->tqent_func(task->tqent_arg);
 }
 
-taskqid_t
-taskq_dispatch_safe(taskq_t *tq, task_func_t func, void *arg, u_int flags,
-    struct ostask *task)
+void
+taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, u_int flags,
+    taskq_ent_t *task)
 {
 	int prio;
 
-	/* 
+	/*
 	 * If TQ_FRONT is given, we want higher priority for this task, so it
 	 * can go at the front of the queue.
 	 */
 	prio = !!(flags & TQ_FRONT);
 
-	task->ost_func = func;
-	task->ost_arg = arg;
+	task->tqent_func = func;
+	task->tqent_arg = arg;
 
-	TASK_INIT(&task->ost_task, prio, taskq_run_safe, task);
-	taskqueue_enqueue(tq->tq_queue, &task->ost_task);
+	TASK_INIT(&task->tqent_task, prio, taskq_run_ent, task);
+	taskqueue_enqueue(tq->tq_queue, &task->tqent_task);
+}
 
-	return ((taskqid_t)(void *)task);
+void
+taskq_wait(taskq_t *tq)
+{
+	taskqueue_drain_all(tq->tq_queue);
 }

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -37,11 +38,12 @@
  */
 
 /*
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c 209962 2010-07-12 23:49:04Z mm $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c 326426 2017-12-01 11:11:25Z avg $
  */
 
 #include <sys/types.h>
 #include <sys/uio.h>
+#include <sys/vnode.h>
 
 /*
  * same as uiomove() but doesn't modify uio structure.
@@ -50,40 +52,26 @@
 int
 uiocopy(void *p, size_t n, enum uio_rw rw, struct uio *uio, size_t *cbytes)
 {
-	struct iovec *iov;
-	ulong_t cnt;
-	int error, iovcnt;
+	struct iovec small_iovec[1];
+	struct uio small_uio_clone;
+	struct uio *uio_clone;
+	int error;
 
-	iovcnt = uio->uio_iovcnt;
-	*cbytes = 0;
+	ASSERT3U(uio->uio_rw, ==, rw);
+	if (uio->uio_iovcnt == 1) {
+		small_uio_clone = *uio;
+		small_iovec[0] = *uio->uio_iov;
+		small_uio_clone.uio_iov = small_iovec;
+		uio_clone = &small_uio_clone;
+	} else {
+		uio_clone = cloneuio(uio);
+	}
 
-	for (iov = uio->uio_iov; n > 0 && iovcnt > 0; iov++, iovcnt--) {
-		cnt = MIN(iov->iov_len, n);
-		if (cnt == 0)
-			continue;
-
-		switch (uio->uio_segflg) {
-		case UIO_USERSPACE:
-			if (rw == UIO_READ)
-				error = copyout(p, iov->iov_base, cnt);
-			else
-				error = copyin(iov->iov_base, p, cnt);
-			if (error)
-				return (error);
-			break;
-		case UIO_SYSSPACE:
-			if (uio->uio_rw == UIO_READ)
-				bcopy(p, iov->iov_base, cnt);
-			else
-				bcopy(iov->iov_base, p, cnt);
-			break;
-		}
-
-		p = (caddr_t)p + cnt;
-		n -= cnt;
-		*cbytes += cnt;
-	}
-	return (0);
+	error = vn_io_fault_uiomove(p, n, uio_clone);
+	*cbytes = uio->uio_resid - uio_clone->uio_resid;
+	if (uio_clone != &small_uio_clone)
+		free(uio_clone, M_IOV);
+	return (error);
 }
 
 /*
@@ -90,23 +78,16 @@
  * Drop the next n chars out of *uiop.
  */
 void
-uioskip(uio_t *uiop, size_t n)
+uioskip(uio_t *uio, size_t n)
 {
-	if (n > uiop->uio_resid)
+	enum uio_seg segflg;
+
+	/* For the full compatibility with illumos. */
+	if (n > uio->uio_resid)
 		return;
-	while (n != 0) {
-		register iovec_t	*iovp = uiop->uio_iov;
-		register size_t		niovb = MIN(iovp->iov_len, n);
 
-		if (niovb == 0) {
-			uiop->uio_iov++;
-			uiop->uio_iovcnt--;
-			continue;
-		}
-		iovp->iov_base += niovb;
-		uiop->uio_loffset += niovb;
-		iovp->iov_len -= niovb;
-		uiop->uio_resid -= niovb;
-		n -= niovb;
-	}
+	segflg = uio->uio_segflg;
+	uio->uio_segflg = UIO_NOCOPY;
+	uiomove(NULL, n, uio->uio_rw, uio);
+	uio->uio_segflg = segflg;
 }

Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006-2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c 243491 2012-11-24 12:56:07Z avg $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c 324295 2017-10-05 07:16:31Z avg $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -121,6 +122,12 @@
 	struct ucred *cr;
 	int error;
 
+	ASSERT_VOP_ELOCKED(*vpp, "mount_snapshot");
+
+	vp = *vpp;
+	*vpp = NULL;
+	error = 0;
+
 	/*
 	 * Be ultra-paranoid about making sure the type and fspath
 	 * variables will fit in our mp buffers, including the
@@ -127,28 +134,27 @@
 	 * terminating NUL.
 	 */
 	if (strlen(fstype) >= MFSNAMELEN || strlen(fspath) >= MNAMELEN)
-		return (ENAMETOOLONG);
-
-	vfsp = vfs_byname_kld(fstype, td, &error);
-	if (vfsp == NULL)
-		return (ENODEV);
-
-	vp = *vpp;
-	if (vp->v_type != VDIR)
-		return (ENOTDIR);
+		error = ENAMETOOLONG;
+	if (error == 0 && (vfsp = vfs_byname_kld(fstype, td, &error)) == NULL)
+		error = ENODEV;
+	if (error == 0 && vp->v_type != VDIR)
+		error = ENOTDIR;
 	/*
 	 * We need vnode lock to protect v_mountedhere and vnode interlock
 	 * to protect v_iflag.
 	 */
-	vn_lock(vp, LK_SHARED | LK_RETRY);
-	VI_LOCK(vp);
-	if ((vp->v_iflag & VI_MOUNT) != 0 || vp->v_mountedhere != NULL) {
+	if (error == 0) {
+		VI_LOCK(vp);
+		if ((vp->v_iflag & VI_MOUNT) == 0 && vp->v_mountedhere == NULL)
+			vp->v_iflag |= VI_MOUNT;
+		else
+			error = EBUSY;
 		VI_UNLOCK(vp);
-		VOP_UNLOCK(vp, 0);
-		return (EBUSY);
 	}
-	vp->v_iflag |= VI_MOUNT;
-	VI_UNLOCK(vp);
+	if (error != 0) {
+		vput(vp);
+		return (error);
+	}
 	VOP_UNLOCK(vp, 0);
 
 	/*
@@ -191,13 +197,21 @@
 	td->td_ucred = cr;
 
 	if (error != 0) {
+		/*
+		 * Clear VI_MOUNT and decrement the use count "atomically",
+		 * under the vnode lock.  This is not strictly required,
+		 * but makes it easier to reason about the life-cycle and
+		 * ownership of the covered vnode.
+		 */
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		VI_LOCK(vp);
 		vp->v_iflag &= ~VI_MOUNT;
 		VI_UNLOCK(vp);
-		vrele(vp);
+		vput(vp);
 		vfs_unbusy(mp);
+		vfs_freeopts(mp->mnt_optnew);
+		mp->mnt_vnodecovered = NULL;
 		vfs_mount_destroy(mp);
-		*vpp = NULL;
 		return (error);
 	}
 
@@ -228,7 +242,7 @@
 	vfs_event_signal(NULL, VQ_MOUNT, 0);
 	if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp))
 		panic("mount: lost mount");
-	vput(vp);
+	VOP_UNLOCK(vp, 0);
 	vfs_unbusy(mp);
 	*vpp = mvp;
 	return (0);

Added: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c	                        (rev 0)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -0,0 +1,71 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 EMC Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c 260786 2014-01-16 18:15:59Z avg $");
+
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/freebsd_rwlock.h>
+
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/vm_object.h>
+#include <vm/vm_page.h>
+#include <vm/vm_pager.h>
+
+const int zfs_vm_pagerret_bad = VM_PAGER_BAD;
+const int zfs_vm_pagerret_error = VM_PAGER_ERROR;
+const int zfs_vm_pagerret_ok = VM_PAGER_OK;
+const int zfs_vm_pagerput_sync = VM_PAGER_PUT_SYNC;
+const int zfs_vm_pagerput_inval = VM_PAGER_PUT_INVAL;
+
+void
+zfs_vmobject_assert_wlocked(vm_object_t object)
+{
+
+	/*
+	 * This is not ideal because FILE/LINE used by assertions will not
+	 * be too helpful, but it must be an hard function for
+	 * compatibility reasons.
+	 */
+	VM_OBJECT_ASSERT_WLOCKED(object);
+}
+
+void
+zfs_vmobject_wlock(vm_object_t object)
+{
+
+	VM_OBJECT_WLOCK(object);
+}
+
+void
+zfs_vmobject_wunlock(vm_object_t object)
+{
+
+	VM_OBJECT_WUNLOCK(object);
+}


Property changes on: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c
===================================================================
--- trunk/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c 219089 2011-02-27 19:41:40Z pjd $");
+__FBSDID("$FreeBSD: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c 219089 2011-02-27 19:41:40Z pjd $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>

Modified: trunk/sys/cddl/compat/opensolaris/rpc/xdr.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/rpc/xdr.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/rpc/xdr.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape

Modified: trunk/sys/cddl/compat/opensolaris/sys/acl.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/acl.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/acl.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/acl.h 192804 2009-05-26 11:42:06Z trasz $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/acl.h 192804 2009-05-26 11:42:06Z trasz $
  */
 
 #ifndef OPENSOLARIS_SYS_ACL_H

Modified: trunk/sys/cddl/compat/opensolaris/sys/assfail.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/assfail.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/assfail.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2012 Martin Matuska <mm at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/assfail.h 243674 2012-11-29 14:05:04Z mm $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/assfail.h 274623 2014-11-17 13:26:50Z avg $
  */
 
 #ifndef _OPENSOLARIS_SYS_ASSFAIL_H_
@@ -46,6 +47,8 @@
 #else	/* !defined(_KERNEL) */
 
 #ifndef HAVE_ASSFAIL
+extern int aok;
+
 static __inline int
 __assfail(const char *expr, const char *file, int line)
 {
@@ -52,8 +55,8 @@
 
 	(void)fprintf(stderr, "Assertion failed: (%s), file %s, line %d.\n",
 	    expr, file, line);
-	abort();
-	/* NOTREACHED */
+	if (!aok)
+		abort();
 	return (0);
 }
 #define assfail __assfail
@@ -60,6 +63,8 @@
 #endif
 
 #ifndef HAVE_ASSFAIL3
+extern int aok;
+
 static __inline void
 __assfail3(const char *expr, uintmax_t lv, const char *op, uintmax_t rv,
     const char *file, int line) {
@@ -67,8 +72,8 @@
 	(void)fprintf(stderr,
 	    "Assertion failed: %s (0x%jx %s 0x%jx), file %s, line %d.\n",
 	    expr, lv, op, rv, file, line);
-        abort();
-        /* NOTREACHED */
+	if (!aok)
+		abort();
 }
 #define assfail3 __assfail3
 #endif

Modified: trunk/sys/cddl/compat/opensolaris/sys/atomic.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/atomic.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/atomic.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/atomic.h 222757 2011-06-06 14:46:43Z mm $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/atomic.h 271003 2014-09-03 08:24:11Z delphij $
  */
 
 #ifndef _OPENSOLARIS_SYS_ATOMIC_H_
@@ -36,7 +37,7 @@
 	atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr_t) (_c))
 #define cas32	atomic_cmpset_32
 
-#if !defined(__LP64__) && !defined(__mips_n32)
+#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64)
 extern void atomic_add_64(volatile uint64_t *target, int64_t delta);
 extern void atomic_dec_64(volatile uint64_t *target);
 #endif
@@ -85,7 +86,7 @@
 	return (atomic_fetchadd_32(target, -1) - 1);
 }
 
-#if defined(__LP64__) || defined(__mips_n32)
+#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64)
 static __inline void
 atomic_dec_64(volatile uint64_t *target)
 {
@@ -117,6 +118,12 @@
 	return (atomic_add_64_nv(target, 1));
 }
 
+static __inline uint64_t
+atomic_dec_64_nv(volatile uint64_t *target)
+{
+	return (atomic_add_64_nv(target, -1));
+}
+
 #if !defined(COMPAT_32BIT) && defined(__LP64__)
 static __inline void *
 atomic_cas_ptr(volatile void *target, void *cmp,  void *newval)

Modified: trunk/sys/cddl/compat/opensolaris/sys/bitmap.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/bitmap.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/bitmap.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -18,7 +19,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/bitmap.h 178414 2008-04-22 07:43:00Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/bitmap.h 178414 2008-04-22 07:43:00Z jb $
  */
 
 /*

Modified: trunk/sys/cddl/compat/opensolaris/sys/byteorder.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/byteorder.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/byteorder.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -18,7 +19,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/byteorder.h 247309 2013-02-26 05:58:05Z delphij $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/byteorder.h 246586 2013-02-09 06:39:28Z delphij $
  */
 
 /*

Added: trunk/sys/cddl/compat/opensolaris/sys/callo.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/callo.h	                        (rev 0)
+++ trunk/sys/cddl/compat/opensolaris/sys/callo.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -0,0 +1,38 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2016 Alexander Motin <mav at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/callo.h 297108 2016-03-21 00:13:39Z mav $
+ */
+
+#ifndef _OPENSOLARIS_SYS_CALLO_H_
+#define	_OPENSOLARIS_SYS_CALLO_H_
+
+#include_next <sys/callout.h>
+
+#define	CALLOUT_REALTIME	0		/* realtime callout type */
+#define	CALLOUT_NORMAL		1		/* normal callout type */
+
+#endif	/* !_OPENSOLARIS_SYS_CALLO_H_ */


Property changes on: trunk/sys/cddl/compat/opensolaris/sys/callo.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/cddl/compat/opensolaris/sys/cmn_err.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/cmn_err.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/cmn_err.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/cmn_err.h 179202 2008-05-22 08:33:24Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/cmn_err.h 179202 2008-05-22 08:33:24Z jb $
  */
 
 #ifndef _OPENSOLARIS_SYS_CMN_ERR_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/cpupart.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/cpupart.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/cpupart.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -18,7 +19,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/cpupart.h 178414 2008-04-22 07:43:00Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/cpupart.h 178414 2008-04-22 07:43:00Z jb $
  */
 
 /*

Modified: trunk/sys/cddl/compat/opensolaris/sys/cpuvar.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/cpuvar.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/cpuvar.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -18,7 +19,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/cpuvar.h 182448 2008-08-29 15:55:49Z scottl $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/cpuvar.h 282748 2015-05-11 07:54:39Z avg $
  */
 
 /*
@@ -38,11 +39,8 @@
 
 typedef struct {
 	int		cpuid;
-        struct cyc_cpu *cpu_cyclic;
 	uint32_t	cpu_flags;
 	uint_t		cpu_intr_actv;
-	uintptr_t	cpu_profile_pc;
-	uintptr_t	cpu_profile_upc;
 	uintptr_t	cpu_dtrace_caller;	/* DTrace: caller, if any */
 	hrtime_t	cpu_dtrace_chillmark;	/* DTrace: chill mark time */
 	hrtime_t	cpu_dtrace_chilled;	/* DTrace: total chill time */

Modified: trunk/sys/cddl/compat/opensolaris/sys/cpuvar_defs.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/cpuvar_defs.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/cpuvar_defs.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/sys/cddl/compat/opensolaris/sys/cred.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/cred.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/cred.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/cred.h 249643 2013-04-19 09:19:10Z mm $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/cred.h 248571 2013-03-21 08:38:03Z mm $
  */
 
 #ifndef _OPENSOLARIS_SYS_CRED_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/cyclic.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/cyclic.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/cyclic.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/sys/cddl/compat/opensolaris/sys/cyclic_impl.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/cyclic_impl.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/cyclic_impl.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *

Modified: trunk/sys/cddl/compat/opensolaris/sys/debug.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/debug.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/debug.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/debug.h 243674 2012-11-29 14:05:04Z mm $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/debug.h 240415 2012-09-12 18:05:43Z mm $
  */
 
 #ifndef _OPENSOLARIS_SYS_DEBUG_H_

Added: trunk/sys/cddl/compat/opensolaris/sys/debug_compat.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/debug_compat.h	                        (rev 0)
+++ trunk/sys/cddl/compat/opensolaris/sys/debug_compat.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -0,0 +1,38 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Andriy Gapon <avg at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/debug_compat.h 253996 2013-08-06 15:51:56Z avg $
+ */
+
+/*
+ * This is a special file that SHOULD NOT be included using #include directive.
+ */
+
+#if defined(INVARIANTS)
+#ifndef DEBUG
+#define DEBUG
+#endif
+#endif


Property changes on: trunk/sys/cddl/compat/opensolaris/sys/debug_compat.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/cddl/compat/opensolaris/sys/dirent.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/dirent.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/dirent.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/dirent.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/dirent.h 219089 2011-02-27 19:41:40Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_DIRENT_H_

Added: trunk/sys/cddl/compat/opensolaris/sys/disp.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/disp.h	                        (rev 0)
+++ trunk/sys/cddl/compat/opensolaris/sys/disp.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -0,0 +1,41 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Andriy Gapon
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/disp.h 260763 2014-01-16 15:57:39Z avg $
+ */
+
+#ifndef _OPENSOLARIS_SYS_DISP_H_
+#define	_OPENSOLARIS_SYS_DISP_H_
+
+#ifdef _KERNEL
+
+#include <sys/proc.h>
+
+#define	kpreempt(x)	kern_yield(PRI_USER)
+
+#endif	/* _KERNEL */
+
+#endif	/* _OPENSOLARIS_SYS_DISP_H_ */


Property changes on: trunk/sys/cddl/compat/opensolaris/sys/disp.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/cddl/compat/opensolaris/sys/dkio.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/dkio.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/dkio.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -18,7 +19,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/dkio.h 251419 2013-06-05 13:03:47Z smh $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/dkio.h 270312 2014-08-21 22:44:08Z smh $
  */
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
@@ -75,8 +76,6 @@
  */
 #define	DKIOCFLUSHWRITECACHE	(DKIOC|34)	/* flush cache to phys medium */
 
-#define	DKIOCTRIM		(DKIOC|35)	/* TRIM a block */
-
 struct dk_callback {
 	void (*dkc_callback)(void *dkc_cookie, int error);
 	void *dkc_cookie;

Modified: trunk/sys/cddl/compat/opensolaris/sys/dnlc.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/dnlc.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/dnlc.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/dnlc.h 207937 2010-05-11 22:46:36Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/dnlc.h 207937 2010-05-11 22:46:36Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_DNLC_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/elf.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/elf.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/elf.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -18,7 +19,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/elf.h 177698 2008-03-28 22:16:18Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/elf.h 177698 2008-03-28 22:16:18Z jb $
  *
  * ELF compatibility definitions for OpenSolaris source.
  *

Modified: trunk/sys/cddl/compat/opensolaris/sys/feature_tests.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/feature_tests.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/feature_tests.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (C) 2007 John Birrell <jb at freebsd.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/feature_tests.h 179204 2008-05-22 09:08:41Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/feature_tests.h 179204 2008-05-22 09:08:41Z jb $
  *
  */
 

Modified: trunk/sys/cddl/compat/opensolaris/sys/file.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/file.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/file.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/file.h 224778 2011-08-11 12:30:23Z rwatson $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/file.h 280258 2015-03-19 13:37:36Z rwatson $
  */
 
 #ifndef _OPENSOLARIS_SYS_FILE_H_
@@ -36,18 +37,14 @@
 #ifdef _KERNEL
 typedef	struct file	file_t;
 
-#include <sys/capability.h>
+#include <sys/capsicum.h>
 
 static __inline file_t *
-getf(int fd)
+getf(int fd, cap_rights_t *rightsp)
 {
 	struct file *fp;
 
-	/*
-	 * We wouldn't need all of these rights on every invocation
-	 * if we had more information about intent.
-	 */
-	if (fget(curthread, fd, CAP_READ | CAP_WRITE | CAP_SEEK, &fp) == 0)
+	if (fget(curthread, fd, rightsp, &fp) == 0)
 		return (fp);
 	return (NULL);
 }
@@ -58,7 +55,7 @@
 	struct file *fp;
 
 	/* No CAP_ rights required, as we're only releasing. */
-	if (fget(curthread, fd, 0, &fp) == 0) {
+	if (fget(curthread, fd, NULL, &fp) == 0) {
 		fdrop(fp, curthread);
 		fdrop(fp, curthread);
 	}

Modified: trunk/sys/cddl/compat/opensolaris/sys/kcondvar.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/kcondvar.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/kcondvar.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,5 +1,7 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
+ * Copyright (c) 2013 iXsystems, Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/kcondvar.h 177698 2008-03-28 22:16:18Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/kcondvar.h 255437 2013-09-10 01:46:47Z delphij $
  */
 
 #ifndef _OPENSOLARIS_SYS_CONDVAR_H_
@@ -36,6 +38,7 @@
 
 #include <sys/mutex.h>
 #include <sys/condvar.h>
+#include <sys/time.h>
 
 typedef struct cv	kcondvar_t;
 
@@ -55,8 +58,21 @@
 		_name = #cv;						\
 	cv_init((cv), _name);						\
 } while (0)
-#define	cv_init(cv, name, type, arg)	zfs_cv_init((cv), (name), (type), (arg))
+#define	cv_init(cv, name, type, arg)	zfs_cv_init(cv, name, type, arg)
 
+static clock_t
+cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,
+    int flag)
+{
+	sbintime_t sbt;
+	sbintime_t pr;
+
+	sbt = tim * SBT_1NS;
+	pr = res * SBT_1NS;
+
+	return (cv_timedwait_sbt(cvp, mp, sbt, pr, 0));
+}
+
 #endif	/* _KERNEL */
 
 #endif	/* _OPENSOLARIS_SYS_CONDVAR_H_ */

Modified: trunk/sys/cddl/compat/opensolaris/sys/kidmap.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/kidmap.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/kidmap.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/kidmap.h 185029 2008-11-17 20:49:29Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/kidmap.h 185029 2008-11-17 20:49:29Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_KIDMAP_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/kmem.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/kmem.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/kmem.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/kmem.h 246533 2013-02-08 07:59:13Z avg $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/kmem.h 272875 2014-10-10 00:12:16Z smh $
  */
 
 #ifndef _OPENSOLARIS_SYS_KMEM_H_
@@ -32,6 +33,7 @@
 #include <sys/param.h>
 #include <sys/proc.h>
 #include <sys/malloc.h>
+#include <sys/vmem.h>
 
 #include <vm/uma.h>
 #include <vm/vm.h>
@@ -46,8 +48,9 @@
 #define	KM_PUSHPAGE		M_WAITOK
 #define	KM_NOSLEEP		M_NOWAIT
 #define	KM_NODEBUG		M_NODUMP
+#define	KM_NORMALPRI		0
+#define	KMC_NODEBUG		UMA_ZONE_NODUMP
 #define	KMC_NOTOUCH		0
-#define	KMC_NODEBUG		UMA_ZONE_NODUMP
 
 typedef struct kmem_cache {
 	char		kc_name[32];
@@ -61,12 +64,9 @@
 	void		*kc_private;
 } kmem_cache_t;
 
-#define vmem_t	void
-
 void *zfs_kmem_alloc(size_t size, int kmflags);
 void zfs_kmem_free(void *buf, size_t size);
 uint64_t kmem_size(void);
-uint64_t kmem_used(void);
 kmem_cache_t *kmem_cache_create(char *name, size_t bufsize, size_t align,
     int (*constructor)(void *, void *, int), void (*destructor)(void *, void *),
     void (*reclaim)(void *) __unused, void *private, vmem_t *vmp, int cflags);
@@ -78,6 +78,9 @@
 int kmem_debugging(void);
 void *calloc(size_t n, size_t s);
 
+#define	freemem				(cnt.v_free_count + cnt.v_cache_count)
+#define	minfree				cnt.v_free_min
+#define	heap_arena			kmem_arena
 #define	kmem_alloc(size, kmflags)	zfs_kmem_alloc((size), (kmflags))
 #define	kmem_zalloc(size, kmflags)	zfs_kmem_alloc((size), (kmflags) | M_ZERO)
 #define	kmem_free(buf, size)		zfs_kmem_free((buf), (size))

Modified: trunk/sys/cddl/compat/opensolaris/sys/kobj.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/kobj.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/kobj.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/kobj.h 177698 2008-03-28 22:16:18Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/kobj.h 177698 2008-03-28 22:16:18Z jb $
  */
 
 #ifndef _OPENSOLARIS_SYS_KOBJ_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/kstat.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/kstat.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/kstat.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/kstat.h 251419 2013-06-05 13:03:47Z smh $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/kstat.h 288551 2015-10-03 07:31:42Z mav $
  */
 
 #ifndef _OPENSOLARIS_SYS_KSTAT_H_
@@ -35,6 +36,9 @@
 
 #define	KSTAT_FLAG_VIRTUAL	0x01
 
+#define	KSTAT_READ	0
+#define	KSTAT_WRITE	1
+
 typedef struct kstat {
 	void	*ks_data;
 	u_int	 ks_ndata;
@@ -42,6 +46,8 @@
 	struct sysctl_ctx_list ks_sysctl_ctx;
 	struct sysctl_oid *ks_sysctl_root;
 #endif
+	int		(*ks_update)(struct kstat *, int); /* dynamic update */
+	void		*ks_private;	/* arbitrary provider-private data */
 } kstat_t;
 
 typedef struct kstat_named {

Modified: trunk/sys/cddl/compat/opensolaris/sys/lock.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/lock.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/lock.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/lock.h 179035 2008-05-16 02:09:13Z attilio $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/lock.h 179035 2008-05-16 02:09:13Z attilio $
  */
 
 #ifndef _OPENSOLARIS_SYS_LOCK_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/misc.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/misc.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/misc.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/misc.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/misc.h 219089 2011-02-27 19:41:40Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_MISC_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/mman.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/mman.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/mman.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (C) 2007 John Birrell <jb at freebsd.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/mman.h 177698 2008-03-28 22:16:18Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/mman.h 177698 2008-03-28 22:16:18Z jb $
  *
  */
 

Modified: trunk/sys/cddl/compat/opensolaris/sys/mntent.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/mntent.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/mntent.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -19,7 +20,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/mntent.h 185029 2008-11-17 20:49:29Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/mntent.h 326328 2017-11-28 17:33:10Z asomers $
  */
 /*
  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
@@ -46,7 +47,7 @@
 #define	MNTOPT_NODEVICES	"nodevices"	/* Device-special disallowed */
 #define	MNTOPT_SETUID	"setuid"	/* Set uid allowed */
 #define	MNTOPT_NOSETUID	"nosetuid"	/* Set uid not allowed */
-#define	MNTOPT_REMOUNT	"remount"	/* Change mount options */
+#define	MNTOPT_REMOUNT	"update"	/* Change mount options */
 #define	MNTOPT_ATIME	"atime"		/* update atime for files */
 #define	MNTOPT_NOATIME  "noatime"	/* do not update atime for files */
 #define	MNTOPT_XATTR	"xattr"		/* enable extended attributes */

Modified: trunk/sys/cddl/compat/opensolaris/sys/mnttab.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/mnttab.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/mnttab.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/mnttab.h 177698 2008-03-28 22:16:18Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/mnttab.h 177698 2008-03-28 22:16:18Z jb $
  */
 
 #ifndef _OPENSOLARIS_SYS_MNTTAB_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/modctl.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/modctl.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/modctl.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (C) 2007 John Birrell <jb at freebsd.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/modctl.h 177698 2008-03-28 22:16:18Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/modctl.h 177698 2008-03-28 22:16:18Z jb $
  *
  */
 

Modified: trunk/sys/cddl/compat/opensolaris/sys/mount.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/mount.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/mount.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/mount.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/mount.h 219089 2011-02-27 19:41:40Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_MOUNT_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/mutex.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/mutex.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/mutex.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/mutex.h 252308 2013-06-27 18:20:19Z smh $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/mutex.h 253996 2013-08-06 15:51:56Z avg $
  */
 
 #ifndef _OPENSOLARIS_SYS_MUTEX_H_
@@ -46,7 +47,7 @@
 
 typedef struct sx	kmutex_t;
 
-#ifndef DEBUG
+#ifndef OPENSOLARIS_WITNESS
 #define	MUTEX_FLAGS	(SX_DUPOK | SX_NOWITNESS)
 #else
 #define	MUTEX_FLAGS	(SX_DUPOK)

Modified: trunk/sys/cddl/compat/opensolaris/sys/objfs.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/objfs.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/objfs.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * CDDL HEADER START
  *
@@ -18,7 +19,7 @@
  *
  * CDDL HEADER END
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/objfs.h 178414 2008-04-22 07:43:00Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/objfs.h 178414 2008-04-22 07:43:00Z jb $
  */
 
 #ifndef _COMPAT_OPENSOLARIS_SYS_OBJFS_H

Modified: trunk/sys/cddl/compat/opensolaris/sys/param.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/param.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/param.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (C) 2007 John Birrell <jb at freebsd.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/param.h 185029 2008-11-17 20:49:29Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/param.h 185029 2008-11-17 20:49:29Z pjd $
  *
  */
 

Modified: trunk/sys/cddl/compat/opensolaris/sys/pathname.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/pathname.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/pathname.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/pathname.h 185029 2008-11-17 20:49:29Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/pathname.h 315844 2017-03-23 08:16:29Z avg $
  */
 
 #ifndef _OPENSOLARIS_SYS_PATHNAME_H_
@@ -34,20 +35,9 @@
 #include <sys/param.h>
 #include <sys/vnode.h>
 
-typedef struct pathname {
-	char	*pn_buf;		/* underlying storage */
-	char	*pn_path;		/* remaining pathname */
-	size_t	pn_pathlen;		/* remaining length */
-	size_t	pn_bufsize;		/* total size of pn_buf */
-} pathname_t;
-
-#define	pn_alloc(pnp)	panic("pn_alloc() called")
-#define	pn_free(pnp)	panic("pn_free() called")
-
 int lookupname(char *, enum uio_seg, enum symfollow, vnode_t **, vnode_t **);
 int lookupnameat(char *, enum uio_seg, enum symfollow, vnode_t **, vnode_t **,
     vnode_t *);
-int traverse(vnode_t **, int);
 
 #endif	/* _KERNEL */
 

Modified: trunk/sys/cddl/compat/opensolaris/sys/pcpu.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/pcpu.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/pcpu.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (C) 2007 John Birrell <jb at freebsd.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/pcpu.h 179202 2008-05-22 08:33:24Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/pcpu.h 179202 2008-05-22 08:33:24Z jb $
  *
  */
 

Modified: trunk/sys/cddl/compat/opensolaris/sys/policy.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/policy.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/policy.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- $ $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/policy.h 219089 2011-02-27 19:41:40Z pjd $
+ $ $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/policy.h 219089 2011-02-27 19:41:40Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_POLICY_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/proc.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/proc.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/proc.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/proc.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/proc.h 286843 2015-08-17 12:51:46Z ed $
  */
 
 #ifndef _OPENSOLARIS_SYS_PROC_H_
@@ -63,7 +64,7 @@
 extern struct proc *zfsproc;
 
 static __inline kthread_t *
-thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
+do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
     size_t len, proc_t *pp, int state, pri_t pri)
 {
 	kthread_t *td = NULL;
@@ -88,6 +89,8 @@
 	return (td);
 }
 
+#define	thread_create(stk, stksize, proc, arg, len, pp, state, pri) \
+	do_thread_create(stk, stksize, proc, arg, len, pp, state, pri)
 #define	thread_exit()	kthread_exit()
 
 #endif	/* _KERNEL */

Modified: trunk/sys/cddl/compat/opensolaris/sys/random.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/random.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/random.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/random.h 177698 2008-03-28 22:16:18Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/random.h 305765 2016-09-13 09:25:38Z mav $
  */
 
 #ifndef _OPENSOLARIS_SYS_RANDOM_H_
@@ -32,6 +33,6 @@
 #include_next <sys/random.h>
 
 #define	random_get_bytes(p, s)		read_random((p), (int)(s))
-#define	random_get_pseudo_bytes(p, s)	read_random((p), (int)(s))
+#define	random_get_pseudo_bytes(p, s)	arc4rand((p), (int)(s), 0)
 
 #endif	/* !_OPENSOLARIS_SYS_RANDOM_H_ */

Modified: trunk/sys/cddl/compat/opensolaris/sys/refstr.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/refstr.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/refstr.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- $ $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/refstr.h 185029 2008-11-17 20:49:29Z pjd $
+ $ $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/refstr.h 185029 2008-11-17 20:49:29Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_REFSTR_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/rwlock.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/rwlock.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/rwlock.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/rwlock.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/rwlock.h 253996 2013-08-06 15:51:56Z avg $
  */
 
 #ifndef _OPENSOLARIS_SYS_RWLOCK_H_
@@ -47,7 +48,7 @@
 
 typedef	struct sx	krwlock_t;
 
-#ifndef DEBUG
+#ifndef OPENSOLARIS_WITNESS
 #define	RW_FLAGS	(SX_DUPOK | SX_NOWITNESS)
 #else
 #define	RW_FLAGS	(SX_DUPOK)

Modified: trunk/sys/cddl/compat/opensolaris/sys/sdt.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/sdt.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/sdt.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,26 +24,26 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/sdt.h 249643 2013-04-19 09:19:10Z mm $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/sdt.h 272877 2014-10-10 00:26:00Z smh $
  */
 
 #ifndef _OPENSOLARIS_SYS_SDT_H_
 #define	_OPENSOLARIS_SYS_SDT_H_
 
+#ifdef _KERNEL
+#include <opt_kdtrace.h>
+#endif
 #include_next <sys/sdt.h>
 
-#undef	DTRACE_PROBE
-#undef	DTRACE_PROBE1
-#undef	DTRACE_PROBE2
-#undef	DTRACE_PROBE3
-#undef	DTRACE_PROBE4
+#ifdef KDTRACE_HOOKS
+SDT_PROBE_DECLARE(sdt, , , set__error);
 
-#define	DTRACE_PROBE(name)
-#define	DTRACE_PROBE1(name, type1, arg1)
-#define	DTRACE_PROBE2(name, type1, arg1, type2, arg2)
-#define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3)
-#define	DTRACE_PROBE4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4)
+#define SET_ERROR(err) \
+	((sdt_sdt___set__error->id ? \
+	(*sdt_probe_func)(sdt_sdt___set__error->id, \
+	    (uintptr_t)err, 0, 0, 0, 0) : 0), err)
+#else
+#define SET_ERROR(err) (err)
+#endif
 
-#define	SET_ERROR(err)	(err)
-
 #endif	/* _OPENSOLARIS_SYS_SDT_H_ */

Modified: trunk/sys/cddl/compat/opensolaris/sys/sema.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/sema.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/sema.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (C) 2007 John Birrell <jb at freebsd.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/sema.h 179203 2008-05-22 08:35:03Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/sema.h 179203 2008-05-22 08:35:03Z jb $
  *
  */
 

Modified: trunk/sys/cddl/compat/opensolaris/sys/sid.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/sid.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/sid.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/sid.h 240258 2012-09-09 07:38:15Z mm $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/sid.h 240162 2012-09-06 13:43:48Z mm $
  */
 
 #ifndef _OPENSOLARIS_SYS_SID_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/sig.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/sig.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/sig.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2008 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/sig.h 195702 2009-07-14 22:52:46Z kib $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/sig.h 248470 2013-03-18 17:23:58Z jhb $
  */
 
 #ifndef _OPENSOLARIS_SYS_SIG_H_
@@ -55,7 +56,7 @@
 		p = td->td_proc;
 		PROC_LOCK(p);
 		mtx_lock(&p->p_sigacts->ps_mtx);
-		sig = cursig(td, SIG_STOP_ALLOWED);
+		sig = cursig(td);
 		mtx_unlock(&p->p_sigacts->ps_mtx);
 		PROC_UNLOCK(p);
 		if (sig != 0)

Modified: trunk/sys/cddl/compat/opensolaris/sys/stat.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/stat.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/stat.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (C) 2007 John Birrell <jb at freebsd.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/stat.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/stat.h 219089 2011-02-27 19:41:40Z pjd $
  *
  */
 

Modified: trunk/sys/cddl/compat/opensolaris/sys/string.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/string.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/string.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/string.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/string.h 219089 2011-02-27 19:41:40Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_STRING_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/sunddi.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/sunddi.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/sunddi.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/sunddi.h 220447 2011-04-08 11:08:26Z mm $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/sunddi.h 220447 2011-04-08 11:08:26Z mm $
  */
 
 #ifndef _OPENSOLARIS_SYS_SUNDDI_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/systeminfo.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/systeminfo.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/systeminfo.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 #ifndef _SYS_SYSTEMINFO_H_
 #define	_SYS_SYSTEMINFO_H_
 

Modified: trunk/sys/cddl/compat/opensolaris/sys/systm.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/systm.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/systm.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/systm.h 221409 2011-05-03 20:13:27Z marius $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/systm.h 297108 2016-03-21 00:13:39Z mav $
  */
 
 #ifndef _OPENSOLARIS_SYS_SYSTM_H_
@@ -42,6 +43,9 @@
 
 #define	delay(x)	pause("soldelay", (x))
 
+#define	timeout_generic(type, fn, arg, t, r, f)			\
+    timeout(fn, arg, t / (NANOSEC/hz) + 1)
+
 #endif	/* _KERNEL */
 
 #endif	/* _OPENSOLARIS_SYS_SYSTM_H_ */

Modified: trunk/sys/cddl/compat/opensolaris/sys/taskq.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/taskq.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/taskq.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2010 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.

Modified: trunk/sys/cddl/compat/opensolaris/sys/time.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/time.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/time.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/time.h 251419 2013-06-05 13:03:47Z smh $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/time.h 297116 2016-03-21 00:22:55Z mav $
  */
 
 #ifndef _OPENSOLARIS_SYS_TIME_H_
@@ -37,6 +38,12 @@
 #define NANOSEC		1000000000
 #define TIME_MAX	LLONG_MAX
 
+#define	MSEC2NSEC(m)	((hrtime_t)(m) * (NANOSEC / MILLISEC))
+#define	NSEC2MSEC(n)	((n) / (NANOSEC / MILLISEC))
+
+#define	NSEC2SEC(n)	((n) / (NANOSEC / SEC))
+#define	SEC2NSEC(m)	((hrtime_t)(m) * (NANOSEC / SEC))
+
 typedef longlong_t	hrtime_t;
 
 #if defined(__i386__) || defined(__powerpc__)
@@ -68,20 +75,10 @@
 
 extern int nsec_per_tick;	/* nanoseconds per clock tick */
 
-static __inline int64_t
-ddi_get_lbolt64(void)
-{
+#define ddi_get_lbolt64()				\
+    (int64_t)(((getsbinuptime() >> 16) * hz) >> 16)
+#define ddi_get_lbolt()		(clock_t)ddi_get_lbolt64()
 
-	return (gethrtime() / nsec_per_tick);
-}
-
-static __inline clock_t
-ddi_get_lbolt(void)
-{
-
-	return (ddi_get_lbolt64());
-}
-
 #else
 
 static __inline hrtime_t gethrtime(void) {

Modified: trunk/sys/cddl/compat/opensolaris/sys/types.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/types.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/types.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/types.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/types.h 219089 2011-02-27 19:41:40Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_TYPES_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/uio.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/uio.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/uio.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2010 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/uio.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/uio.h 219089 2011-02-27 19:41:40Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_UIO_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/varargs.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/varargs.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/varargs.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/varargs.h 177698 2008-03-28 22:16:18Z jb $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/varargs.h 177698 2008-03-28 22:16:18Z jb $
  */
 
 #ifndef _OPENSOLARIS_SYS_VARARGS_H_

Modified: trunk/sys/cddl/compat/opensolaris/sys/vfs.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/vfs.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/vfs.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/vfs.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/vfs.h 298533 2016-04-24 08:39:55Z avg $
  */
 
 #ifndef _OPENSOLARIS_SYS_VFS_H_
@@ -54,17 +55,6 @@
 #define	VFS_NOSETUID	MNT_NOSUID
 #define	VFS_NOEXEC	MNT_NOEXEC
 
-#define	VFS_HOLD(vfsp)	do {						\
-	MNT_ILOCK(vfsp);						\
-	MNT_REF(vfsp);							\
-	MNT_IUNLOCK(vfsp);						\
-} while (0)
-#define	VFS_RELE(vfsp)	do {						\
-	MNT_ILOCK(vfsp);						\
-	MNT_REL(vfsp);							\
-	MNT_IUNLOCK(vfsp);						\
-} while (0)
-
 #define	fs_vscan(vp, cr, async)	(0)
 
 #define	VROOT		VV_ROOT

Added: trunk/sys/cddl/compat/opensolaris/sys/vm.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/vm.h	                        (rev 0)
+++ trunk/sys/cddl/compat/opensolaris/sys/vm.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -0,0 +1,62 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 EMC Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/vm.h 260786 2014-01-16 18:15:59Z avg $
+ */
+
+#ifndef _OPENSOLARIS_SYS_VM_H_
+#define	_OPENSOLARIS_SYS_VM_H_
+
+#ifdef _KERNEL
+
+#include <sys/sf_buf.h>
+
+extern const int zfs_vm_pagerret_bad;
+extern const int zfs_vm_pagerret_error;
+extern const int zfs_vm_pagerret_ok;
+extern const int zfs_vm_pagerput_sync;
+extern const int zfs_vm_pagerput_inval;
+
+void	zfs_vmobject_assert_wlocked(vm_object_t object);
+void	zfs_vmobject_wlock(vm_object_t object);
+void	zfs_vmobject_wunlock(vm_object_t object);
+
+static inline caddr_t
+zfs_map_page(vm_page_t pp, struct sf_buf **sfp)
+{
+	*sfp = sf_buf_alloc(pp, 0);
+	return ((caddr_t)sf_buf_kva(*sfp));
+}
+
+static inline void
+zfs_unmap_page(struct sf_buf *sf)
+{
+	sf_buf_free(sf);
+}
+
+#endif	/* _KERNEL */
+
+#endif	/* _OPENSOLARIS_SYS_VM_H_ */


Property changes on: trunk/sys/cddl/compat/opensolaris/sys/vm.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/cddl/compat/opensolaris/sys/vnode.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/vnode.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/vnode.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/vnode.h 233353 2012-03-23 11:26:54Z kib $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/vnode.h 304671 2016-08-23 07:55:05Z avg $
  */
 
 #ifndef _OPENSOLARIS_SYS_VNODE_H_
@@ -76,7 +77,7 @@
 #define	vn_has_cached_data(vp)	\
 	((vp)->v_object != NULL && \
 	 ((vp)->v_object->resident_page_count > 0 || \
-	  (vp)->v_object->cache != NULL))
+	  !vm_object_cache_is_empty((vp)->v_object)))
 #define	vn_exists(vp)		do { } while (0)
 #define	vn_invalid(vp)		do { } while (0)
 #define	vn_renamepath(tdvp, svp, tnm, lentnm)	do { } while (0)
@@ -87,8 +88,6 @@
 #define	VN_RELE(v)	vrele(v)
 #define	VN_URELE(v)	vput(v)
 
-#define	VOP_REALVP(vp, vpp, ct)	(*(vpp) = (vp), 0)
-
 #define	vnevent_create(vp, ct)			do { } while (0)
 #define	vnevent_link(vp, ct)			do { } while (0)
 #define	vnevent_remove(vp, dvp, name, ct)	do { } while (0)
@@ -193,7 +192,7 @@
 
 	if (startvp != NULL)
 		vref(startvp);
-	NDINIT_ATVP(&nd, operation, MPSAFE, UIO_SYSSPACE, pnamep, startvp, td);
+	NDINIT_ATVP(&nd, operation, 0, UIO_SYSSPACE, pnamep, startvp, td);
 	filemode |= O_NOFOLLOW;
 	error = vn_open_cred(&nd, &filemode, createmode, 0, td->td_ucred, NULL);
 	NDFREE(&nd, NDF_ONLY_PNBUF);
@@ -223,13 +222,12 @@
     ssize_t *residp)
 {
 	struct thread *td = curthread;
-	int error, vfslocked;
+	int error;
 	ssize_t resid;
 
 	ASSERT(ioflag == 0);
 	ASSERT(ulimit == RLIM64_INFINITY);
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if (rw == UIO_WRITE) {
 		ioflag = IO_SYNC;
 	} else {
@@ -237,7 +235,6 @@
 	}
 	error = vn_rdwr(rw, vp, base, len, offset, seg, ioflag, cr, NOCRED,
 	    &resid, td);
-	VFS_UNLOCK_GIANT(vfslocked);
 	if (residp != NULL)
 		*residp = (ssize_t)resid;
 	return (error);
@@ -249,11 +246,10 @@
 zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr)
 {
 	struct mount *mp;
-	int error, vfslocked;
+	int error;
 
 	ASSERT(flag == FSYNC);
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
 		goto drop;
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
@@ -261,7 +257,6 @@
 	VOP_UNLOCK(vp, 0);
 	vn_finished_write(mp);
 drop:
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error);
 }
 #define	VOP_FSYNC(vp, flag, cr, ct)	zfs_vop_fsync((vp), (flag), (cr))
@@ -269,14 +264,12 @@
 static __inline int
 zfs_vop_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr)
 {
-	int error, vfslocked;
+	int error;
 
 	ASSERT(count == 1);
 	ASSERT(offset == 0);
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	error = vn_close(vp, flag, cr, curthread);
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error);
 }
 #define	VOP_CLOSE(vp, oflags, count, offset, cr, ct)			\

Modified: trunk/sys/cddl/compat/opensolaris/sys/zone.h
===================================================================
--- trunk/sys/cddl/compat/opensolaris/sys/zone.h	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/compat/opensolaris/sys/zone.h	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: release/9.2.0/sys/cddl/compat/opensolaris/sys/zone.h 219089 2011-02-27 19:41:40Z pjd $
+ * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/zone.h 219089 2011-02-27 19:41:40Z pjd $
  */
 
 #ifndef _OPENSOLARIS_SYS_ZONE_H_

Modified: trunk/sys/cddl/dev/cyclic/i386/cyclic_machdep.c
===================================================================
--- trunk/sys/cddl/dev/cyclic/i386/cyclic_machdep.c	2018-06-01 22:48:12 UTC (rev 10166)
+++ trunk/sys/cddl/dev/cyclic/i386/cyclic_machdep.c	2018-06-01 22:49:17 UTC (rev 10167)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright 2006-2008 John Birrell <jb at FreeBSD.org>
  *



More information about the Midnightbsd-cvs mailing list