aboutsummaryrefslogtreecommitdiff
path: root/cddl/compat
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2011-02-27 19:41:40 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2011-02-27 19:41:40 +0000
commit10b9d77bf1ccf2f3affafa6261692cb92cf7e992 (patch)
treeef515cadc08bf427e4d3f1360199ec9827b1596b /cddl/compat
parente02dd14a548a89bee6657d9eacb0f992bf61b280 (diff)
downloadsrc-10b9d77bf1ccf2f3affafa6261692cb92cf7e992.tar.gz
src-10b9d77bf1ccf2f3affafa6261692cb92cf7e992.zip
Finally... Import the latest open-source ZFS version - (SPA) 28.
Few new things available from now on: - Data deduplication. - Triple parity RAIDZ (RAIDZ3). - zfs diff. - zpool split. - Snapshot holds. - zpool import -F. Allows to rewind corrupted pool to earlier transaction group. - Possibility to import pool in read-only mode. MFC after: 1 month
Notes
Notes: svn path=/head/; revision=219089
Diffstat (limited to 'cddl/compat')
-rw-r--r--cddl/compat/opensolaris/include/fcntl.h3
-rw-r--r--cddl/compat/opensolaris/include/mnttab.h4
-rw-r--r--cddl/compat/opensolaris/include/priv.h2
-rw-r--r--cddl/compat/opensolaris/include/sha2.h38
-rw-r--r--cddl/compat/opensolaris/include/solaris.h6
-rw-r--r--cddl/compat/opensolaris/include/thread_pool.h39
-rw-r--r--cddl/compat/opensolaris/misc/fsshare.c14
-rw-r--r--cddl/compat/opensolaris/misc/zmount.c5
8 files changed, 101 insertions, 10 deletions
diff --git a/cddl/compat/opensolaris/include/fcntl.h b/cddl/compat/opensolaris/include/fcntl.h
index 9b6c3f9ee62d..548918aaab3a 100644
--- a/cddl/compat/opensolaris/include/fcntl.h
+++ b/cddl/compat/opensolaris/include/fcntl.h
@@ -32,6 +32,7 @@
#include_next <fcntl.h>
-#define open64 open
+#define open64(...) open(__VA_ARGS__)
+#define openat64(...) openat(__VA_ARGS__)
#endif
diff --git a/cddl/compat/opensolaris/include/mnttab.h b/cddl/compat/opensolaris/include/mnttab.h
index a18dd8d1893b..227196a4017f 100644
--- a/cddl/compat/opensolaris/include/mnttab.h
+++ b/cddl/compat/opensolaris/include/mnttab.h
@@ -12,6 +12,10 @@
#define MNTTAB _PATH_DEVZERO
#define MNT_LINE_MAX 1024
+#define MS_OVERLAY 0x0
+#define MS_NOMNTTAB 0x0
+#define MS_RDONLY 0x1
+
#define umount2(p, f) unmount(p, f)
struct mnttab {
diff --git a/cddl/compat/opensolaris/include/priv.h b/cddl/compat/opensolaris/include/priv.h
index 32696ae5668b..2fee5b0d40c8 100644
--- a/cddl/compat/opensolaris/include/priv.h
+++ b/cddl/compat/opensolaris/include/priv.h
@@ -10,7 +10,7 @@
#define PRIV_SYS_CONFIG 0
static __inline int
-priv_ineffect(priv)
+priv_ineffect(int priv)
{
assert(priv == PRIV_SYS_CONFIG);
diff --git a/cddl/compat/opensolaris/include/sha2.h b/cddl/compat/opensolaris/include/sha2.h
new file mode 100644
index 000000000000..488f2dbd8b47
--- /dev/null
+++ b/cddl/compat/opensolaris/include/sha2.h
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _OPENSOLARIS_SHA2_H_
+#define _OPENSOLARIS_SHA2_H_
+
+#include_next <sha256.h>
+
+#define SHA256Init(c) SHA256_Init(c)
+#define SHA256Update(c, d, s) SHA256_Update((c), (d), (s))
+#define SHA256Final(b, c) SHA256_Final((unsigned char *)(b), (c))
+
+#endif /* !_OPENSOLARIS_SHA2_H_ */
diff --git a/cddl/compat/opensolaris/include/solaris.h b/cddl/compat/opensolaris/include/solaris.h
index 01f9d4776abc..9bead018bcec 100644
--- a/cddl/compat/opensolaris/include/solaris.h
+++ b/cddl/compat/opensolaris/include/solaris.h
@@ -5,6 +5,10 @@
#include <sys/ccompile.h>
-#define dirent64 dirent
+#include <fcntl.h>
+
+#define NOTE(s)
+
+int mkdirp(const char *, mode_t);
#endif /* !_SOLARIS_H_ */
diff --git a/cddl/compat/opensolaris/include/thread_pool.h b/cddl/compat/opensolaris/include/thread_pool.h
new file mode 100644
index 000000000000..25ac55dedea7
--- /dev/null
+++ b/cddl/compat/opensolaris/include/thread_pool.h
@@ -0,0 +1,39 @@
+/*-
+ * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _OPENSOLARIS_THREAD_POOL_H_
+#define _OPENSOLARIS_THREAD_POOL_H_
+
+typedef int tpool_t;
+
+#define tpool_create(a, b, c, d) (0)
+#define tpool_dispatch(pool, func, arg) func(arg)
+#define tpool_wait(pool) do { } while (0)
+#define tpool_destroy(pool) do { } while (0)
+
+#endif /* !_OPENSOLARIS_THREAD_POOL_H_ */
diff --git a/cddl/compat/opensolaris/misc/fsshare.c b/cddl/compat/opensolaris/misc/fsshare.c
index 10ed591d5bca..e8faa928d6fb 100644
--- a/cddl/compat/opensolaris/misc/fsshare.c
+++ b/cddl/compat/opensolaris/misc/fsshare.c
@@ -28,15 +28,17 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
+
+#include <assert.h>
#include <errno.h>
+#include <fcntl.h>
+#include <fsshare.h>
#include <libutil.h>
-#include <assert.h>
#include <pathnames.h> /* _PATH_MOUNTDPID */
-#include <fsshare.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
#define FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n"
#define OPTSSIZE 1024
diff --git a/cddl/compat/opensolaris/misc/zmount.c b/cddl/compat/opensolaris/misc/zmount.c
index 493a4fc4ef12..b4f99e3be9fd 100644
--- a/cddl/compat/opensolaris/misc/zmount.c
+++ b/cddl/compat/opensolaris/misc/zmount.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <mnttab.h>
static void
build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
@@ -78,7 +79,7 @@ zmount(const char *spec, const char *dir, int mflag, char *fstype,
assert(spec != NULL);
assert(dir != NULL);
- assert(mflag == 0);
+ assert(mflag == 0 || mflag == MS_RDONLY);
assert(fstype != NULL);
assert(strcmp(fstype, MNTTYPE_ZFS) == 0);
assert(dataptr == NULL);
@@ -91,6 +92,8 @@ zmount(const char *spec, const char *dir, int mflag, char *fstype,
iov = NULL;
iovlen = 0;
+ if (mflag & MS_RDONLY)
+ build_iovec(&iov, &iovlen, "ro", NULL, 0);
build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir),
(size_t)-1);