[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 18/48] ivshmem: improve error handling
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v5 18/48] ivshmem: improve error handling |
Date: |
Fri, 2 Oct 2015 21:09:21 +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>
Reviewed-by: Claudio Fontana <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 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
- [Qemu-devel] [PATCH v5 27/48] ivshmem: fix pci_ivshmem_exit(), (continued)
- [Qemu-devel] [PATCH v5 27/48] ivshmem: fix pci_ivshmem_exit(), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 41/48] tests: add ivshmem qtest, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 35/48] docs: update ivshmem device spec, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 12/48] ivshmem: simplify around increase_dynamic_storage(), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 01/48] char: add qemu_chr_free(), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 13/48] ivshmem: allocate eventfds in resize_peers(), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 19/48] ivshmem: print error on invalid peer id, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 16/48] ivshmem: remove max_peer field, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 25/48] ivshmem: check shm isn't already initialized, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 18/48] ivshmem: improve error handling,
marcandre . lureau <=
- [Qemu-devel] [PATCH v5 20/48] ivshmem: simplify a bit the code, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 30/48] ivshmem: reset mask on device reset, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 28/48] ivshmem: replace 'guest' for 'peer' appropriately, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 37/48] contrib: remove unnecessary strdup(), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 42/48] ivshmem: do not keep shm_fd open, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 38/48] msix: implement pba write (but read-only), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 45/48] ivshmem: remove EventfdEntry.vector, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 48/48] ivshmem: use little-endian int64_t for the protocol, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 04/48] ivshmem: fix number of bytes to push to fifo, marcandre . lureau, 2015/10/08