Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Feb 2003 22:30:58 -0500
From:      Mike Barcroft <mike@FreeBSD.org>
To:        Nate Lawson <njl@FreeBSD.org>
Cc:        current@freebsd.org, hackers@freebsd.org
Subject:   Re: 64 bit endian routines
Message-ID:  <20030227223058.G93968@espresso.bsdmike.org>
In-Reply-To: <200302280324.h1S3OndV078007@freefall.freebsd.org>; from njl@FreeBSD.org on Thu, Feb 27, 2003 at 07:24:49PM -0800
References:  <200302280324.h1S3OndV078007@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Nate Lawson <njl@FreeBSD.org> 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 <machine/endian.h>, 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
<sys/endian.h> (I guess phk didn't either).

Best regards,
Mike Barcroft

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030227223058.G93968>