From patchwork Sun Mar 20 17:11:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 553203 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp885533mag; Sun, 20 Mar 2022 10:37:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMHlvXuC/HaYB6K4EMxFPb43NUSW4LW5W2mCGzkR++cgkro0m0eRcMRes8WLAUCkXvcltb X-Received: by 2002:ac8:5b8c:0:b0:2e1:e454:7fd1 with SMTP id a12-20020ac85b8c000000b002e1e4547fd1mr13732077qta.687.1647797828248; Sun, 20 Mar 2022 10:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647797828; cv=none; d=google.com; s=arc-20160816; b=KMLoAQZ3JxpL9vzKffjj3pvuBVcR7exnfxm8D9JngOSOcbXgp1k8iDqKHikzcIULKj g4Su9g56D2sxDN5LLyqz4HVvpdo/4kR+Dw2Lxa40OtOCpd+iuwNam9+uCThTMBb0gGOc oWLhCd8ZGE23x/LJKe/iID5UnpABx4E6UOXKvzJldUxp/aLvQEBWBRLjyXIQaMr/UsBV LglShn0v5AR4a7EZZ9zeUdczSBELQQDfZtN+Hx/WVPSRuCkdWLll53eo9AF9GQoAgy3s 3K/IHPqf2KKR7Q9D2tVLrsm1+vLOcZx73n7R28lgsiyD7anftnWJkfsZw1YmIYSuncrA +UBA== 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=JKSI3UGozDJNBAh+QUx3PhImAK1Aw8+e6IP7+9yTeH4=; b=lNttUGKsxizI8EjO/wddq1r7bzTPM3upSn2tX1aFXfi1n+SDaTUv6zBu9FK1d5Y1jB eGXM9wwKBFjSGTJmRvOVQNXyOqldPgpUges2dS4Zyl1jOI27XcbM4+LABnd36MjwwfTx 9xMJ+6DR/JJcSjIusAdly/DZAMIjw5OA/3HvuQ6GBr+w4vvwaGmlb5qiFDhQuR4PWQ9K pvrqvOD88PaZyC0kL9kN7icHlKZbyxI4zsfVBV2bLYyTTuA93Ps94CNmy6jqmHY0PW2b P8p3uJUJjmxaoGUnwB9vRkQo/zSjUrdVffmz9RSeyqCeyv8oAS2ZQOC9WujPtbisnKUv Q0Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=euGRNYuM; 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=pass (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 m124-20020a375882000000b0067e4be239d3si1247728qkb.536.2022.03.20.10.37.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Mar 2022 10:37:08 -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=pass header.i=@linaro.org header.s=google header.b=euGRNYuM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVzUJ-0002wI-Ps for patch@linaro.org; Sun, 20 Mar 2022 13:37:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVz67-0000OO-3m for qemu-devel@nongnu.org; Sun, 20 Mar 2022 13:12:07 -0400 Received: from [2607:f8b0:4864:20::631] (port=35668 helo=mail-pl1-x631.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVz65-0003Vu-Er for qemu-devel@nongnu.org; Sun, 20 Mar 2022 13:12:06 -0400 Received: by mail-pl1-x631.google.com with SMTP id n15so10901626plh.2 for ; Sun, 20 Mar 2022 10:12:05 -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=JKSI3UGozDJNBAh+QUx3PhImAK1Aw8+e6IP7+9yTeH4=; b=euGRNYuMu54gk93H0zl0aTUrj12Yy4p3/eCuCwxBUmSOJq2DsMFW6j7tLtHn8jUQ+u g4NOxa1yLlcLYC1H8fMA5WKBG6A3jlDjOYQe7clx0uV2yJi7CvJ2gEgGmnG3TLYqXk8Z CKYrxpVPsIBKi7SQtJEs5fNLjp7Tk3sNRjimJh+hUYVxkwyOwwBdKCJwiFTORI40kXod cgzAB5hvegQVapxdcZwXMcMtm9JDhnFW7A9+UbwTp5zCFaBDLvUgvfaMq+x1aS0imjhe rxQYbNrMi7MkIybqPs9hZHa41f/eFZjJWu9zVMknbX1AkBmJ6SVc+tFl4qimtx8p5tou wc5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JKSI3UGozDJNBAh+QUx3PhImAK1Aw8+e6IP7+9yTeH4=; b=eIWJhXNUt0QIPaHndkAzsLbB3QeMvdDCIp9V/Oo2J44P77tXp4RnWACDbb1O+sx4hG +qXk2yD2vNPkT1v9Lm8w2NKUnAOo1wMAZApwtZjkw49twTihuOcQbuDiFk1ClwaTpuQW HSmP8CW7mWfjMBrlNC0yZY5WvQlvT/ZhxcA334jvj9Ik4qZ3cCrNN7mUPl2WgBO7LUwt kmrpNPiE7kvSenM1o2eCGO3SIFe6A73v4HqzdeOmrpXOJrs2/CNGkBsw+C0HMzhG0Wjw ez0NeFlIqwBOLp8SMefrFJPY0EMxIzMvM7iExarNOCd/nZiWVOF+VdN572WZI8yo7xiQ HlOQ== X-Gm-Message-State: AOAM530hTdhdFaO7ch1pyNfXThKcuPUxE+OxBY7J8NqZD9wmfsu810aa 9lkt+/7fuh9us49S3NNEWh3Mgr2oxBhB7A== X-Received: by 2002:a17:90b:390c:b0:1c6:259f:a4cd with SMTP id ob12-20020a17090b390c00b001c6259fa4cdmr32078135pjb.73.1647796324163; Sun, 20 Mar 2022 10:12:04 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id q12-20020a17090aa00c00b001bc6f1baaaesm17149697pjp.39.2022.03.20.10.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Mar 2022 10:12:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL for-7.1 30/36] util/log: Rename qemu_logfile to global_file Date: Sun, 20 Mar 2022 10:11:29 -0700 Message-Id: <20220320171135.2704502-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320171135.2704502-1-richard.henderson@linaro.org> References: <20220320171135.2704502-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::631 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Rename to emphasize this is the file-scope global variable. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- util/log.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/util/log.c b/util/log.c index e559d37369..0676ce5bd6 100644 --- a/util/log.c +++ b/util/log.c @@ -36,7 +36,7 @@ typedef struct QemuLogFile { static char *global_filename; static QemuMutex qemu_logfile_mutex; -static QemuLogFile *qemu_logfile; +static QemuLogFile *global_file; int qemu_loglevel; static int log_append = 0; static GArray *debug_regions; @@ -44,7 +44,7 @@ static GArray *debug_regions; /* Returns true if qemu_log() will really write somewhere. */ bool qemu_log_enabled(void) { - return qemu_logfile != NULL; + return global_file != NULL; } /* Returns true if qemu_log() will write somewhere other than stderr. */ @@ -54,7 +54,7 @@ bool qemu_log_separate(void) bool res = false; rcu_read_lock(); - logfile = qatomic_rcu_read(&qemu_logfile); + logfile = qatomic_rcu_read(&global_file); if (logfile && logfile->fd != stderr) { res = true; } @@ -69,7 +69,7 @@ FILE *qemu_log_lock(void) QemuLogFile *logfile; rcu_read_lock(); - logfile = qatomic_rcu_read(&qemu_logfile); + logfile = qatomic_rcu_read(&global_file); if (logfile) { qemu_flockfile(logfile->fd); return logfile->fd; @@ -133,7 +133,7 @@ static void qemu_set_log_internal(const char *filename, bool changed_name, QemuLogFile *logfile; QEMU_LOCK_GUARD(&qemu_logfile_mutex); - logfile = qemu_logfile; + logfile = global_file; if (changed_name) { char *newname = NULL; @@ -165,7 +165,7 @@ static void qemu_set_log_internal(const char *filename, bool changed_name, filename = newname; if (logfile) { - qatomic_rcu_set(&qemu_logfile, NULL); + qatomic_rcu_set(&global_file, NULL); call_rcu(logfile, qemu_logfile_free, rcu); logfile = NULL; } @@ -188,7 +188,7 @@ static void qemu_set_log_internal(const char *filename, bool changed_name, need_to_open_file = log_flags && (!is_daemonized() || filename); if (logfile && !need_to_open_file) { - qatomic_rcu_set(&qemu_logfile, NULL); + qatomic_rcu_set(&global_file, NULL); call_rcu(logfile, qemu_logfile_free, rcu); return; } @@ -219,7 +219,7 @@ static void qemu_set_log_internal(const char *filename, bool changed_name, logfile = g_new0(QemuLogFile, 1); logfile->fd = fd; - qatomic_rcu_set(&qemu_logfile, logfile); + qatomic_rcu_set(&global_file, logfile); } }