From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: [PULL 40/45] util: Use real functions for thread-posix QemuRecMutex
Date: Thu, 17 Jun 2021 11:31:29 +0200 [thread overview]
Message-ID: <20210617093134.900014-41-pbonzini@redhat.com> (raw)
In-Reply-To: <20210617093134.900014-1-pbonzini@redhat.com>
From: Richard Henderson <richard.henderson@linaro.org>
Move the declarations from thread-win32.h into thread.h
and remove the macro redirection from thread-posix.h.
This will be required by following cleanups.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210614233143.1221879-4-richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/qemu/thread-posix.h | 4 ----
include/qemu/thread-win32.h | 6 ------
include/qemu/thread.h | 9 ++++++---
util/qemu-thread-posix.c | 20 ++++++++++++++++++++
4 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h
index c903525062..cf8bc90468 100644
--- a/include/qemu/thread-posix.h
+++ b/include/qemu/thread-posix.h
@@ -5,10 +5,6 @@
#include <semaphore.h>
typedef QemuMutex QemuRecMutex;
-#define qemu_rec_mutex_destroy qemu_mutex_destroy
-#define qemu_rec_mutex_lock_impl qemu_mutex_lock_impl
-#define qemu_rec_mutex_trylock_impl qemu_mutex_trylock_impl
-#define qemu_rec_mutex_unlock qemu_mutex_unlock
struct QemuMutex {
pthread_mutex_t lock;
diff --git a/include/qemu/thread-win32.h b/include/qemu/thread-win32.h
index d0a1a9597e..d95af4498f 100644
--- a/include/qemu/thread-win32.h
+++ b/include/qemu/thread-win32.h
@@ -18,12 +18,6 @@ struct QemuRecMutex {
bool initialized;
};
-void qemu_rec_mutex_destroy(QemuRecMutex *mutex);
-void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int line);
-int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file,
- int line);
-void qemu_rec_mutex_unlock(QemuRecMutex *mutex);
-
struct QemuCond {
CONDITION_VARIABLE var;
bool initialized;
diff --git a/include/qemu/thread.h b/include/qemu/thread.h
index 5435763184..2c0d85f3bc 100644
--- a/include/qemu/thread.h
+++ b/include/qemu/thread.h
@@ -28,6 +28,12 @@ int qemu_mutex_trylock_impl(QemuMutex *mutex, const char *file, const int line);
void qemu_mutex_lock_impl(QemuMutex *mutex, const char *file, const int line);
void qemu_mutex_unlock_impl(QemuMutex *mutex, const char *file, const int line);
+void qemu_rec_mutex_init(QemuRecMutex *mutex);
+void qemu_rec_mutex_destroy(QemuRecMutex *mutex);
+void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int line);
+int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file, int line);
+void qemu_rec_mutex_unlock(QemuRecMutex *mutex);
+
typedef void (*QemuMutexLockFunc)(QemuMutex *m, const char *f, int l);
typedef int (*QemuMutexTrylockFunc)(QemuMutex *m, const char *f, int l);
typedef void (*QemuRecMutexLockFunc)(QemuRecMutex *m, const char *f, int l);
@@ -129,9 +135,6 @@ static inline int (qemu_rec_mutex_trylock)(QemuRecMutex *mutex)
return qemu_rec_mutex_trylock(mutex);
}
-/* Prototypes for other functions are in thread-posix.h/thread-win32.h. */
-void qemu_rec_mutex_init(QemuRecMutex *mutex);
-
void qemu_cond_init(QemuCond *cond);
void qemu_cond_destroy(QemuCond *cond);
diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
index dcff5e7c5d..8e2b6653f5 100644
--- a/util/qemu-thread-posix.c
+++ b/util/qemu-thread-posix.c
@@ -124,6 +124,26 @@ void qemu_rec_mutex_init(QemuRecMutex *mutex)
mutex->initialized = true;
}
+void qemu_rec_mutex_destroy(QemuRecMutex *mutex)
+{
+ qemu_mutex_destroy(mutex);
+}
+
+void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int line)
+{
+ qemu_mutex_lock_impl(mutex, file, line);
+}
+
+int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file, int line)
+{
+ return qemu_mutex_trylock_impl(mutex, file, line);
+}
+
+void qemu_rec_mutex_unlock(QemuRecMutex *mutex)
+{
+ qemu_mutex_unlock(mutex);
+}
+
void qemu_cond_init(QemuCond *cond)
{
int err;
--
2.31.1
next prev parent reply other threads:[~2021-06-17 10:03 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 9:30 [PULL 00/45] Memory, i386, compilation, bugfix changes for 2021-06-17 Paolo Bonzini
2021-06-17 9:30 ` [PULL 01/45] vnc: avoid deprecation warnings for SASL on OS X Paolo Bonzini
2021-06-17 9:30 ` [PULL 02/45] vl: Fix an assert failure in error path Paolo Bonzini
2021-06-17 9:30 ` [PULL 03/45] qemu-config: use qemu_opts_from_qdict Paolo Bonzini
2021-06-17 9:30 ` [PULL 04/45] block/scsi: correctly emulate the VPD block limits page Paolo Bonzini
2021-06-17 9:30 ` [PULL 05/45] runstate: Initialize Error * to NULL Paolo Bonzini
2021-06-17 9:30 ` [PULL 06/45] esp: only assert INTR_DC interrupt flag if selection fails Paolo Bonzini
2021-06-17 9:30 ` [PULL 07/45] esp: only set ESP_RSEQ at the start of the select sequence Paolo Bonzini
2021-06-17 9:30 ` [PULL 08/45] esp: allow non-DMA callback in esp_transfer_data() initial transfer Paolo Bonzini
2021-06-17 9:30 ` [PULL 09/45] esp: handle non-DMA transfers from the target one byte at a time Paolo Bonzini
2021-06-17 9:30 ` [PULL 10/45] esp: ensure PDMA write transfers are flushed from the FIFO to the target immediately Paolo Bonzini
2021-06-17 9:31 ` [PULL 11/45] esp: revert 75ef849696 "esp: correctly fill bus id with requested lun" Paolo Bonzini
2021-06-17 9:31 ` [PULL 12/45] esp: correctly accumulate extended messages for PDMA Paolo Bonzini
2021-06-17 9:31 ` [PULL 13/45] esp: fix migration version check in esp_is_version_5() Paolo Bonzini
2021-06-17 9:31 ` [PULL 14/45] esp: store lun coming from the MESSAGE OUT phase Paolo Bonzini
2021-06-17 9:31 ` [PULL 15/45] softmmu/physmem: Mark shared anonymous memory RAM_SHARED Paolo Bonzini
2021-06-17 9:31 ` [PULL 16/45] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory Paolo Bonzini
2021-06-17 9:31 ` [PULL 17/45] softmmu/physmem: Fix qemu_ram_remap() " Paolo Bonzini
2021-06-17 9:31 ` [PULL 18/45] util/mmap-alloc: Factor out calculation of the pagesize for the guard page Paolo Bonzini
2021-06-17 9:31 ` [PULL 19/45] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve() Paolo Bonzini
2021-06-17 9:31 ` [PULL 20/45] util/mmap-alloc: Factor out activating of memory to mmap_activate() Paolo Bonzini
2021-06-17 9:31 ` [PULL 21/45] softmmu/memory: Pass ram_flags to qemu_ram_alloc_from_fd() Paolo Bonzini
2021-06-17 9:31 ` [PULL 22/45] softmmu/memory: Pass ram_flags to memory_region_init_ram_shared_nomigrate() Paolo Bonzini
2021-06-17 9:31 ` [PULL 23/45] softmmu/memory: Pass ram_flags to qemu_ram_alloc() and qemu_ram_alloc_internal() Paolo Bonzini
2021-06-17 9:31 ` [PULL 24/45] util/mmap-alloc: Pass flags instead of separate bools to qemu_ram_mmap() Paolo Bonzini
2021-06-17 9:31 ` [PULL 25/45] memory: Introduce RAM_NORESERVE and wire it up in qemu_ram_mmap() Paolo Bonzini
2021-06-17 9:31 ` [PULL 26/45] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE under Linux Paolo Bonzini
2021-06-17 9:31 ` [PULL 27/45] hostmem: Wire up RAM_NORESERVE via "reserve" property Paolo Bonzini
2021-06-17 9:31 ` [PULL 28/45] qmp: Clarify memory backend properties returned via query-memdev Paolo Bonzini
2021-06-17 9:31 ` [PULL 29/45] qmp: Include "share" property of memory backends Paolo Bonzini
2021-06-17 9:31 ` [PULL 30/45] hmp: Print "share" property of memory backends with "info memdev" Paolo Bonzini
2021-06-17 9:31 ` [PULL 31/45] qmp: Include "reserve" property of memory backends Paolo Bonzini
2021-06-17 9:31 ` [PULL 32/45] hmp: Print "reserve" property of memory backends with "info memdev" Paolo Bonzini
2021-06-17 9:31 ` [PULL 33/45] configure: map x32 to cpu_family x86_64 for meson Paolo Bonzini
2021-06-17 9:31 ` [PULL 34/45] target/i386: Refactored intercept checks into cpu_svm_has_intercept Paolo Bonzini
2021-06-17 9:31 ` [PULL 35/45] target/i386: Added consistency checks for VMRUN intercept and ASID Paolo Bonzini
2021-06-17 9:31 ` [PULL 36/45] target/i386: Added consistency checks for CR0 Paolo Bonzini
2021-06-17 9:31 ` [PULL 37/45] target/i386: Added Intercept CR0 writes check Paolo Bonzini
2021-06-17 9:31 ` [PULL 38/45] configure: Use -std=gnu11 Paolo Bonzini
2021-06-17 9:31 ` [PULL 39/45] softfloat: Use _Generic instead of QEMU_GENERIC Paolo Bonzini
2021-06-17 9:31 ` Paolo Bonzini [this message]
2021-06-17 9:31 ` [PULL 41/45] util: Pass file+line to qemu_rec_mutex_unlock_impl Paolo Bonzini
2021-06-17 9:31 ` [PULL 42/45] util: Use unique type for QemuRecMutex in thread-posix.h Paolo Bonzini
2021-06-17 9:31 ` [PULL 43/45] include/qemu/lockable: Use _Generic instead of QEMU_GENERIC Paolo Bonzini
2021-06-17 9:31 ` [PULL 44/45] qemu/compiler: Remove QEMU_GENERIC Paolo Bonzini
2021-06-17 9:31 ` [PULL 45/45] configure: Remove probe for _Static_assert Paolo Bonzini
2021-06-17 10:21 ` [PULL 00/45] Memory, i386, compilation, bugfix changes for 2021-06-17 no-reply
2021-06-18 8:53 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210617093134.900014-41-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).