[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 18/47] ivshmem: improve error handling
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v4 18/47] ivshmem: improve error handling |
Date: |
Thu, 24 Sep 2015 13:37:20 +0200 |
From: Marc-André Lureau <address@hidden>
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 <address@hidden>
---
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 71a71fc..ed1b6f7 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
- [Qemu-devel] [PATCH v4 08/47] ivshmem: remove useless doorbell field, (continued)
- [Qemu-devel] [PATCH v4 08/47] ivshmem: remove useless doorbell field, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 10/47] ivshmem: remove last exit(1), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 09/47] ivshmem: more qdev conversion, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 11/47] ivshmem: limit maximum number of peers to G_MAXUINT16, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 12/47] ivshmem: simplify around increase_dynamic_storage(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 14/47] ivshmem: remove useless ivshmem_update_irq() val argument, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 13/47] ivshmem: allocate eventfds in resize_peers(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 16/47] ivshmem: remove max_peer field, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 15/47] ivshmem: initialize max_peer to -1, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 17/47] ivshmem: improve debug messages, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 18/47] ivshmem: improve error handling,
marcandre . lureau <=
- [Qemu-devel] [PATCH v4 19/47] ivshmem: print error on invalid peer id, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 20/47] ivshmem: simplify a bit the code, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 21/47] ivshmem: use common return, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 22/47] ivshmem: use common is_power_of_2(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 23/47] ivshmem: migrate with VMStateDescription, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 25/47] ivshmem: check shm isn't already initialized, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 24/47] ivshmem: shmfd can be 0, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 26/47] ivshmem: add device description, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 27/47] ivshmem: fix pci_ivshmem_exit(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 28/47] ivshmem: replace 'guest' for 'peer' appropriately, marcandre . lureau, 2015/09/24