From c60f599bcb9bf9256eb87c1c60add55d23f76de3 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 17 Apr 2022 11:29:47 -0700 Subject: util/log: Rename qemu_log_lock to qemu_log_trylock This function can fail, which makes it more like ftrylockfile or pthread_mutex_trylock than flockfile or pthread_mutex_lock, so rename it. To closer match the other trylock functions, release rcu_read_lock along the failure path, so that qemu_log_unlock need not be called on failure. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-Id: <20220417183019.755276-8-richard.henderson@linaro.org> --- include/exec/log.h | 2 +- include/qemu/log.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/exec/log.h b/include/exec/log.h index 3c7fa65ead..fb595d1eb7 100644 --- a/include/exec/log.h +++ b/include/exec/log.h @@ -71,7 +71,7 @@ static inline void log_disas(const void *code, unsigned long size) /* page_dump() output to the log file: */ static inline void log_page_dump(const char *operation) { - FILE *logfile = qemu_log_lock(); + FILE *logfile = qemu_log_trylock(); if (logfile) { qemu_log("page layout changed following %s\n", operation); page_dump(logfile); diff --git a/include/qemu/log.h b/include/qemu/log.h index 6a6b1efce5..d090faf22a 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -67,7 +67,7 @@ static inline bool qemu_log_separate(void) /* Lock/unlock output. */ -FILE *qemu_log_lock(void); +FILE *qemu_log_trylock(void); void qemu_log_unlock(FILE *fd); /* Logging functions: */ -- cgit v1.2.3-55-g7522