diff options
author | Carlo Landmeter <clandmeter@gmail.com> | 2016-08-20 01:03:47 +0000 |
---|---|---|
committer | Carlo Landmeter <clandmeter@gmail.com> | 2016-08-20 01:03:54 +0000 |
commit | 2a4a9928dc6f584578d8340ee9b41654f4dada23 (patch) | |
tree | fece4fadfd168bc0204341b7ea42723c6b73ca23 | |
parent | c5cf7a9dc691eb09fe4fd30b06ad8ffa2ee94752 (diff) | |
download | aports-2a4a9928dc6f584578d8340ee9b41654f4dada23.tar.bz2 aports-2a4a9928dc6f584578d8340ee9b41654f4dada23.tar.xz |
main/zfs-vanilla: new aport
10 files changed, 945 insertions, 0 deletions
diff --git a/main/zfs-vanilla/0001-Use-the-correct-macro-to-include-backtrace.patch b/main/zfs-vanilla/0001-Use-the-correct-macro-to-include-backtrace.patch new file mode 100644 index 0000000000..aaae11f58a --- /dev/null +++ b/main/zfs-vanilla/0001-Use-the-correct-macro-to-include-backtrace.patch @@ -0,0 +1,42 @@ +From b8fd863517ae6dba1f4bdf225f45b97eb913e09e Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter <clandmeter@gmail.com> +Date: Tue, 1 Mar 2016 15:23:09 +0100 +Subject: [PATCH 1/8] Use the correct macro to include backtrace + +execinfo.h and backtrace() are GNU extensions provided by glibc +and not by gcc, see: + +http://www.gnu.org/software/libc/manual/html_mono/libc.html#Backtraces + +Signed-off-by: Carlo Landmeter <clandmeter@gmail.com> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #4453 +--- + cmd/ztest/ztest.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c +index afe6faa..40524ed 100644 +--- a/cmd/ztest/ztest.c ++++ b/cmd/ztest/ztest.c +@@ -123,7 +123,7 @@ + #include <math.h> + #include <sys/fs/zfs.h> + #include <libnvpair.h> +-#ifdef __GNUC__ ++#ifdef __GLIBC__ + #include <execinfo.h> /* for backtrace() */ + #endif + +@@ -490,7 +490,7 @@ _umem_logging_init(void) + static void sig_handler(int signo) + { + struct sigaction action; +-#ifdef __GNUC__ /* backtrace() is a GNU extension */ ++#ifdef __GLIBC__ /* backtrace() is a GNU extension */ + int nptrs; + void *buffer[BACKTRACE_SZ]; + +-- +2.7.4 + diff --git a/main/zfs-vanilla/0002-Include-sys-types.h-in-devid.h.patch b/main/zfs-vanilla/0002-Include-sys-types.h-in-devid.h.patch new file mode 100644 index 0000000000..350d2cb6ba --- /dev/null +++ b/main/zfs-vanilla/0002-Include-sys-types.h-in-devid.h.patch @@ -0,0 +1,29 @@ +From 38cab4ba7bdeee22a114bcb09665be980a5b1f39 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter <clandmeter@gmail.com> +Date: Tue, 1 Mar 2016 15:56:26 +0100 +Subject: [PATCH 2/8] Include sys/types.h in devid.h + +This is needed for musl libc + +Signed-off-by: Carlo Landmeter <clandmeter@gmail.com> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #4454 +--- + lib/libspl/include/devid.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/libspl/include/devid.h b/lib/libspl/include/devid.h +index 5406c33..4b346da 100644 +--- a/lib/libspl/include/devid.h ++++ b/lib/libspl/include/devid.h +@@ -27,6 +27,7 @@ + #ifndef _LIBSPL_DEVID_H + #define _LIBSPL_DEVID_H + ++#include <sys/types.h> + #include <stdlib.h> + + typedef int ddi_devid_t; +-- +2.7.4 + diff --git a/main/zfs-vanilla/0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch b/main/zfs-vanilla/0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch new file mode 100644 index 0000000000..87ccb78874 --- /dev/null +++ b/main/zfs-vanilla/0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch @@ -0,0 +1,29 @@ +From 401951765dcf49c5a993280bf6a93b89c7f01bb8 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter <clandmeter@gmail.com> +Date: Fri, 25 Mar 2016 20:47:03 +0100 +Subject: [PATCH 3/8] Add missing fcntl.h to includes in mount_zfs.c + +This is needed for musl libc + +Signed-off-by: Carlo Landmeter <clandmeter@gmail.com> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #4456 +--- + cmd/mount_zfs/mount_zfs.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c +index bd860cb..a939744 100644 +--- a/cmd/mount_zfs/mount_zfs.c ++++ b/cmd/mount_zfs/mount_zfs.c +@@ -33,6 +33,7 @@ + #include <libzfs.h> + #include <locale.h> + #include <getopt.h> ++#include <fcntl.h> + + #define ZS_COMMENT 0x00000000 /* comment */ + #define ZS_ZFSUTIL 0x00000001 /* caller is zfs(8) */ +-- +2.7.4 + diff --git a/main/zfs-vanilla/0004-Ensure-correct-return-value-type.patch b/main/zfs-vanilla/0004-Ensure-correct-return-value-type.patch new file mode 100644 index 0000000000..9897864c02 --- /dev/null +++ b/main/zfs-vanilla/0004-Ensure-correct-return-value-type.patch @@ -0,0 +1,30 @@ +From 8fb2f7092f5188d6ad42f0f66049568e49c8e7c8 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter <clandmeter@gmail.com> +Date: Tue, 1 Mar 2016 15:32:52 +0100 +Subject: [PATCH 4/8] Ensure correct return value type + +When compiling with musl libc the return type will be incorrect. + +Signed-off-by: Carlo Landmeter <clandmeter@gmail.com> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #4454 +--- + include/sys/zfs_context.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h +index 4f7e328..78e33e1 100644 +--- a/include/sys/zfs_context.h ++++ b/include/sys/zfs_context.h +@@ -623,7 +623,7 @@ extern void delay(clock_t ticks); + #define maxclsyspri -20 + #define defclsyspri 0 + +-#define CPU_SEQID (pthread_self() & (max_ncpus - 1)) ++#define CPU_SEQID ((uintptr_t)pthread_self() & (max_ncpus - 1)) + + #define kcred NULL + #define CRED() NULL +-- +2.7.4 + diff --git a/main/zfs-vanilla/0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch b/main/zfs-vanilla/0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch new file mode 100644 index 0000000000..37c5a33ffd --- /dev/null +++ b/main/zfs-vanilla/0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch @@ -0,0 +1,31 @@ +From f8c3aff70bbea57527ee301c16b94dcc8adc4cc9 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter <clandmeter@gmail.com> +Date: Tue, 1 Mar 2016 16:23:12 +0100 +Subject: [PATCH 5/8] Set _DATE_FMT to '%+' if not defined in + libspl/timestamp.c + +Signed-off-by: Carlo Landmeter <clandmeter@gmail.com> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #4458 +--- + lib/libspl/timestamp.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lib/libspl/timestamp.c b/lib/libspl/timestamp.c +index a4f4cf4..e2838da 100644 +--- a/lib/libspl/timestamp.c ++++ b/lib/libspl/timestamp.c +@@ -28,6 +28,10 @@ + #include <langinfo.h> + #include "statcommon.h" + ++#ifndef _DATE_FMT ++#define _DATE_FMT "%+" ++#endif ++ + /* + * Print timestamp as decimal reprentation of time_t value (-T u was specified) + * or in date(1) format (-T d was specified). +-- +2.7.4 + diff --git a/main/zfs-vanilla/0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch b/main/zfs-vanilla/0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch new file mode 100644 index 0000000000..ac844dda62 --- /dev/null +++ b/main/zfs-vanilla/0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch @@ -0,0 +1,52 @@ +From d4ad14173906db278937a8779dc608a3e155727e Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter <clandmeter@gmail.com> +Date: Fri, 25 Mar 2016 13:21:53 +0100 +Subject: [PATCH 6/8] Move hrtime_t timestruc_t and timespec_t + +hrtime_t timestruc_t and timespec_t should have originally been +included in sys/time.h so lets move them. + +longlong_t is not defined by any standard so change it to long long + +Signed-off-by: Carlo Landmeter <clandmeter@gmail.com> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #4459 +--- + lib/libspl/include/sys/time.h | 5 +++++ + lib/libspl/include/sys/types.h | 4 ---- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h +index f0da440..03da3f7 100644 +--- a/lib/libspl/include/sys/time.h ++++ b/lib/libspl/include/sys/time.h +@@ -58,6 +58,11 @@ + #define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC)) + #endif + ++typedef long long hrtime_t; ++typedef struct timespec timestruc_t; ++typedef struct timespec timespec_t; ++ ++ + extern hrtime_t gethrtime(void); + extern void gethrestime(timestruc_t *); + +diff --git a/lib/libspl/include/sys/types.h b/lib/libspl/include/sys/types.h +index 25d56be..8996af9 100644 +--- a/lib/libspl/include/sys/types.h ++++ b/lib/libspl/include/sys/types.h +@@ -55,10 +55,6 @@ typedef longlong_t diskaddr_t; + typedef ulong_t pgcnt_t; /* number of pages */ + typedef long spgcnt_t; /* signed number of pages */ + +-typedef longlong_t hrtime_t; +-typedef struct timespec timestruc_t; +-typedef struct timespec timespec_t; +- + typedef short pri_t; + + typedef int zoneid_t; +-- +2.7.4 + diff --git a/main/zfs-vanilla/0007-Remove-complicated-libspl-assert-wrappers.patch b/main/zfs-vanilla/0007-Remove-complicated-libspl-assert-wrappers.patch new file mode 100644 index 0000000000..74e8a747c6 --- /dev/null +++ b/main/zfs-vanilla/0007-Remove-complicated-libspl-assert-wrappers.patch @@ -0,0 +1,159 @@ +From bd123ed53786910cfdcfa7f3a983a268a5951fb0 Mon Sep 17 00:00:00 2001 +From: Brian Behlendorf <behlendorf1@llnl.gov> +Date: Tue, 1 Mar 2016 15:45:43 +0100 +Subject: [PATCH 7/8] Remove complicated libspl assert wrappers + +Effectively provide our own version of assert()/verify() for use +in user space. This minimizes our dependencies and aligns the +user space assertion handling with what's used in the kernel. + +Signed-off-by: Carlo Landmeter <clandmeter@gmail.com> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #4449 +--- + include/libzfs_impl.h | 5 --- + lib/libspl/include/assert.h | 82 ++++++++++++++++++++------------------------- + 2 files changed, 36 insertions(+), 51 deletions(-) + +diff --git a/include/libzfs_impl.h b/include/libzfs_impl.h +index e805e3e..ff02fa7 100644 +--- a/include/libzfs_impl.h ++++ b/include/libzfs_impl.h +@@ -46,11 +46,6 @@ + extern "C" { + #endif + +-#ifdef VERIFY +-#undef VERIFY +-#endif +-#define VERIFY verify +- + typedef struct libzfs_fru { + char *zf_device; + char *zf_fru; +diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h +index 52924e8..6226872 100644 +--- a/lib/libspl/include/assert.h ++++ b/lib/libspl/include/assert.h +@@ -32,68 +32,54 @@ + #include <stdio.h> + #include <stdlib.h> + +-#ifndef __assert_c99 +-static inline void +-__assert_c99(const char *expr, const char *file, int line, const char *func) ++static inline int ++libspl_assert(const char *buf, const char *file, const char *func, int line) + { +- fprintf(stderr, "%s:%i: %s: Assertion `%s` failed.\n", +- file, line, func, expr); ++ fprintf(stderr, "%s\n", buf); ++ fprintf(stderr, "ASSERT at %s:%d:%s()", file, line, func); + abort(); + } +-#endif /* __assert_c99 */ +- +-#ifndef verify +-#if defined(__STDC__) +-#if __STDC_VERSION__ - 0 >= 199901L +-#define verify(EX) (void)((EX) || \ +- (__assert_c99(#EX, __FILE__, __LINE__, __func__), 0)) +-#else +-#define verify(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0)) +-#endif /* __STDC_VERSION__ - 0 >= 199901L */ +-#else +-#define verify(EX) (void)((EX) || (_assert("EX", __FILE__, __LINE__), 0)) +-#endif /* __STDC__ */ +-#endif /* verify */ +- +-#undef VERIFY +-#undef ASSERT + +-#define VERIFY verify +-#define ASSERT assert ++#ifdef verify ++#undef verify ++#endif + +-extern void __assert(const char *, const char *, int); ++#define VERIFY(cond) \ ++ (void) ((!(cond)) && \ ++ libspl_assert(#cond, __FILE__, __FUNCTION__, __LINE__)) ++#define verify(cond) \ ++ (void) ((!(cond)) && \ ++ libspl_assert(#cond, __FILE__, __FUNCTION__, __LINE__)) + +-static inline int +-assfail(const char *buf, const char *file, int line) +-{ +- __assert(buf, file, line); +- return (0); +-} +- +-/* BEGIN CSTYLED */ +-#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \ +- const TYPE __left = (TYPE)(LEFT); \ +- const TYPE __right = (TYPE)(RIGHT); \ +- if (!(__left OP __right)) { \ +- char *__buf = alloca(256); \ +- (void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \ +- #LEFT, #OP, #RIGHT, \ +- (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ +- assfail(__buf, __FILE__, __LINE__); \ +- } \ ++#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) \ ++do { \ ++ const TYPE __left = (TYPE)(LEFT); \ ++ const TYPE __right = (TYPE)(RIGHT); \ ++ if (!(__left OP __right)) { \ ++ char *__buf = alloca(256); \ ++ (void) snprintf(__buf, 256, \ ++ "%s %s %s (0x%llx %s 0x%llx)", #LEFT, #OP, #RIGHT, \ ++ (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ ++ libspl_assert(__buf, __FILE__, __FUNCTION__, __LINE__); \ ++ } \ + } while (0) +-/* END CSTYLED */ + + #define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) + #define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) + #define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) + #define VERIFY0(x) VERIFY3_IMPL(x, ==, 0, uint64_t) + ++#ifdef assert ++#undef assert ++#endif ++ + #ifdef NDEBUG + #define ASSERT3S(x, y, z) ((void)0) + #define ASSERT3U(x, y, z) ((void)0) + #define ASSERT3P(x, y, z) ((void)0) + #define ASSERT0(x) ((void)0) ++#define ASSERT(x) ((void)0) ++#define assert(x) ((void)0) + #define ASSERTV(x) + #define IMPLY(A, B) ((void)0) + #define EQUIV(A, B) ((void)0) +@@ -102,13 +88,17 @@ assfail(const char *buf, const char *file, int line) + #define ASSERT3U(x, y, z) VERIFY3U(x, y, z) + #define ASSERT3P(x, y, z) VERIFY3P(x, y, z) + #define ASSERT0(x) VERIFY0(x) ++#define ASSERT(x) VERIFY(x) ++#define assert(x) VERIFY(x) + #define ASSERTV(x) x + #define IMPLY(A, B) \ + ((void)(((!(A)) || (B)) || \ +- assfail("(" #A ") implies (" #B ")", __FILE__, __LINE__))) ++ libspl_assert("(" #A ") implies (" #B ")", \ ++ __FILE__, __FUNCTION__, __LINE__))) + #define EQUIV(A, B) \ + ((void)((!!(A) == !!(B)) || \ +- assfail("(" #A ") is equivalent to (" #B ")", __FILE__, __LINE__))) ++ libspl_assert("(" #A ") is equivalent to (" #B ")", \ ++ __FILE__, __FUNCTION__, __LINE__))) + + #endif /* NDEBUG */ + +-- +2.7.4 + diff --git a/main/zfs-vanilla/0008-Add-support-for-libtirpc.patch b/main/zfs-vanilla/0008-Add-support-for-libtirpc.patch new file mode 100644 index 0000000000..4849871483 --- /dev/null +++ b/main/zfs-vanilla/0008-Add-support-for-libtirpc.patch @@ -0,0 +1,331 @@ +From 6f8aad51a7ef24ea614184f8ef801852b25357a1 Mon Sep 17 00:00:00 2001 +From: Brian Behlendorf <behlendorf1@llnl.gov> +Date: Tue, 26 Apr 2016 17:24:41 -0700 +Subject: [PATCH 8/8] Add support for libtirpc + +While OpenSolaris libc and glibc both include XDR support, the musl libc +does not in favor of depending on the BSD-licensed libtirpc library. + +Adding support is a simple matter of detecting the library, including +the headers and linking against it. By default libtirpc will be checked +for and if available used. Otherwise, configure will fall back to using +the xdr implementation provided by libc if available. The options +--with-tirpc/--without-tirpc can be used to disable this checking. + +In addition, the xdr_control() function has been simplied to only +handle ZFSs specific use case. + +Original-patch-by: stf <s@ctrlc.hu> +Original-patch-by: Richard Yao <ryao@gentoo.org> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Signed-off-by: Signed-off-by: Carlo Landmeter <clandmeter@gmail.com> +Closes #2254 +Closes #4559 +--- + config/user-libtirpc.m4 | 30 ++++++++++++++ + config/user.m4 | 1 + + lib/libnvpair/Makefile.am | 6 +-- + lib/libnvpair/nvpair_alloc_system.c | 1 + + lib/libspl/Makefile.am | 1 - + lib/libspl/include/rpc/Makefile.am | 1 - + lib/libspl/include/rpc/types.h | 32 --------------- + lib/libspl/include/rpc/xdr.h | 43 ++++++++++++-------- + lib/libspl/xdr.c | 78 ------------------------------------- + 9 files changed, 61 insertions(+), 132 deletions(-) + create mode 100644 config/user-libtirpc.m4 + delete mode 100644 lib/libspl/include/rpc/types.h + delete mode 100644 lib/libspl/xdr.c + +diff --git a/config/user-libtirpc.m4 b/config/user-libtirpc.m4 +new file mode 100644 +index 0000000..5f92906 +--- /dev/null ++++ b/config/user-libtirpc.m4 +@@ -0,0 +1,30 @@ ++dnl # ++dnl # Check for libtirpc - may be needed for xdr functionality ++dnl # ++AC_DEFUN([ZFS_AC_CONFIG_USER_LIBTIRPC], [ ++ AC_ARG_WITH([tirpc], ++ [AS_HELP_STRING([--with-tirpc], ++ [use tirpc for xdr encoding @<:@default=check@:>@])], ++ [], ++ [with_tirpc=check]) ++ ++ LIBTIRPC= ++ LIBTIRPC_CFLAGS= ++ ++ AS_IF([test "x$with_tirpc" != xno], ++ [AC_CHECK_LIB([tirpc], [xdrmem_create], ++ [AC_SUBST([LIBTIRPC], [-ltirpc]) ++ AC_SUBST([LIBTIRPC_CFLAGS], [-I/usr/include/tirpc]) ++ AC_DEFINE([HAVE_LIBTIRPC], [1], [Define if you have libtirpc]) ++ ], ++ [if test "x$with_tirpc" != xcheck; then ++ AC_MSG_FAILURE( ++ [--with-tirpc was given, but test for tirpc failed]) ++ fi ++ AC_SEARCH_LIBS([xdrmem_create], [tirpc], [], [ ++ AC_MSG_FAILURE([xdrmem_create() requires tirpc or libc])]) ++ ])], ++ [AC_SEARCH_LIBS([xdrmem_create], [tirpc], [], [ ++ AC_MSG_FAILURE([xdrmem_create() requires libc])]) ++ ]) ++]) +diff --git a/config/user.m4 b/config/user.m4 +index 7f79420..7213e61 100644 +--- a/config/user.m4 ++++ b/config/user.m4 +@@ -10,6 +10,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [ + ZFS_AC_CONFIG_USER_ARCH + ZFS_AC_CONFIG_USER_ZLIB + ZFS_AC_CONFIG_USER_LIBUUID ++ ZFS_AC_CONFIG_USER_LIBTIRPC + ZFS_AC_CONFIG_USER_LIBBLKID + ZFS_AC_CONFIG_USER_FRAME_LARGER_THAN + ZFS_AC_CONFIG_USER_RUNSTATEDIR +diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am +index c9ac1f1..2833557 100644 +--- a/lib/libnvpair/Makefile.am ++++ b/lib/libnvpair/Makefile.am +@@ -4,7 +4,7 @@ VPATH = \ + $(top_srcdir)/module/nvpair \ + $(top_srcdir)/lib/libnvpair + +-AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN) ++AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN) $(LIBTIRPC_CFLAGS) + + DEFAULT_INCLUDES += \ + -I$(top_srcdir)/include \ +@@ -26,8 +26,8 @@ nodist_libnvpair_la_SOURCES = \ + $(KERNEL_C) + + libnvpair_la_LIBADD = \ +- $(top_builddir)/lib/libuutil/libuutil.la +- ++ $(top_builddir)/lib/libuutil/libuutil.la \ ++ $(LIBTIRPC) + libnvpair_la_LDFLAGS = -version-info 1:1:0 + + EXTRA_DIST = $(USER_C) +diff --git a/lib/libnvpair/nvpair_alloc_system.c b/lib/libnvpair/nvpair_alloc_system.c +index f45dc5f..54dde1e 100644 +--- a/lib/libnvpair/nvpair_alloc_system.c ++++ b/lib/libnvpair/nvpair_alloc_system.c +@@ -27,6 +27,7 @@ + + + #include <rpc/types.h> ++#include <sys/kmem.h> + #include <sys/nvpair.h> + + static void * +diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am +index a569446..afd64fc 100644 +--- a/lib/libspl/Makefile.am ++++ b/lib/libspl/Makefile.am +@@ -29,7 +29,6 @@ USER_C = \ + strnlen.c \ + timestamp.c \ + zone.c \ +- xdr.c \ + include/sys/list.h \ + include/sys/list_impl.h + +diff --git a/lib/libspl/include/rpc/Makefile.am b/lib/libspl/include/rpc/Makefile.am +index 7a29aba..78ee5a2 100644 +--- a/lib/libspl/include/rpc/Makefile.am ++++ b/lib/libspl/include/rpc/Makefile.am +@@ -1,4 +1,3 @@ + libspldir = $(includedir)/libspl/rpc + libspl_HEADERS = \ +- $(top_srcdir)/lib/libspl/include/rpc/types.h \ + $(top_srcdir)/lib/libspl/include/rpc/xdr.h +diff --git a/lib/libspl/include/rpc/types.h b/lib/libspl/include/rpc/types.h +deleted file mode 100644 +index aa9901f..0000000 +--- a/lib/libspl/include/rpc/types.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-/* +- * CDDL HEADER START +- * +- * 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] +- * +- * CDDL HEADER END +- */ +-/* +- * Copyright 2010 Sun Microsystems, Inc. All rights reserved. +- * Use is subject to license terms. +- */ +- +-#ifndef LIBSPL_RPC_TYPES_H +-#define LIBSPL_RPC_TYPES_H +- +-#include_next <rpc/types.h> +-#include <sys/kmem.h> +- +-#endif /* LIBSPL_RPC_TYPES_H */ +diff --git a/lib/libspl/include/rpc/xdr.h b/lib/libspl/include/rpc/xdr.h +index 99500d6..3c7c53f 100644 +--- a/lib/libspl/include/rpc/xdr.h ++++ b/lib/libspl/include/rpc/xdr.h +@@ -32,11 +32,20 @@ + #ifndef LIBSPL_RPC_XDR_H + #define LIBSPL_RPC_XDR_H + +-#include_next <rpc/xdr.h> +- + /* +- * These are XDR control operators ++ * When available prefer libtirpc for xdr functionality. This library is ++ * mandatory when compiling with musl libc because it does not provide xdr. + */ ++#if defined(HAVE_LIBTIRPC) ++ ++#include <tirpc/rpc/xdr.h> ++#ifdef xdr_control ++#undef xdr_control ++#endif ++ ++#else ++#include_next <rpc/xdr.h> ++#endif /* HAVE_LIBTIRPC */ + + #define XDR_GET_BYTES_AVAIL 1 + +@@ -46,20 +55,20 @@ typedef struct xdr_bytesrec { + } xdr_bytesrec_t; + + /* +- * These are the request arguments to XDR_CONTROL. +- * +- * XDR_PEEK - returns the contents of the next XDR unit on the XDR stream. +- * XDR_SKIPBYTES - skips the next N bytes in the XDR stream. +- * XDR_RDMAGET - for xdr implementation over RDMA, gets private flags from +- * the XDR stream being moved over RDMA +- * XDR_RDMANOCHUNK - for xdr implementaion over RDMA, sets private flags in +- * the XDR stream moving over RDMA. ++ * This functionality is not required and is disabled in user space. + */ +-#define XDR_PEEK 2 +-#define XDR_SKIPBYTES 3 +-#define XDR_RDMAGET 4 +-#define XDR_RDMASET 5 ++static inline bool_t ++xdr_control(XDR *xdrs, int request, void *info) ++{ ++ xdr_bytesrec_t *xptr; + +-extern bool_t xdr_control(XDR *xdrs, int request, void *info); ++ ASSERT3U(request, ==, XDR_GET_BYTES_AVAIL); + +-#endif ++ xptr = (xdr_bytesrec_t *)info; ++ xptr->xc_is_last_record = TRUE; ++ xptr->xc_num_avail = xdrs->x_handy; ++ ++ return (TRUE); ++} ++ ++#endif /* LIBSPL_RPC_XDR_H */ +diff --git a/lib/libspl/xdr.c b/lib/libspl/xdr.c +deleted file mode 100644 +index 288a338..0000000 +--- a/lib/libspl/xdr.c ++++ /dev/null +@@ -1,78 +0,0 @@ +-/* +- * CDDL HEADER START +- * +- * The contents of this file are subject to the terms of the +- * Common Development and Distribution License, Version 1.0 only +- * (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] +- * +- * CDDL HEADER END +- * +- * Copyright 2005 Sun Microsystems, Inc. All rights reserved. +- * Use is subject to license terms. +- * +- * Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T +- * All Rights Reserved +- * +- * Portions of this source code were derived from Berkeley 4.3 BSD +- * under license from the Regents of the University of California. +- */ +- +-#include <rpc/xdr.h> +- +-/* +- * As of glibc-2.5-25 there is not support for xdr_control(). The +- * xdrmem implementation from OpenSolaris is used here. +- * +- * FIXME: Not well tested it may not work as expected. +- */ +-bool_t +-xdr_control(XDR *xdrs, int request, void *info) +-{ +- xdr_bytesrec_t *xptr; +- int32_t *int32p; +- int len; +- +- switch (request) { +- case XDR_GET_BYTES_AVAIL: +- xptr = (xdr_bytesrec_t *)info; +- xptr->xc_is_last_record = TRUE; +- xptr->xc_num_avail = xdrs->x_handy; +- return (TRUE); +- +- case XDR_PEEK: +- /* +- * Return the next 4 byte unit in the XDR stream. +- */ +- if (xdrs->x_handy < sizeof (int32_t)) +- return (FALSE); +- int32p = (int32_t *)info; +- *int32p = (int32_t)ntohl((uint32_t) +- (*((int32_t *)(xdrs->x_private)))); +- return (TRUE); +- +- case XDR_SKIPBYTES: +- /* +- * Skip the next N bytes in the XDR stream. +- */ +- int32p = (int32_t *)info; +- len = RNDUP((int)(*int32p)); +- if ((xdrs->x_handy -= len) < 0) +- return (FALSE); +- xdrs->x_private += len; +- return (TRUE); +- +- } +- return (FALSE); +-} +-- +2.7.4 + diff --git a/main/zfs-vanilla/0009-Add-support-for-alpine-linux.patch b/main/zfs-vanilla/0009-Add-support-for-alpine-linux.patch new file mode 100644 index 0000000000..54d55e6ea5 --- /dev/null +++ b/main/zfs-vanilla/0009-Add-support-for-alpine-linux.patch @@ -0,0 +1,122 @@ +From 00aa1a096d2c9ecaf28faa51aca5feb9d406aab0 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter <clandmeter@gmail.com> +Date: Tue, 1 Mar 2016 16:36:28 +0100 +Subject: [PATCH] Add support for alpine linux + +Both Alpine Linux and Gentoo use OpenRC so we share its logic +--- + config/zfs-build.m4 | 7 ++++++- + etc/init.d/Makefile.am | 2 +- + etc/init.d/zfs-import.in | 2 +- + etc/init.d/zfs-mount.in | 2 +- + etc/init.d/zfs-share.in | 2 +- + etc/init.d/zfs-zed.in | 2 +- + 6 files changed, 11 insertions(+), 6 deletions(-) + +diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 +index f93c5b5..9d3f0a6 100644 +--- a/config/zfs-build.m4 ++++ b/config/zfs-build.m4 +@@ -266,6 +266,8 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ + VENDOR=ubuntu ; + elif test -f /etc/debian_version ; then + VENDOR=debian ; ++ elif test -f /etc/alpine-release ; then ++ VENDOR=alpine ; + else + VENDOR= ; + fi +@@ -278,6 +280,7 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ + redhat) DEFAULT_PACKAGE=rpm ;; + fedora) DEFAULT_PACKAGE=rpm ;; + gentoo) DEFAULT_PACKAGE=tgz ;; ++ alpine) DEFAULT_PACKAGE=tgz ;; + arch) DEFAULT_PACKAGE=tgz ;; + sles) DEFAULT_PACKAGE=rpm ;; + slackware) DEFAULT_PACKAGE=tgz ;; +@@ -299,7 +302,8 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ + toss) DEFAULT_INIT_SCRIPT=redhat ;; + redhat) DEFAULT_INIT_SCRIPT=redhat ;; + fedora) DEFAULT_INIT_SCRIPT=fedora ;; +- gentoo) DEFAULT_INIT_SCRIPT=gentoo ;; ++ gentoo) DEFAULT_INIT_SCRIPT=openrc ;; ++ alpine) DEFAULT_INIT_SCRIPT=openrc ;; + arch) DEFAULT_INIT_SCRIPT=lsb ;; + sles) DEFAULT_INIT_SCRIPT=lsb ;; + slackware) DEFAULT_INIT_SCRIPT=lsb ;; +@@ -313,6 +317,7 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ + + AC_MSG_CHECKING([default init config direectory]) + case "$VENDOR" in ++ alpine) DEFAULT_INITCONF_DIR=/etc/conf.d ;; + gentoo) DEFAULT_INITCONF_DIR=/etc/conf.d ;; + toss) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; + redhat) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; +diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am +index 5f70fc6..c6e29d1 100644 +--- a/etc/init.d/Makefile.am ++++ b/etc/init.d/Makefile.am +@@ -21,7 +21,7 @@ $(init_SCRIPTS) $(initconf_SCRIPTS) $(initcommon_SCRIPTS): $(EXTRA_DIST) + else \ + NFS_SRV=nfs; \ + fi; \ +- if [ -e /etc/gentoo-release ]; then \ ++ if [ -e /sbin/openrc-run ]; then \ + SHELL=/sbin/runscript; \ + else \ + SHELL=/bin/sh; \ +diff --git a/etc/init.d/zfs-import.in b/etc/init.d/zfs-import.in +index 2258638..354bbc6 100755 +--- a/etc/init.d/zfs-import.in ++++ b/etc/init.d/zfs-import.in +@@ -308,7 +308,7 @@ do_start() + + # ---------------------------------------------------- + +-if [ ! -e /etc/gentoo-release ] ++if [ ! -e /sbin/openrc-run ] + then + case "$1" in + start) +diff --git a/etc/init.d/zfs-mount.in b/etc/init.d/zfs-mount.in +index 05cea9b..34db057 100755 +--- a/etc/init.d/zfs-mount.in ++++ b/etc/init.d/zfs-mount.in +@@ -199,7 +199,7 @@ do_stop() + + # ---------------------------------------------------- + +-if [ ! -e /etc/gentoo-release ] ++if [ ! -e /sbin/openrc-run ] + then + case "$1" in + start) +diff --git a/etc/init.d/zfs-share.in b/etc/init.d/zfs-share.in +index 1b70da4..ce3cc1c 100755 +--- a/etc/init.d/zfs-share.in ++++ b/etc/init.d/zfs-share.in +@@ -58,7 +58,7 @@ do_stop() + + # ---------------------------------------------------- + +-if [ ! -e /etc/gentoo-release ]; then ++if [ ! -e /sbin/openrc-run ]; then + case "$1" in + start) + do_start +diff --git a/etc/init.d/zfs-zed.in b/etc/init.d/zfs-zed.in +index 86e3185..d0086ee 100755 +--- a/etc/init.d/zfs-zed.in ++++ b/etc/init.d/zfs-zed.in +@@ -98,7 +98,7 @@ do_reload() + + # ---------------------------------------------------- + +-if [ ! -e /etc/gentoo-release ]; then ++if [ ! -e /sbin/openrc-run ]; then + case "$1" in + start) + do_start +-- +2.7.2 + diff --git a/main/zfs-vanilla/APKBUILD b/main/zfs-vanilla/APKBUILD new file mode 100644 index 0000000000..c58f204d54 --- /dev/null +++ b/main/zfs-vanilla/APKBUILD @@ -0,0 +1,120 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: Carlo Landmeter <clandmeter@gmail.com> + +_flavor=${FLAVOR:-vanilla} +_realname=zfs +_name=$_realname-$_flavor + +_kpkg=linux-$_flavor +_kver=4.4.18 +_kpkgrel=0 + +_realver=0.6.5.7 +_mypkgrel=0 + +# source the kernel version +if [ -f ../../main/linux-$_flavor/APKBUILD ]; then + . ../../main/linux-$_flavor/APKBUILD + [ "$_kver" != "$pkgver" ] && die "$_name: Please update _kver to $pkgver" + [ "$_kpkgrel" != "$pkgrel" ] && die "$_name: Please update _kpkgrel to $pkgrel" +fi + +_kernelver=$_kver-r$_kpkgrel +_abi_release=${_kver} + +pkgname=$_name +pkgver=$_kver +pkgrel=$(($_kpkgrel + $_mypkgrel)) +pkgdesc="ZFS for Linux" +url="http://zfsonlinux.org" +arch="x86 x86_64 aarch64" +license="CDDL" +depends="spl-$_flavor" +depends_dev="glib-dev e2fsprogs-dev util-linux-dev libtirpc-dev + linux-$_flavor-dev=$_kernelver spl-$_flavor-dev" +makedepends="$depends_dev automake autoconf libtool linux-headers" +install_if="zfs linux-vanilla-$_kver" +install="" +subpackages="$pkgname-dev" +source="http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-$_realver.tar.gz + 0001-Use-the-correct-macro-to-include-backtrace.patch + 0002-Include-sys-types.h-in-devid.h.patch + 0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch + 0004-Ensure-correct-return-value-type.patch + 0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch + 0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch + 0007-Remove-complicated-libspl-assert-wrappers.patch + 0008-Add-support-for-libtirpc.patch + 0009-Add-support-for-alpine-linux.patch + " + + +builddir="$srcdir/$_realname-$_realver" + +prepare() { + default_prepare + autoreconf -vif || return 1 +} + +build() { + cd "$builddir" + export LIBS="$LIBS -lintl" + KCFLAGS="-fno-pie" \ + EXTRA_KCFLAGS="-fno-pie -Wno-error=unused-but-set-variable" \ + ./configure --prefix=/usr \ + --with-tirpc \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --with-config=kernel \ + --with-linux=/usr/src/linux-headers-${_abi_release} \ + --with-spl=/usr/src/spl-${_realver} \ + || return 1 + make KCFLAGS="-fno-pie" \ + EXTRA_KCFLAGS="-fno-pie" \ + || return 1 +} + +package() { + cd "$builddir" + make KCFLAGS="-fno-pie" DESTDIR="$pkgdir" \ + install || return 1 +} + +dev() { + mkdir -p "$subpkgdir"/usr + mv "$pkgdir"/usr/src "$subpkgdir"/usr || return 1 + default_dev +} + +md5sums="b470c0426da6e1e3513f5166c907218d zfs-0.6.5.7.tar.gz +f6ec48b9b5c441a1f54949370144fda5 0001-Use-the-correct-macro-to-include-backtrace.patch +9bad71efa929c9cde4521878250d85d3 0002-Include-sys-types.h-in-devid.h.patch +20e8a315dd63c6846f6391da1b72a733 0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch +00fdcfb201ea5dae99b545830b594282 0004-Ensure-correct-return-value-type.patch +2799a289044ff300d22884d3e97742d7 0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch +53c86d3f6d17e9b13adc6c2d3e59039b 0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch +a1138f272d993474b51951ae4d14e242 0007-Remove-complicated-libspl-assert-wrappers.patch +36d1338fc76c999441506f674a85d9fc 0008-Add-support-for-libtirpc.patch +ce98b83e44621e99e686cb384b36aaeb 0009-Add-support-for-alpine-linux.patch" +sha256sums="4a9e271bb9a6af8d564e4d5800e4fff36224f1697b923a7253659bdda80dc590 zfs-0.6.5.7.tar.gz +c30273c9874e8ab13f3eb8612dd7af6b7916b5b358060a1afee7c9b0af68f307 0001-Use-the-correct-macro-to-include-backtrace.patch +3898613e9ee3f46e7048a4a74ee2584979bd7b258e6831c9aeb46e6862ec3371 0002-Include-sys-types.h-in-devid.h.patch +f0153d3ebc2b58d6f0e0a7b4a705c6728cb18bfcff568f0eac917a21aba78324 0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch +fa840bf91e0fd44677b7d180c72687f8caad36f673f0c01bf6bf6d29836530a5 0004-Ensure-correct-return-value-type.patch +8a6d9b6fa6edf57a7f91b1204099a7a8fc1f604b5edf8dc28f21681cdc56699c 0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch +96adc58dd0955b0dfe99321ae32fb07289836d2390a4492e6daa4911d3b638c4 0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch +48167b51bdaac8d0cac4c534d5b01afc3bd6b416aceddc7e8bea705b30b6dc7e 0007-Remove-complicated-libspl-assert-wrappers.patch +259ab7271776e4034ab36f7cff06d8b9aa9fb74756f8ca1e1b933ddf93030f8e 0008-Add-support-for-libtirpc.patch +f06e42db7c7e41481dfb068d80c9b763d7c9aead4c8f017e9398f88d58424092 0009-Add-support-for-alpine-linux.patch" +sha512sums="559b826ae1a176217b92d8407729e2c5feeffb117dc9affaa8c9c2134d996b6c3cbe095f7a0c4666c9b131742491f1304eeb292e13e0df0b6d001fa620568af2 zfs-0.6.5.7.tar.gz +1e9f3c753b5bbe50ea6c953fec4200ae3a2de63abaa0dbcc2fb558a92716c27545ef773b3d0dc7bb1248622073a0db4c194d008bc83af7de7f90111169ffe31a 0001-Use-the-correct-macro-to-include-backtrace.patch +244f143c3cca0102ee98aed122b70d9e255a68645d90f927d67fe19e89c4678839b91fbb560c4e55306510e8aec4762c4afc671317df153940f17e905c17b928 0002-Include-sys-types.h-in-devid.h.patch +413cf13db3d390714fcd20c4150d3b0dbddcff031572117fcd4f015d929fde642381ab98f0b796dc4001472b2ee13dbf69261f4b83e990c2b0a080223667193c 0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch +c26793c4ada197584d5829a6d31fd826333416a73ac1fa1d8f84277ba99312db72608d6d13171131cdf61b20e1c6c1ada51027361d48cc7b2863fd5b23df8083 0004-Ensure-correct-return-value-type.patch +fbd44839a422925a54710e8425405d24ca2428b78aa54b9a77492e5882a3e21aa4a5e53656466c5af79460fde75ac6aeb6f1f3fe85a1f26333d5acd36c6c9013 0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch +e20fb3004af9e6454513d7df09292465e5bc4101a558538cf794ef41b56a30713e1868dcda251e6b3ed10c5f0178e86068bcb113bd8228eedb626cb73bb19ecd 0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch +9843aca713021772435cfa68fde5d9aa2de0387de0da6c48045db0348f2a24d2c2e968d3eb1921923170c9e2fd6514e31c5f0a7bacbf8510b53c2c625c4737d1 0007-Remove-complicated-libspl-assert-wrappers.patch +fa752b3ed04f05ec4fac257cbd2c581a57a792e12165d8f135a77b894445cdefb0da1753922e3e59c9fbaed20ca1dc6d19b5436745c8fa588a42304f6561f1a2 0008-Add-support-for-libtirpc.patch +d2efb627f493bab06f8049dc4bcb7c39269ff9dcd66879a0f96fa5040e1c7468f9e684277ec3e54841b3a5f8734d9470f2c6a1af470e3f1a71f759f9155b7ede 0009-Add-support-for-alpine-linux.patch" |