From 5ae69c71d9c7bd60aee73c54cb454e596927a0f8 Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Wed, 7 Apr 2010 14:25:09 -0300
Subject: [PATCH 05/12] qemu: rename notifier->event_notifier

RH-Author: Michael S. Tsirkin <mst@redhat.com>
Message-id: <555b00ede1f7e59fe02d0da19dc5f487ccb28c9f.1270649651.git.mst@redhat.com>
Patchwork-id: 8424
O-Subject: [PATCH RHEL6.0 2/9] qemu: rename notifier->event_notifier
Bugzilla: 580109
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>

name from upstream is clearer as we have many types
of notifiers.

Cherry-picked from commit 2292b33986de9e2ac10b2674f85722bdfbc977d5.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 Makefile.target     |    2 +-
 hw/event_notifier.c |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/event_notifier.h |   16 +++++++++++++
 hw/notifier.c       |   62 ---------------------------------------------------
 hw/notifier.h       |   16 -------------
 hw/virtio.h         |    2 +-
 6 files changed, 80 insertions(+), 80 deletions(-)
 create mode 100644 hw/event_notifier.c
 create mode 100644 hw/event_notifier.h
 delete mode 100644 hw/notifier.c
 delete mode 100644 hw/notifier.h

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 Makefile.target     |    2 +-
 hw/event_notifier.c |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/event_notifier.h |   16 +++++++++++++
 hw/notifier.c       |   62 ---------------------------------------------------
 hw/notifier.h       |   16 -------------
 hw/virtio.h         |    2 +-
 6 files changed, 80 insertions(+), 80 deletions(-)
 create mode 100644 hw/event_notifier.c
 create mode 100644 hw/event_notifier.h
 delete mode 100644 hw/notifier.c
 delete mode 100644 hw/notifier.h

diff --git a/Makefile.target b/Makefile.target
index 8c7213b..97b35f5 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -167,7 +167,7 @@ obj-y = vl.o async.o monitor.o pci.o pci_host.o pcie_host.o machine.o gdbstub.o
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
 obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-pci.o virtio-serial-bus.o
-obj-y += notifier.o
+obj-y += event_notifier.o
 obj-y += vhost_net.o
 obj-$(CONFIG_VHOST_NET) += vhost.o
 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
diff --git a/hw/event_notifier.c b/hw/event_notifier.c
new file mode 100644
index 0000000..fb9618c
--- /dev/null
+++ b/hw/event_notifier.c
@@ -0,0 +1,62 @@
+/*
+ * event notifier support
+ *
+ * Copyright Red Hat, Inc. 2010
+ *
+ * Authors:
+ *  Michael S. Tsirkin <mst@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include "hw.h"
+#include "event_notifier.h"
+#ifdef CONFIG_EVENTFD
+#include <sys/eventfd.h>
+#endif
+
+int event_notifier_init(EventNotifier *e, int active)
+{
+#ifdef CONFIG_EVENTFD
+	int fd = eventfd(!!active, EFD_NONBLOCK | EFD_CLOEXEC);
+	if (fd < 0)
+		return -errno;
+	e->fd = fd;
+	return 0;
+#else
+	return -ENOSYS;
+#endif
+}
+
+void event_notifier_cleanup(EventNotifier *e)
+{
+	close(e->fd);
+}
+
+int event_notifier_get_fd(EventNotifier *e)
+{
+	return e->fd;
+}
+
+int event_notifier_test_and_clear(EventNotifier *e)
+{
+	uint64_t value;
+	int r = read(e->fd, &value, sizeof(value));
+	return r == sizeof(value);
+}
+
+int event_notifier_test(EventNotifier *e)
+{
+	uint64_t value;
+	int r = read(e->fd, &value, sizeof(value));
+	if (r == sizeof(value)) {
+		/* restore previous value. */
+		int s = write(e->fd, &value, sizeof(value));
+		/* never blocks because we use EFD_SEMAPHORE.
+		 * If we didn't we'd get EAGAIN on overflow
+		 * and we'd have to write code to ignore it. */
+		assert(s == sizeof(value));
+	}
+	return r == sizeof(value);
+}
diff --git a/hw/event_notifier.h b/hw/event_notifier.h
new file mode 100644
index 0000000..24117ea
--- /dev/null
+++ b/hw/event_notifier.h
@@ -0,0 +1,16 @@
+#ifndef QEMU_EVENT_NOTIFIER_H
+#define QEMU_EVENT_NOTIFIER_H
+
+#include "qemu-common.h"
+
+struct EventNotifier {
+	int fd;
+};
+
+int event_notifier_init(EventNotifier *, int active);
+void event_notifier_cleanup(EventNotifier *);
+int event_notifier_get_fd(EventNotifier *);
+int event_notifier_test_and_clear(EventNotifier *);
+int event_notifier_test(EventNotifier *);
+
+#endif
diff --git a/hw/notifier.c b/hw/notifier.c
deleted file mode 100644
index c6db3c3..0000000
--- a/hw/notifier.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * event notifier support
- *
- * Copyright Red Hat, Inc. 2010
- *
- * Authors:
- *  Michael S. Tsirkin <mst@redhat.com>
- *
- * This work is licensed under the terms of the GNU GPL, version 2.  See
- * the COPYING file in the top-level directory.
- */
-
-#include "hw.h"
-#include "notifier.h"
-#ifdef CONFIG_EVENTFD
-#include <sys/eventfd.h>
-#endif
-
-int event_notifier_init(EventNotifier *e, int active)
-{
-#ifdef CONFIG_EVENTFD
-	int fd = eventfd(!!active, EFD_NONBLOCK | EFD_CLOEXEC);
-	if (fd < 0)
-		return -errno;
-	e->fd = fd;
-	return 0;
-#else
-	return -ENOSYS;
-#endif
-}
-
-void event_notifier_cleanup(EventNotifier *e)
-{
-	close(e->fd);
-}
-
-int event_notifier_get_fd(EventNotifier *e)
-{
-	return e->fd;
-}
-
-int event_notifier_test_and_clear(EventNotifier *e)
-{
-	uint64_t value;
-	int r = read(e->fd, &value, sizeof(value));
-	return r == sizeof(value);
-}
-
-int event_notifier_test(EventNotifier *e)
-{
-	uint64_t value;
-	int r = read(e->fd, &value, sizeof(value));
-	if (r == sizeof(value)) {
-		/* restore previous value. */
-		int s = write(e->fd, &value, sizeof(value));
-		/* never blocks because we use EFD_SEMAPHORE.
-		 * If we didn't we'd get EAGAIN on overflow
-		 * and we'd have to write code to ignore it. */
-		assert(s == sizeof(value));
-	}
-	return r == sizeof(value);
-}
diff --git a/hw/notifier.h b/hw/notifier.h
deleted file mode 100644
index 24117ea..0000000
--- a/hw/notifier.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef QEMU_EVENT_NOTIFIER_H
-#define QEMU_EVENT_NOTIFIER_H
-
-#include "qemu-common.h"
-
-struct EventNotifier {
-	int fd;
-};
-
-int event_notifier_init(EventNotifier *, int active);
-void event_notifier_cleanup(EventNotifier *);
-int event_notifier_get_fd(EventNotifier *);
-int event_notifier_test_and_clear(EventNotifier *);
-int event_notifier_test(EventNotifier *);
-
-#endif
diff --git a/hw/virtio.h b/hw/virtio.h
index 6f2fab0..066eee3 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -19,7 +19,7 @@
 #include "qdev.h"
 #include "sysemu.h"
 #include "block_int.h"
-#include "notifier.h"
+#include "event_notifier.h"
 
 /* from Linux's linux/virtio_config.h */
 
-- 
1.7.0.3

