Skip to content

Commit

Permalink
event_notifier: Make event_notifier_init_fd() #ifdef CONFIG_EVENTFD
Browse files Browse the repository at this point in the history
Event notifiers are designed for eventfd(2).  They can fall back to
pipes, but according to Paolo, event_notifier_init_fd() really
requires the real thing, and should therefore be under #ifdef
CONFIG_EVENTFD.  Do that.

Its only user is ivshmem, which is currently CONFIG_POSIX.  Narrow it
to CONFIG_EVENTFD.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1458066895-20632-6-git-send-email-armbru@redhat.com>
  • Loading branch information
Markus Armbruster committed Mar 21, 2016
1 parent ad49293 commit 330b583
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion default-configs/pci.mak
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ CONFIG_SDHCI=y
CONFIG_EDU=y
CONFIG_VGA=y
CONFIG_VGA_PCI=y
CONFIG_IVSHMEM=$(CONFIG_POSIX)
CONFIG_IVSHMEM=$(CONFIG_EVENTFD)
CONFIG_ROCKER=y
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ gcov-files-pci-y += hw/display/virtio-gpu-pci.c
gcov-files-pci-$(CONFIG_VIRTIO_VGA) += hw/display/virtio-vga.c
check-qtest-pci-y += tests/intel-hda-test$(EXESUF)
gcov-files-pci-y += hw/audio/intel-hda.c hw/audio/hda-codec.c
check-qtest-pci-$(CONFIG_POSIX) += tests/ivshmem-test$(EXESUF)
check-qtest-pci-$(CONFIG_EVENTFD) += tests/ivshmem-test$(EXESUF)
gcov-files-pci-y += hw/misc/ivshmem.c

check-qtest-i386-y = tests/endianness-test$(EXESUF)
Expand Down
6 changes: 6 additions & 0 deletions util/event_notifier-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@
#include <sys/eventfd.h>
#endif

#ifdef CONFIG_EVENTFD
/*
* Initialize @e with existing file descriptor @fd.
* @fd must be a genuine eventfd object, emulation with pipe won't do.
*/
void event_notifier_init_fd(EventNotifier *e, int fd)
{
e->rfd = fd;
e->wfd = fd;
}
#endif

int event_notifier_init(EventNotifier *e, int active)
{
Expand Down

0 comments on commit 330b583

Please sign in to comment.