From owner-freebsd-net@FreeBSD.ORG Wed Jun 23 19:43:25 2010 Return-Path: Delivered-To: net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA745106564A for ; Wed, 23 Jun 2010 19:43:25 +0000 (UTC) (envelope-from julian@elischer.org) Received: from out-0.mx.aerioconnect.net (out-0-23.mx.aerioconnect.net [216.240.47.83]) by mx1.freebsd.org (Postfix) with ESMTP id A91568FC13 for ; Wed, 23 Jun 2010 19:43:25 +0000 (UTC) Received: from idiom.com (postfix@mx0.idiom.com [216.240.32.160]) by out-0.mx.aerioconnect.net (8.13.8/8.13.8) with ESMTP id o5NJgqO5025085; Wed, 23 Jun 2010 12:42:55 -0700 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137]) by idiom.com (Postfix) with ESMTP id 409272D6012; Wed, 23 Jun 2010 12:40:44 -0700 (PDT) Message-ID: <4C226354.80601@elischer.org> Date: Wed, 23 Jun 2010 12:41:08 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: Luigi Rizzo References: <20100622221228.GA93249@onelab2.iet.unipi.it> <20100623232402.X45536@delplex.bde.org> <9C936FEB-4858-4D8D-89CC-182EA3A80365@lakerest.net> <20100623171222.GA7981@onelab2.iet.unipi.it> In-Reply-To: <20100623171222.GA7981@onelab2.iet.unipi.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 216.240.47.51 Cc: Randall Stewart , net@FreeBSD.org Subject: Re: Observations from an old timer playing with 64 bit numbers... X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jun 2010 19:43:25 -0000 On 6/23/10 10:12 AM, Luigi Rizzo wrote: > On Wed, Jun 23, 2010 at 09:50:26AM -0700, Randall Stewart wrote: > ... >>>> strong objection! >>>> We should instead use names with exact sizes (16,32,64). >> >> So please tell me why you object so strongly? We have the 16/32/64 bit >> names which >> are nice but are not expected so folks seem to not use them. I have > > people's ignorance is not an excuse for not doing things right. > We'd still be using BYTE, WORD and DWORD otherwise. > > I think there is no doubt that we should use the 16/32/64 bit names > if we could start from scratch, and the only reason for not doing > so is avoiding gratuitous changes to existing/stable code. > > The case of *to*ll does not apply, in that there is no actual legacy > to adapt to. And btw there is tons of places which use the 16/32/64 bit > names in the filesystem, usb and generic device drivers. In fact, > many more than ntohl/htonl > > > grep -r be32 ~/FreeBSD/head/sys/ | grep -v .svn | wc > 1438 6397 145174 > > grep -r le32 ~/FreeBSD/head/sys/ | grep -v .svn | wc > 2203 10269 210989 > > grep -r ntohl ~/FreeBSD/head/sys/ | grep -v .svn | wc > 854 4009 84855 > > grep -r htonl ~/FreeBSD/head/sys/ | grep -v .svn | wc > 738 3604 72970 what he said.. if you want to have ntohll in SCTP then that is your choice, but I think it should be a local define to be64toh or ntoh64 I do prefer the ntoh64 version but beXXtoh or whatever it looks like others are using is ok to me too since 'net' is a pretty wide definition and not ALL protocols are big endian.