From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MPMSP-0003I9-K5 for qemu-devel@nongnu.org; Fri, 10 Jul 2009 16:12:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MPMSL-0003Cr-FA for qemu-devel@nongnu.org; Fri, 10 Jul 2009 16:12:33 -0400 Received: from [199.232.76.173] (port=46110 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MPMSL-0003Cj-Av for qemu-devel@nongnu.org; Fri, 10 Jul 2009 16:12:29 -0400 Received: from mx2.redhat.com ([66.187.237.31]:47635) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MPMSK-0002Xu-Qe for qemu-devel@nongnu.org; Fri, 10 Jul 2009 16:12:29 -0400 Message-ID: <4A57A030.5020107@redhat.com> Date: Fri, 10 Jul 2009 22:10:24 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 01/13] qdev: rework device properties. References: <1247225179-5495-1-git-send-email-kraxel@redhat.com> <200907101813.37430.paul@codesourcery.com> <4A57967A.50008@redhat.com> <200907102043.01584.paul@codesourcery.com> In-Reply-To: <200907102043.01584.paul@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org 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 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