aboutsummaryrefslogtreecommitdiff
path: root/cddl/usr.sbin/zfsd
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/usr.sbin/zfsd')
-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
10 files changed, 29 insertions, 30 deletions
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>