Commit fe345da6 authored by Carlo Landmeter's avatar Carlo Landmeter
Browse files

testing/zfs-grsec: rebase upstream patches and fix install_if

parent 300c4378
--- ./cmd/mount_zfs/mount_zfs.c.orig
+++ ./cmd/mount_zfs/mount_zfs.c
@@ -32,6 +32,7 @@
#include <sys/stat.h>
#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) */
From d8eadaf30347d1d67e8125ae7c299239d3b730dc Mon Sep 17 00:00:00 2001
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 3/8] Use the correct macro to include backtrace
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 42643ef..a824da9 100644
index afe6faa..40524ed 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -123,7 +123,7 @@
......@@ -30,5 +38,5 @@ index 42643ef..a824da9 100644
void *buffer[BACKTRACE_SZ];
--
2.7.2
2.7.4
From 0f29fd8ac81a166103f311c180fd06d956dc6dc4 Mon Sep 17 00:00:00 2001
From: Carlo Landmeter <clandmeter@gmail.com>
Date: Tue, 1 Mar 2016 15:13:44 +0100
Subject: [PATCH 2/8] Add support for libtirpc
This introduces the --with-tirpc configure switch to compile with libtirpc.
This is needed for libc's which do not have their own RPC libary (ie musl libc).
---
cmd/mount_zfs/Makefile.am | 3 ++-
cmd/zdb/Makefile.am | 2 +-
cmd/zed/Makefile.am | 3 ++-
cmd/zfs/Makefile.am | 2 +-
cmd/zhack/Makefile.am | 2 +-
cmd/zinject/Makefile.am | 3 ++-
cmd/zpool/Makefile.am | 2 +-
cmd/zstreamdump/Makefile.am | 2 +-
cmd/ztest/Makefile.am | 2 +-
config/tirpc.m4 | 17 +++++++++++++++++
config/user.m4 | 1 +
lib/libnvpair/Makefile.am | 2 +-
lib/libspl/Makefile.am | 6 +++---
lib/libspl/include/rpc/xdr.h | 2 ++
lib/libspl/xdr.c | 2 ++
module/nvpair/nvpair.c | 4 ++++
16 files changed, 42 insertions(+), 13 deletions(-)
create mode 100644 config/tirpc.m4
diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am
index b1d9389..4be1135 100644
--- a/cmd/mount_zfs/Makefile.am
+++ b/cmd/mount_zfs/Makefile.am
@@ -19,4 +19,5 @@ mount_zfs_LDADD = \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la \
- $(top_builddir)/lib/libzfs_core/libzfs_core.la
+ $(top_builddir)/lib/libzfs_core/libzfs_core.la \
+ $(TIRPC_LIBS)
diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am
index c22186a..181a821 100644
--- a/cmd/zdb/Makefile.am
+++ b/cmd/zdb/Makefile.am
@@ -19,4 +19,4 @@ zdb_LDADD = \
$(top_builddir)/lib/libzfs/libzfs.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.la
-zdb_LDADD += $(ZLIB)
+zdb_LDADD += $(ZLIB) $(TIRPC_LIBS)
diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am
index 70e4f7f..ce16ceb 100644
--- a/cmd/zed/Makefile.am
+++ b/cmd/zed/Makefile.am
@@ -30,7 +30,8 @@ zed_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la \
- $(top_builddir)/lib/libzfs_core/libzfs_core.la
+ $(top_builddir)/lib/libzfs_core/libzfs_core.la \
+ $(TIRPC_LIBS)
zedconfdir = $(sysconfdir)/zfs/zed.d
diff --git a/cmd/zfs/Makefile.am b/cmd/zfs/Makefile.am
index 3cac73d..ea35555 100644
--- a/cmd/zfs/Makefile.am
+++ b/cmd/zfs/Makefile.am
@@ -19,5 +19,5 @@ zfs_LDADD = \
$(top_builddir)/lib/libzfs/libzfs.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.la
-zfs_LDADD += $(ZLIB)
+zfs_LDADD += $(ZLIB) $(TIRPC_LIBS)
zfs_LDFLAGS = -pthread
diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am
index 53e3241..07b5fab 100644
--- a/cmd/zhack/Makefile.am
+++ b/cmd/zhack/Makefile.am
@@ -16,4 +16,4 @@ zhack_LDADD = \
$(top_builddir)/lib/libzfs/libzfs.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.la
-zhack_LDADD += $(ZLIB)
+zhack_LDADD += $(ZLIB) $(TIRPC_LIBS)
diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am
index 2500bee..2d069d3 100644
--- a/cmd/zinject/Makefile.am
+++ b/cmd/zinject/Makefile.am
@@ -16,4 +16,5 @@ zinject_LDADD = \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la \
- $(top_builddir)/lib/libzfs_core/libzfs_core.la
+ $(top_builddir)/lib/libzfs_core/libzfs_core.la \
+ $(TIRPC_LIBS)
diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am
index c11951b..a59bf32 100644
--- a/cmd/zpool/Makefile.am
+++ b/cmd/zpool/Makefile.am
@@ -19,4 +19,4 @@ zpool_LDADD = \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.la \
- $(LIBBLKID)
+ $(LIBBLKID) $(TIRPC_LIBS)
diff --git a/cmd/zstreamdump/Makefile.am b/cmd/zstreamdump/Makefile.am
index 654863a..f800a8e 100644
--- a/cmd/zstreamdump/Makefile.am
+++ b/cmd/zstreamdump/Makefile.am
@@ -16,4 +16,4 @@ zstreamdump_LDADD = \
$(top_builddir)/lib/libzfs/libzfs.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.la
-zstreamdump_LDADD += $(ZLIB)
+zstreamdump_LDADD += $(ZLIB) $(TIRPC_LIBS)
diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am
index e3be39a..1953fe8 100644
--- a/cmd/ztest/Makefile.am
+++ b/cmd/ztest/Makefile.am
@@ -19,4 +19,4 @@ ztest_LDADD = \
$(top_builddir)/lib/libzfs/libzfs.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.la
-ztest_LDADD += -lm -ldl
+ztest_LDADD += -lm -ldl $(TIRPC_LIBS)
diff --git a/config/tirpc.m4 b/config/tirpc.m4
new file mode 100644
index 0000000..ec15785
--- /dev/null
+++ b/config/tirpc.m4
@@ -0,0 +1,17 @@
+dnl
+dnl musl support
+dnl
+
+AC_DEFUN([ZFS_AC_CONFIG_USER_TIRPC], [
+AH_TEMPLATE([WITH_TIRPC],
+ [Define to 1 if libtirpc is being used as the RPC library])
+AC_ARG_WITH(tirpc,
+AC_HELP_STRING([--with-tirpc], [compile with libtirpc]),
+[if test x$withval = xyes; then
+ AC_DEFINE([WITH_TIRPC], 1, [Define if you have musl])
+ PKG_CHECK_MODULES([TIRPC],[libtirpc])
+ AC_DEFINE([WITH_TIRPC], 1, [Define if you have libtirpc])
+ AC_SUBST(TIRPC_CFLAGS)
+ AC_SUBST(TIRPC_LIBS)
+fi])
+])
diff --git a/config/user.m4 b/config/user.m4
index 7f79420..820b8d3 100644
--- a/config/user.m4
+++ b/config/user.m4
@@ -13,6 +13,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_LIBBLKID
ZFS_AC_CONFIG_USER_FRAME_LARGER_THAN
ZFS_AC_CONFIG_USER_RUNSTATEDIR
+ ZFS_AC_CONFIG_USER_TIRPC
dnl #
dnl # Checks for library functions
AC_CHECK_FUNCS([mlockall])
diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am
index c9ac1f1..985285a 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) $(TIRPC_CFLAGS)
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am
index a569446..9cedfaa 100644
--- a/lib/libspl/Makefile.am
+++ b/lib/libspl/Makefile.am
@@ -4,13 +4,13 @@ VPATH = \
$(top_srcdir)/lib/libspl \
$(top_srcdir)/lib/libspl/$(TARGET_ASM_DIR)
-AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
+AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN) $(TIRPC_CFLAGS)
SUBDIRS = include $(TARGET_ASM_DIR)
DIST_SUBDIRS = include asm-generic asm-i386 asm-x86_64
DEFAULT_INCLUDES += \
- -I$(top_srcdir)/lib/libspl/include
+ -I$(top_srcdir)/lib/libspl/include $(TIRPC_CFLAGS)
AM_CCASFLAGS = \
-I$(top_srcdir)/lib/libspl/include
@@ -42,6 +42,6 @@ nodist_libspl_la_SOURCES = \
$(USER_ASM) \
$(KERNEL_C)
-libspl_la_LIBADD = -lrt
+libspl_la_LIBADD = -lrt $(TIRPC_LDFLAGS)
EXTRA_DIST = $(USER_C)
diff --git a/lib/libspl/include/rpc/xdr.h b/lib/libspl/include/rpc/xdr.h
index 99500d6..cd2d17a 100644
--- a/lib/libspl/include/rpc/xdr.h
+++ b/lib/libspl/include/rpc/xdr.h
@@ -60,6 +60,8 @@ typedef struct xdr_bytesrec {
#define XDR_RDMAGET 4
#define XDR_RDMASET 5
+#ifndef WITH_TIRPC
extern bool_t xdr_control(XDR *xdrs, int request, void *info);
+#endif
#endif
diff --git a/lib/libspl/xdr.c b/lib/libspl/xdr.c
index 288a338..f122496 100644
--- a/lib/libspl/xdr.c
+++ b/lib/libspl/xdr.c
@@ -29,6 +29,7 @@
* under license from the Regents of the University of California.
*/
+#ifndef WITH_TIRPC
#include <rpc/xdr.h>
/*
@@ -76,3 +77,4 @@ xdr_control(XDR *xdrs, int request, void *info)
}
return (FALSE);
}
+#endif
diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c
index 1eca0fe..efd6287 100644
--- a/module/nvpair/nvpair.c
+++ b/module/nvpair/nvpair.c
@@ -3251,8 +3251,12 @@ nvs_xdr_nvpair(nvstream_t *nvs, nvpair_t *nvp, size_t *size)
return (0);
/* sanity check the size parameter */
+#ifndef WITH_TIRPC
if (!xdr_control(xdr, XDR_GET_BYTES_AVAIL, &bytesrec))
return (EFAULT);
+#else
+ xdr_control(xdr, XDR_GET_BYTES_AVAIL, &bytesrec);
+#endif
if (*size > NVS_XDR_MAX_LEN(bytesrec.xc_num_avail))
return (EFAULT);
--
2.7.2
From 9104430ec34fe257ccb6e199771c804d38f0003a Mon Sep 17 00:00:00 2001
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 6/8] Include sys/types.h in devid.h
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(+)
......@@ -21,5 +25,5 @@ index 5406c33..4b346da 100644
typedef int ddi_devid_t;
--
2.7.2
2.7.4
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
From b2197a57c1261591e34d92a6ad7444ea97819db6 Mon Sep 17 00:00:00 2001
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 cc626fd..e68223e 100644
index 4f7e328..78e33e1 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -637,7 +637,7 @@ extern void delay(clock_t ticks);
@@ -623,7 +623,7 @@ extern void delay(clock_t ticks);
#define maxclsyspri -20
#define defclsyspri 0
......@@ -22,5 +26,5 @@ index cc626fd..e68223e 100644
#define kcred NULL
#define CRED() NULL
--
2.7.2
2.7.4
From b49e2287871f612167dc40eb0d86e1c8b2d6311e Mon Sep 17 00:00:00 2001
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 8/8] Set _DATE_FMT to '%+' if not defined in
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..85b7ecf 100644
index a4f4cf4..e2838da 100644
--- a/lib/libspl/timestamp.c
+++ b/lib/libspl/timestamp.c
@@ -28,6 +28,10 @@
......@@ -17,12 +20,12 @@ index a4f4cf4..85b7ecf 100644
#include "statcommon.h"
+#ifndef _DATE_FMT
+#define _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.2
2.7.4
From 3bca72de3c30598c585c910208459a0cf05b9f0d Mon Sep 17 00:00:00 2001
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] Move hrtime_t timestruc_t and timespec_t and change
longlong_t to long long
Subject: [PATCH 6/8] Move hrtime_t timestruc_t and timespec_t
hrtime_t timestruc_t and timespec_t should have originally be included in
sys/time.h so lets move them.
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 ----
......@@ -44,3 +47,6 @@ index 25d56be..8996af9 100644
typedef short pri_t;
typedef int zoneid_t;
--
2.7.4
From 468e0c54b8d34d93043c9631cab954fb88fff8cb Mon Sep 17 00:00:00 2001
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] Remove complicated libspl assert wrappers
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 error messages with those from the kernel.
spl.ko module.
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 | 76 +++++++++++++++++++--------------------------
2 files changed, 32 insertions(+), 49 deletions(-)
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
......@@ -31,7 +32,7 @@ index e805e3e..ff02fa7 100644
char *zf_device;
char *zf_fru;
diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h
index 52924e8..b30626e 100644
index 52924e8..6226872 100644
--- a/lib/libspl/include/assert.h
+++ b/lib/libspl/include/assert.h
@@ -32,68 +32,54 @@
......@@ -133,7 +134,7 @@ index 52924e8..b30626e 100644
#define ASSERTV(x)
#define IMPLY(A, B) ((void)0)
#define EQUIV(A, B) ((void)0)
@@ -102,6 +88,8 @@ assfail(const char *buf, const char *file, int line)
@@ -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)
......@@ -142,3 +143,17 @@ index 52924e8..b30626e 100644
#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
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)
</