From owner-freebsd-arch Tue Apr 2 22:15:40 2002 Delivered-To: freebsd-arch@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 13D1037B4B9 for ; Tue, 2 Apr 2002 22:15:22 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id g3368o976778; Wed, 3 Apr 2002 01:08:50 -0500 (EST) (envelope-from mike) Date: Wed, 3 Apr 2002 01:08:50 -0500 From: Mike Barcroft To: Marcel Moolenaar Cc: arch@FreeBSD.org Subject: Re: Please review: endian invariant kernel dump headers Message-ID: <20020403010850.C19806@espresso.q9media.com> References: <20020403034208.GA929@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020403034208.GA929@dhcp01.pn.xcllnt.net>; from marcel@xcllnt.net on Tue, Apr 02, 2002 at 07:42:08PM -0800 Organization: The FreeBSD Project Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Marcel Moolenaar 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 > + > +#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