aboutsummaryrefslogtreecommitdiff
path: root/cddl/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/usr.sbin')
-rw-r--r--cddl/usr.sbin/dtrace/Makefile10
-rw-r--r--cddl/usr.sbin/lockstat/Makefile9
-rw-r--r--cddl/usr.sbin/plockstat/Makefile8
-rw-r--r--cddl/usr.sbin/zdb/Makefile34
-rw-r--r--cddl/usr.sbin/zfsd/Makefile.common29
-rw-r--r--cddl/usr.sbin/zfsd/callout.cc1
-rw-r--r--cddl/usr.sbin/zfsd/case_file.cc15
-rw-r--r--cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc1
-rw-r--r--cddl/usr.sbin/zfsd/vdev.cc1
-rw-r--r--cddl/usr.sbin/zfsd/vdev_iterator.cc1
-rw-r--r--cddl/usr.sbin/zfsd/zfsd.cc2
-rw-r--r--cddl/usr.sbin/zfsd/zfsd_event.cc7
-rw-r--r--cddl/usr.sbin/zfsd/zfsd_exception.cc1
-rw-r--r--cddl/usr.sbin/zfsd/zpool_list.cc1
-rw-r--r--cddl/usr.sbin/zhack/Makefile28
15 files changed, 86 insertions, 62 deletions
diff --git a/cddl/usr.sbin/dtrace/Makefile b/cddl/usr.sbin/dtrace/Makefile
index 501b7c14861a..19a55d5dc1be 100644
--- a/cddl/usr.sbin/dtrace/Makefile
+++ b/cddl/usr.sbin/dtrace/Makefile
@@ -10,6 +10,13 @@ BINDIR?= /usr/sbin
WARNS?= 1
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd/spl
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
-I${SRCTOP}/cddl/compat/opensolaris/include \
-I${OPENSOLARIS_USR_DISTDIR}/head \
@@ -17,12 +24,13 @@ CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
-I${OPENSOLARIS_USR_DISTDIR}/lib/libproc/common \
-I${OPENSOLARIS_SYS_DISTDIR}/uts/common \
-I${OPENSOLARIS_SYS_DISTDIR}/compat
+CFLAGS+= -DHAVE_ISSETUGID
# Optional debugging stuff...
#CFLAGS+= -DNEED_ERRLOC
#YFLAGS+= -d
-LIBADD= dtrace ctf elf proc
+LIBADD= dtrace ctf elf proc spl
.if ${MK_DTRACE_TESTS} != "no"
SUBDIR+= tests
diff --git a/cddl/usr.sbin/lockstat/Makefile b/cddl/usr.sbin/lockstat/Makefile
index 3ffcc7049f35..6efb9e6fa5c5 100644
--- a/cddl/usr.sbin/lockstat/Makefile
+++ b/cddl/usr.sbin/lockstat/Makefile
@@ -8,6 +8,14 @@ BINDIR?= /usr/sbin
WARNS?= 1
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd/spl
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
-I${SRCTOP}/cddl/compat/opensolaris/include \
-I${OPENSOLARIS_USR_DISTDIR}/head \
@@ -16,6 +24,7 @@ CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
-I${OPENSOLARIS_SYS_DISTDIR}/uts/common \
-I${OPENSOLARIS_SYS_DISTDIR}/compat \
-I${SRCTOP}/sys
+CFLAGS+= -DHAVE_ISSETUGID
CFLAGS+= -DNEED_ERRLOC -g
diff --git a/cddl/usr.sbin/plockstat/Makefile b/cddl/usr.sbin/plockstat/Makefile
index cb263fb427a7..f65ac8146e4e 100644
--- a/cddl/usr.sbin/plockstat/Makefile
+++ b/cddl/usr.sbin/plockstat/Makefile
@@ -8,6 +8,13 @@ BINDIR?= /usr/sbin
WARNS?= 1
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd/spl
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
-I${SRCTOP}/cddl/compat/opensolaris/include \
-I${OPENSOLARIS_USR_DISTDIR}/head \
@@ -17,6 +24,7 @@ CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
-I${OPENSOLARIS_SYS_DISTDIR}/compat \
-I${SRCTOP}/cddl/lib/libdtrace \
-I${SRCTOP}/sys
+CFLAGS+= -DHAVE_ISSETUGID
LIBADD= dtrace proc
diff --git a/cddl/usr.sbin/zdb/Makefile b/cddl/usr.sbin/zdb/Makefile
index 8c919341f8e3..efd8c746128f 100644
--- a/cddl/usr.sbin/zdb/Makefile
+++ b/cddl/usr.sbin/zdb/Makefile
@@ -1,33 +1,33 @@
# $FreeBSD$
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/cmd/zdb
+ZFSTOP= ${SRCTOP}/sys/contrib/openzfs
+
+.PATH: ${ZFSTOP}/cmd/zdb
+.PATH: ${ZFSTOP}/man/man8
PROG= zdb
MAN= zdb.8
+INCS= zdb.h
SRCS= zdb.c zdb_il.c
WARNS?= 2
CSTD= c99
-CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
-CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
-
-LIBADD= nvpair umem uutil zfs zpool
+CFLAGS+= \
+ -DIN_BASE \
+ -I${ZFSTOP}/include \
+ -I${ZFSTOP}/lib/libspl/include \
+ -I${ZFSTOP}/lib/libspl/include/os/freebsd \
+ -I${ZFSTOP}/lib/libspl/include/os/freebsd/spl \
+ -I${SRCTOP}/sys \
+ -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \
+ -DHAVE_ISSETUGID
+
+LIBADD= nvpair umem uutil zfs spl avl zutil zpool
CFLAGS.gcc+= -fms-extensions
# Since there are many asserts in this program, it makes no sense to compile
# it without debugging.
-CFLAGS+= -g -DDEBUG=1
+CFLAGS+= -g -DDEBUG=1 -DZFS_DEBUG=1
.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/zfsd/Makefile.common b/cddl/usr.sbin/zfsd/Makefile.common
index 7d45a3ed1695..95882dec175a 100644
--- a/cddl/usr.sbin/zfsd/Makefile.common
+++ b/cddl/usr.sbin/zfsd/Makefile.common
@@ -10,29 +10,24 @@ SRCS= callout.cc \
zpool_list.cc \
zfsd_main.cc
-WARNS?= 3
+WARNS?= 2
# Ignore warnings about Solaris specific pragmas.
IGNORE_PRAGMA= YES
-INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
-INCFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-INCFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
-INCFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
-INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
-INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
-INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libumem/common
-INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
-INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
-INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
-INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
-INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
-INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd/spl
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -I${SRCTOP}/cddl/usr.sbin
-CFLAGS+= -DNEED_SOLARIS_BOOLEAN ${INCFLAGS}
+# use issetugid(2)
+CFLAGS+= -D_MACHINE_FLOAT_H_ -DHAVE_ISSETUGID
-LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil
+LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair avl uutil zutil
cscope:
find ${.CURDIR} -type f -a \( -name "*.[ch]" -o -name "*.cc" \) \
diff --git a/cddl/usr.sbin/zfsd/callout.cc b/cddl/usr.sbin/zfsd/callout.cc
index 2671c5d3e783..3e5cd5779559 100644
--- a/cddl/usr.sbin/zfsd/callout.cc
+++ b/cddl/usr.sbin/zfsd/callout.cc
@@ -39,6 +39,7 @@
* timer services built on top of the POSIX interval timer.
*/
+#include <sys/byteorder.h>
#include <sys/time.h>
#include <signal.h>
diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc
index 19c4abe45fc9..da2125b4d716 100644
--- a/cddl/usr.sbin/zfsd/case_file.cc
+++ b/cddl/usr.sbin/zfsd/case_file.cc
@@ -39,11 +39,13 @@
* accumulate in order to mark a device as degraded.
*/
#include <sys/cdefs.h>
+#include <sys/byteorder.h>
#include <sys/time.h>
#include <sys/fs/zfs.h>
#include <dirent.h>
+#include <fcntl.h>
#include <iomanip>
#include <fstream>
#include <functional>
@@ -75,7 +77,6 @@
__FBSDID("$FreeBSD$");
/*============================ Namespace Control =============================*/
-using std::auto_ptr;
using std::hex;
using std::ifstream;
using std::stringstream;
@@ -239,8 +240,6 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev)
{
ZpoolList zpl(ZpoolList::ZpoolByGUID, &m_poolGUID);
zpool_handle_t *pool(zpl.empty() ? NULL : zpl.front());
- zpool_boot_label_t boot_type;
- uint64_t boot_size;
if (pool == NULL || !RefreshVdevState()) {
/*
@@ -333,13 +332,7 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev)
}
/* Write a label on the newly inserted disk. */
- if (zpool_is_bootable(pool))
- boot_type = ZPOOL_COPY_BOOT_LABEL;
- else
- boot_type = ZPOOL_NO_BOOT_LABEL;
- boot_size = zpool_get_prop_int(pool, ZPOOL_PROP_BOOTSIZE, NULL);
- if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str(),
- boot_type, boot_size, NULL) != 0) {
+ if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str()) != 0) {
syslog(LOG_ERR,
"Replace vdev(%s/%s) by physical path (label): %s: %s\n",
zpool_get_name(pool), VdevGUIDString().c_str(),
@@ -1118,7 +1111,7 @@ CaseFile::Replace(const char* vdev_type, const char* path, bool isspare) {
nvlist_free(newvd);
retval = (zpool_vdev_attach(zhp, oldstr.c_str(), path, nvroot,
- /*replace*/B_TRUE) == 0);
+ /*replace*/B_TRUE, /*rebuild*/ B_FALSE) == 0);
if (retval)
syslog(LOG_INFO, "Replacing vdev(%s/%s) with %s\n",
poolname, oldstr.c_str(), path);
diff --git a/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc b/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc
index d65295075c1f..e2833170f9ac 100644
--- a/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc
+++ b/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc
@@ -30,6 +30,7 @@
* Authors: Alan Somers (Spectra Logic Corporation)
*/
#include <sys/cdefs.h>
+#include <sys/byteorder.h>
#include <stdarg.h>
#include <syslog.h>
diff --git a/cddl/usr.sbin/zfsd/vdev.cc b/cddl/usr.sbin/zfsd/vdev.cc
index 687b0647ceb5..508af8cda925 100644
--- a/cddl/usr.sbin/zfsd/vdev.cc
+++ b/cddl/usr.sbin/zfsd/vdev.cc
@@ -39,6 +39,7 @@
*/
#include <syslog.h>
#include <sys/cdefs.h>
+#include <sys/byteorder.h>
#include <sys/fs/zfs.h>
#include <libzfs.h>
diff --git a/cddl/usr.sbin/zfsd/vdev_iterator.cc b/cddl/usr.sbin/zfsd/vdev_iterator.cc
index 31a4ce962970..b5a4f22c1c60 100644
--- a/cddl/usr.sbin/zfsd/vdev_iterator.cc
+++ b/cddl/usr.sbin/zfsd/vdev_iterator.cc
@@ -38,6 +38,7 @@
* Implementation of the VdevIterator class.
*/
#include <sys/cdefs.h>
+#include <sys/byteorder.h>
#include <sys/fs/zfs.h>
#include <stdint.h>
diff --git a/cddl/usr.sbin/zfsd/zfsd.cc b/cddl/usr.sbin/zfsd/zfsd.cc
index 2f17b474e493..876cca836e9e 100644
--- a/cddl/usr.sbin/zfsd/zfsd.cc
+++ b/cddl/usr.sbin/zfsd/zfsd.cc
@@ -42,10 +42,12 @@
*/
#include <sys/cdefs.h>
+#include <sys/byteorder.h>
#include <sys/param.h>
#include <sys/fs/zfs.h>
#include <err.h>
+#include <fcntl.h>
#include <libgeom.h>
#include <libutil.h>
#include <poll.h>
diff --git a/cddl/usr.sbin/zfsd/zfsd_event.cc b/cddl/usr.sbin/zfsd/zfsd_event.cc
index 707a868c67e8..688e7c0354a2 100644
--- a/cddl/usr.sbin/zfsd/zfsd_event.cc
+++ b/cddl/usr.sbin/zfsd/zfsd_event.cc
@@ -34,6 +34,7 @@
* \file zfsd_event.cc
*/
#include <sys/cdefs.h>
+#include <sys/byteorder.h>
#include <sys/time.h>
#include <sys/fs/zfs.h>
#include <sys/vdev_impl.h>
@@ -41,12 +42,13 @@
#include <syslog.h>
#include <libzfs.h>
+#include <libzutil.h>
/*
* Undefine flush, defined by cpufunc.h on sparc64, because it conflicts with
* C++ flush methods
*/
#undef flush
-
+#undef __init
#include <list>
#include <map>
#include <sstream>
@@ -190,7 +192,8 @@ GeomEvent::ReadLabel(int devFd, bool &inUse, bool &degraded)
if (poolName != NULL)
free(poolName);
- nlabels = zpool_read_all_labels(devFd, &devLabel);
+ if (zpool_read_label(devFd, &devLabel, &nlabels) != 0)
+ return (NULL);
/*
* If we find a disk with fewer than the maximum number of
* labels, it might be the whole disk of a partitioned disk
diff --git a/cddl/usr.sbin/zfsd/zfsd_exception.cc b/cddl/usr.sbin/zfsd/zfsd_exception.cc
index 7859a654003e..7ebb74ca8c6a 100644
--- a/cddl/usr.sbin/zfsd/zfsd_exception.cc
+++ b/cddl/usr.sbin/zfsd/zfsd_exception.cc
@@ -36,6 +36,7 @@
* Implementation of the ZfsdException class.
*/
#include <sys/cdefs.h>
+#include <sys/byteorder.h>
#include <sys/fs/zfs.h>
#include <syslog.h>
diff --git a/cddl/usr.sbin/zfsd/zpool_list.cc b/cddl/usr.sbin/zfsd/zpool_list.cc
index 1d1540b294a2..82c35736df13 100644
--- a/cddl/usr.sbin/zfsd/zpool_list.cc
+++ b/cddl/usr.sbin/zfsd/zpool_list.cc
@@ -38,6 +38,7 @@
* Implementation of the ZpoolList class.
*/
#include <sys/cdefs.h>
+#include <sys/byteorder.h>
#include <sys/fs/zfs.h>
#include <stdint.h>
diff --git a/cddl/usr.sbin/zhack/Makefile b/cddl/usr.sbin/zhack/Makefile
index 1347111c7c17..24800c693cf3 100644
--- a/cddl/usr.sbin/zhack/Makefile
+++ b/cddl/usr.sbin/zhack/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/cmd/zhack
+.PATH: ${SRCTOP}/sys/contrib/openzfs/cmd/zhack
PROG= zhack
MAN=
@@ -8,20 +8,20 @@ MAN=
WARNS?= 0
CSTD= c99
-CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
+WARNS?= 2
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
-
-LIBADD= nvpair zfs zpool
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID
+CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
+
+
+LIBADD= nvpair zfs spl zutil zpool
CFLAGS+= -DDEBUG=1
#DEBUG_FLAGS+= -g