Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 2002 01:08:50 -0500
From:      Mike Barcroft <mike@FreeBSD.org>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        arch@FreeBSD.org
Subject:   Re: Please review: endian invariant kernel dump headers
Message-ID:  <20020403010850.C19806@espresso.q9media.com>
In-Reply-To: <20020403034208.GA929@dhcp01.pn.xcllnt.net>; from marcel@xcllnt.net on Tue, Apr 02, 2002 at 07:42:08PM -0800
References:  <20020403034208.GA929@dhcp01.pn.xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Marcel Moolenaar <marcel@xcllnt.net> writes:
> Please review the attached patch. The change achieves the following:
[...]
> Index: sys/sys/kerneldump.h
> ===================================================================
> RCS file: /home/ncvs/src/sys/sys/kerneldump.h,v
> retrieving revision 1.2
> diff -u -r1.2 kerneldump.h
> --- sys/sys/kerneldump.h	2 Apr 2002 10:53:59 -0000	1.2
> +++ sys/sys/kerneldump.h	3 Apr 2002 03:15:20 -0000
> @@ -38,6 +38,25 @@
>  #ifndef _SYS_KERNELDUMP_H
>  #define _SYS_KERNELDUMP_H
>  
> +#include <machine/endian.h>
> +
> +#if BYTE_ORDER == LITTLE_ENDIAN
> +#define	dtoh32(x)	__bswap32(x)
> +#define	dtoh64(x)	__bswap64(x)
> +#define	htod32(x)	__bswap32(x)
> +#define	htod64(x)	__bswap64(x)
> +#else
> +#define	dtoh32(x)	x
> +#define	dtoh64(x)	x
> +#define	htod32(x)	x
> +#define	htod64(x)	x
> +#endif

Adding extra parens around `x' in the !LITTLE_ENDIAN case would
prevent bitting future developers that might be expecting this to be
evaluated like a function.

The rest looks okay.

Best regards,
Mike Barcroft

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




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