Source-Changes-HG archive

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

[src/trunk]: src Implement xdrmem_control(), used as xdr_control(xdr, XDR_GET...



details:   https://anonhg.NetBSD.org/src/rev/37a4b536519a
branches:  trunk
changeset: 841849:37a4b536519a
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Jun 04 08:44:08 2019 +0000

description:
Implement xdrmem_control(), used as xdr_control(xdr, XDR_GET_BYTES_AVAIL ...
and bump libc minor number.

Final goal is to remove the unmaintained XDR implementation
at external/cddl/osnet/dist/uts/common/rpc.

diffstat:

 distrib/sets/lists/base/shl.mi  |   6 +++---
 distrib/sets/lists/debug/shl.mi |   6 +++---
 include/rpc/xdr.h               |  19 ++++++++++++++++---
 lib/libc/rpc/xdr_mem.c          |  26 ++++++++++++++++++++++----
 lib/libc/shlib_version          |   4 ++--
 5 files changed, 46 insertions(+), 15 deletions(-)

diffs (170 lines):

diff -r c90e98767baa -r 37a4b536519a distrib/sets/lists/base/shl.mi
--- a/distrib/sets/lists/base/shl.mi    Tue Jun 04 03:03:34 2019 +0000
+++ b/distrib/sets/lists/base/shl.mi    Tue Jun 04 08:44:08 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.864 2019/04/28 00:03:46 christos Exp $
+# $NetBSD: shl.mi,v 1.865 2019/06/04 08:44:08 hannken Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -18,7 +18,7 @@
 ./lib/libblacklist.so.0.0                      base-sys-shlib          dynamicroot
 ./lib/libc.so                                  base-sys-shlib          dynamicroot
 ./lib/libc.so.12                               base-sys-shlib          dynamicroot
-./lib/libc.so.12.212                           base-sys-shlib          dynamicroot
+./lib/libc.so.12.213                           base-sys-shlib          dynamicroot
 ./lib/libcrypt.so                              base-sys-shlib          dynamicroot
 ./lib/libcrypt.so.1                            base-sys-shlib          dynamicroot
 ./lib/libcrypt.so.1.0                          base-sys-shlib          dynamicroot
@@ -221,7 +221,7 @@
 ./usr/lib/libc++.so.1.0                                base-sys-shlib          compatfile,libcxx
 ./usr/lib/libc.so                              base-sys-shlib          compatfile
 ./usr/lib/libc.so.12                           base-sys-shlib          compatfile
-./usr/lib/libc.so.12.212                       base-sys-shlib          compatfile
+./usr/lib/libc.so.12.213                       base-sys-shlib          compatfile
 ./usr/lib/libcdk.so                            base-obsolete           compatfile,obsolete
 ./usr/lib/libcom_err.so                                base-krb5-shlib         compatfile,kerberos
 ./usr/lib/libcom_err.so.8                      base-krb5-shlib         compatfile,kerberos
diff -r c90e98767baa -r 37a4b536519a distrib/sets/lists/debug/shl.mi
--- a/distrib/sets/lists/debug/shl.mi   Tue Jun 04 03:03:34 2019 +0000
+++ b/distrib/sets/lists/debug/shl.mi   Tue Jun 04 08:44:08 2019 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: shl.mi,v 1.223 2019/04/28 00:03:46 christos Exp $
+# $NetBSD: shl.mi,v 1.224 2019/06/04 08:44:08 hannken Exp $
 ./usr/lib/libbfd_g.a                                           comp-c-debuglib debuglib,compatfile,binutils
 ./usr/libdata/debug/lib                                                base-sys-usr    debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug              comp-sys-debug  debug,dynamicroot
-./usr/libdata/debug/lib/libc.so.12.212.debug                   comp-sys-debug  debug,dynamicroot
+./usr/libdata/debug/lib/libc.so.12.213.debug                   comp-sys-debug  debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypt.so.1.0.debug                  comp-sys-debug  debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypto.so.12.0.debug                        comp-sys-debug  debug,dynamicroot,openssl=10
 ./usr/libdata/debug/lib/libcrypto.so.14.0.debug                        comp-sys-debug  debug,dynamicroot,openssl=11
@@ -71,7 +71,7 @@
 ./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug          comp-sys-debug  debug,compatfile
 ./usr/libdata/debug/usr/lib/libbz2.so.1.1.debug                        comp-sys-debug  debug,compatfile
 ./usr/libdata/debug/usr/lib/libc++.so.1.0.debug                        comp-sys-debug  debug,compatfile,libcxx
-./usr/libdata/debug/usr/lib/libc.so.12.212.debug               comp-sys-debug  debug,compatfile
+./usr/libdata/debug/usr/lib/libc.so.12.213.debug               comp-sys-debug  debug,compatfile
 ./usr/libdata/debug/usr/lib/libcom_err.so.8.0.debug            comp-krb5-debug debug,compatfile,kerberos
 ./usr/libdata/debug/usr/lib/libcrypt.so.1.0.debug              comp-sys-debug  debug,compatfile
 ./usr/libdata/debug/usr/lib/libcrypto.so.12.0.debug            comp-crypto-debug       debug,compatfile,openssl=10
diff -r c90e98767baa -r 37a4b536519a include/rpc/xdr.h
--- a/include/rpc/xdr.h Tue Jun 04 03:03:34 2019 +0000
+++ b/include/rpc/xdr.h Tue Jun 04 08:44:08 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xdr.h,v 1.30 2017/08/16 08:35:48 christos Exp $        */
+/*     $NetBSD: xdr.h,v 1.31 2019/06/04 08:44:08 hannken Exp $ */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -209,8 +209,8 @@
                (*(xdrs)->x_ops->x_destroy)(xdrs)
 
 #define XDR_CONTROL(xdrs, req, op)                     \
-       if ((xdrs)->x_ops->x_control)                   \
-               (*(xdrs)->x_ops->x_control)(xdrs, req, op)
+       (((xdrs)->x_ops->x_control == NULL) ? (FALSE) : \
+               (*(xdrs)->x_ops->x_control)(xdrs, req, op))
 #define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op)
 
 #define xdr_rpcvers(xdrs, versp) xdr_u_int32_t(xdrs, versp)
@@ -326,6 +326,19 @@
 extern bool_t   xdr_netobj(XDR *, struct netobj *);
 
 /*
+ * These are XDR control operators
+ */
+
+#define XDR_GET_BYTES_AVAIL    1
+
+struct xdr_bytesrec {
+       bool_t xc_is_last_record;
+       size_t xc_num_avail;
+};
+
+typedef struct xdr_bytesrec xdr_bytesrec;
+
+/*
  * These are the public routines for the various implementations of
  * xdr streams.
  */
diff -r c90e98767baa -r 37a4b536519a lib/libc/rpc/xdr_mem.c
--- a/lib/libc/rpc/xdr_mem.c    Tue Jun 04 03:03:34 2019 +0000
+++ b/lib/libc/rpc/xdr_mem.c    Tue Jun 04 08:44:08 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xdr_mem.c,v 1.19 2013/03/11 20:19:30 tron Exp $        */
+/*     $NetBSD: xdr_mem.c,v 1.20 2019/06/04 08:44:08 hannken Exp $     */
 
 /*
  * Copyright (c) 2010, Oracle America, Inc.
@@ -37,7 +37,7 @@
 static char *sccsid = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
 static char *sccsid = "@(#)xdr_mem.c   2.1 88/07/29 4.0 RPCSRC";
 #else
-__RCSID("$NetBSD: xdr_mem.c,v 1.19 2013/03/11 20:19:30 tron Exp $");
+__RCSID("$NetBSD: xdr_mem.c,v 1.20 2019/06/04 08:44:08 hannken Exp $");
 #endif
 #endif
 
@@ -79,6 +79,7 @@
 static bool_t xdrmem_setpos(XDR *, u_int);
 static int32_t *xdrmem_inline_aligned(XDR *, u_int);
 static int32_t *xdrmem_inline_unaligned(XDR *, u_int);
+static bool_t xdrmem_control(XDR *xdrs, int request, void *info);
 
 static const struct    xdr_ops xdrmem_ops_aligned = {
        xdrmem_getlong_aligned,
@@ -89,7 +90,7 @@
        xdrmem_setpos,
        xdrmem_inline_aligned,
        xdrmem_destroy,
-       NULL,   /* xdrmem_control */
+       xdrmem_control
 };
 
 static const struct    xdr_ops xdrmem_ops_unaligned = {
@@ -101,7 +102,7 @@
        xdrmem_setpos,
        xdrmem_inline_unaligned,
        xdrmem_destroy,
-       NULL,   /* xdrmem_control */
+       xdrmem_control
 };
 
 /*
@@ -243,3 +244,20 @@
 
        return (0);
 }
+
+static bool_t
+xdrmem_control(XDR *xdrs, int request, void *info)
+{
+       xdr_bytesrec *xptr;
+
+       switch (request) {
+
+       case XDR_GET_BYTES_AVAIL:
+               xptr = (xdr_bytesrec *)info;
+               xptr->xc_is_last_record = TRUE;
+               xptr->xc_num_avail = xdrs->x_handy;
+               return (TRUE);
+
+       }
+       return (FALSE);
+}
diff -r c90e98767baa -r 37a4b536519a lib/libc/shlib_version
--- a/lib/libc/shlib_version    Tue Jun 04 03:03:34 2019 +0000
+++ b/lib/libc/shlib_version    Tue Jun 04 08:44:08 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: shlib_version,v 1.283 2019/03/04 19:20:12 christos Exp $
+#      $NetBSD: shlib_version,v 1.284 2019/06/04 08:44:08 hannken Exp $
 #      Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -54,4 +54,4 @@
 # - move statfs() to libcompat since we have statvfs()
 # - the syscall stubs for the (obsolete) lfs syscalls should be removed
 major=12
-minor=212
+minor=213



Home | Main Index | Thread Index | Old Index