From owner-p4-projects@FreeBSD.ORG Sat Apr 30 15:29:18 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A49C816A4D0; Sat, 30 Apr 2005 15:29:17 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from green.homeunix.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 22D1C16A4CE; Sat, 30 Apr 2005 15:29:17 +0000 (GMT) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.13.3/8.13.1) with ESMTP id j3UFTGLT062841; Sat, 30 Apr 2005 11:29:16 -0400 (EDT) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.13.3/8.13.1/Submit) id j3UFTGZD062840; Sat, 30 Apr 2005 11:29:16 -0400 (EDT) (envelope-from green) Date: Sat, 30 Apr 2005 11:29:16 -0400 From: Brian Fundakowski Feldman To: Robert Watson Message-ID: <20050430152916.GG39270@green.homeunix.org> References: <200504301312.j3UDCRxB061197@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200504301312.j3UDCRxB061197@repoman.freebsd.org> User-Agent: Mutt/1.5.6i cc: Perforce Change Reviews Subject: Re: PERFORCE change 76270 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2005 15:29:18 -0000 On Sat, Apr 30, 2005 at 01:12:28PM +0000, Robert Watson wrote: > http://perforce.freebsd.org/chv.cgi?CH=76270 > > Change 76270 by rwatson@rwatson_paprika on 2005/04/30 13:11:27 > > Darwin 8.0 has 64-bit file ID's, so improve support for that. > > Affected files ... > > .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#9 edit > > Differences ... > > ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#9 (text+ko) ==== > > @@ -181,12 +181,20 @@ > ADD_U_INT32(dptr, attr->va_gid); > ADD_U_INT32(dptr, attr->va_fsid); > > - /* > - * Darwin defines the size for fileid > - * as 4 bytes; BSM defines 8 so pad with 0 > - */ > - ADD_U_INT32(dptr, pad0_32); > - ADD_U_INT32(dptr, attr->va_fileid); > + /* > + * Some systems use 32-bit file ID's, other's use 64-bit file IDs. > + * Attempt to handle both, and let the compiler sort it out. If we > + * could pick this out at compile-time, it would be better, so as to > + * avoid the else case below. > + */ > + if (sizeof(attr->va_fileid) == sizeof(uint32_t)) { > + ADD_U_INT32(dptr, pad0_32); > + ADD_U_INT32(dptr, attr->va_fileid); > + } else if (sizeof(attr->va_fileid) == sizeof(uint64_t)) { > + ADD_U_INT64(dptr, attr->va_fileid); > + } else { > + ADD_U_INT64(dptr, 0LL); > + } > > ADD_U_INT32(dptr, attr->va_rdev); > > How about (after adding CTASSERT() if it hasn't already been merged to Darwin): + CTASSERT(sizeof(((struct vattr *)NULL)->va_fileid) == sizeof(uint32_t) || + sizeof(((struct vattr *)NULL)->va_fileid) == sizeof(uint64_t)); ... > + /* > + * Some systems use 32-bit file ID's, other's use 64-bit file IDs. > + */ > + if (sizeof(attr->va_fileid) == sizeof(uint32_t)) { > + ADD_U_INT32(dptr, pad0_32); > + ADD_U_INT32(dptr, attr->va_fileid); > + } else { > + ADD_U_INT64(dptr, attr->va_fileid); > + } -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\