Re: 64 bit endian routines

2003-02-28 Thread Marcel Moolenaar
On Fri, Feb 28, 2003 at 09:40:35AM -0800, Nate Lawson wrote:
> 
>   On Thu, Feb 27, 2003 at 08:45:44PM -0800, Nate Lawson wrote:
>   > Both scsi and geom implement unaligned access functions
>   that perform byte > ordering.  I never intended to supplant
>   them with __bswap*().  What I want > is for machine/endian.h
>   to have functions that provide 16-64 bit endian > conversions
>   in both aligned and unaligned access forms.  After these
>   functions > are there, I'd like us to unify use of them and
>   remove driver-private > versions.  > > Is this more clear
>   now?
> 
>   Crystal :-)
> 
> Heh, I hope I didn't sound too forceful.  It was just a straightforward
> question, not a diatribe.  :)

No worries. It's too late to realize that there might be a disconnect
if you are using blunt objects to get your point across.

-- 
 Marcel Moolenaar USPA: A-39004  [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: 64 bit endian routines

2003-02-28 Thread Nate Lawson
Date: Thu, 27 Feb 2003 21:17:13 -0800
From: Marcel Moolenaar <[EMAIL PROTECTED]>
To: Nate Lawson <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: 64 bit endian routines
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

On Thu, Feb 27, 2003 at 08:45:44PM -0800, Nate Lawson wrote:
> Both scsi and geom implement unaligned access functions
that perform byte > ordering.  I never intended to supplant
them with __bswap*().  What I want > is for machine/endian.h
to have functions that provide 16-64 bit endian > conversions
in both aligned and unaligned access forms.  After these
functions > are there, I'd like us to unify use of them and
remove driver-private > versions.  > > Is this more clear
now?

Crystal :-)

-- 
 Marcel Moolenaar USPA: A-39004  [EMAIL PROTECTED]

Heh, I hope I didn't sound too forceful.  It was just a straightforward
question, not a diatribe.  :)

-Nate

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: 64 bit endian routines

2003-02-28 Thread Mike Barcroft
Nate Lawson <[EMAIL PROTECTED]> writes:
> Both scsi and geom implement unaligned access functions that perform byte
> ordering.  I never intended to supplant them with __bswap*().  What I want
> is for machine/endian.h to have functions that provide 16-64 bit endian
> conversions in both aligned and unaligned access forms.  After these functions
> are there, I'd like us to unify use of them and remove driver-private
> versions.

Sounds good, though  would be more appropriate unless
they're MD.

Best regards,
Mike Barcroft

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: 64 bit endian routines

2003-02-27 Thread Poul-Henning Kamp
In message <[EMAIL PROTECTED]>, Nate Lawson writ
es:

>Both scsi and geom implement unaligned access functions that perform byte
>ordering.  I never intended to supplant them with __bswap*().  What I want
>is for machine/endian.h to have functions that provide 16-64 bit endian
>conversions in both aligned and unaligned access forms.  After these functions
>are there, I'd like us to unify use of them and remove driver-private
>versions.

I'm all for a unification.  I only made my private version in geom because
I couldn't get any responses when I raised the issue on [EMAIL PROTECTED]

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED] | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: 64 bit endian routines

2003-02-27 Thread Marcel Moolenaar
On Thu, Feb 27, 2003 at 08:45:44PM -0800, Nate Lawson wrote:
> 
> Both scsi and geom implement unaligned access functions that perform byte
> ordering.  I never intended to supplant them with __bswap*().  What I want
> is for machine/endian.h to have functions that provide 16-64 bit endian
> conversions in both aligned and unaligned access forms.  After these functions
> are there, I'd like us to unify use of them and remove driver-private
> versions.
> 
> Is this more clear now?

Crystal :-)

-- 
 Marcel Moolenaar USPA: A-39004  [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: 64 bit endian routines

2003-02-27 Thread Nate Lawson
Date: Thu, 27 Feb 2003 20:18:49 -0800
From: Marcel Moolenaar <[EMAIL PROTECTED]>
To: Mike Barcroft <[EMAIL PROTECTED]>
Cc: Nate Lawson <[EMAIL PROTECTED]>, [EMAIL PROTECTED],
[EMAIL PROTECTED]
        Subject: Re: 64 bit endian routines
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

On Thu, Feb 27, 2003 at 10:30:58PM -0500, Mike Barcroft wrote:
> 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).

The geom functions serve a primary purpose of dealing with random
alignment of fields. The endianness has been added later, so they
now serve a dual function. Do not unify them with byte-order only
functions.

-- 
 Marcel Moolenaar USPA: A-39004  [EMAIL PROTECTED]

Both scsi and geom implement unaligned access functions that perform byte
ordering.  I never intended to supplant them with __bswap*().  What I want
is for machine/endian.h to have functions that provide 16-64 bit endian
conversions in both aligned and unaligned access forms.  After these functions
are there, I'd like us to unify use of them and remove driver-private
versions.

Is this more clear now?

-Nate

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: 64 bit endian routines

2003-02-27 Thread Marcel Moolenaar
On Thu, Feb 27, 2003 at 10:30:58PM -0500, Mike Barcroft wrote:
> 
> 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).

The geom functions serve a primary purpose of dealing with random
alignment of fields. The endianness has been added later, so they
now serve a dual function. Do not unify them with byte-order only
functions.

-- 
 Marcel Moolenaar USPA: A-39004  [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: 64 bit endian routines

2003-02-27 Thread Mike Barcroft
Nate Lawson <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


64 bit endian routines

2003-02-27 Thread Nate Lawson
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?

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?

Thanks,
Nate

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message