From owner-freebsd-current Thu Feb 27 19:43:41 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3DCD737B401; Thu, 27 Feb 2003 19:43:40 -0800 (PST) Received: from espresso.bsdmike.org (espresso.bsdmike.org [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 98DC343FA3; Thu, 27 Feb 2003 19:43:39 -0800 (PST) (envelope-from mike@espresso.bsdmike.org) Received: by espresso.bsdmike.org (Postfix, from userid 1002) id 5A3FB9C5F; Thu, 27 Feb 2003 22:30:58 -0500 (EST) Date: Thu, 27 Feb 2003 22:30:58 -0500 From: Mike Barcroft To: Nate Lawson Cc: current@freebsd.org, hackers@freebsd.org Subject: Re: 64 bit endian routines Message-ID: <20030227223058.G93968@espresso.bsdmike.org> References: <200302280324.h1S3OndV078007@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200302280324.h1S3OndV078007@freefall.freebsd.org>; from njl@FreeBSD.org on Thu, Feb 27, 2003 at 07:24:49PM -0800 Organization: The FreeBSD Project Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Nate Lawson writes: > First, the simple question: what's the simplest cross-platform way of > implementing scsi_ulto4b and scsi_4btoul (/sys/cam/scsi/scsi_all.h) for > 64 bit values. GEOM (/sys/geom/geom_enc.c) implements it via a 64 bit > cast in g_enc_le8. Is this the best current way? Maybe the byteorder(9) macrofunctions with a union? > Second, anyone done work on unifying our various byte ordering macros? > Besides htonl and ntohl, there are scsi_*ul*, g_enc_*, openssl/aes_locl.h, > machine/endian.h, arpa/nameser.h, and I'm sure there are others. Perhaps > the best thing is to add macros similar to geom_enc_* to machine/endian.h. > Any ideas? Most of these could probably be implemented in terms of the __bswap*() functions in , except for vendor sources like openssl, and htonl and ntohl which already are. I'm not sure if there would be an advantage to moving the geom byte ordering functions to (I guess phk didn't either). Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message