From 1b03c5bf41222b723415638f03e00ed12cac076a Mon Sep 17 00:00:00 2001 From: pjd Date: Sun, 27 Feb 2011 19:41:40 +0000 Subject: 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 --- cddl/compat/opensolaris/include/fcntl.h | 3 ++- cddl/compat/opensolaris/include/mnttab.h | 4 +++ cddl/compat/opensolaris/include/priv.h | 2 +- cddl/compat/opensolaris/include/sha2.h | 38 ++++++++++++++++++++++++++ cddl/compat/opensolaris/include/solaris.h | 6 ++++- cddl/compat/opensolaris/include/thread_pool.h | 39 +++++++++++++++++++++++++++ cddl/compat/opensolaris/misc/fsshare.c | 14 +++++----- cddl/compat/opensolaris/misc/zmount.c | 5 +++- 8 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 cddl/compat/opensolaris/include/sha2.h create mode 100644 cddl/compat/opensolaris/include/thread_pool.h (limited to 'cddl/compat/opensolaris') diff --git a/cddl/compat/opensolaris/include/fcntl.h b/cddl/compat/opensolaris/include/fcntl.h index 9b6c3f9..548918a 100644 --- a/cddl/compat/opensolaris/include/fcntl.h +++ b/cddl/compat/opensolaris/include/fcntl.h @@ -32,6 +32,7 @@ #include_next -#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 a18dd8d..227196a 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 32696ae..2fee5b0 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 0000000..488f2db --- /dev/null +++ b/cddl/compat/opensolaris/include/sha2.h @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * 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 + +#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 01f9d47..9bead01 100644 --- a/cddl/compat/opensolaris/include/solaris.h +++ b/cddl/compat/opensolaris/include/solaris.h @@ -5,6 +5,10 @@ #include -#define dirent64 dirent +#include + +#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 0000000..25ac55d --- /dev/null +++ b/cddl/compat/opensolaris/include/thread_pool.h @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * 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 10ed591..e8faa92 100644 --- a/cddl/compat/opensolaris/misc/fsshare.c +++ b/cddl/compat/opensolaris/misc/fsshare.c @@ -28,15 +28,17 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include -#include + +#include #include +#include +#include #include -#include #include /* _PATH_MOUNTDPID */ -#include +#include +#include +#include +#include #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 493a4fc..b4f99e3 100644 --- a/cddl/compat/opensolaris/misc/zmount.c +++ b/cddl/compat/opensolaris/misc/zmount.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include 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); -- cgit v1.1