Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet Use the upstream xdr, with a rename danc...



details:   https://anonhg.NetBSD.org/src/rev/f01c0d26ae82
branches:  trunk
changeset: 337310:f01c0d26ae82
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Apr 10 22:44:20 2015 +0000

description:
Use the upstream xdr, with a rename dance to avoid clash with libc.

The upstream xdr provides some functionality expected by the upstream
libnvpair which our libc's xdr does not provide.

When modifying, double-check that libnvpair.so defines no xdr_*
symbols, only _solaris_xdr_*.  (XXX Put this note somewhere...)

diffstat:

 external/cddl/osnet/dist/uts/common/rpc/types.h |   4 ++
 external/cddl/osnet/dist/uts/common/rpc/xdr.c   |   7 +++++
 external/cddl/osnet/dist/uts/common/rpc/xdr.h   |  35 +++++++++++++++++++++++-
 external/cddl/osnet/lib/libnvpair/Makefile      |   6 +++-
 4 files changed, 49 insertions(+), 3 deletions(-)

diffs (116 lines):

diff -r 7c4995bb48fa -r f01c0d26ae82 external/cddl/osnet/dist/uts/common/rpc/types.h
--- a/external/cddl/osnet/dist/uts/common/rpc/types.h   Fri Apr 10 22:38:30 2015 +0000
+++ b/external/cddl/osnet/dist/uts/common/rpc/types.h   Fri Apr 10 22:44:20 2015 +0000
@@ -88,6 +88,10 @@
 #endif
 
 #ifndef        _KERNEL
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
 #define        mem_alloc(bsize)        malloc(bsize)
 #define        mem_free(ptr, bsize)    free(ptr)
 #else
diff -r 7c4995bb48fa -r f01c0d26ae82 external/cddl/osnet/dist/uts/common/rpc/xdr.c
--- a/external/cddl/osnet/dist/uts/common/rpc/xdr.c     Fri Apr 10 22:38:30 2015 +0000
+++ b/external/cddl/osnet/dist/uts/common/rpc/xdr.c     Fri Apr 10 22:44:20 2015 +0000
@@ -47,10 +47,17 @@
 #include <rpc/xdr.h>
 #include <sys/isa_defs.h>
 
+#ifdef __NetBSD__
+__weak_alias(_solaris_xdr_int32_t,_solaris_xdr_int)
+__weak_alias(_solaris_xdr_uint32_t,_solaris_xdr_u_int)
+__weak_alias(_solaris_xdr_int64_t,_solaris_xdr_longlong_t)
+__weak_alias(_solaris_xdr_uint64_t,_solaris_xdr_u_longlong_t)
+#else
 #pragma weak xdr_int32_t = xdr_int
 #pragma weak xdr_uint32_t = xdr_u_int
 #pragma weak xdr_int64_t = xdr_longlong_t
 #pragma weak xdr_uint64_t = xdr_u_longlong_t
+#endif
 
 #if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
 #error "Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined"
diff -r 7c4995bb48fa -r f01c0d26ae82 external/cddl/osnet/dist/uts/common/rpc/xdr.h
--- a/external/cddl/osnet/dist/uts/common/rpc/xdr.h     Fri Apr 10 22:38:30 2015 +0000
+++ b/external/cddl/osnet/dist/uts/common/rpc/xdr.h     Fri Apr 10 22:44:20 2015 +0000
@@ -46,6 +46,39 @@
 #include <sys/stream.h>
 #endif
 
+#ifdef __NetBSD__              /* Avoid conflicts with libc xdr.  */
+/* xdr.c */
+#define        xdr_bool                _solaris_xdr_bool
+#define        xdr_bytes               _solaris_xdr_bytes
+#define        xdr_char                _solaris_xdr_char
+#define        xdr_enum                _solaris_xdr_enum
+#define        xdr_free                _solaris_xdr_free
+#define        xdr_int                 _solaris_xdr_int
+#define        xdr_int32_t             _solaris_xdr_int32_t
+#define        xdr_int64_t             _solaris_xdr_int64_t
+#define        xdr_longlong_t          _solaris_xdr_longlong_t
+#define        xdr_netobj              _solaris_xdr_netobj
+#define        xdr_opaque              _solaris_xdr_opaque
+#define        xdr_short               _solaris_xdr_short
+#define        xdr_string              _solaris_xdr_string
+#define        xdr_u_char              _solaris_xdr_u_char
+#define        xdr_u_int               _solaris_xdr_u_int
+#define        xdr_u_longlong_t        _solaris_xdr_u_longlong_t
+#define        xdr_u_short             _solaris_xdr_u_short
+#define        xdr_uint32_t            _solaris_xdr_uint32_t
+#define        xdr_uint64_t            _solaris_xdr_uint64_t
+#define        xdr_union               _solaris_xdr_union
+#define        xdr_vector              _solaris_xdr_vector
+#define        xdr_void                _solaris_xdr_void
+#define        xdr_wrapstring          _solaris_xdr_wrapstring
+
+/* xdr_array.c */
+#define        xdr_array               _solaris_xdr_array
+
+/* xdr_mem.c */
+#define        xdrmem_create           _solaris_xdrmem_create
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -540,7 +573,6 @@
  * XDR_RDMANOCHUNK - for xdr implementaion over RDMA, sets private flags in
  *                   the XDR stream moving over RDMA.
  */
-#ifdef _KERNEL
 #define        XDR_PEEK                2
 #define        XDR_SKIPBYTES           3
 #define        XDR_RDMA_GET_FLAGS      4
@@ -551,7 +583,6 @@
 #define        XDR_RDMA_GET_WLIST      9
 #define        XDR_RDMA_GET_WCINFO     10
 #define        XDR_RDMA_GET_RLIST      11
-#endif
 
 /*
  * These are the public routines for the various implementations of
diff -r 7c4995bb48fa -r f01c0d26ae82 external/cddl/osnet/lib/libnvpair/Makefile
--- a/external/cddl/osnet/lib/libnvpair/Makefile        Fri Apr 10 22:38:30 2015 +0000
+++ b/external/cddl/osnet/lib/libnvpair/Makefile        Fri Apr 10 22:44:20 2015 +0000
@@ -1,13 +1,17 @@
-#      $NetBSD: Makefile,v 1.6 2011/01/13 23:18:24 haad Exp $
+#      $NetBSD: Makefile,v 1.7 2015/04/10 22:44:20 riastradh Exp $
 
 .PATH:  ${.CURDIR}/../../dist/lib/libnvpair
 .PATH:  ${.CURDIR}/../../dist/common/nvpair
+.PATH:  ${.CURDIR}/../../dist/uts/common/rpc
 
 CPPFLAGS+=-Wall -Wno-unknown-pragmas
 
 LIB=   nvpair
 
 SRCS=  libnvpair.c nvpair_alloc_system.c nvpair_alloc_fixed.c nvpair.c
+SRCS+= xdr.c
+SRCS+= xdr_array.c
+SRCS+= xdr_mem.c
 
 .include "../../Makefile.zfs"
 .include <bsd.lib.mk>



Home | Main Index | Thread Index | Old Index