Subject: RE: OpenFirmware, node numbers, handles etc.
To: Michael Lorenz <macallan@netbsd.org>
From: Tim Rightnour <root@garbled.net>
List: tech-kern
Date: 11/28/2007 10:27:36
On 27-Nov-2007 Michael Lorenz wrote:
> is there a good reason why OF handles, node numbers etc. are  
> represented as int in our code? As far as I can tell using a signed  
> type here only causes trouble since at least node numbers may well  
> have the upper bit set.

I personally allways want to make them uint32_t, but the rest of the code all
specifies it as int, so I've been just cargo-culting that around.

However, I think it would be better if we instead did what uwe suggests, and
create things like phandle_t, ihandle_t, etc etc.  It would improve readability
too.  We could also define some simple macros like VALID_PHANDLE(x) that would
prevent people from doing things like >0.  (well, not prevent, but encourage)

---
Tim Rightnour <root@garbled.net>
NetBSD: Free multi-architecture OS http://www.netbsd.org/
Genecys: Open Source 3D MMORPG: http://www.genecys.org/