Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On 12 May 2009, at 06:03, Kip Macy wrote: Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On Tue, May 12, 2009 at 12:33 AM, Doug Rabson d...@rabson.org wrote: On 12 May 2009, at 06:03, Kip Macy wrote: Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. I'm not familiar with XDR, so I might be in error. If you could reconcile the differences between Solaris and FreeBSD so that ZFS can use FreeBSD's XDR implementation I would greatly appreciate it. Thanks, Kip -- When bad men combine, the good must associate; else they will fall one by one, an unpitied sacrifice in a contemptible struggle. Edmund Burke ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On 12 May 2009, at 09:16, Kip Macy wrote: On Tue, May 12, 2009 at 12:33 AM, Doug Rabson d...@rabson.org wrote: On 12 May 2009, at 06:03, Kip Macy wrote: Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. I'm not familiar with XDR, so I might be in error. If you could reconcile the differences between Solaris and FreeBSD so that ZFS can use FreeBSD's XDR implementation I would greatly appreciate it. I'll see what I can do. Thanks for taking the time to look at it. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On Tue, May 12, 2009 at 12:33 AM, Doug Rabson d...@rabson.org wrote: I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. XDR is defined in RFC 4506. It should be independent from architecture. An XDR {signed,unsigned} integer is a 32-bit datum... The standard also defines 64-bit (8-byte) numbers called hyper integers and unsigned hyper integers. -- Frank Behrens, Osterwieck, Germany PGP-key 0x5B7C47ED on public servers available. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On Tue, May 12, 2009 at 2:13 AM, Frank Behrens fr...@ilse.behrens.de wrote: On Tue, May 12, 2009 at 12:33 AM, Doug Rabson d...@rabson.org wrote: I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. XDR is defined in RFC 4506. It should be independent from architecture. An XDR {signed,unsigned} integer is a 32-bit datum... The standard also defines 64-bit (8-byte) numbers called hyper integers and unsigned hyper integers. That is the definition. The implementation may be something entirely different :-) -Kip ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On Tuesday 12 May 2009 04:18 am, Doug Rabson wrote: On 12 May 2009, at 09:16, Kip Macy wrote: On Tue, May 12, 2009 at 12:33 AM, Doug Rabson d...@rabson.org wrote: On 12 May 2009, at 06:03, Kip Macy wrote: Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. I'm not familiar with XDR, so I might be in error. If you could reconcile the differences between Solaris and FreeBSD so that ZFS can use FreeBSD's XDR implementation I would greatly appreciate it. I'll see what I can do. Thanks for taking the time to look at it. xdr in kernel is originally from Sun. So, we have two versions of xdr from Sun with different license terms now, one from ancient rpcsrc distribution and one from OpenSolaris. Interesting... Sorry, just thinking out loud... ;-) Jung-uk Kim ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On 12 May 2009, at 20:16, Jung-uk Kim wrote: On Tuesday 12 May 2009 04:18 am, Doug Rabson wrote: On 12 May 2009, at 09:16, Kip Macy wrote: On Tue, May 12, 2009 at 12:33 AM, Doug Rabson d...@rabson.org wrote: On 12 May 2009, at 06:03, Kip Macy wrote: Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. I'm not familiar with XDR, so I might be in error. If you could reconcile the differences between Solaris and FreeBSD so that ZFS can use FreeBSD's XDR implementation I would greatly appreciate it. I'll see what I can do. Thanks for taking the time to look at it. xdr in kernel is originally from Sun. So, we have two versions of xdr from Sun with different license terms now, one from ancient rpcsrc distribution and one from OpenSolaris. Interesting... Sorry, just thinking out loud... ;-) Well hopefully we can end up with just from from ancient rpcsrc (and not CDDL). ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
The XDR support code that is in the main kernel should have a very similar API to the opensolaris bits, possibly identical. Perhaps the opensolaris compat could use the main kernel's XDR implementation? On 11 May 2009, at 05:18, Kip Macy wrote: Author: kmacy Date: Mon May 11 04:18:58 2009 New Revision: 191984 URL: http://svn.freebsd.org/changeset/base/191984 Log: rename xdr support files to avoid conflicts when linking in to the kernel Added: head/sys/cddl/contrib/opensolaris/uts/common/rpc/ opensolaris_xdr.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/ opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/ opensolaris_xdr_array.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/ opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/ opensolaris_xdr_mem.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/ opensolaris/uts/common/rpc/xdr_mem.c Deleted: head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c Modified: head/sys/modules/zfs/Makefile Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/ opensolaris_xdr.c (from r191983, head/sys/cddl/contrib/opensolaris/ uts/common/rpc/xdr.c) = = = = = = = = == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/ opensolaris_xdr.c Mon May 11 04:18:58 2009 (r191984, copy of r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) @@ -0,0 +1,621 @@ +/* + * 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 [] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 ATT */ +/* 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. + */ + +/* + * xdr.c, generic XDR routines implementation. + * These are the generic xdr routines used to serialize and de- serialize + * most common data items. See xdr.h for more info on the interface to + * xdr. + */ + +#include sys/param.h +#include sys/cmn_err.h +#include sys/types.h +#include sys/systm.h + +#include rpc/types.h +#include rpc/xdr.h + +#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 + +#if defined(sun) +#if !defined(_BIG_ENDIAN) !defined(_LITTLE_ENDIAN) +#error Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined +#elif defined(_BIG_ENDIAN) defined(_LITTLE_ENDIAN) +#error Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined +#endif +#endif + +/* + * constants specific to the xdr protocol + */ +#defineXDR_FALSE ((int32_t)0) +#defineXDR_TRUE((int32_t)1) +#defineLASTUNSIGNED((uint_t)0-1) + +/* + * for unit alignment + */ +static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; + +/* + * Free a data structure using XDR + * Not a filter, but a convenient utility nonetheless + */ +void +xdr_free(xdrproc_t proc, char *objp) +{ + XDR x; + + x.x_op = XDR_FREE; + (*proc)(x, objp); +} + +/* + * XDR nothing + */ +bool_t +xdr_void(void) +{ + return (TRUE); +} + +/* + * XDR integers + * + * PSARC 2003/523 Contract Private Interface + * xdr_int + * Changes must be reviewed by Solaris File Sharing + * Changes must be communicated to contract-2003-...@sun.com + */ +bool_t +xdr_int(XDR *xdrs, int *ip) +{ + if (xdrs-x_op == XDR_ENCODE) + return (XDR_PUTINT32(xdrs, ip)); + + if (xdrs-x_op == XDR_DECODE) + return (XDR_GETINT32(xdrs, ip)); + + if (xdrs-x_op == XDR_FREE) + return (TRUE); + + return (FALSE); +} + +/* + * XDR unsigned integers + * + * PSARC 2003/523 Contract Private Interface + * xdr_u_int + * Changes must be
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On Mon, May 11, 2009 at 11:21 AM, Doug Rabson d...@rabson.org wrote: The XDR support code that is in the main kernel should have a very similar API to the opensolaris bits, possibly identical. Perhaps the opensolaris compat could use the main kernel's XDR implementation? I tried that. The label reads end up failing when ZFS uses the libkern implementation. Somewhere in there, there is a behavioral difference between the two implementations. At some point I'll track down the offending function. -Kip On 11 May 2009, at 05:18, Kip Macy wrote: Author: kmacy Date: Mon May 11 04:18:58 2009 New Revision: 191984 URL: http://svn.freebsd.org/changeset/base/191984 Log: rename xdr support files to avoid conflicts when linking in to the kernel Added: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c Deleted: head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c Modified: head/sys/modules/zfs/Makefile Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c (from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c Mon May 11 04:18:58 2009 (r191984, copy of r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) @@ -0,0 +1,621 @@ +/* + * 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 [] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 ATT */ +/* 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. + */ + +/* + * xdr.c, generic XDR routines implementation. + * These are the generic xdr routines used to serialize and de-serialize + * most common data items. See xdr.h for more info on the interface to + * xdr. + */ + +#include sys/param.h +#include sys/cmn_err.h +#include sys/types.h +#include sys/systm.h + +#include rpc/types.h +#include rpc/xdr.h + +#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 + +#if defined(sun) +#if !defined(_BIG_ENDIAN) !defined(_LITTLE_ENDIAN) +#error Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined +#elif defined(_BIG_ENDIAN) defined(_LITTLE_ENDIAN) +#error Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined +#endif +#endif + +/* + * constants specific to the xdr protocol + */ +#define XDR_FALSE ((int32_t)0) +#define XDR_TRUE ((int32_t)1) +#define LASTUNSIGNED ((uint_t)0-1) + +/* + * for unit alignment + */ +static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; + +/* + * Free a data structure using XDR + * Not a filter, but a convenient utility nonetheless + */ +void +xdr_free(xdrproc_t proc, char *objp) +{ + XDR x; + + x.x_op = XDR_FREE; + (*proc)(x, objp); +} + +/* + * XDR nothing + */ +bool_t +xdr_void(void) +{ + return (TRUE); +} + +/* + * XDR integers + * + * PSARC 2003/523 Contract Private Interface + * xdr_int + * Changes must be reviewed by Solaris File Sharing + * Changes must be communicated to contract-2003-...@sun.com + */ +bool_t +xdr_int(XDR *xdrs, int
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. Solaris: bool_t xdr_int(XDR *xdrs, int *ip) { if (xdrs-x_op == XDR_ENCODE) return (XDR_PUTINT32(xdrs, ip)); if (xdrs-x_op == XDR_DECODE) return (XDR_GETINT32(xdrs, ip)); if (xdrs-x_op == XDR_FREE) return (TRUE); return (FALSE); } #if !defined(_LP64) !defined(_KERNEL) /* * For binary compatability on ILP32 we do not change the shape * of the XDR structure and the GET/PUTINT32 functions just use * the get/putlong vectors which operate on identically-sized * units of data. */ #define XDR_GETINT32(xdrs, int32p) \ (*(xdrs)-x_ops-x_getlong)(xdrs, (long *)int32p) #define xdr_getint32(xdrs, int32p) \ (*(xdrs)-x_ops-x_getlong)(xdrs, (long *)int32p) #define XDR_PUTINT32(xdrs, int32p) \ (*(xdrs)-x_ops-x_putlong)(xdrs, (long *)int32p) #define xdr_putint32(xdrs, int32p) \ (*(xdrs)-x_ops-x_putlong)(xdrs, (long *)int32p) #else /* !_LP64 !_KERNEL */ #define XDR_GETINT32(xdrs, int32p) \ (*(xdrs)-x_ops-x_getint32)(xdrs, int32p) #define xdr_getint32(xdrs, int32p) \ (*(xdrs)-x_ops-x_getint32)(xdrs, int32p) #define XDR_PUTINT32(xdrs, int32p) \ (*(xdrs)-x_ops-x_putint32)(xdrs, int32p) #define xdr_putint32(xdrs, int32p) \ (*(xdrs)-x_ops-x_putint32)(xdrs, int32p) #endif /* !_LP64 !_KERNEL */ FreeBSD: bool_t xdr_int(XDR *xdrs, int *ip) { long l; switch (xdrs-x_op) { case XDR_ENCODE: l = (long) *ip; return (XDR_PUTLONG(xdrs, l)); case XDR_DECODE: if (!XDR_GETLONG(xdrs, l)) { return (FALSE); } *ip = (int) l; return (TRUE); case XDR_FREE: return (TRUE); } /* NOTREACHED */ return (FALSE); } On Mon, May 11, 2009 at 12:23 PM, Kip Macy km...@freebsd.org wrote: On Mon, May 11, 2009 at 11:21 AM, Doug Rabson d...@rabson.org wrote: The XDR support code that is in the main kernel should have a very similar API to the opensolaris bits, possibly identical. Perhaps the opensolaris compat could use the main kernel's XDR implementation? I tried that. The label reads end up failing when ZFS uses the libkern implementation. Somewhere in there, there is a behavioral difference between the two implementations. At some point I'll track down the offending function. -Kip On 11 May 2009, at 05:18, Kip Macy wrote: Author: kmacy Date: Mon May 11 04:18:58 2009 New Revision: 191984 URL: http://svn.freebsd.org/changeset/base/191984 Log: rename xdr support files to avoid conflicts when linking in to the kernel Added: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c Deleted: head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c Modified: head/sys/modules/zfs/Makefile Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c (from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c Mon May 11 04:18:58 2009 (r191984, copy of r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) @@ -0,0 +1,621 @@ +/* + * 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