From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MbV5U-0004tQ-KO for qemu-devel@nongnu.org; Thu, 13 Aug 2009 03:51:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbV5O-0004sY-DV for qemu-devel@nongnu.org; Thu, 13 Aug 2009 03:51:03 -0400 Received: from [199.232.76.173] (port=41091 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbV5O-0004sV-7Q for qemu-devel@nongnu.org; Thu, 13 Aug 2009 03:50:58 -0400 Received: from mx20.gnu.org ([199.232.41.8]:15285) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MbV5N-00084j-Qk for qemu-devel@nongnu.org; Thu, 13 Aug 2009 03:50:57 -0400 Received: from mx2.redhat.com ([66.187.237.31]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MbV5M-0007ER-GD for qemu-devel@nongnu.org; Thu, 13 Aug 2009 03:50:56 -0400 Message-ID: <4A83C562.1090802@redhat.com> Date: Thu, 13 Aug 2009 09:48:50 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] qdev: add return value to init() callbacks. References: <1250092766-23986-1-git-send-email-kraxel@redhat.com> <200908122028.41012.paul@codesourcery.com> <4A831C47.3070309@redhat.com> <873a7w2q6n.fsf@pike.pond.sub.org> In-Reply-To: <873a7w2q6n.fsf@pike.pond.sub.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Paul Brook , qemu-devel@nongnu.org On 08/13/09 08:17, Markus Armbruster wrote: > One problem with passing up error codes is diagnostics: when we reach > the point where we can decide on policy, we've lost the context for > precise diagnostics. net.c tackles that problem by passing the > destination for diagnostics down, to let code report errors with > config_error() while remaining unaware of policy. I don't want pass additional arguments all the way down just for error reporting. One thing we can do is storing the error message in a global or thread-local variable (much like errno). We could also add a errmsg field to DeviceState and use that. > Issue also exists elsewhere. Try monitor command "pci_add auto > model=?". Thats why I'd tend to use a global variable. It also works in case don't have a DeviceState. cheers, Gerd