[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Please test zfsutils 9.0~svn226163-1



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

On 19.10.2011 07:32, Robert Millan wrote:
> If a standalone libmd upload is holding things up, the GPL
> incompatibility could also be resolved by linking libmd statically
> into zfsutils as you proposed initially.

Guillem announced to work on libmd soon. I used the package as it exists
in the repository today to build my zfsutils versions. This works fine
as is, therefore the only problem with it is the license issue, indeed.

For zfsutils itself there is no license problem. I don't know which
dependencies need libmd besides of me, but I don't think we have any GPL
code to link with it in our glibc-bsd codebase, do we?

Regardless of that issue /I/ can't upload anyway as I'm lacking upload
permissions. If you, or anyone else wants to, just go ahead. :)

> As for #645305 I'll take care of this in GRUB side.

In the updated packages below I removed all shared libraries which had
been built out of the zfsutils source package previously, except of
libnvpair and libzfs which do have external dependencies for the time
being. I see your patch in #645305 would remove the requirement to
support libzfs externally too.

Since you wrote a patch for grub which removes this dependency, I guess
your plan is to remove all the libraries?

By the way, I am sorry, but I couldn't test your patch yet.

> The only remaining problem is that your update is to 9-STABLE.  I
> think it'd be bad to upgrade zfsutils to 9-STABLE in Sid since the
> Wheezy is due in 6 months and 9.0 isn't even released yet.  Perhaps
> you could look at resyncing your patches with 8-STABLE?

I did so, see the downloads below. It was an easy and straightforward
procedure to provide a 8.3 package. I briefly tested the 8.3 package and
it seems to work fine together with a 9.0 kernel. However, there are
some problems with the Wheezy 8.2 kernel. It does not seem to be an ABI
incompatibility, but "zfs volinit" is not supported by the zfsutils
anymore, while the 8.2 kernel still needs the API call. In kfreebsd-9.0
(and 8.3 I presume) this call isn't needed anymore, hence zfsutils
removed support for it.

> Note that in terms of features 8-STABLE receives backports for almost
> everything, it's a lot like the Testing/Unstable separation in Debian
> (this will change when 9.0 is released though).

Thanks for letting me know. I updated the package as said and I am
providing a 8.3 zfsutils package now. Also I fixed some more things,
when compared to my original package I announced a few days ago.

You can get the files here:

* http://daemonkeeper.net/wp-content/files/zfsutils/
*
http://daemonkeeper.net/wp-content/files/zfsutils/zfsutils_8.3~svn226546-1.dsc
*
http://daemonkeeper.net/wp-content/files/zfsutils/zfsutils_9.0~svn226163-1.dsc


Binary packages for kfreebsd-amd64 are available as well there. I did
also upload a binary, but otherwise unchanged package for libmd which
Guillem prepared. This is a needed dependency to build and install
zfsutils as said.

The differences between the 8.3 and the 9.0 version are minimal, I only
refreshed the patches and used a different code base (the upstream delta
seems minimal as well).

These are differences between my last 9.0 upload and this one (full diff
in "zfsutils-9-previous.patch"):

* The package is not embedding libmd anymore but uses it as external
dependency
* I removed the binary packages for libuutil0, libumem0 and libzpool0.
Instead I'm embedding those libraries into the binaries. The code base
in the source package is unchanged.
* I made 16-wrap-cdefs.diff a /bit/ less ugly (but still ...)
* I fixed hyphen-used-as-minus-sign by a Perl hack in debian/rules
* Some more minor fixes to make Lintian happier (e.g. sectioning and
package description in debian/control, I made the rules targets cleaner)

In zfsutils-diff-8-9.patch I am providing a full diff between my 9.0
version and the 8.2 Wheezy version of zfsutils.

The delta between zfsutils_8.3~svn226546-1 and zfsutils_9.0~svn226163-1
is minimal. I only changed version number, source repository and I had
to refresh a few patches.

- -- 
with kind regards,
Arno Töll
IRC: daemonkeeper on Freenode/OFTC
GnuPG Key-ID: 0x9D80F36D
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOn0adAAoJEMcrUe6dgPNtZnoQAKj9wQgLa8uZQu2HMTHb9ndL
XU7wkpbN8gdmV6PABFEgkMUWOhZ6yyv7SmmioWol4CkNZYi3I+bLArEGdhTvoP3E
lVE2u/uCzIonNeu/1/oF5Gjzfu+2z7wTaQ5DXmHvwIJKkZEFYjaSG1ldUN5B8Hti
ImHCLAlusGQJaxB622l0uh4+SE+24hGQBsmc3vgw8vOFPfWl3p4JXVlVf12ZduBN
3G3ZkHmryVj2dhzTJG2502pI1fuyX8HcT+dh0jebwrBZ27dBhx6N1eaM49maH/nN
OGuLVubJBN34nSOur0/xL/TfSPXdA7Y9DIIoLj1t9+cZrkj0TDH8ScJ2d1ajUyc/
BS7e+EiRw0mfmqjmTZvPYlNv8byGx6yC9rJfl5GRiyFGI4HVlsZ/731FNNhMykyH
GysDc4BrvoPoGPIehpbSxg2BJqZ5RDhVZJhm5S0Zy72U2qMdhQYA9RxRsh8m02S3
GF6YyykscZhUA4Fyg1yu1JLlowACsUb2X3gBwzFw4HgLeTfCtAFTHic59q6KX6gg
PrsKX0LNjzn0AETZ0sL6ms2Av3TdzwR4ekmaSrXDlKqas7Rxa6dDPIz6x+/IhydG
AbER/mriX3VlVxTGwv8GQOMVLl5iedjo8fhv6wxpxrq6GEo87SohS5MhAnf9HDfR
8JkIjrPuZGCcBwi5W+Bn
=Z/H/
-----END PGP SIGNATURE-----
diff -ruN zfsutils-9.old/debian/changelog zfsutils-9/debian/changelog
--- zfsutils-9.old/debian/changelog	2011-10-10 14:39:17.014544865 -0400
+++ zfsutils-9/debian/changelog	2011-10-18 21:31:47.512616267 -0400
@@ -1,7 +1,14 @@
 zfsutils (9.0~svn226163-1) experimental; urgency=low
 
+  * New upstream snapshot, based on the FreeBSD 9 tree which supports ZFS
+    version 28 now.
+  * Remove libuutil0, libumem0 and libzpool0. Those are considered private
+    libraries now and are linked into the binaries as required.
   * Change the XC-Package-Type field to Package-Type. The field is supported
     since dpkg 1.15.7
+  * Make sure build-time hardening flags injected by dpkg 1.16.1 are actually
+    passed to the upstream Makefile. This means zfsutils are built with
+    hardening flags now.
   * Improve several package descriptions - at least they don't duplicate the
     descriptions by other packages anymore
   * Refresh patches, leave hunks unchanged where possible. Additionally:
@@ -16,9 +23,9 @@
     + Add build-libmd target. The library is statically linked into several
       utils.
   * Remove the zfs volinit/volfini commands from the init script as they are
-    not available anymore. 
+    not available anymore; also stop on runlevel 1.
 
- -- Arno Töll <debian@toell.net>  Sun, 09 Oct 2011 20:17:17 -0400
+ -- Arno Töll <debian@toell.net>  Tue, 18 Oct 2011 21:31:15 -0400
 
 zfsutils (8.2-4) unstable; urgency=high
 
diff -ruN zfsutils-9.old/debian/control zfsutils-9/debian/control
--- zfsutils-9.old/debian/control	2011-10-10 14:39:17.012521423 -0400
+++ zfsutils-9/debian/control	2011-10-10 23:01:47.188380924 -0400
@@ -3,38 +3,13 @@
 Priority: optional
 Maintainer: GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>
 Uploaders: Aurelien Jarno <aurel32@debian.org>, Robert Millan <rmh@debian.org>
-Build-Depends: debhelper (>= 7), freebsd-buildutils, libbsd-dev (>= 0.1.4),
+Build-Depends: debhelper (>= 7.0.50~), freebsd-buildutils, libbsd-dev (>= 0.1.4),
  libc0.1-dev (>= 2.10), kfreebsd-kernel-headers (>= 0.51), libgeom-dev, libsbuf-dev,
  zlib1g-dev, libmd-dev
 Vcs-Browser: http://svn.debian.org/wsvn/glibc-bsd/trunk/zfsutils/
 Vcs-Svn: svn://svn.debian.org/glibc-bsd/trunk/zfsutils/
 Standards-Version: 3.9.2
 
-Package: libuutil0
-Section: libs
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris userland utility library
- This package contains the OpenSolaris userland utility library.
-
-Package: libuutil-dev
-Section: libdevel
-Architecture: kfreebsd-any
-Depends: libuutil0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
-Description: Development files for libuutil
- This package contains the header files and static library needed to
- compile applications that use libuutil.
-
-Package: libuutil0-udeb
-XC-Package-Type: udeb
-Section: debian-installer
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris userland utility library
- This package contains the OpenSolaris userland utility library.
- .
- This is a minimal package for use in debian-installer.
-
 Package: libnvpair0
 Section: libs
 Architecture: kfreebsd-any
@@ -49,14 +24,14 @@
 Depends: libnvpair0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
 Description: Development files for libnvpair
  This package contains the header files and static library needed to
- compile applications that use libnvpair.
+ compile applications that use libnvpair, a library to manage name-value pairs
 
 Package: libnvpair0-udeb
 Package-Type: udeb
 Section: debian-installer
 Architecture: kfreebsd-any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris name-value pair library
+Description: OpenSolaris name-value pair library (udeb version)
  This package contains the OpenSolaris libnvpair library, for managing
  name-value pairs.
  .
@@ -77,6 +52,8 @@
 Architecture: kfreebsd-any
 Depends: libzfs0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
 Description: Development files for libzfs
+ The ZFS library provides support for managing ZFS filesystems.
+ .
  This package contains the header files and static library needed to
  compile applications that use libzfs.
 
@@ -85,7 +62,7 @@
 Section: debian-installer
 Architecture: kfreebsd-any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: FreeBSD ZFS library
+Description: FreeBSD ZFS library (udeb version)
  The Z file system is a pooled filesystem designed for maximum data integrity,
  supporting data snapshots, multiple copies, and data checksums.
  .
@@ -94,9 +71,9 @@
  This is a minimal package for use in debian-installer.
 
 Package: zfsutils
-Section: admin
 Architecture: kfreebsd-any
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Provides: libuutil0, libzpool0, libumem0
 Description: command-line tools to manage ZFS filesystems
  The Z file system is a pooled filesystem designed for maximum data integrity,
  supporting data snapshots, multiple copies, and data checksums.
@@ -109,7 +86,7 @@
 Section: debian-installer
 Architecture: kfreebsd-any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: command-line tools to manage ZFS filesystems
+Description: command-line tools to manage ZFS filesystems (udeb version)
  The Z file system is a pooled filesystem designed for maximum data integrity,
  supporting data snapshots, multiple copies, and data checksums.
  .
@@ -118,54 +95,3 @@
  .
  This is a minimal package for use in debian-installer.
 
-
-Package: libumem0
-Section: libs
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris memory-management library
- This package contains the OpenSolaris libumem library, to detect
- memory management bugs in applications
-
-Package: libumem-dev
-Section: libdevel
-Architecture: kfreebsd-any
-Depends: libumem0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
-Description: Development files for libumem0
- This package contains the header files and static library needed to
- compile applications that use libumem.
-
-Package: libumem0-udeb
-Package-Type: udeb
-Section: debian-installer
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris name-value pair library
- This package contains the OpenSolaris libumem library, to detect
- memory management bugs in applications
-
-
-Package: libzpool0
-Section: libs
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris interface library to manage ZFS storage pools
- This package contains the OpenSolaris libzpool library.
-
-Package: libzpool-dev
-Section: libdevel
-Architecture: kfreebsd-any
-Depends: libzpool0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
-Description: Development files for libzpool0
- This package contains the header files and static library needed to
- compile applications that use libzpool.
-
-Package: libzpool0-udeb
-Package-Type: udeb
-Section: debian-installer
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris interface library to manage ZFS storage pools
- This package contains the OpenSolaris libzpool library.
- .
- This is a minimal package for use in debian-installer.
diff -ruN zfsutils-9.old/debian/libumem0.install zfsutils-9/debian/libumem0.install
--- zfsutils-9.old/debian/libumem0.install	2011-10-10 14:39:17.012521423 -0400
+++ zfsutils-9/debian/libumem0.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libumem/libumem.so.0	lib
diff -ruN zfsutils-9.old/debian/libumem0-udeb.install zfsutils-9/debian/libumem0-udeb.install
--- zfsutils-9.old/debian/libumem0-udeb.install	2011-10-10 14:39:17.014544865 -0400
+++ zfsutils-9/debian/libumem0-udeb.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libumem/libumem.so.0	lib
diff -ruN zfsutils-9.old/debian/libumem-dev.install zfsutils-9/debian/libumem-dev.install
--- zfsutils-9.old/debian/libumem-dev.install	2011-10-10 14:39:17.008539353 -0400
+++ zfsutils-9/debian/libumem-dev.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libumem/libumem.a	usr/lib
diff -ruN zfsutils-9.old/debian/libumem-dev.links zfsutils-9/debian/libumem-dev.links
--- zfsutils-9.old/debian/libumem-dev.links	2011-10-10 14:39:17.014544865 -0400
+++ zfsutils-9/debian/libumem-dev.links	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-lib/libumem.so.0                 usr/lib/libumem.so
diff -ruN zfsutils-9.old/debian/libuutil0.install zfsutils-9/debian/libuutil0.install
--- zfsutils-9.old/debian/libuutil0.install	2011-10-10 14:39:17.008539353 -0400
+++ zfsutils-9/debian/libuutil0.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libuutil/libuutil.so.0	lib
diff -ruN zfsutils-9.old/debian/libuutil0-udeb.install zfsutils-9/debian/libuutil0-udeb.install
--- zfsutils-9.old/debian/libuutil0-udeb.install	2011-10-10 14:39:17.012521423 -0400
+++ zfsutils-9/debian/libuutil0-udeb.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libuutil/libuutil.so.0	lib
diff -ruN zfsutils-9.old/debian/libuutil-dev.install zfsutils-9/debian/libuutil-dev.install
--- zfsutils-9.old/debian/libuutil-dev.install	2011-10-10 14:39:17.011544204 -0400
+++ zfsutils-9/debian/libuutil-dev.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libuutil/libuutil.a	usr/lib
diff -ruN zfsutils-9.old/debian/libuutil-dev.links zfsutils-9/debian/libuutil-dev.links
--- zfsutils-9.old/debian/libuutil-dev.links	2011-10-10 14:39:17.014544865 -0400
+++ zfsutils-9/debian/libuutil-dev.links	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-lib/libuutil.so.0                 usr/lib/libuutil.so
diff -ruN zfsutils-9.old/debian/libzpool0.install zfsutils-9/debian/libzpool0.install
--- zfsutils-9.old/debian/libzpool0.install	2011-10-10 14:39:17.011544204 -0400
+++ zfsutils-9/debian/libzpool0.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libzpool/libzpool.so.0	lib
diff -ruN zfsutils-9.old/debian/libzpool0-udeb.install zfsutils-9/debian/libzpool0-udeb.install
--- zfsutils-9.old/debian/libzpool0-udeb.install	2011-10-10 14:39:17.013568204 -0400
+++ zfsutils-9/debian/libzpool0-udeb.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libzpool/libzpool.so.0	lib
diff -ruN zfsutils-9.old/debian/libzpool-dev.install zfsutils-9/debian/libzpool-dev.install
--- zfsutils-9.old/debian/libzpool-dev.install	2011-10-10 14:39:17.011544204 -0400
+++ zfsutils-9/debian/libzpool-dev.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libzpool/libzpool.a	usr/lib
diff -ruN zfsutils-9.old/debian/libzpool-dev.links zfsutils-9/debian/libzpool-dev.links
--- zfsutils-9.old/debian/libzpool-dev.links	2011-10-10 14:39:17.013568204 -0400
+++ zfsutils-9/debian/libzpool-dev.links	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-lib/libzpool.so.0                 usr/lib/libzpool.so
diff -ruN zfsutils-9.old/debian/patches/01_glibc_kludge.diff zfsutils-9/debian/patches/01_glibc_kludge.diff
--- zfsutils-9.old/debian/patches/01_glibc_kludge.diff	2011-10-10 14:39:17.010565029 -0400
+++ zfsutils-9/debian/patches/01_glibc_kludge.diff	2011-10-10 21:48:26.367231308 -0400
@@ -56,14 +56,3 @@
  {
  	callb_cpr_t cpr;
  	l2arc_dev_t *dev;
---- a/sys/cddl/compat/opensolaris/sys/misc.h
-+++ b/sys/cddl/compat/opensolaris/sys/misc.h
-@@ -31,7 +31,7 @@
- 
- #include <sys/limits.h>
- 
--#define	MAXUID	UID_MAX
-+#define	MAXUID	UINT_MAX
- 
- #define	SPEC_MAXOFFSET_T	OFF_MAX
- 
diff -ruN zfsutils-9.old/debian/patches/04_stdint.diff zfsutils-9/debian/patches/04_stdint.diff
--- zfsutils-9.old/debian/patches/04_stdint.diff	2011-10-10 14:39:17.010565029 -0400
+++ zfsutils-9/debian/patches/04_stdint.diff	2011-10-10 21:48:26.377780973 -0400
@@ -37,27 +37,3 @@
  #include <sys/note.h>
  #include <sys/kernel.h>
  #include <sys/debug.h>
---- a/lib/libmd/sha512.h
-+++ b/lib/libmd/sha512.h
-@@ -30,6 +30,9 @@
- #define _SHA512_H_
- 
- #include <sys/types.h>
-+#ifdef __GLIBC__
-+#include <stdint.h>
-+#endif
- 
- typedef struct SHA512Context {
- 	uint64_t state[8];
---- a/lib/libmd/sha256.h
-+++ b/lib/libmd/sha256.h
-@@ -30,6 +30,9 @@
- #define _SHA256_H_
- 
- #include <sys/types.h>
-+#ifdef __GLIBC__
-+#include <stdint.h>
-+#endif
- 
- typedef struct SHA256Context {
- 	uint32_t state[8];
diff -ruN zfsutils-9.old/debian/patches/05_makefile.diff zfsutils-9/debian/patches/05_makefile.diff
--- zfsutils-9.old/debian/patches/05_makefile.diff	2011-10-10 14:39:17.009550934 -0400
+++ zfsutils-9/debian/patches/05_makefile.diff	2011-10-10 21:48:26.373729900 -0400
@@ -11,19 +11,20 @@
 
 --- a/cddl/lib/libzfs/Makefile
 +++ b/cddl/lib/libzfs/Makefile
-@@ -6,8 +6,13 @@
+@@ -6,8 +6,14 @@
  .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
  
  LIB=	zfs
 -DPADD=	${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL}
 -LDADD=	-lmd -lpthread -lumem -lutil
 +DPADD=	${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBMD}
-+LDADD=	-lmd -lpthread -lumem -lm -lbsd -lgeom -lnvpair -luutil
++LDADD=	-lmd -lpthread -lm -lbsd -lgeom -lnvpair
 +
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libnvpair
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libuutil
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libumem
-+
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libuutil/libuutil.a
  
  SRCS=	deviceid.c \
  	fsshare.c \
@@ -38,7 +39,7 @@
  .include <bsd.lib.mk>
 --- a/cddl/sbin/zfs/Makefile
 +++ b/cddl/sbin/zfs/Makefile
-@@ -21,8 +21,13 @@
+@@ -21,8 +21,15 @@
  CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
  CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
  
@@ -47,17 +48,19 @@
 -LDADD=	-lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
 +DPADD=	${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} \
 +	${LIBUUTIL} ${LIBZFS}
-+LDADD=	-lbsd -lgeom -lm -lnvpair -lumem -luutil -lzfs
++LDADD=	-lbsd -lgeom -lm -lnvpair -lzfs
 +
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzfs \
 +       -L${.CURDIR}/../../../cddl/lib/libnvpair \
 +       -L${.CURDIR}/../../../cddl/lib/libuutil \
 +       -L${.CURDIR}/../../../cddl/lib/libumem
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libuutil/libuutil.a
  
  .include <bsd.prog.mk>
 --- a/cddl/sbin/zpool/Makefile
 +++ b/cddl/sbin/zpool/Makefile
-@@ -26,8 +26,12 @@
+@@ -26,8 +26,14 @@
  CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
  CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
  
@@ -65,70 +68,81 @@
 -	${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
 -LDADD=	-lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
 +DPADD=  ${LIBZFS} ${LIBGEOM} ${LIBNVPAIR} ${LIBUUTIL} ${LIBUMEM}
-+LDADD= -lzfs -lgeom -lnvpair -luutil -lbsd -lumem
++LDADD= -lzfs -lgeom -lnvpair -lbsd
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzfs \
 +       -L${.CURDIR}/../../../cddl/lib/libnvpair \
 +       -L${.CURDIR}/../../../cddl/lib/libuutil \
 +       -L${.CURDIR}/../../../cddl/lib/libumem
-+
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libuutil/libuutil.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libavl/libavl.a
  
  .include <bsd.prog.mk>
 --- a/cddl/usr.sbin/zdb/Makefile
 +++ b/cddl/usr.sbin/zdb/Makefile
-@@ -25,7 +25,12 @@
+@@ -25,7 +25,14 @@
  
  DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
  	${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL}
 -LDADD=	-lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
-+LDADD=	-lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
+-
++LDADD=	-lgeom -lm -lnvpair -lpthread -lz -lzfs -lbsd -lmd
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libumem
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzpool
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libnvpair
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libuutil
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzfs
- 
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libuutil/libuutil.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libzpool/libzpool.a
  
  .include <bsd.prog.mk>
 --- a/cddl/usr.bin/zinject/Makefile
 +++ b/cddl/usr.bin/zinject/Makefile
-@@ -21,6 +21,11 @@
+@@ -21,6 +21,12 @@
  
  DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
  	${LIBZFS} ${LIBZPOOL}
 -LDADD=	-lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
-+LDADD= -lbsd -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
++LDADD= -lbsd -lgeom -lm -lnvpair -lzfs -lmd -lz
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzpool
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libumem
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libnvpair
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libuutil
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzfs
++LDADD+= ${.CURDIR}/../../../cddl/lib/libzpool/libzpool.a
  
  .include <bsd.prog.mk>
 --- a/cddl/usr.bin/ztest/Makefile
 +++ b/cddl/usr.bin/ztest/Makefile
-@@ -19,7 +19,10 @@
+@@ -19,7 +19,14 @@
  
  DPADD=	${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
  	${LIBPTHREAD} ${LIBZ} ${LIBAVL}
 -LDADD=	-lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
-+LDADD=	-lm -lnvpair -lumem -lzpool -lpthread -lz -lrt -ldl -lbsd
++LDADD=	-lm -lnvpair -lpthread -lz -lrt -ldl -lbsd -lmd
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzpool
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libumem
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libnvpair
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libzpool/libzpool.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libavl/libavl.a
++
  
  CSTD=	c99
  
 --- a/cddl/lib/libzpool/Makefile
 +++ b/cddl/lib/libzpool/Makefile
-@@ -57,7 +57,10 @@
+@@ -57,7 +57,11 @@
  CFLAGS+=	-I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include
  
  DPADD=		${LIBMD} ${LIBPTHREAD} ${LIBZ}
 -LDADD=		-lmd -lpthread -lz
-+LDADD=          -lmd -lpthread -lz -lrt -lbsd -lnvpair -lumem
-+LDADD+=        -L${.CURDIR}/../../../cddl/lib/libnvpair
-+LDADD+=        -L${.CURDIR}/../../../cddl/lib/libumem
-+LDADD+=        ${.CURDIR}/../../../cddl/lib/libavl/libavl.a
++LDADD+=         -lmd -lpthread -lz -lrt -lbsd -lnvpair -lumem
++LDADD+=         -L${.CURDIR}/../../../cddl/lib/libnvpair
++LDADD+=         -L${.CURDIR}/../../../cddl/lib/libumem
++LDADD+=         ${.CURDIR}/../../../cddl/lib/libavl/libavl.a
++
  
  # atomic.S doesn't like profiling.
  NO_PROFILE=
diff -ruN zfsutils-9.old/debian/patches/16-wrap-cdefs.diff zfsutils-9/debian/patches/16-wrap-cdefs.diff
--- zfsutils-9.old/debian/patches/16-wrap-cdefs.diff	2011-10-10 14:39:17.009550934 -0400
+++ zfsutils-9/debian/patches/16-wrap-cdefs.diff	2011-10-10 21:48:26.345465693 -0400
@@ -1,31 +1,42 @@
 --- a/sys/cddl/compat/opensolaris/sys/misc.h
 +++ b/sys/cddl/compat/opensolaris/sys/misc.h
-@@ -29,6 +29,13 @@
- #ifndef _OPENSOLARIS_SYS_MISC_H_
- #define	_OPENSOLARIS_SYS_MISC_H_
- 
-+#ifdef _POSIX_C_SOURCE
-+#if _POSIX_C_SOURCE >= 200112
-+#define __POSIX_VISIBLE         200112
-+#define __ISO_C_VISIBLE         1999
-+#endif
-+#endif
-+
+@@ -31,7 +31,11 @@
+ 
  #include <sys/limits.h>
  
- #define	MAXUID	UINT_MAX
---- a/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
-+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
-@@ -75,6 +75,12 @@
- #include <sys/mntent.h>
- #include <libgeom.h>
- #include <bsd/string.h>
-+#ifdef _POSIX_C_SOURCE
-+#if _POSIX_C_SOURCE >= 200112
-+#define __POSIX_VISIBLE         200112
-+#define __ISO_C_VISIBLE         1999
++#ifndef UID_MAX
++#define MAXUID UINT_MAX
++#else
+ #define	MAXUID	UID_MAX
++#endif
+ 
+ #define	SPEC_MAXOFFSET_T	OFF_MAX
+ 
+--- a/sys/cddl/compat/opensolaris/sys/vnode.h
++++ b/sys/cddl/compat/opensolaris/sys/vnode.h
+@@ -116,7 +116,11 @@
+ #define	va_blksize	va_blocksize
+ #define	va_seq		va_gen
+ 
++#ifndef OFF_MAX
++#define MAXOFFSET_T	__OFF_MAX
++#else
+ #define	MAXOFFSET_T	OFF_MAX
 +#endif
+ #define	EXCL		0
+ 
+ #define	ACCESSED		(AT_ATIME)
+--- a/sys/cddl/compat/opensolaris/sys/stat.h
++++ b/sys/cddl/compat/opensolaris/sys/stat.h
+@@ -36,7 +36,11 @@
+ #define	stat64	stat
+ #endif
+ 
++#ifndef OFF_MAX
++#define MAXOFFSET_T	__OFF_MAX
++#else
+ #define	MAXOFFSET_T	OFF_MAX
 +#endif
- #include <sys/limits.h>
  
- #include "zpool_util.h"
+ #if !defined(_KERNEL) && !defined(__GLIBC__)
+ #include <sys/disk.h>
diff -ruN zfsutils-9.old/debian/rules zfsutils-9/debian/rules
--- zfsutils-9.old/debian/rules	2011-10-10 14:39:17.012521423 -0400
+++ zfsutils-9/debian/rules	2011-10-18 21:22:01.922550770 -0400
@@ -74,7 +74,12 @@
 	tar --numeric-owner --owner 0 --group 0 -czf ../$(TARNAME) $(ORIGDIR)
 	rm -rf $(ORIGDIR)
 
-build: build-libmd build-libuutil build-libnvpair build-libzfs build-libumem build-libzpool build-zfsutils build-libavl
+build: build-arch build-indep
+
+build-arch: build-libuutil build-libnvpair build-libzfs build-libumem build-libzpool build-zfsutils build-libavl
+
+build-indep:
+	# We have nothing to do
 
 build-libuutil: build-libuutil-stamp
 build-libuutil-stamp:
@@ -97,13 +102,8 @@
 	$(PMAKE) -C $(CURDIR)/cddl/lib/libzpool
 	touch $@
 
-build-libmd: build-libmd-stamp
-build-libmd-stamp:
-	$(PMAKE) -C $(CURDIR)/lib/libmd
-	touch $@
-
 build-libzfs: build-libzfs-stamp
-build-libzfs-stamp: build-libnvpair-stamp build-libuutil-stamp build-libmd-stamp build-libumem-stamp
+build-libzfs-stamp: build-libnvpair-stamp build-libuutil-stamp build-libumem-stamp
 	$(PMAKE) -C $(CURDIR)/cddl/lib/libzfs
 	touch $@
 
@@ -140,9 +140,10 @@
 	$(PMAKE) -C $(CURDIR)/cddl/usr.sbin/zdb clean
 	$(PMAKE) -C $(CURDIR)/cddl/usr.bin/ztest clean
 	$(PMAKE) -C $(CURDIR)/cddl/usr.bin/zinject clean
-	$(PMAKE) -C $(CURDIR)/lib/libmd clean
 
 	rm -f *stamp
+	rm -f debian/zpool.8 debian/zfs.8 debian/zdb.8
+
 	dh_clean
 
 install: build
@@ -156,8 +157,16 @@
 binary-indep: build install
 # We have nothing to do by default.
 
+
+manpages:
+	# Replace the hyphen used in man pages by the minus sign.
+	set -e
+	cat cddl/contrib/opensolaris/cmd/zpool/zpool.8 | perl -pi -e 's/(?<!\\)(?<!\.in |\.ll |\.po |\.ti |\.ce )-/\\-/g' > debian/zpool.8
+	cat cddl/contrib/opensolaris/cmd/zfs/zfs.8 | perl -pi -e 's/(?<!\\)(?<!\.in |\.ll |\.po |\.ti |\.ce )-/\\-/g' > debian/zfs.8
+	zcat cddl/usr.sbin/zdb/zdb.8.gz | perl -pi -e 's/(?<!\\)(?<!\.in |\.ll |\.po |\.ti |\.ce )-/\\-/g' > debian/zdb.8
+
 # Build architecture-dependent files here.
-binary-arch: build install
+binary-arch: build install manpages
 	dh_testdir
 	dh_testroot
 	dh_installchangelogs -a
@@ -175,10 +184,7 @@
 #	dh_python
 	dh_makeshlibs -a
 	dh_makeshlibs -plibnvpair0 --add-udeb=libnvpair0-udeb
-	dh_makeshlibs -plibuutil0 --add-udeb=libuutil0-udeb
 	dh_makeshlibs -plibzfs0 --add-udeb=libzfs0-udeb
-	dh_makeshlibs -plibzpool0 --add-udeb=libzpool0-udeb
-	dh_makeshlibs -plibumem0 --add-udeb=libumem0-udeb
 	dh_makeshlibs -pzfsutils --add-udeb=zfsutils-udeb
 	dh_installdeb -a
 	dh_shlibdeps -a
@@ -187,4 +193,4 @@
 	dh_builddeb -a
 
 binary: binary-arch binary-indep
-.PHONY: build clean binary-indep binary-arch binary install configure
+.PHONY: build clean binary-indep binary-arch binary install configure build-arch build-indep
diff -ruN zfsutils-9.old/debian/zfsutils.manpages zfsutils-9/debian/zfsutils.manpages
--- zfsutils-9.old/debian/zfsutils.manpages	2011-10-10 14:39:17.013568204 -0400
+++ zfsutils-9/debian/zfsutils.manpages	2011-10-18 18:18:34.496250500 -0400
@@ -1,3 +1,3 @@
-cddl/contrib/opensolaris/cmd/zpool/zpool.8
-cddl/contrib/opensolaris/cmd/zfs/zfs.8
-cddl/usr.sbin/zdb/zdb.8.gz
+debian/zpool.8
+debian/zfs.8
+debian/zdb.8
diff -ruN zfsutils-9.old/debian/zfsutils.zfs.init zfsutils-9/debian/zfsutils.zfs.init
--- zfsutils-9.old/debian/zfsutils.zfs.init	2011-10-10 14:39:17.013568204 -0400
+++ zfsutils-9/debian/zfsutils.zfs.init	2011-10-10 22:28:58.166216375 -0400
@@ -6,7 +6,7 @@
 # X-Start-Before:    checkroot
 # X-Stop-After:      umountfs
 # Default-Start:     S
-# Default-Stop:      0 6
+# Default-Stop:      0 1 6
 # Short-Description: Start/stop ZFS subsystem.
 # Description:
 ### END INIT INFO
diff -ruN zfsutils_old/zfsutils-8.2/debian/changelog zfsutils/zfsutils-9/debian/changelog
--- zfsutils_old/zfsutils-8.2/debian/changelog	2011-08-08 09:40:57.000000000 -0400
+++ zfsutils/zfsutils-9/debian/changelog	2011-10-18 21:31:47.512616267 -0400
@@ -1,3 +1,32 @@
+zfsutils (9.0~svn226163-1) experimental; urgency=low
+
+  * New upstream snapshot, based on the FreeBSD 9 tree which supports ZFS
+    version 28 now.
+  * Remove libuutil0, libumem0 and libzpool0. Those are considered private
+    libraries now and are linked into the binaries as required.
+  * Change the XC-Package-Type field to Package-Type. The field is supported
+    since dpkg 1.15.7
+  * Make sure build-time hardening flags injected by dpkg 1.16.1 are actually
+    passed to the upstream Makefile. This means zfsutils are built with
+    hardening flags now.
+  * Improve several package descriptions - at least they don't duplicate the
+    descriptions by other packages anymore
+  * Refresh patches, leave hunks unchanged where possible. Additionally:
+    + 04_stdint.diff: Extend inclusion of stdint.h to several new files
+    + 05_makefile.diff: Patch libm, add new linkings where needed
+    + Remove 10_zpool_import.diff entirely
+    + Add 15_pthread_compat.diff: Work around compatibility issues with eglibc
+    + Remove 15_ztest.fix entirely
+    + 16-wrap-cdefs.diff: Work around the unavailability of cdefs.h
+  * debian/rules:
+    + Rework get-orig-source target, add new origin paths where needed.
+    + Add build-libmd target. The library is statically linked into several
+      utils.
+  * Remove the zfs volinit/volfini commands from the init script as they are
+    not available anymore; also stop on runlevel 1.
+
+ -- Arno Töll <debian@toell.net>  Tue, 18 Oct 2011 21:31:15 -0400
+
 zfsutils (8.2-4) unstable; urgency=high
 
   * Bring back mount/unmount routines in init script. See #637020 and
diff -ruN zfsutils_old/zfsutils-8.2/debian/control zfsutils/zfsutils-9/debian/control
--- zfsutils_old/zfsutils-8.2/debian/control	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/control	2011-10-10 23:01:47.188380924 -0400
@@ -3,38 +3,13 @@
 Priority: optional
 Maintainer: GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>
 Uploaders: Aurelien Jarno <aurel32@debian.org>, Robert Millan <rmh@debian.org>
-Build-Depends: debhelper (>= 7), freebsd-buildutils, libbsd-dev (>= 0.1.4),
+Build-Depends: debhelper (>= 7.0.50~), freebsd-buildutils, libbsd-dev (>= 0.1.4),
  libc0.1-dev (>= 2.10), kfreebsd-kernel-headers (>= 0.51), libgeom-dev, libsbuf-dev,
- zlib1g-dev
+ zlib1g-dev, libmd-dev
 Vcs-Browser: http://svn.debian.org/wsvn/glibc-bsd/trunk/zfsutils/
 Vcs-Svn: svn://svn.debian.org/glibc-bsd/trunk/zfsutils/
 Standards-Version: 3.9.2
 
-Package: libuutil0
-Section: libs
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris userland utility library
- This package contains the OpenSolaris userland utility library.
-
-Package: libuutil-dev
-Section: libdevel
-Architecture: kfreebsd-any
-Depends: libuutil0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
-Description: Development files for libuutil
- This package contains the header files and static library needed to
- compile applications that use libuutil.
-
-Package: libuutil0-udeb
-XC-Package-Type: udeb
-Section: debian-installer
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris userland utility library
- This package contains the OpenSolaris userland utility library.
- .
- This is a minimal package for use in debian-installer.
-
 Package: libnvpair0
 Section: libs
 Architecture: kfreebsd-any
@@ -49,14 +24,14 @@
 Depends: libnvpair0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
 Description: Development files for libnvpair
  This package contains the header files and static library needed to
- compile applications that use libnvpair.
+ compile applications that use libnvpair, a library to manage name-value pairs
 
 Package: libnvpair0-udeb
-XC-Package-Type: udeb
+Package-Type: udeb
 Section: debian-installer
 Architecture: kfreebsd-any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris name-value pair library
+Description: OpenSolaris name-value pair library (udeb version)
  This package contains the OpenSolaris libnvpair library, for managing
  name-value pairs.
  .
@@ -77,15 +52,17 @@
 Architecture: kfreebsd-any
 Depends: libzfs0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
 Description: Development files for libzfs
+ The ZFS library provides support for managing ZFS filesystems.
+ .
  This package contains the header files and static library needed to
  compile applications that use libzfs.
 
 Package: libzfs0-udeb
-XC-Package-Type: udeb
+Package-Type: udeb
 Section: debian-installer
 Architecture: kfreebsd-any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: FreeBSD ZFS library
+Description: FreeBSD ZFS library (udeb version)
  The Z file system is a pooled filesystem designed for maximum data integrity,
  supporting data snapshots, multiple copies, and data checksums.
  .
@@ -94,9 +71,9 @@
  This is a minimal package for use in debian-installer.
 
 Package: zfsutils
-Section: admin
 Architecture: kfreebsd-any
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Provides: libuutil0, libzpool0, libumem0
 Description: command-line tools to manage ZFS filesystems
  The Z file system is a pooled filesystem designed for maximum data integrity,
  supporting data snapshots, multiple copies, and data checksums.
@@ -105,11 +82,11 @@
  ZFS filesystems.
 
 Package: zfsutils-udeb
-XC-Package-Type: udeb
+Package-Type: udeb
 Section: debian-installer
 Architecture: kfreebsd-any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: command-line tools to manage ZFS filesystems
+Description: command-line tools to manage ZFS filesystems (udeb version)
  The Z file system is a pooled filesystem designed for maximum data integrity,
  supporting data snapshots, multiple copies, and data checksums.
  .
@@ -118,56 +95,3 @@
  .
  This is a minimal package for use in debian-installer.
 
-
-Package: libumem0
-Section: libs
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris name-value pair library
- This package contains the OpenSolaris libumem library, to detect
- memory management bugs in applications
-
-Package: libumem-dev
-Section: libdevel
-Architecture: kfreebsd-any
-Depends: libumem0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
-Description: Development files for libnvpair
- This package contains the header files and static library needed to
- compile applications that use libumem.
-
-Package: libumem0-udeb
-XC-Package-Type: udeb
-Section: debian-installer
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris name-value pair library
- This package contains the OpenSolaris libumem library, to detect
- memory management bugs in applications
-
-
-Package: libzpool0
-Section: libs
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris name-value pair library
- This package contains the OpenSolaris libzpool library.
- .
- This is a minimal package for use in debian-installer.
-
-Package: libzpool-dev
-Section: libdevel
-Architecture: kfreebsd-any
-Depends: libzpool0 (= ${binary:Version}), ${misc:Depends}, libc0.1-dev | libc-dev
-Description: Development files for libnvpair
- This package contains the header files and static library needed to
- compile applications that use libzpool.
-
-Package: libzpool0-udeb
-XC-Package-Type: udeb
-Section: debian-installer
-Architecture: kfreebsd-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: OpenSolaris name-value pair library
- This package contains the OpenSolaris libzpool library.
- .
- This is a minimal package for use in debian-installer.
diff -ruN zfsutils_old/zfsutils-8.2/debian/libumem0.install zfsutils/zfsutils-9/debian/libumem0.install
--- zfsutils_old/zfsutils-8.2/debian/libumem0.install	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libumem0.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libumem/libumem.so.0	lib
diff -ruN zfsutils_old/zfsutils-8.2/debian/libumem0-udeb.install zfsutils/zfsutils-9/debian/libumem0-udeb.install
--- zfsutils_old/zfsutils-8.2/debian/libumem0-udeb.install	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libumem0-udeb.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libumem/libumem.so.0	lib
diff -ruN zfsutils_old/zfsutils-8.2/debian/libumem-dev.install zfsutils/zfsutils-9/debian/libumem-dev.install
--- zfsutils_old/zfsutils-8.2/debian/libumem-dev.install	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libumem-dev.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libumem/libumem.a	usr/lib
diff -ruN zfsutils_old/zfsutils-8.2/debian/libumem-dev.links zfsutils/zfsutils-9/debian/libumem-dev.links
--- zfsutils_old/zfsutils-8.2/debian/libumem-dev.links	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libumem-dev.links	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-lib/libumem.so.0                 usr/lib/libumem.so
diff -ruN zfsutils_old/zfsutils-8.2/debian/libuutil0.install zfsutils/zfsutils-9/debian/libuutil0.install
--- zfsutils_old/zfsutils-8.2/debian/libuutil0.install	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libuutil0.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libuutil/libuutil.so.0	lib
diff -ruN zfsutils_old/zfsutils-8.2/debian/libuutil0-udeb.install zfsutils/zfsutils-9/debian/libuutil0-udeb.install
--- zfsutils_old/zfsutils-8.2/debian/libuutil0-udeb.install	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libuutil0-udeb.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libuutil/libuutil.so.0	lib
diff -ruN zfsutils_old/zfsutils-8.2/debian/libuutil-dev.install zfsutils/zfsutils-9/debian/libuutil-dev.install
--- zfsutils_old/zfsutils-8.2/debian/libuutil-dev.install	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libuutil-dev.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libuutil/libuutil.a	usr/lib
diff -ruN zfsutils_old/zfsutils-8.2/debian/libuutil-dev.links zfsutils/zfsutils-9/debian/libuutil-dev.links
--- zfsutils_old/zfsutils-8.2/debian/libuutil-dev.links	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libuutil-dev.links	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-lib/libuutil.so.0                 usr/lib/libuutil.so
diff -ruN zfsutils_old/zfsutils-8.2/debian/libzpool0.install zfsutils/zfsutils-9/debian/libzpool0.install
--- zfsutils_old/zfsutils-8.2/debian/libzpool0.install	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libzpool0.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libzpool/libzpool.so.0	lib
diff -ruN zfsutils_old/zfsutils-8.2/debian/libzpool0-udeb.install zfsutils/zfsutils-9/debian/libzpool0-udeb.install
--- zfsutils_old/zfsutils-8.2/debian/libzpool0-udeb.install	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libzpool0-udeb.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libzpool/libzpool.so.0	lib
diff -ruN zfsutils_old/zfsutils-8.2/debian/libzpool-dev.install zfsutils/zfsutils-9/debian/libzpool-dev.install
--- zfsutils_old/zfsutils-8.2/debian/libzpool-dev.install	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libzpool-dev.install	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-cddl/lib/libzpool/libzpool.a	usr/lib
diff -ruN zfsutils_old/zfsutils-8.2/debian/libzpool-dev.links zfsutils/zfsutils-9/debian/libzpool-dev.links
--- zfsutils_old/zfsutils-8.2/debian/libzpool-dev.links	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/libzpool-dev.links	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-lib/libzpool.so.0                 usr/lib/libzpool.so
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/01_glibc_kludge.diff zfsutils/zfsutils-9/debian/patches/01_glibc_kludge.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/01_glibc_kludge.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/01_glibc_kludge.diff	2011-10-10 21:48:26.367231308 -0400
@@ -17,9 +17,9 @@
  	int i, error;
 --- a/cddl/compat/opensolaris/misc/zmount.c
 +++ b/cddl/compat/opensolaris/misc/zmount.c
-@@ -92,6 +92,9 @@
- 	iov = NULL;
- 	iovlen = 0;
+@@ -95,6 +95,9 @@
+ 	if (mflag & MS_RDONLY)
+ 		build_iovec(&iov, &iovlen, "ro", NULL, 0);
  	build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
 +#ifndef __DECONST
 +#define __DECONST(type, var)	((type)(uintptr_t)(const void *)(var))
@@ -29,7 +29,7 @@
  	build_iovec(&iov, &iovlen, "from", __DECONST(char *, spec), (size_t)-1);
 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
-@@ -2265,7 +2265,7 @@
+@@ -2327,7 +2327,7 @@
  }
  
  static void
@@ -38,7 +38,7 @@
  {
  	clock_t			growtime = 0;
  	arc_reclaim_strategy_t	last_reclaim = ARC_RECLAIM_CONS;
-@@ -3771,7 +3771,7 @@
+@@ -3705,7 +3705,7 @@
  static eventhandler_tag arc_event_lowmem = NULL;
  
  static void
@@ -47,7 +47,7 @@
  {
  
  	/* Serialize access via arc_lowmem_lock. */
-@@ -4828,7 +4828,7 @@
+@@ -4767,7 +4767,7 @@
   * heart of the L2ARC.
   */
  static void
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/02_glibc_misc.diff zfsutils/zfsutils-9/debian/patches/02_glibc_misc.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/02_glibc_misc.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/02_glibc_misc.diff	2011-10-10 21:48:26.357568628 -0400
@@ -17,17 +17,6 @@
  #include <assert.h>
  
  /*
---- a/sys/cddl/compat/opensolaris/sys/sysmacros.h
-+++ b/sys/cddl/compat/opensolaris/sys/sysmacros.h
-@@ -107,7 +107,7 @@
-  * High order bit is 31 (or 63 in _LP64 kernel).
-  */
- static __inline int
--highbit(ulong_t i)
-+highbit(unsigned long i)
- {
- 	register int h = 1;
- 
 --- a/sys/cddl/compat/opensolaris/sys/time.h
 +++ b/sys/cddl/compat/opensolaris/sys/time.h
 @@ -29,7 +29,12 @@
@@ -43,3 +32,31 @@
  
  #define SEC		1
  #define MILLISEC	1000
+--- a/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h
++++ b/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h
+@@ -380,7 +380,7 @@
+  * High order bit is 31 (or 63 in _LP64 kernel).
+  */
+ static __inline int
+-highbit(ulong_t i)
++highbit(unsigned long i)
+ {
+ 	register int h = 1;
+ 
+--- a/sys/cddl/compat/opensolaris/sys/stat.h
++++ b/sys/cddl/compat/opensolaris/sys/stat.h
+@@ -32,11 +32,13 @@
+ 
+ #include_next <sys/stat.h>
+ 
++#ifndef __GLIBC__
+ #define	stat64	stat
++#endif
+ 
+ #define	MAXOFFSET_T	OFF_MAX
+ 
+-#ifndef _KERNEL
++#if !defined(_KERNEL) && !defined(__GLIBC__)
+ #include <sys/disk.h>
+ 
+ static __inline int
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/03_glibc_namespace.diff zfsutils/zfsutils-9/debian/patches/03_glibc_namespace.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/03_glibc_namespace.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/03_glibc_namespace.diff	2011-10-10 21:48:26.350507395 -0400
@@ -9,18 +9,6 @@
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c     |    2 +-
  8 files changed, 17 insertions(+), 10 deletions(-)
 
---- a/cddl/compat/opensolaris/include/solaris.h
-+++ b/cddl/compat/opensolaris/include/solaris.h
-@@ -5,6 +5,9 @@
- 
- #include <sys/ccompile.h>
- 
-+/* GNU libc has its own dirent64 declaration */
-+#ifndef __GLIBC__
- #define	dirent64	dirent
-+#endif
- 
- #endif	/* !_SOLARIS_H_ */
 --- a/cddl/compat/opensolaris/misc/fsshare.c
 +++ b/cddl/compat/opensolaris/misc/fsshare.c
 @@ -28,6 +28,7 @@
@@ -28,10 +16,10 @@
  
  #include <sys/param.h>
 +#include <sys/file.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <fcntl.h>
-@@ -67,7 +68,7 @@
+ 
+ #include <assert.h>
+ #include <errno.h>
+@@ -69,7 +70,7 @@
   * mountpoint specified in the 'skip' argument.
   */
  static char *
@@ -40,7 +28,7 @@
  {
  	static char line[MAXLINESIZE];
  	size_t len, skiplen;
-@@ -198,7 +199,7 @@
+@@ -200,7 +201,7 @@
  
  	/* Place big, fat warning at the begining of the file. */
  	fprintf(newfd, "%s", FILE_HEADER);
@@ -62,9 +50,9 @@
  	char *f, *opts = tmpopts;
 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
 +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
-@@ -1637,11 +1637,11 @@
- 	case ZFS_PROP_NBMAND:
- 		*val = getprop_uint64(zhp, prop, source);
+@@ -1735,11 +1735,11 @@
+ 		if (received)
+ 			break;
  
 -		if (hasmntopt(&mnt, mntopt_on) && !*val) {
 +		if (solaris_hasmntopt(&mnt, mntopt_on) && !*val) {
@@ -89,7 +77,7 @@
  
 --- a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
 +++ b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
-@@ -105,8 +105,8 @@
+@@ -107,8 +107,8 @@
  
  #define	ZFS_LOG(...)	do {  } while (0)
  
@@ -100,7 +88,7 @@
  
  #ifdef ZFS_DEBUG
  extern void dprintf_setup(int *argc, char **argv);
-@@ -445,7 +445,7 @@
+@@ -496,7 +496,7 @@
  extern int vn_openat(char *path, int x1, int oflags, int mode, vnode_t **vpp,
      int x2, int x3, vnode_t *vp, int fd);
  extern int vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len,
@@ -111,20 +99,20 @@
  #define	vn_remove(path, x1, x2)		remove(path)
 --- a/sys/cddl/compat/opensolaris/sys/dirent.h
 +++ b/sys/cddl/compat/opensolaris/sys/dirent.h
-@@ -32,7 +32,10 @@
- #include_next <sys/dirent.h>
- 
+@@ -36,7 +36,10 @@
  typedef	struct dirent	dirent64_t;
+ typedef ino_t		ino64_t;
+ 
 +/* GNU libc has its own dirent64 declaration */
 +#ifndef __GLIBC__
  #define	dirent64	dirent
 +#endif
- #define	ino64_t		ino_t
  
  #define	d_ino	d_fileno
+ 
 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
-@@ -710,7 +710,7 @@
+@@ -717,7 +717,7 @@
  zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
  {
  	znode_t		*zp = VTOZ(vp);
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/04_stdint.diff zfsutils/zfsutils-9/debian/patches/04_stdint.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/04_stdint.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/04_stdint.diff	2011-10-10 21:48:26.377780973 -0400
@@ -12,12 +12,12 @@
  
 -#include <sys/stdint.h>
 +#include <stdint.h>
- #include_next <sys/types.h>
  
- #define	MAXNAMELEN	256
+ #ifdef _KERNEL
+ typedef	int64_t		clock_t;
 --- a/sys/cddl/contrib/opensolaris/common/avl/avl.c
 +++ b/sys/cddl/contrib/opensolaris/common/avl/avl.c
-@@ -92,7 +92,7 @@
+@@ -89,7 +89,7 @@
  
  #include <sys/types.h>
  #include <sys/param.h>
@@ -28,7 +28,7 @@
  
 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
-@@ -33,7 +33,7 @@
+@@ -31,7 +31,7 @@
  #endif
  
  #include <sys/param.h>
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/05_makefile.diff zfsutils/zfsutils-9/debian/patches/05_makefile.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/05_makefile.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/05_makefile.diff	2011-10-10 21:48:26.373729900 -0400
@@ -11,21 +11,26 @@
 
 --- a/cddl/lib/libzfs/Makefile
 +++ b/cddl/lib/libzfs/Makefile
-@@ -7,7 +7,10 @@
+@@ -6,8 +6,14 @@
+ .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
  
  LIB=	zfs
- DPADD=	${LIBUTIL}
--LDADD=	-lutil
-+LDADD=	-lm -lbsd -lgeom -lnvpair -luutil
+-DPADD=	${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL}
+-LDADD=	-lmd -lpthread -lumem -lutil
++DPADD=	${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBMD}
++LDADD=	-lmd -lpthread -lm -lbsd -lgeom -lnvpair
 +
-+LDADD+= -L${.CURDIR}/../../../cddl/lib/libnvpair \
-+	-L${.CURDIR}/../../../cddl/lib/libuutil \
++LDADD+= -L${.CURDIR}/../../../cddl/lib/libnvpair
++LDADD+= -L${.CURDIR}/../../../cddl/lib/libuutil
++LDADD+= -L${.CURDIR}/../../../cddl/lib/libumem
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libuutil/libuutil.a
  
  SRCS=	deviceid.c \
  	fsshare.c \
 --- a/cddl/lib/libuutil/Makefile
 +++ b/cddl/lib/libuutil/Makefile
-@@ -22,4 +22,6 @@
+@@ -23,4 +23,6 @@
  CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
  CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
  
@@ -34,96 +39,110 @@
  .include <bsd.lib.mk>
 --- a/cddl/sbin/zfs/Makefile
 +++ b/cddl/sbin/zfs/Makefile
-@@ -19,9 +19,12 @@
- CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+@@ -21,8 +21,15 @@
  CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
+ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
  
--DPADD=	${LIBZFS} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} \
--	${LIBM} ${LIBNVPAIR} ${LIBUUTIL} ${LIBUTIL}
--LDADD=	-lzfs -lgeom -lbsdxml -lsbuf \
--	-lm -lnvpair -luutil -lutil
-+DPADD=	${LIBZFS} ${LIBGEOM} \
-+	${LIBM} ${LIBNVPAIR} ${LIBUUTIL}
-+LDADD=	-lzfs -lgeom -lnvpair -luutil -lbsd
+-DPADD=	${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \
+-	${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
+-LDADD=	-lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
++DPADD=	${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} \
++	${LIBUUTIL} ${LIBZFS}
++LDADD=	-lbsd -lgeom -lm -lnvpair -lzfs
 +
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzfs \
 +       -L${.CURDIR}/../../../cddl/lib/libnvpair \
-+       -L${.CURDIR}/../../../cddl/lib/libuutil 
++       -L${.CURDIR}/../../../cddl/lib/libuutil \
++       -L${.CURDIR}/../../../cddl/lib/libumem
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libuutil/libuutil.a
  
  .include <bsd.prog.mk>
 --- a/cddl/sbin/zpool/Makefile
 +++ b/cddl/sbin/zpool/Makefile
-@@ -21,9 +21,10 @@
- CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
- CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
- 
--DPADD=	${LIBAVL} ${LIBZFS} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} \
--	${LIBM} ${LIBNVPAIR} ${LIBUUTIL} ${LIBUTIL}
--LDADD=	-lavl -lzfs -lgeom -lbsdxml -lsbuf \
--	-lm -lnvpair -luutil -lutil
-+DPADD=	${LIBZFS} ${LIBGEOM} ${LIBNVPAIR} ${LIBUUTIL}
-+LDADD=	-lzfs -lgeom -lnvpair -luutil -lbsd
+@@ -26,8 +26,14 @@
+ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
+ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
+ 
+-DPADD=	${LIBAVL} ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \
+-	${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
+-LDADD=	-lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
++DPADD=  ${LIBZFS} ${LIBGEOM} ${LIBNVPAIR} ${LIBUUTIL} ${LIBUMEM}
++LDADD= -lzfs -lgeom -lnvpair -lbsd
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzfs \
-+	-L${.CURDIR}/../../../cddl/lib/libnvpair \
-+	-L${.CURDIR}/../../../cddl/lib/libuutil
++       -L${.CURDIR}/../../../cddl/lib/libnvpair \
++       -L${.CURDIR}/../../../cddl/lib/libuutil \
++       -L${.CURDIR}/../../../cddl/lib/libumem
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libuutil/libuutil.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libavl/libavl.a
  
  .include <bsd.prog.mk>
 --- a/cddl/usr.sbin/zdb/Makefile
 +++ b/cddl/usr.sbin/zdb/Makefile
-@@ -21,7 +21,12 @@
+@@ -25,7 +25,14 @@
  
  DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
  	${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL}
 -LDADD=	-lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
-+LDADD=	-lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
+-
++LDADD=	-lgeom -lm -lnvpair -lpthread -lz -lzfs -lbsd -lmd
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libumem
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzpool
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libnvpair
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libuutil
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzfs
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libuutil/libuutil.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libzpool/libzpool.a
  
- CSTD=	c99
- 
+ .include <bsd.prog.mk>
 --- a/cddl/usr.bin/zinject/Makefile
 +++ b/cddl/usr.bin/zinject/Makefile
-@@ -20,6 +20,11 @@
+@@ -21,6 +21,12 @@
  
  DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
- 	${LIBZFS} ${LIBZPOOL} ${LIBUUTIL}
+ 	${LIBZFS} ${LIBZPOOL}
 -LDADD=	-lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
-+LDADD=	-lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
++LDADD= -lbsd -lgeom -lm -lnvpair -lzfs -lmd -lz
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzpool
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libumem
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libnvpair
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libuutil
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzfs
++LDADD+= ${.CURDIR}/../../../cddl/lib/libzpool/libzpool.a
  
  .include <bsd.prog.mk>
 --- a/cddl/usr.bin/ztest/Makefile
 +++ b/cddl/usr.bin/ztest/Makefile
-@@ -17,7 +17,10 @@
+@@ -19,7 +19,14 @@
  
  DPADD=	${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
  	${LIBPTHREAD} ${LIBZ} ${LIBAVL}
 -LDADD=	-lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
-+LDADD=	-lm -lnvpair -lumem -lzpool -lpthread -lz -lrt -ldl -lbsd
++LDADD=	-lm -lnvpair -lpthread -lz -lrt -ldl -lbsd -lmd
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libzpool
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libumem
 +LDADD+= -L${.CURDIR}/../../../cddl/lib/libnvpair
++LDADD+= ${.CURDIR}/../../../cddl/lib/libumem/libumem.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libzpool/libzpool.a
++LDADD+= ${.CURDIR}/../../../cddl/lib/libavl/libavl.a
++
  
  CSTD=	c99
  
 --- a/cddl/lib/libzpool/Makefile
 +++ b/cddl/lib/libzpool/Makefile
-@@ -53,7 +53,10 @@
- CFLAGS+=	-I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_ARCH}/include
+@@ -57,7 +57,11 @@
+ CFLAGS+=	-I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include
  
- DPADD=		${LIBPTHREAD} ${LIBZ}
--LDADD=		-lpthread -lz
-+LDADD=		-lpthread -lz -lrt -lbsd -lnvpair -lumem
-+LDADD+=	-L${.CURDIR}/../../../cddl/lib/libnvpair
-+LDADD+=	-L${.CURDIR}/../../../cddl/lib/libumem
-+LDADD+=	${.CURDIR}/../../../cddl/lib/libavl/libavl.a
+ DPADD=		${LIBMD} ${LIBPTHREAD} ${LIBZ}
+-LDADD=		-lmd -lpthread -lz
++LDADD+=         -lmd -lpthread -lz -lrt -lbsd -lnvpair -lumem
++LDADD+=         -L${.CURDIR}/../../../cddl/lib/libnvpair
++LDADD+=         -L${.CURDIR}/../../../cddl/lib/libumem
++LDADD+=         ${.CURDIR}/../../../cddl/lib/libavl/libavl.a
++
  
  # atomic.S doesn't like profiling.
  NO_PROFILE=
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/06_mountd.diff zfsutils/zfsutils-9/debian/patches/06_mountd.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/06_mountd.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/06_mountd.diff	2011-10-10 21:48:26.347482430 -0400
@@ -4,15 +4,15 @@
 
 --- a/cddl/compat/opensolaris/misc/fsshare.c
 +++ b/cddl/compat/opensolaris/misc/fsshare.c
-@@ -36,7 +36,6 @@
- #include <errno.h>
+@@ -35,7 +35,6 @@
+ #include <fcntl.h>
+ #include <fsshare.h>
  #include <libutil.h>
- #include <assert.h>
 -#include <pathnames.h>	/* _PATH_MOUNTDPID */
- #include <fsshare.h>
- 
- #define	FILE_HEADER	"# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n"
-@@ -46,6 +45,9 @@
+ #include <signal.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -48,6 +47,9 @@
  static void
  restart_mountd(void)
  {
@@ -22,7 +22,7 @@
  	struct pidfh *pfh;
  	pid_t mountdpid;
  
-@@ -61,6 +63,7 @@
+@@ -63,6 +65,7 @@
  	}
  	/* We have mountd(8) PID in mountdpid varible. */
  	kill(mountdpid, SIGHUP);
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/07_manpages.diff zfsutils/zfsutils-9/debian/patches/07_manpages.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/07_manpages.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/07_manpages.diff	2011-10-10 21:48:26.341930607 -0400
@@ -5,23 +5,34 @@
 
 --- a/cddl/contrib/opensolaris/cmd/zfs/zfs.8
 +++ b/cddl/contrib/opensolaris/cmd/zfs/zfs.8
-@@ -6,7 +6,7 @@
- .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
- .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with
+@@ -8,7 +8,7 @@
  .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
--.TH zfs 1M "5 May 2009" "SunOS 5.11" "System Administration Commands"
-+.TH zfs 8 "5 May 2009" "SunOS 5.11" "System Administration Commands"
+ .\" Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ .\" Copyright 2011 by Delphix.  All rights reserved.
+-.TH zfs 1M "24 Sep 2009" "SunOS 5.11" "System Administration Commands"
++.TH zfs 8 "24 Sep 2009" "SunOS 5.11" "System Administration Commands"
  .SH NAME
  zfs \- configures ZFS file systems
  .SH SYNOPSIS
 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool.8
 +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool.8
 @@ -3,7 +3,7 @@
- .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
- .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
- .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
--.TH zpool 1M "5 Mar 2009" "SunOS 5.11" "System Administration Commands"
-+.TH zpool 8 "5 Mar 2009" "SunOS 5.11" "System Administration Commands"
+ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
+ .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the
+ .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
+-.TH zpool 1M "21 Sep 2009" "SunOS 5.11" "System Administration Commands"
++.TH zpool 8 "21 Sep 2009" "SunOS 5.11" "System Administration Commands"
  .SH NAME
  zpool \- configures ZFS storage pools
  .SH SYNOPSIS
+--- a/cddl/contrib/opensolaris/cmd/zdb/zdb.8
++++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.8
+@@ -3,7 +3,7 @@
+ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
+ .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
+ .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
+-.TH zdb 1M "31 Oct 2005" "SunOS 5.11" "System Administration Commands"
++.TH zdb 8 "31 Oct 2005" "SunOS 5.11" "System Administration Commands"
+ .SH NAME
+ zdb \- ZFS debugger
+ .SH SYNOPSIS
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/08_libbsd.diff zfsutils/zfsutils-9/debian/patches/08_libbsd.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/08_libbsd.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/08_libbsd.diff	2011-10-10 21:48:26.362614241 -0400
@@ -78,11 +78,12 @@
  #include <fcntl.h>
 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
 +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
-@@ -74,6 +74,7 @@
+@@ -74,6 +74,8 @@
  #include <sys/disk.h>
  #include <sys/mntent.h>
  #include <libgeom.h>
 +#include <bsd/string.h>
++#include <sys/limits.h>
  
  #include "zpool_util.h"
  
@@ -109,8 +110,8 @@
 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
 +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
 @@ -51,6 +51,7 @@
- #include <unistd.h>
  #include <fcntl.h>
+ #include <thread_pool.h>
  #include <libgeom.h>
 +#include <bsd/string.h>
  
@@ -118,7 +119,7 @@
  
 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
 +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
-@@ -76,6 +76,7 @@
+@@ -72,6 +72,7 @@
  #include <sys/mntent.h>
  #include <sys/mount.h>
  #include <sys/stat.h>
@@ -128,34 +129,24 @@
  
 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
 +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
-@@ -41,6 +41,7 @@
+@@ -36,6 +36,7 @@
+ #include <unistd.h>
  #include <sys/zfs_ioctl.h>
- #include <sys/zio.h>
- #include <umem.h>
+ #include <dlfcn.h>
 +#include <bsd/string.h>
  
  #include "zfs_namecheck.h"
  #include "zfs_prop.h"
 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
 +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
-@@ -40,6 +40,7 @@
- #include <sys/mnttab.h>
- #include <sys/avl.h>
- #include <stddef.h>
+@@ -37,6 +37,7 @@
+ #include <sys/mount.h>
+ #include <pthread.h>
+ #include <umem.h>
 +#include <bsd/string.h>
  
  #include <libzfs.h>
  
---- a/cddl/compat/opensolaris/misc/fsshare.c
-+++ b/cddl/compat/opensolaris/misc/fsshare.c
-@@ -37,6 +37,7 @@
- #include <libutil.h>
- #include <assert.h>
- #include <fsshare.h>
-+#include <bsd/string.h>
- 
- #define	FILE_HEADER	"# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n"
- #define	OPTSSIZE	1024
 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
 +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
 @@ -31,6 +31,7 @@
@@ -168,7 +159,7 @@
  #include <stddef.h>
 --- a/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
 +++ b/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
-@@ -28,6 +28,7 @@
+@@ -27,6 +27,7 @@
  #include <poll.h>
  #include <stdio.h>
  #include <stdlib.h>
@@ -178,7 +169,7 @@
  #include <sys/spa.h>
 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
 +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
-@@ -36,6 +36,7 @@
+@@ -35,6 +35,7 @@
  #include <locale.h>
  #include <stdio.h>
  #include <stdlib.h>
@@ -188,7 +179,7 @@
  #include <unistd.h>
 --- a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
 +++ b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
-@@ -50,6 +50,7 @@
+@@ -49,6 +49,7 @@
  #include <fcntl.h>
  #include <unistd.h>
  #include <errno.h>
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/10_zpool_import.diff zfsutils/zfsutils-9/debian/patches/10_zpool_import.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/10_zpool_import.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/10_zpool_import.diff	1969-12-31 19:00:00.000000000 -0500
@@ -1,73 +0,0 @@
----
- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c |   26 +++++--------
- 1 file changed, 10 insertions(+), 16 deletions(-)
-
---- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
-+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
-@@ -845,8 +845,6 @@
- 	DIR *dirp = NULL;
- 	struct dirent64 *dp;
- 	char path[MAXPATHLEN];
--	char *end;
--	size_t pathleft;
- 	struct stat64 statbuf;
- 	nvlist_t *ret = NULL, *config;
- 	static char *default_dir = "/dev/dsk";
-@@ -873,6 +871,11 @@
- 		char *rdsk;
- 		int dfd;
- 
-+		if (strcmp(argv[i], default_dir) == 0) {
-+			geom_find_import(hdl, &pools);
-+			continue;
-+		}
-+
- 		/* use realpath to normalize the path */
- 		if (realpath(argv[i], path) == 0) {
- 			(void) zfs_error_fmt(hdl, EZFS_BADPATH,
-@@ -880,15 +883,6 @@
- 			    argv[i]);
- 			goto error;
- 		}
--		end = &path[strlen(path)];
--		*end++ = '/';
--		*end = 0;
--		pathleft = &path[sizeof (path)] - end;
--
--		if (strcmp(argv[i], default_dir) == 0) {
--			geom_find_import(hdl, &pools);
--			continue;
--		}
- 
- 		/*
- 		 * Using raw devices instead of block devices when we're
-@@ -912,15 +906,16 @@
- 		 * This is not MT-safe, but we have no MT consumers of libzfs
- 		 */
- 		while ((dp = readdir64(dirp)) != NULL) {
-+	                char devpath[MAXPATHLEN];
- 			const char *name = dp->d_name;
- 			if (name[0] == '.' &&
- 			    (name[1] == 0 || (name[1] == '.' && name[2] == 0)))
- 				continue;
- 
--			(void) snprintf(path, sizeof (path), "%s/%s", rdsk,
--			    dp->d_name);
-+			(void) snprintf(devpath, sizeof (devpath), "%s/%s",
-+			    rdsk, dp->d_name);
- 
--			if ((fd = open64(path, O_RDONLY)) < 0)
-+			if ((fd = open64(devpath, O_RDONLY)) < 0)
- 				continue;
- 
- 			/*
-@@ -967,8 +962,7 @@
- 					continue;
- 				}
- 				/* use the non-raw path for the config */
--				(void) strlcpy(end, name, pathleft);
--				if (add_config(hdl, &pools, path, config) != 0)
-+				if (add_config(hdl, &pools, devpath, config) != 0)
- 					goto error;
- 			}
- 		}
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/11_endian.diff zfsutils/zfsutils-9/debian/patches/11_endian.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/11_endian.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/11_endian.diff	2011-10-10 21:48:26.388355781 -0400
@@ -23,12 +23,21 @@
   */
 -#if _BYTE_ORDER == _BIG_ENDIAN
 +#if BYTE_ORDER == BIG_ENDIAN
- #define	LE_64(x)	BSWAP_64(x)
+ #define	BE_8(x)		BMASK_8(x)
+ #define	BE_16(x)	BMASK_16(x)
+ #define	BE_32(x)	BMASK_32(x)
+@@ -78,7 +80,7 @@
+ #define	BE_64(x)	BSWAP_64(x)
+ #endif
+ 
+-#if _BYTE_ORDER == _BIG_ENDIAN
++#if BYTE_ORDER == BIG_ENDIAN
+ #define	htonll(x)	BMASK_64(x)
+ #define	ntohll(x)	BMASK_64(x)
  #else
- #define	LE_64(x)	BMASK_64(x)
 --- a/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c
 +++ b/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c
-@@ -36,6 +36,7 @@
+@@ -33,6 +33,7 @@
  #include <sys/varargs.h>
  #include <sys/sunddi.h>
  #else
@@ -36,7 +45,7 @@
  #include <stdarg.h>
  #include <stdlib.h>
  #include <string.h>
-@@ -2199,11 +2200,11 @@
+@@ -2251,11 +2252,11 @@
  	int err = 0;
  	nvstream_t nvs;
  	int nvl_endian;
@@ -61,7 +70,7 @@
  #ifdef	__cplusplus
  extern "C" {
  #endif
-@@ -299,7 +301,7 @@
+@@ -329,7 +331,7 @@
   * Note: the byteorder is either 0 or -1, both of which are palindromes.
   * This simplifies the endianness handling a bit.
   */
@@ -70,35 +79,6 @@
  #define	ZFS_HOST_BYTEORDER	(0ULL)
  #else
  #define	ZFS_HOST_BYTEORDER	(-1ULL)
---- a/sys/cddl/contrib/opensolaris/uts/common/sys/byteorder.h
-+++ b/sys/cddl/contrib/opensolaris/uts/common/sys/byteorder.h
-@@ -48,6 +48,8 @@
- #include <asm/byteorder.h>
- #endif
- 
-+#include <endian.h>
-+
- #ifdef	__cplusplus
- extern "C" {
- #endif
-@@ -56,7 +58,7 @@
-  * macros for conversion between host and (internet) network byte order
-  */
- 
--#if BYTE_ORDER == _BIG_ENDIAN && !defined(ntohl) && !defined(__lint)
-+#if BYTE_ORDER == BIG_ENDIAN && !defined(ntohl) && !defined(__lint)
- /* big-endian */
- #define	ntohl(x)	(x)
- #define	ntohs(x)	(x)
-@@ -141,7 +143,7 @@
- /*
-  * Macros to convert from a specific byte order to/from native byte order
-  */
--#if BYTE_ORDER == _BIG_ENDIAN
-+#if BYTE_ORDER == BIG_ENDIAN
- #define	BE_8(x)		BMASK_8(x)
- #define	BE_16(x)	BMASK_16(x)
- #define	BE_32(x)	BMASK_32(x)
 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
 +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
 @@ -29,6 +29,8 @@
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/12_freebsd.diff zfsutils/zfsutils-9/debian/patches/12_freebsd.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/12_freebsd.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/12_freebsd.diff	2011-10-10 21:48:26.335887939 -0400
@@ -8,73 +8,31 @@
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c |    2 +-
  7 files changed, 10 insertions(+), 10 deletions(-)
 
---- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
-+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
-@@ -601,7 +601,7 @@
- extern int zpool_enable_datasets(zpool_handle_t *, const char *, int);
- extern int zpool_disable_datasets(zpool_handle_t *, boolean_t);
- 
--#ifdef	__FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- extern int zmount(const char *, const char *, int, char *, char *, int, char *,
-     int);
- #endif
---- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
-+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
-@@ -190,7 +190,7 @@
- extern int zfs_unshare_proto(zfs_handle_t *,
-     const char *, zfs_share_proto_t *);
- 
--#ifdef	__FreeBSD__
-+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- 
- /*
-  * This is FreeBSD version of ioctl, because Solaris' ioctl() updates
---- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
-+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
-@@ -726,7 +726,7 @@
- 	return (err);
- }
- 
--#ifndef __FreeBSD__
-+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
- int
- dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
-     page_t *pp, dmu_tx_t *tx)
-@@ -781,7 +781,7 @@
- 	dmu_buf_rele_array(dbp, numbufs, FTAG);
- 	return (err);
- }
--#endif	/* !__FreeBSD__ */
-+#endif	/* !__FreeBSD__ && !__FreeBSD_kernel__ */
- #endif	/* _KERNEL */
- 
- /*
 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h
 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h
-@@ -51,7 +51,7 @@
- extern int zvol_open(dev_t *devp, int flag, int otyp, cred_t *cr);
- extern int zvol_dump(dev_t dev, caddr_t addr, daddr_t offset, int nblocks);
- extern int zvol_close(dev_t dev, int flag, int otyp, cred_t *cr);
--#ifndef __FreeBSD__
-+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
- extern int zvol_strategy(buf_t *bp);
- extern int zvol_read(dev_t dev, uio_t *uiop, cred_t *cr);
- extern int zvol_write(dev_t dev, uio_t *uiop, cred_t *cr);
+@@ -71,7 +71,7 @@
+     ssize_t resid, boolean_t sync);
+ #endif	/* sun */
+ 
+-#ifdef __FreeBSD__
++#ifdef defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ extern int zvol_create_minors(const char *name);
+ extern void zvol_rename_minors(const char *oldname, const char *newname);
+ #endif
 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
-@@ -1878,7 +1878,7 @@
+@@ -1681,7 +1681,7 @@
  			} else {
  				acl_ids->z_fgid = zfs_fuid_create_cred(zfsvfs,
  				    ZFS_GROUP, cr, &acl_ids->z_fuidp);
 -#ifdef __FreeBSD__
 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- 				gid = acl_ids->z_fgid = dzp->z_phys->zp_gid;
+ 				gid = acl_ids->z_fgid = dzp->z_gid;
  #else
  				gid = crgetgid(cr);
-@@ -2562,7 +2562,7 @@
- 	is_attr = ((zp->z_phys->zp_flags & ZFS_XATTR) &&
- 	    (ZTOV(zp)->v_type == VDIR));
+@@ -2371,7 +2371,7 @@
+ 
+ 	is_attr = ((zp->z_pflags & ZFS_XATTR) && (ZTOV(zp)->v_type == VDIR));
  
 -#ifdef __FreeBSD__
 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
@@ -83,7 +41,7 @@
  	 * Note that not checking them is not just an optimization - without
 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
-@@ -833,7 +833,7 @@
+@@ -919,7 +919,7 @@
  	 * In FreeBSD, access checking for creating an EA is being done
  	 * in zfs_setextattr(),
  	 */
@@ -92,7 +50,7 @@
  	if (error = zfs_zaccess(zp, ACE_WRITE_NAMED_ATTRS, 0, B_FALSE, cr))
  		return (error);
  #endif
-@@ -916,7 +916,7 @@
+@@ -1012,7 +1012,7 @@
  
  	if (!(flags & CREATE_XATTR_DIR)) {
  		zfs_dirent_unlock(dl);
@@ -103,7 +61,7 @@
  		return (ENOENT);
 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
-@@ -1385,7 +1385,7 @@
+@@ -1804,7 +1804,7 @@
  		rrw_exit(&zfsvfs->z_teardown_lock, FTAG);
  		rw_exit(&zfsvfs->z_teardown_inactive_lock);
  
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/13_mnttab.diff zfsutils/zfsutils-9/debian/patches/13_mnttab.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/13_mnttab.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/13_mnttab.diff	2011-10-10 21:48:26.337906073 -0400
@@ -12,4 +12,4 @@
 +#define	MNTTAB		_PATH_MNTTAB
  #define	MNT_LINE_MAX	1024
  
- #define	umount2(p, f)	unmount(p, f)
+ #define	MS_OVERLAY	0x0
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/14_bootloader_advice.diff zfsutils/zfsutils-9/debian/patches/14_bootloader_advice.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/14_bootloader_advice.diff	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/14_bootloader_advice.diff	2011-10-10 21:48:26.391497800 -0400
@@ -13,7 +13,7 @@
 
 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
 +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
-@@ -3609,11 +3609,11 @@
+@@ -4249,11 +4249,11 @@
  
  	if (cb.cb_poolname[0] != '\0') {
  		(void) printf(
@@ -30,7 +30,7 @@
  
 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
 +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
-@@ -1895,11 +1895,11 @@
+@@ -2473,11 +2473,11 @@
  			(void) fprintf(stderr, dgettext(TEXT_DOMAIN, "If "
  			    "you boot from pool '%s', you may need to update\n"
  			    "boot code on newly attached disk '%s'.\n\n"
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/15_pthread_compat.diff zfsutils/zfsutils-9/debian/patches/15_pthread_compat.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/15_pthread_compat.diff	1969-12-31 19:00:00.000000000 -0500
+++ zfsutils/zfsutils-9/debian/patches/15_pthread_compat.diff	2011-10-10 21:48:26.339914987 -0400
@@ -0,0 +1,32 @@
+--- a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
++++ b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
+@@ -251,7 +251,28 @@
+ #undef	MUTEX_NOT_HELD
+ #define	MUTEX_HELD(m)	((m)->m_owner == curthread)
+ #define	MUTEX_NOT_HELD(m) (!MUTEX_HELD(m))
+-#define	_mutex_held(m)	pthread_mutex_isowned_np(m)
++/*
++ * glibc/pthread does not define pthread_mutex_isowned_np()
++ * That's a FreeBSD extension available in libthr. Its code is
++ *
++ * int
++ * _pthread_mutex_isowned_np(pthread_mutex_t *mutex)
++ * {
++ *       struct pthread_mutex    *m;
++ *
++ *       m = *mutex;
++ *       if (m <= THR_MUTEX_DESTROYED)
++ *               return (0);
++ *       return (m->m_owner == _get_curthread());
++ * }
++ * Unfortunately we do not support either, this symbol or pthread_mutex as
++ * struct.
++ * In our phtread implementation, pthread_mutex is typedefed to int, on FreeBSD
++ * it's a struct. Hence We can't simply wrap the missing code. Fortunately the code
++ * using _pthread_mutex_isowned_np currently does so in a assert() only,
++ * so we /may/ be safe if our code never "fails". For now.
++ */
++#define	_mutex_held(m)	(1)
+ 
+ /*
+  * Argh -- we have to get cheesy here because the kernel and userland
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/15_ztest.fix zfsutils/zfsutils-9/debian/patches/15_ztest.fix
--- zfsutils_old/zfsutils-8.2/debian/patches/15_ztest.fix	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/15_ztest.fix	1969-12-31 19:00:00.000000000 -0500
@@ -1,31 +0,0 @@
-From: Arno Töll <debian@toell.net>
-Subject: Fix assertion problems for ztest
-
-* cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Fix path problems
-
-Origin: upstream, 
-	http://freshbsd.org/2010/11/01/10/41/05
-
-Cherry pick patch from upstream to get the `ztest' binary working in the 
- current Debian version of zfsutils. This patch may be removed, as soon
- as a more recent vesion of zfsutils is shipped with Debian
-
-Last-Update: 2011-04-22
-
----
- cddl/contrib/opensolaris/cmd/ztest/ztest.c |    4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/cddl/contrib/opensolaris/cmd/ztest/ztest.c
-+++ b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
-@@ -3362,8 +3362,8 @@
- 	int isalen;
- 	FILE *fp;
- 
--	if (realpath(progname, zdb) == NULL)
--		assert(!"realpath() failed");
-+	
-+	strlcpy(zdb, "/usr/bin/ztest", sizeof(zdb));
- 
- 	/* zdb lives in /usr/sbin, while ztest lives in /usr/bin */
- 	bin = strstr(zdb, "/usr/bin/");
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/16-wrap-cdefs.diff zfsutils/zfsutils-9/debian/patches/16-wrap-cdefs.diff
--- zfsutils_old/zfsutils-8.2/debian/patches/16-wrap-cdefs.diff	1969-12-31 19:00:00.000000000 -0500
+++ zfsutils/zfsutils-9/debian/patches/16-wrap-cdefs.diff	2011-10-10 21:48:26.345465693 -0400
@@ -0,0 +1,42 @@
+--- a/sys/cddl/compat/opensolaris/sys/misc.h
++++ b/sys/cddl/compat/opensolaris/sys/misc.h
+@@ -31,7 +31,11 @@
+ 
+ #include <sys/limits.h>
+ 
++#ifndef UID_MAX
++#define MAXUID UINT_MAX
++#else
+ #define	MAXUID	UID_MAX
++#endif
+ 
+ #define	SPEC_MAXOFFSET_T	OFF_MAX
+ 
+--- a/sys/cddl/compat/opensolaris/sys/vnode.h
++++ b/sys/cddl/compat/opensolaris/sys/vnode.h
+@@ -116,7 +116,11 @@
+ #define	va_blksize	va_blocksize
+ #define	va_seq		va_gen
+ 
++#ifndef OFF_MAX
++#define MAXOFFSET_T	__OFF_MAX
++#else
+ #define	MAXOFFSET_T	OFF_MAX
++#endif
+ #define	EXCL		0
+ 
+ #define	ACCESSED		(AT_ATIME)
+--- a/sys/cddl/compat/opensolaris/sys/stat.h
++++ b/sys/cddl/compat/opensolaris/sys/stat.h
+@@ -36,7 +36,11 @@
+ #define	stat64	stat
+ #endif
+ 
++#ifndef OFF_MAX
++#define MAXOFFSET_T	__OFF_MAX
++#else
+ #define	MAXOFFSET_T	OFF_MAX
++#endif
+ 
+ #if !defined(_KERNEL) && !defined(__GLIBC__)
+ #include <sys/disk.h>
diff -ruN zfsutils_old/zfsutils-8.2/debian/patches/series zfsutils/zfsutils-9/debian/patches/series
--- zfsutils_old/zfsutils-8.2/debian/patches/series	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/patches/series	2011-10-10 21:48:26.381293431 -0400
@@ -7,9 +7,9 @@
 07_manpages.diff
 08_libbsd.diff
 09_xdr_control.diff
-10_zpool_import.diff
 11_endian.diff
 12_freebsd.diff
 13_mnttab.diff
 14_bootloader_advice.diff
-15_ztest.fix
+15_pthread_compat.diff
+16-wrap-cdefs.diff
diff -ruN zfsutils_old/zfsutils-8.2/debian/rules zfsutils/zfsutils-9/debian/rules
--- zfsutils_old/zfsutils-8.2/debian/rules	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/rules	2011-10-18 21:22:01.922550770 -0400
@@ -20,10 +20,13 @@
 endif
 
 SOURCE = zfsutils
-VERSION = $(shell dpkg-parsechangelog | sed -e '/^Version:/!d' -e 's/^Version: //g' -e 's/-.*//g')
-SVN = http://svn.freebsd.org/base/release/$(VERSION).0
+VERSION := $(shell dpkg-parsechangelog | sed -ne 's,^Version: *\(.*\)-[0-9]*$$,\1,p')
+SVN_REVISION := $(shell echo $(VERSION) | cut -d \~ -f2 | sed 's/svn//')
+VERSION := $(shell echo $(VERSION) | cut -d . -f1)
+SVN = http://svn.freebsd.org/base/stable/$(VERSION)/
+#SVN = http://svn.freebsd.org/base/release/$(VERSION).0
 ORIGDIR = $(SOURCE)-$(VERSION)
-TARNAME = $(SOURCE)_$(VERSION).orig.tar.gz
+TARNAME = $(SOURCE)_$(VERSION).0~svn$(SVN_REVISION).orig.tar.gz
 
 PATH := /usr/lib/freebsd:$(PATH)
 DESTDIR = $(CURDIR)/debian/tmp
@@ -33,6 +36,8 @@
 export SHLIBDIR = ./
 
 get-orig-source:
+	@echo "Version: $(VERSION)"
+	@echo "SVN Revision: $(SVN_REVISION)"
 	rm -rf $(ORIGDIR)
 	for i in \
 	         cddl/compat/opensolaris \
@@ -46,6 +51,7 @@
 	         cddl/contrib/opensolaris/lib/libuutil \
 	         cddl/contrib/opensolaris/lib/libzfs \
 	         cddl/contrib/opensolaris/lib/libzpool \
+		 cddl/contrib/opensolaris/cmd/stat/common/ \
 	         sys/cddl/compat/opensolaris \
 	         sys/cddl/contrib/opensolaris \
 	         cddl/lib/libavl \
@@ -60,7 +66,7 @@
 	         cddl/usr.bin/ztest \
 	         cddl/usr.sbin/zdb \
 	         ; do \
-	    svn export $(SVN)/$$i $(ORIGDIR)/$$i ; \
+	    svn export $(SVN)/$$i -r $(SVN_REVISION) $(ORIGDIR)/$$i ; \
 	done
 	rm -f $(ORIGDIR)/cddl/compat/opensolaris/include/alloca.h
 	rm -f $(ORIGDIR)/cddl/compat/opensolaris/include/stdlib.h
@@ -68,7 +74,12 @@
 	tar --numeric-owner --owner 0 --group 0 -czf ../$(TARNAME) $(ORIGDIR)
 	rm -rf $(ORIGDIR)
 
-build: build-libuutil build-libnvpair build-libzfs build-libumem build-libzpool build-zfsutils build-libavl
+build: build-arch build-indep
+
+build-arch: build-libuutil build-libnvpair build-libzfs build-libumem build-libzpool build-zfsutils build-libavl
+
+build-indep:
+	# We have nothing to do
 
 build-libuutil: build-libuutil-stamp
 build-libuutil-stamp:
@@ -92,7 +103,7 @@
 	touch $@
 
 build-libzfs: build-libzfs-stamp
-build-libzfs-stamp: build-libnvpair-stamp build-libuutil-stamp
+build-libzfs-stamp: build-libnvpair-stamp build-libuutil-stamp build-libumem-stamp
 	$(PMAKE) -C $(CURDIR)/cddl/lib/libzfs
 	touch $@
 
@@ -131,6 +142,8 @@
 	$(PMAKE) -C $(CURDIR)/cddl/usr.bin/zinject clean
 
 	rm -f *stamp
+	rm -f debian/zpool.8 debian/zfs.8 debian/zdb.8
+
 	dh_clean
 
 install: build
@@ -144,8 +157,16 @@
 binary-indep: build install
 # We have nothing to do by default.
 
+
+manpages:
+	# Replace the hyphen used in man pages by the minus sign.
+	set -e
+	cat cddl/contrib/opensolaris/cmd/zpool/zpool.8 | perl -pi -e 's/(?<!\\)(?<!\.in |\.ll |\.po |\.ti |\.ce )-/\\-/g' > debian/zpool.8
+	cat cddl/contrib/opensolaris/cmd/zfs/zfs.8 | perl -pi -e 's/(?<!\\)(?<!\.in |\.ll |\.po |\.ti |\.ce )-/\\-/g' > debian/zfs.8
+	zcat cddl/usr.sbin/zdb/zdb.8.gz | perl -pi -e 's/(?<!\\)(?<!\.in |\.ll |\.po |\.ti |\.ce )-/\\-/g' > debian/zdb.8
+
 # Build architecture-dependent files here.
-binary-arch: build install
+binary-arch: build install manpages
 	dh_testdir
 	dh_testroot
 	dh_installchangelogs -a
@@ -163,10 +184,7 @@
 #	dh_python
 	dh_makeshlibs -a
 	dh_makeshlibs -plibnvpair0 --add-udeb=libnvpair0-udeb
-	dh_makeshlibs -plibuutil0 --add-udeb=libuutil0-udeb
 	dh_makeshlibs -plibzfs0 --add-udeb=libzfs0-udeb
-	dh_makeshlibs -plibzpool0 --add-udeb=libzpool0-udeb
-	dh_makeshlibs -plibumem0 --add-udeb=libumem0-udeb
 	dh_makeshlibs -pzfsutils --add-udeb=zfsutils-udeb
 	dh_installdeb -a
 	dh_shlibdeps -a
@@ -175,4 +193,4 @@
 	dh_builddeb -a
 
 binary: binary-arch binary-indep
-.PHONY: build clean binary-indep binary-arch binary install configure
+.PHONY: build clean binary-indep binary-arch binary install configure build-arch build-indep
diff -ruN zfsutils_old/zfsutils-8.2/debian/watch zfsutils/zfsutils-9/debian/watch
--- zfsutils_old/zfsutils-8.2/debian/watch	1969-12-31 19:00:00.000000000 -0500
+++ zfsutils/zfsutils-9/debian/watch	2011-10-10 21:48:26.330828916 -0400
@@ -0,0 +1,5 @@
+version=3
+
+# Sorry, this package is not produced by a single upstream tarball. Instead it
+# is built by several paths within upstream's SVN repository. Please use the
+# get-orig-source target in debian/rules
diff -ruN zfsutils_old/zfsutils-8.2/debian/zfsutils.manpages zfsutils/zfsutils-9/debian/zfsutils.manpages
--- zfsutils_old/zfsutils-8.2/debian/zfsutils.manpages	2011-08-07 14:09:45.000000000 -0400
+++ zfsutils/zfsutils-9/debian/zfsutils.manpages	2011-10-18 18:18:34.496250500 -0400
@@ -1,3 +1,3 @@
-cddl/contrib/opensolaris/cmd/zpool/zpool.8
-cddl/contrib/opensolaris/cmd/zfs/zfs.8
-cddl/usr.sbin/zdb/zdb.8.gz
+debian/zpool.8
+debian/zfs.8
+debian/zdb.8
diff -ruN zfsutils_old/zfsutils-8.2/debian/zfsutils.zfs.init zfsutils/zfsutils-9/debian/zfsutils.zfs.init
--- zfsutils_old/zfsutils-8.2/debian/zfsutils.zfs.init	2011-08-08 09:38:12.000000000 -0400
+++ zfsutils/zfsutils-9/debian/zfsutils.zfs.init	2011-10-10 22:28:58.166216375 -0400
@@ -6,7 +6,7 @@
 # X-Start-Before:    checkroot
 # X-Stop-After:      umountfs
 # Default-Start:     S
-# Default-Stop:      0 6
+# Default-Stop:      0 1 6
 # Short-Description: Start/stop ZFS subsystem.
 # Description:
 ### END INIT INFO
@@ -19,15 +19,6 @@
 do_start() {
 	log_begin_msg "Starting ZFS subsystem..."
 
-	# zvol
-	log_progress_msg "zvol"
-	zfs volinit
-	RET=$?
-	if [ $RET != 0 ] ; then
-		log_end_msg $RET
-		exit $RET
-	fi
-
 	# Enable swap on ZVOLs with property org.freebsd:swap=on.
 	log_progress_msg "swap"
 	zfs list -H -o org.freebsd:swap,name -t volume | \
@@ -75,15 +66,6 @@
 		esac
 	done
 
-	# zvol
-	log_progress_msg "zvol"
-	zfs volfini
-	RET=$?
-	if [ $RET != 0 ] ; then
-		log_end_msg $RET
-		exit $RET
-	fi
-
 	# filesystems
 	log_progress_msg "filesystems"
 	zfs unshare -a

Reply to: