From nobody Thu Oct 30 15:33:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525818489679484.5283701092774; Tue, 8 May 2018 15:28:09 -0700 (PDT) Received: from localhost ([::1]:53580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB5c-000759-Q4 for importer@patchew.org; Tue, 08 May 2018 18:28:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtF-0003Fv-3B for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtC-0001Z7-NA for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:21 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:52628) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtC-0001YV-BM for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:18 -0400 Received: by mail-wm0-x235.google.com with SMTP id w194so21163870wmf.2 for ; Tue, 08 May 2018 15:15:18 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OEbyxaYkY08ebP7I3i4jlet+JgJtA1uzyV2bm9GLHkE=; b=dghUwPVHFTba82IgPEUMv3YCdkxeZuLs3hoUnxLilLQH7PtexPU7qf1IfODeW17I8a ZpWaYphIROX7t4o/IzjpuzoSyHYpMPDgDlEKIR9UQwBu8NiZXSJVeuTyqAJOdKHN/MUQ LRy5/Wk8VTRe0QW0IvXAN1mg+OVQh9SQ1hIFXdcy7ifrcVtKmmEqjOCMFJBAzFqQGFZP x0NBUK3YrPP+AiqaD2qvlr1bUNm+AoTqdTulVj5gzUAxUj8RQYf/GSuySe+3HruZO/2y aXqhtFsHuBMLGCe9fMafA/yxdsOnS2rof6Kdsq4fwJL5JWJioa9cloUpf1UnygG7CM9N XJuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=OEbyxaYkY08ebP7I3i4jlet+JgJtA1uzyV2bm9GLHkE=; b=THuUvq7GDsYiVIn3x7T6Zx1UpErw316XMYozgw3pO7HAHlppxnTuShf7lHAtGQlhwe CYIlSqcSOt1Y981okBjWkC00BXvnt4oJSm2a/93LGrbj7cNKDhAOu1KVOCEclODzYi/u NfHvF+WnSMzv3pcDf0h5q29i709AGfLWWGX0iROLQ9eeqKm7BMXRGIkWONPDyYIAuJ41 Do7QC31cor1Ml65xCkhSL8dHPJzApHfaFsfbXugsJ6Y734H/ovKPaspVVRufosnMGT29 recxdtlkBeXoaxNRJgw0lyw/WdZSrARxtaCVEUHlKEGCTWHBsxBg5hoQIh8qx2NetGJD nCYg== X-Gm-Message-State: ALQs6tBuH3lIcrdiAZXG1qDwd8GgY2xA9gAWKoHr+vPEd950iki2OoNe K/VaJK92ry+P5uScug6i9CynOI7T X-Google-Smtp-Source: AB8JxZqhC//aHlRu3eL5Esb/VV2QW63deOCNN8ZeQSX3dnuKWwz0fjkRo7BLYlOvHOe6t+GNdDGXxA== X-Received: by 2002:a50:fa06:: with SMTP id b6-v6mr41619032edq.26.1525817716961; Tue, 08 May 2018 15:15:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:40 +0200 Message-Id: <1525817687-34620-24-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::235 Subject: [Qemu-devel] [PULL 23/30] glib: bump min required glib library version to 2.42 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Daniel P. Berrang=C3=A9 Per supported platforms doc, the various min glib on relevant distros is: RHEL-7: 2.50.3 Debian (Stretch): 2.50.3 Debian (Jessie): 2.42.1 OpenBSD (Ports): 2.54.3 FreeBSD (Ports): 2.50.3 OpenSUSE Leap 15: 2.54.3 Ubuntu (Xenial): 2.48.0 macOS (Homebrew): 2.56.0 This suggests that a minimum glib of 2.42 is a reasonable target Signed-off-by: Daniel P. Berrang=C3=83=C2=A9 Message-Id: <20180504160026.14017-3-berrange@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Daniel P. Berrang=C3=A9 --- configure | 6 +- docs/devel/testing.rst | 4 +- include/glib-compat.h | 319 ---------------------------= ---- tests/docker/dockerfiles/centos6.docker | 30 --- tests/docker/dockerfiles/min-glib.docker | 8 - tests/test-qmp-event.c | 2 +- tests/tpm-emu.h | 4 +- tests/vhost-user-test.c | 4 +- trace/simple.c | 6 +- 9 files changed, 11 insertions(+), 372 deletions(-) delete mode 100644 tests/docker/dockerfiles/centos6.docker delete mode 100644 tests/docker/dockerfiles/min-glib.docker diff --git a/configure b/configure index 83a6080..3ff4d77 100755 --- a/configure +++ b/configure @@ -3394,11 +3394,7 @@ fi ########################################## # glib support probe =20 -if test "$mingw32" =3D yes; then - glib_req_ver=3D2.30 -else - glib_req_ver=3D2.22 -fi +glib_req_ver=3D2.42 glib_modules=3Dgthread-2.0 if test "$modules" =3D yes; then glib_modules=3D"$glib_modules gmodule-export-2.0" diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 0ca1a2d..f7b7552 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -297,9 +297,9 @@ the container, with parameters defined by the make targ= et): =20 .. code:: =20 - make docker-test-build@min-glib + make docker-test-build@centos7 =20 -This will create a container instance using the ``min-glib`` image (the im= age +This will create a container instance using the ``centos7`` image (the ima= ge is downloaded and initialized automatically), in which the ``test-build`` = job is executed. =20 diff --git a/include/glib-compat.h b/include/glib-compat.h index c49cf87..3b340ab 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -18,27 +18,6 @@ =20 #include =20 -/* GLIB version compatibility flags */ -#if !GLIB_CHECK_VERSION(2, 26, 0) -#define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT(1000000)) -#endif - -#if !GLIB_CHECK_VERSION(2, 28, 0) -static inline gint64 qemu_g_get_monotonic_time(void) -{ - /* g_get_monotonic_time() is best-effort so we can use the wall clock = as a - * fallback. - */ - - GTimeVal time; - g_get_current_time(&time); - - return time.tv_sec * G_TIME_SPAN_SECOND + time.tv_usec; -} -/* work around distro backports of this interface */ -#define g_get_monotonic_time() qemu_g_get_monotonic_time() -#endif - #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0) /* * g_poll has a problem on Windows when using @@ -48,228 +27,6 @@ static inline gint64 qemu_g_get_monotonic_time(void) gint g_poll_fixed(GPollFD *fds, guint nfds, gint timeout); #endif =20 -#if !GLIB_CHECK_VERSION(2, 30, 0) -/* Not a 100% compatible implementation, but good enough for most - * cases. Placeholders are only supported at the end of the - * template. */ -static inline gchar *qemu_g_dir_make_tmp(gchar const *tmpl, GError **error) -{ - gchar *path =3D g_build_filename(g_get_tmp_dir(), tmpl ?: ".XXXXXX", N= ULL); - - if (mkdtemp(path) !=3D NULL) { - return path; - } - /* Error occurred, clean up. */ - g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno), - "mkdtemp() failed"); - g_free(path); - return NULL; -} -#define g_dir_make_tmp(tmpl, error) qemu_g_dir_make_tmp(tmpl, error) -#endif /* glib 2.30 */ - -#if !GLIB_CHECK_VERSION(2, 31, 0) -/* before glib-2.31, GMutex and GCond was dynamic-only (there was a separa= te - * GStaticMutex, but it didn't work with condition variables). - * - * Our implementation uses GOnce to fake a static implementation that does - * not require separate initialization. - * We need to rename the types to avoid passing our CompatGMutex/CompatGCo= nd - * by mistake to a function that expects GMutex/GCond. However, for ease - * of use we keep the GLib function names. GLib uses macros for the - * implementation, we use inline functions instead and undefine the macros. - */ - -typedef struct CompatGMutex { - GOnce once; -} CompatGMutex; - -typedef struct CompatGCond { - GOnce once; -} CompatGCond; - -static inline gpointer do_g_mutex_new(gpointer unused) -{ - return (gpointer) g_mutex_new(); -} - -static inline void g_mutex_init(CompatGMutex *mutex) -{ - mutex->once =3D (GOnce) G_ONCE_INIT; -} - -static inline void g_mutex_clear(CompatGMutex *mutex) -{ - g_assert(mutex->once.status !=3D G_ONCE_STATUS_PROGRESS); - if (mutex->once.retval) { - g_mutex_free((GMutex *) mutex->once.retval); - } - mutex->once =3D (GOnce) G_ONCE_INIT; -} - -static inline void (g_mutex_lock)(CompatGMutex *mutex) -{ - g_once(&mutex->once, do_g_mutex_new, NULL); - g_mutex_lock((GMutex *) mutex->once.retval); -} -#undef g_mutex_lock - -static inline gboolean (g_mutex_trylock)(CompatGMutex *mutex) -{ - g_once(&mutex->once, do_g_mutex_new, NULL); - return g_mutex_trylock((GMutex *) mutex->once.retval); -} -#undef g_mutex_trylock - - -static inline void (g_mutex_unlock)(CompatGMutex *mutex) -{ - g_mutex_unlock((GMutex *) mutex->once.retval); -} -#undef g_mutex_unlock - -static inline gpointer do_g_cond_new(gpointer unused) -{ - return (gpointer) g_cond_new(); -} - -static inline void g_cond_init(CompatGCond *cond) -{ - cond->once =3D (GOnce) G_ONCE_INIT; -} - -static inline void g_cond_clear(CompatGCond *cond) -{ - g_assert(cond->once.status !=3D G_ONCE_STATUS_PROGRESS); - if (cond->once.retval) { - g_cond_free((GCond *) cond->once.retval); - } - cond->once =3D (GOnce) G_ONCE_INIT; -} - -static inline void (g_cond_wait)(CompatGCond *cond, CompatGMutex *mutex) -{ - g_assert(mutex->once.status !=3D G_ONCE_STATUS_PROGRESS); - g_once(&cond->once, do_g_cond_new, NULL); - g_cond_wait((GCond *) cond->once.retval, (GMutex *) mutex->once.retval= ); -} -#undef g_cond_wait - -static inline void (g_cond_broadcast)(CompatGCond *cond) -{ - g_once(&cond->once, do_g_cond_new, NULL); - g_cond_broadcast((GCond *) cond->once.retval); -} -#undef g_cond_broadcast - -static inline void (g_cond_signal)(CompatGCond *cond) -{ - g_once(&cond->once, do_g_cond_new, NULL); - g_cond_signal((GCond *) cond->once.retval); -} -#undef g_cond_signal - -static inline gboolean (g_cond_timed_wait)(CompatGCond *cond, - CompatGMutex *mutex, - GTimeVal *time) -{ - g_assert(mutex->once.status !=3D G_ONCE_STATUS_PROGRESS); - g_once(&cond->once, do_g_cond_new, NULL); - return g_cond_timed_wait((GCond *) cond->once.retval, - (GMutex *) mutex->once.retval, time); -} -#undef g_cond_timed_wait - -/* This is not a macro, because it didn't exist until 2.32. */ -static inline gboolean g_cond_wait_until(CompatGCond *cond, CompatGMutex *= mutex, - gint64 end_time) -{ - GTimeVal time; - - /* Convert from monotonic to CLOCK_REALTIME. */ - end_time -=3D g_get_monotonic_time(); - g_get_current_time(&time); - end_time +=3D time.tv_sec * G_TIME_SPAN_SECOND + time.tv_usec; - - time.tv_sec =3D end_time / G_TIME_SPAN_SECOND; - time.tv_usec =3D end_time % G_TIME_SPAN_SECOND; - return g_cond_timed_wait(cond, mutex, &time); -} - -/* before 2.31 there was no g_thread_new() */ -static inline GThread *g_thread_new(const char *name, - GThreadFunc func, gpointer data) -{ - GThread *thread =3D g_thread_create(func, data, TRUE, NULL); - if (!thread) { - g_error("creating thread"); - } - return thread; -} -#else -#define CompatGMutex GMutex -#define CompatGCond GCond -#endif /* glib 2.31 */ - -#if !GLIB_CHECK_VERSION(2, 32, 0) -/* Beware, function returns gboolean since 2.39.2, see GLib commit 9101915= */ -static inline void g_hash_table_add(GHashTable *hash_table, gpointer key) -{ - g_hash_table_replace(hash_table, key, key); -} - -static inline gboolean g_hash_table_contains(GHashTable *hash_table, - gpointer key) -{ - return g_hash_table_lookup_extended(hash_table, key, NULL, NULL); -} -#define G_SOURCE_CONTINUE TRUE -#define G_SOURCE_REMOVE FALSE -#endif - -#ifndef g_assert_true -#define g_assert_true(expr) = \ - do { = \ - if (G_LIKELY(expr)) { = \ - } else { = \ - g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUN= C, \ - "'" #expr "' should be TRUE"); = \ - } = \ - } while (0) -#endif - -#ifndef g_assert_false -#define g_assert_false(expr) = \ - do { = \ - if (G_LIKELY(!(expr))) { = \ - } else { = \ - g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUN= C, \ - "'" #expr "' should be FALSE"); = \ - } = \ - } while (0) -#endif - -#ifndef g_assert_null -#define g_assert_null(expr) = \ - do { = \ - if (G_LIKELY((expr) =3D=3D NULL)) { = \ - } else { = \ - g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUN= C, \ - "'" #expr "' should be NULL"); = \ - } = \ - } while (0) -#endif - -#ifndef g_assert_nonnull -#define g_assert_nonnull(expr) = \ - do { = \ - if (G_LIKELY((expr) !=3D NULL)) { = \ - } else { = \ - g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUN= C, \ - "'" #expr "' should not be NULL"); = \ - } = \ - } while (0) -#endif =20 #ifndef g_assert_cmpmem #define g_assert_cmpmem(m1, l1, m2, l2) = \ @@ -288,80 +45,4 @@ static inline gboolean g_hash_table_contains(GHashTable= *hash_table, } while (0) #endif =20 -#if !GLIB_CHECK_VERSION(2, 28, 0) -static inline void g_list_free_full(GList *list, GDestroyNotify free_func) -{ - GList *l; - - for (l =3D list; l; l =3D l->next) { - free_func(l->data); - } - - g_list_free(list); -} - -static inline void g_slist_free_full(GSList *list, GDestroyNotify free_fun= c) -{ - GSList *l; - - for (l =3D list; l; l =3D l->next) { - free_func(l->data); - } - - g_slist_free(list); -} -#endif - -#if !GLIB_CHECK_VERSION(2, 26, 0) -static inline void g_source_set_name(GSource *source, const char *name) -{ - /* This is just a debugging aid, so leaving it a no-op */ -} -static inline void g_source_set_name_by_id(guint tag, const char *name) -{ - /* This is just a debugging aid, so leaving it a no-op */ -} -#endif - -#if !GLIB_CHECK_VERSION(2, 36, 0) -/* Always fail. This will not include error_report output in the test log, - * sending it instead to stderr. - */ -#define g_test_initialized() (0) -#endif -#if !GLIB_CHECK_VERSION(2, 38, 0) -#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS -#error schizophrenic detection of glib subprocess testing -#endif -#define g_test_subprocess() (0) -#endif - - -#if !GLIB_CHECK_VERSION(2, 34, 0) -static inline void -g_test_add_data_func_full(const char *path, - gpointer data, - gpointer fn, - gpointer data_free_func) -{ -#if GLIB_CHECK_VERSION(2, 26, 0) - /* back-compat casts, remove this once we can require new-enough glib = */ - g_test_add_vtable(path, 0, data, NULL, - (GTestFixtureFunc)fn, (GTestFixtureFunc) data_free_f= unc); -#else - /* back-compat casts, remove this once we can require new-enough glib = */ - g_test_add_vtable(path, 0, data, NULL, - (void (*)(void)) fn, (void (*)(void)) data_free_func= ); -#endif -} -#endif - -/* Small compat shim from glib 2.32 */ -#ifndef G_SOURCE_CONTINUE -#define G_SOURCE_CONTINUE TRUE -#endif -#ifndef G_SOURCE_REMOVE -#define G_SOURCE_REMOVE FALSE -#endif - #endif diff --git a/tests/docker/dockerfiles/centos6.docker b/tests/docker/dockerf= iles/centos6.docker deleted file mode 100644 index ad24319..0000000 --- a/tests/docker/dockerfiles/centos6.docker +++ /dev/null @@ -1,30 +0,0 @@ -FROM centos:6 -RUN yum install -y epel-release centos-release-xen -ENV PACKAGES \ - bison \ - bzip2-devel \ - ccache \ - csnappy-devel \ - flex \ - g++ \ - gcc \ - gettext \ - git \ - glib2-devel \ - libepoxy-devel \ - libfdt-devel \ - librdmacm-devel \ - lzo-devel \ - make \ - mesa-libEGL-devel \ - mesa-libgbm-devel \ - pixman-devel \ - SDL-devel \ - spice-glib-devel \ - spice-server-devel \ - tar \ - vte-devel \ - xen-devel \ - zlib-devel -RUN yum install -y $PACKAGES -RUN rpm -q $PACKAGES | sort > /packages.txt diff --git a/tests/docker/dockerfiles/min-glib.docker b/tests/docker/docker= files/min-glib.docker deleted file mode 100644 index f2eed97..0000000 --- a/tests/docker/dockerfiles/min-glib.docker +++ /dev/null @@ -1,8 +0,0 @@ -FROM centos:6 -RUN yum install -y \ - tar gettext git make gcc g++ \ - zlib-devel SDL-devel pixman-devel \ - epel-release -RUN yum install -y libfdt-devel ccache -RUN yum downgrade -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-= 2.22.5-5.el6.x86_64.rpm -RUN yum install -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-de= vel-2.22.5-5.el6.x86_64.rpm diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c index 3a7c227..78a2942 100644 --- a/tests/test-qmp-event.c +++ b/tests/test-qmp-event.c @@ -32,7 +32,7 @@ typedef struct QDictCmpData { } QDictCmpData; =20 TestEventData *test_event_data; -static CompatGMutex test_event_lock; +static GMutex test_event_lock; =20 /* Only compares bool, int, string */ static diff --git a/tests/tpm-emu.h b/tests/tpm-emu.h index ef4bfa8..08f9024 100644 --- a/tests/tpm-emu.h +++ b/tests/tpm-emu.h @@ -24,8 +24,8 @@ struct tpm_hdr { } QEMU_PACKED; =20 typedef struct TestState { - CompatGMutex data_mutex; - CompatGCond data_cond; + GMutex data_mutex; + GCond data_cond; SocketAddress *addr; QIOChannel *tpm_ioc; GThread *emu_tpm_thread; diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index bbc8091..9f680f5 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -150,8 +150,8 @@ typedef struct TestServer { int fds_num; int fds[VHOST_MEMORY_MAX_NREGIONS]; VhostUserMemory memory; - CompatGMutex data_mutex; - CompatGCond data_cond; + GMutex data_mutex; + GCond data_cond; int log_fd; uint64_t rings; bool test_fail; diff --git a/trace/simple.c b/trace/simple.c index e82018d..701dec6 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -36,9 +36,9 @@ * Trace records are written out by a dedicated thread. The thread waits = for * records to become available, writes them out, and then waits again. */ -static CompatGMutex trace_lock; -static CompatGCond trace_available_cond; -static CompatGCond trace_empty_cond; +static GMutex trace_lock; +static GCond trace_available_cond; +static GCond trace_empty_cond; =20 static bool trace_available; static bool trace_writeout_enabled; --=20 1.8.3.1