From patchwork Fri Jun 11 23:33:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458532 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp704415ejc; Fri, 11 Jun 2021 16:43:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUoQb42KbzCKfUPVxxc6L0x7YFrcjISwKZS9FrrKEtp6gXVDPxsETcCs71JFtmg3rEO8Mr X-Received: by 2002:a05:6638:27a:: with SMTP id x26mr6106153jaq.144.1623454996928; Fri, 11 Jun 2021 16:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623454996; cv=none; d=google.com; s=arc-20160816; b=x/O+YPqTcjsAVHzd4Ei6Mm/6QIioXsDOAtyq90SDfjS96FZy9VvHqmbE9WJpkARQK0 QxvzmitV8EoGAz61f+sGoR0wG35t6p5Ovv4sG0g+enlrSRWUhvHyiGHCOnc+cbnE6Zmb BTXloLP4F7OB56AverlicpE2oOCaQKsen0241Hj7lJMbTg6pfJSPR7os0IbUo9V4oh1O lIjxuQPmiUME6FVn8/kU/iV04F8MFV5wssfDKe8AtRZ7QSNl9iFEYGytkSSkyDtZvrzI Nn4N0aQpYI7fhbls6n1pWmK3lQNarwRWeEmGsgvgsIFUE0f4rq/7PcwjXWBoWokZwG8n KXMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=OC0cZyVRPvWMo/VhnD4bd9Z7jMtR0MDDeeQWprN19Gw=; b=hfZ7NtzJ9eM1W1BgYCiDMEFRZHx9jJBtjwZsR2m326EpTwZy8+Bloqx22iEv4AKfWv jYFAQzapCPPEtcagvq+C1fmsNUC0pjkiqcLQf3FvfbxJuvE6vkQdtdDh3BWyLIDZ86kd rRQDGym+9MUZEIlc3yE4PTpSJTM20tMe26EAn04a28WuwoKmBXWB9L8ZO6MstRCukp8/ knBZrDpbmCL2pr6rf2jnA6zSRfgfkmPRBSWWv38P9ojilFCLBvWreiLh9dWJDJyw+mIC EcSSazdbU5am635MrvcFZacJRVrzfgUBIsJP08N26GPRc3PM5+g3qVQSUP9q/1vNA+zV gxBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uT+H0GOg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j15si7580724ilo.150.2021.06.11.16.43.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 16:43:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uT+H0GOg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrqo0-0002M1-8X for patch@linaro.org; Fri, 11 Jun 2021 19:43:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqf4-0004Md-0C for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:34:02 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:54805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqet-0006PY-At for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:34:01 -0400 Received: by mail-pj1-x102e.google.com with SMTP id g24so6512991pji.4 for ; Fri, 11 Jun 2021 16:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OC0cZyVRPvWMo/VhnD4bd9Z7jMtR0MDDeeQWprN19Gw=; b=uT+H0GOg7BHQnDF2P9+Nipe3ErUxtHUccckrNMifaiYwWER7NELb1KprlJPG5fvuIz WIalnSx9M0/niwMiVKgebcIr8xqmJxQtjTCUQMtATszYTkevRMN5t2gjnspLAgJvUeyh v+BkErP1eSZ9UHAeqCx3j6PRbR/g+SuwPcam0USuU932eOnHLl1YPwJIUKDuBdeivSeW 9xH2n5QgAMFdOpYMEd0VDd17ejwEgiHXNDyHgGwbWKaghKtoo2uXcHuGjjva93rq93To QvYH2TZWNdCCaw6OOlsaJhTlJQSXgJvpRSITGqSKyxgPLPZn5NEGz+JEtIC1nKctQnrL i1TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OC0cZyVRPvWMo/VhnD4bd9Z7jMtR0MDDeeQWprN19Gw=; b=WS2WgPWQOhneQxVN6l3LA9qNgYcsX7KcIUOx8XF+6XaYMEndJ2ttQpJ9DaluVTkUSE LefVSG9tU4jOosK0wvwmZtm+JoCxdlyufODiM9nKOxOzgtYO+mXyJTW68IpCUhhmu3/e JQcYKm+tcdqrwqiEvX5xgfdqATezFUP2u79jYCnHwIZlT/wpbRy8Fb6bF94wGiHiff3X 1G0wMBMpAD8UmBgQ9dW3lFX9fOQTP+XLCTiemU3NQSnV8/6jQ63WKXizmaqHMcGGVNoc /dPczfa9MW305lZmQstlaOtYKQ4epaC4WxD1C11RBentQaX3Nh3WY3pLFOHOAoJYOyH2 Vp5A== X-Gm-Message-State: AOAM530/UkkL8WylZmBg7NjgUWTj0pFvZ5Xpa3oYPEX0Q4da5X7bdcUo AmevX36aDGkLNLKLXzlqhRqdGs6tVr9n6w== X-Received: by 2002:a17:90b:46c3:: with SMTP id jx3mr6735079pjb.206.1623454429930; Fri, 11 Jun 2021 16:33:49 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id m134sm6349606pfd.148.2021.06.11.16.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:33:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/8] util: Use real functions for thread-posix QemuRecMutex Date: Fri, 11 Jun 2021 16:33:42 -0700 Message-Id: <20210611233347.653129-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611233347.653129-1-richard.henderson@linaro.org> References: <20210611233347.653129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 --- 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(-) -- 2.25.1 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 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;