From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjXnx-0001L2-Dc for qemu-devel@nongnu.org; Tue, 06 Oct 2015 15:22:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjXnD-0004Q2-Sy for qemu-devel@nongnu.org; Tue, 06 Oct 2015 15:21:41 -0400 Received: from mail-qg0-x22f.google.com ([2607:f8b0:400d:c04::22f]:36756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjXnD-0004Nr-Aq for qemu-devel@nongnu.org; Tue, 06 Oct 2015 15:20:55 -0400 Received: by qgx61 with SMTP id 61so183999595qgx.3 for ; Tue, 06 Oct 2015 12:20:54 -0700 (PDT) Sender: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= From: marcandre.lureau@redhat.com Date: Tue, 6 Oct 2015 21:19:14 +0200 Message-Id: <1444159184-18153-19-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1444159184-18153-1-git-send-email-marcandre.lureau@redhat.com> References: <1444159184-18153-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 18/48] ivshmem: improve error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-devel@nongnu.org From: Marc-André Lureau The test whether the chardev is an AF_UNIX socket rejects "-chardev socket,id=chr0,path=/tmp/foo,server,nowait -device ivshmem,chardev=chr0", but fails to explain why. Use an explicit error on why a chardev may be rejected. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 50f9c8f..d7a00bd 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -301,7 +301,7 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier * chr = qemu_chr_open_eventfd(eventfd); if (chr == NULL) { - error_report("creating eventfd for eventfd %d failed", eventfd); + error_report("creating chardriver for eventfd %d failed", eventfd); return NULL; } qemu_chr_fe_claim_no_fail(chr); @@ -778,8 +778,12 @@ static void pci_ivshmem_realize(PCIDevice *dev, Error **errp) attr |= PCI_BASE_ADDRESS_MEM_TYPE_64; } - if ((s->server_chr != NULL) && - (strncmp(s->server_chr->filename, "unix:", 5) == 0)) { + if (s->server_chr != NULL) { + if (strncmp(s->server_chr->filename, "unix:", 5)) { + error_setg(errp, "chardev is not a unix client socket"); + return; + } + /* if we get a UNIX socket as the parameter we will talk * to the ivshmem server to receive the memory region */ -- 2.4.3