* [Qemu-devel] [PATCH 1/3] glib: move g_poll() replacement into glib-compat.h
@ 2014-05-02 10:32 Michael Tokarev
2014-05-02 10:36 ` Michael Tokarev
0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2014-05-02 10:32 UTC (permalink / raw)
To: stefanha; +Cc: qemu-devel
Stefan Hajnoczi:
> We have a dedicated header file for wrappers to smooth over glib version
> differences. Move the g_poll() definition into glib-compat.h for
> consistency.
Ack.
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
I wanted to include exactly this in my series too, but forgot.
/mjt
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 0/3] glib: move compat functions into glib-compat.h
@ 2014-02-03 13:31 Stefan Hajnoczi
2014-02-03 13:31 ` [Qemu-devel] [PATCH 1/3] glib: move g_poll() replacement " Stefan Hajnoczi
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-02-03 13:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Anthony Liguori
glib has deprecated APIs like GStaticMutex, g_thread_create(), and others. In
QEMU support both old and new APIs since using deprecated APIs would flood us
with warnings but legacy distros must continue to build the QEMU source code.
This patch series reduces ifdefs by moving glib compat functions into
glib-compat.h, where they can be reused.
There are two strategies for compat functions:
1. Implement the new API using the deprecated API. This compat function is
used when building on a legacy host. Sometimes the API semantics are so
different that this option is not feasible.
2. Add a new wrapper API that maps to the deprecated API. The wrapper is not
marked deprecated so it works as a drop-in replacement but is implemented
using the new API where possible.
Stefan Hajnoczi (3):
glib: move g_poll() replacement into glib-compat.h
glib: add g_thread_new() compat function
glib: add compat wrapper for GStaticMutex
coroutine-gthread.c | 26 ++++++++++----------------
include/glib-compat.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
include/qemu-common.h | 12 ------------
trace/simple.c | 31 ++++++++++---------------------
4 files changed, 64 insertions(+), 49 deletions(-)
--
1.8.5.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 1/3] glib: move g_poll() replacement into glib-compat.h
2014-02-03 13:31 [Qemu-devel] [PATCH 0/3] glib: move compat functions " Stefan Hajnoczi
@ 2014-02-03 13:31 ` Stefan Hajnoczi
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-02-03 13:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Anthony Liguori
We have a dedicated header file for wrappers to smooth over glib version
differences. Move the g_poll() definition into glib-compat.h for
consistency.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
include/glib-compat.h | 12 ++++++++++++
include/qemu-common.h | 12 ------------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/glib-compat.h b/include/glib-compat.h
index 8aa77af..8d25900 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -24,4 +24,16 @@ static inline guint g_timeout_add_seconds(guint interval, GSourceFunc function,
}
#endif
+#if !GLIB_CHECK_VERSION(2, 20, 0)
+/*
+ * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly
+ * on older systems.
+ */
+static inline gint g_poll(GPollFD *fds, guint nfds, gint timeout)
+{
+ GMainContext *ctx = g_main_context_default();
+ return g_main_context_get_poll_func(ctx)(fds, nfds, timeout);
+}
+#endif
+
#endif
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 5054836..e0e03cc 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -124,18 +124,6 @@ int qemu_main(int argc, char **argv, char **envp);
void qemu_get_timedate(struct tm *tm, int offset);
int qemu_timedate_diff(struct tm *tm);
-#if !GLIB_CHECK_VERSION(2, 20, 0)
-/*
- * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly
- * on older systems.
- */
-static inline gint g_poll(GPollFD *fds, guint nfds, gint timeout)
-{
- GMainContext *ctx = g_main_context_default();
- return g_main_context_get_poll_func(ctx)(fds, nfds, timeout);
-}
-#endif
-
/**
* is_help_option:
* @s: string to test
--
1.8.5.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-02 10:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-02 10:32 [Qemu-devel] [PATCH 1/3] glib: move g_poll() replacement into glib-compat.h Michael Tokarev
2014-05-02 10:36 ` Michael Tokarev
-- strict thread matches above, loose matches on Subject: below --
2014-02-03 13:31 [Qemu-devel] [PATCH 0/3] glib: move compat functions " Stefan Hajnoczi
2014-02-03 13:31 ` [Qemu-devel] [PATCH 1/3] glib: move g_poll() replacement " Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).