|
From: | Gerd Hoffmann |
Subject: | Re: [Qemu-devel] [PATCH 01/13] qdev: rework device properties. |
Date: | Fri, 10 Jul 2009 22:10:24 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2 |
On 07/10/09 21:42, Paul Brook wrote:
On Friday 10 July 2009, Gerd Hoffmann wrote:There are properties which tend to be specified as decimal numbers (counts, sizes, ...) and some which tend to be specified in hex (adresses, ioports, ...). I think it is useful to have separate parse/print functions for them, although they both end up being an uint32_t.I think this is the wrong distinction. Whether you specify something in hex or decimal (or even binary/octal) is personal user preference.
Hmm. hex32 will accept/print hex numbers only. uint32 should accept 0x<hexnumber> though. I'll double-check it actually does.
.properties = (Property[]) { DEFINE_PROPERTY_UINT32("fifo-size", SyborgPointerState, fifo_size, 16) } Ideally we'd have a single DEFINE_PROPERTY macro and the type would be figured out from typeof(fifo_size), but I can't think how to do that.
I'll have a look whenever I can work out some macro+typeof magic. Would be great if we can catch type mismatches at compile time.
It can fail if the size check (soon to be type check) mentioned above failed. Such a failure would be a clear qemu bug though, so maybe abort() instead?Yes. Returning a status code then never checking it is completely pointless.
Ok. cheers, Gerd
[Prev in Thread] | Current Thread | [Next in Thread] |