From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZRAY-0007TW-Vp for qemu-devel@nongnu.org; Wed, 22 Jun 2011 13:24:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZRAX-0007D7-UB for qemu-devel@nongnu.org; Wed, 22 Jun 2011 13:24:50 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:62933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZRAX-0007CX-RG for qemu-devel@nongnu.org; Wed, 22 Jun 2011 13:24:49 -0400 Received: by gwb19 with SMTP id 19so520933gwb.4 for ; Wed, 22 Jun 2011 10:24:48 -0700 (PDT) Message-ID: <4E02255E.40202@codemonkey.ws> Date: Wed, 22 Jun 2011 12:24:46 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1306927751-8352-1-git-send-email-kwolf@redhat.com> <4E00C471.3060802@redhat.com> In-Reply-To: <4E00C471.3060802@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-char: Print strerror message on failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Markus Armbruster , qemu-devel@nongnu.org On 06/21/2011 11:18 AM, Kevin Wolf wrote: > Am 21.06.2011 18:09, schrieb Markus Armbruster: >> Kevin Wolf writes: >> >>> The only way for chardev drivers to communicate an error was to return a NULL >>> pointer, which resulted in an error message that said _that_ something went >>> wrong, but not _why_. >>> >>> This patch changes the interface to return 0/-errno and updates >>> qemu_chr_open_opts to use strerror to display a more helpful error message. >> >> Returning the result through a pointer is awkward. What about stuffing >> the error code into errno? > > I generally like it better to return error codes explicitly instead of > storing them in some global variable where it tends to be trampled over > before you print the message. But if people prefer it that way, I can > redo the patch. I think passing a pointer to an int to receive the error is best. That way a NULL can be passed to indicate that the caller doesn't care. This matches the Error model that we're proposing else where. Regards, Anthony Liguori > > Kevin >