svn commit: r184817 - in user/dfr/gssapi/6/lib/libc: . sys xdr
Doug Rabson
dfr at FreeBSD.org
Mon Nov 10 08:41:09 PST 2008
Author: dfr
Date: Mon Nov 10 16:41:08 2008
New Revision: 184817
URL: http://svn.freebsd.org/changeset/base/184817
Log:
MFC: 184588
Modified:
user/dfr/gssapi/6/lib/libc/ (props changed)
user/dfr/gssapi/6/lib/libc/sys/ (props changed)
user/dfr/gssapi/6/lib/libc/xdr/xdr.c
Modified: user/dfr/gssapi/6/lib/libc/xdr/xdr.c
==============================================================================
--- user/dfr/gssapi/6/lib/libc/xdr/xdr.c Mon Nov 10 16:39:31 2008 (r184816)
+++ user/dfr/gssapi/6/lib/libc/xdr/xdr.c Mon Nov 10 16:41:08 2008 (r184817)
@@ -263,6 +263,36 @@ xdr_u_int32_t(xdrs, u_int32_p)
return (FALSE);
}
+/*
+ * XDR unsigned 32-bit integers
+ * same as xdr_int32_t - open coded to save a proc call!
+ */
+bool_t
+xdr_uint32_t(xdrs, u_int32_p)
+ XDR *xdrs;
+ uint32_t *u_int32_p;
+{
+ u_long l;
+
+ switch (xdrs->x_op) {
+
+ case XDR_ENCODE:
+ l = (u_long) *u_int32_p;
+ return (XDR_PUTLONG(xdrs, (long *)&l));
+
+ case XDR_DECODE:
+ if (!XDR_GETLONG(xdrs, (long *)&l)) {
+ return (FALSE);
+ }
+ *u_int32_p = (u_int32_t) l;
+ return (TRUE);
+
+ case XDR_FREE:
+ return (TRUE);
+ }
+ /* NOTREACHED */
+ return (FALSE);
+}
/*
* XDR short integers
@@ -385,6 +415,36 @@ xdr_u_int16_t(xdrs, u_int16_p)
return (FALSE);
}
+/*
+ * XDR unsigned 16-bit integers
+ */
+bool_t
+xdr_uint16_t(xdrs, u_int16_p)
+ XDR *xdrs;
+ uint16_t *u_int16_p;
+{
+ u_long l;
+
+ switch (xdrs->x_op) {
+
+ case XDR_ENCODE:
+ l = (u_long) *u_int16_p;
+ return (XDR_PUTLONG(xdrs, (long *)&l));
+
+ case XDR_DECODE:
+ if (!XDR_GETLONG(xdrs, (long *)&l)) {
+ return (FALSE);
+ }
+ *u_int16_p = (u_int16_t) l;
+ return (TRUE);
+
+ case XDR_FREE:
+ return (TRUE);
+ }
+ /* NOTREACHED */
+ return (FALSE);
+}
+
/*
* XDR a char
@@ -806,6 +866,38 @@ xdr_u_int64_t(xdrs, ullp)
return (FALSE);
}
+/*
+ * XDR unsigned 64-bit integers
+ */
+bool_t
+xdr_uint64_t(xdrs, ullp)
+ XDR *xdrs;
+ uint64_t *ullp;
+{
+ u_long ul[2];
+
+ switch (xdrs->x_op) {
+ case XDR_ENCODE:
+ ul[0] = (u_long)(*ullp >> 32) & 0xffffffff;
+ ul[1] = (u_long)(*ullp) & 0xffffffff;
+ if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE)
+ return (FALSE);
+ return (XDR_PUTLONG(xdrs, (long *)&ul[1]));
+ case XDR_DECODE:
+ if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE)
+ return (FALSE);
+ if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE)
+ return (FALSE);
+ *ullp = (u_int64_t)
+ (((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1]));
+ return (TRUE);
+ case XDR_FREE:
+ return (TRUE);
+ }
+ /* NOTREACHED */
+ return (FALSE);
+}
+
/*
* XDR hypers
More information about the svn-src-user
mailing list