From nobody Tue Nov 26 16:40:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1706150058; cv=none; d=zohomail.com; s=zohoarc; b=RCPm8Z6Lklj/DU2n9XiqzVNlSTf66VtL2KnZrg5F+LaG6BzTZn9LOaxRdVlk2uUChFlmRxLlNDU74LW2sVJg3VmPyYWk/s+WIxytOGvm8GC1KCKOhPxc9waG79pbA3KVSBz+GXDOkj3VJR2XQf4k7zCio5qhyr6azVBUkf8eM8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706150058; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WsYSvzB/D6yto1wjF+ezghC1kglQjD8CIBl7spw/li0=; b=hOm+nKqfAwPAI7hPRSMK//4YeFJ8L1qayj2CoUzJGJYGbbKDcgSbuKJn+SGEBnTV0qy2KQzZfEEVKzMjnltHQf4oUzhkN/t4aH69raxkJXCvGdI0YjleYVxGKEmt63+ybyN/4ybuAccAe6AT1iSjvslzB9+eZWhZyVWM8ZKuzx8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706150058008445.00929805068233; Wed, 24 Jan 2024 18:34:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSpYk-0002Ko-Ce; Wed, 24 Jan 2024 21:33:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSpYh-0002KX-IA for qemu-devel@nongnu.org; Wed, 24 Jan 2024 21:33:39 -0500 Received: from mgamail.intel.com ([192.198.163.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSpYe-0004HL-Ug for qemu-devel@nongnu.org; Wed, 24 Jan 2024 21:33:39 -0500 Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 18:33:34 -0800 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by orviesa001.jf.intel.com with ESMTP; 24 Jan 2024 18:33:32 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706150017; x=1737686017; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JJMGK4Khd8RwNnz0Blay9zCaeDovhWnkx9H2LHmEgjs=; b=W4Am1ojEhVedV5YqD448bx6L5qrfD3+mmESmKvojmBO8gHecAg5UF42x 59I6RnMU8MHjnLVFFIRXyvLoAjkKL0cZuzAlreHIrb5cmasINIiouqpvr T4c13wPA7akQA150beWO0bRBpFeUQQcV9Z6XO1ky5hT5M8ayQBEK+zhY7 yiHNZckBE9O7gIZF7d0TxlQL+RDKoO7vNeJa4Ir20+yAoZeATmNOlymb1 6M0QFx5vN2CgpcXO+C2+XSB65eJ3426y7TYyxe6vhmafC3enjCjIBMaMa nxiugiJjnUYH8MKEK42z4mbrj8JR+WQOmx7XdlnQr2i2VsPByulGUEMPW A==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="8715187" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="8715187" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="34968223" From: Xiaoyao Li To: Paolo Bonzini , Peter Xu , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Cc: qemu-devel@nongnu.org, xiaoyao.li@intel.com Subject: [PATCH] physmem: replace function name with __func__ in ram_block_discard_range() Date: Wed, 24 Jan 2024 21:33:28 -0500 Message-Id: <20240125023328.2520888-1-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.11; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HK_RANDOM_ENVFROM=0.999, HK_RANDOM_FROM=1, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1706150060076100003 Content-Type: text/plain; charset="utf-8" Use __func__ to avoid hard-coded function name. Signed-off-by: Xiaoyao Li Reviewed-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- system/physmem.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index cc68a7976378..c1b22bac77c2 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -3500,16 +3500,15 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t = start, size_t length) uint8_t *host_startaddr =3D rb->host + start; =20 if (!QEMU_PTR_IS_ALIGNED(host_startaddr, rb->page_size)) { - error_report("ram_block_discard_range: Unaligned start address: %p= ", - host_startaddr); + error_report("%s: Unaligned start address: %p", + __func__, host_startaddr); goto err; } =20 if ((start + length) <=3D rb->max_length) { bool need_madvise, need_fallocate; if (!QEMU_IS_ALIGNED(length, rb->page_size)) { - error_report("ram_block_discard_range: Unaligned length: %zx", - length); + error_report("%s: Unaligned length: %zx", __func__, length); goto err; } =20 @@ -3533,8 +3532,8 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t st= art, size_t length) * proper error message. */ if (rb->flags & RAM_READONLY_FD) { - error_report("ram_block_discard_range: Discarding RAM" - " with readonly files is not supported"); + error_report("%s: Discarding RAM with readonly files is no= t" + " supported", __func__); goto err; =20 } @@ -3549,27 +3548,26 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t = start, size_t length) * file. */ if (!qemu_ram_is_shared(rb)) { - warn_report_once("ram_block_discard_range: Discarding RAM" + warn_report_once("%s: Discarding RAM" " in private file mappings is possibly" " dangerous, because it will modify the" " underlying file and will affect other" - " users of the file"); + " users of the file", __func__); } =20 ret =3D fallocate(rb->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEE= P_SIZE, start, length); if (ret) { ret =3D -errno; - error_report("ram_block_discard_range: Failed to fallocate= " - "%s:%" PRIx64 " +%zx (%d)", - rb->idstr, start, length, ret); + error_report("%s: Failed to fallocate %s:%" PRIx64 " +%zx = (%d)", + __func__, rb->idstr, start, length, ret); goto err; } #else ret =3D -ENOSYS; - error_report("ram_block_discard_range: fallocate not available= /file" + error_report("%s: fallocate not available/file" "%s:%" PRIx64 " +%zx (%d)", - rb->idstr, start, length, ret); + __func__, rb->idstr, start, length, ret); goto err; #endif } @@ -3587,25 +3585,23 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t = start, size_t length) } if (ret) { ret =3D -errno; - error_report("ram_block_discard_range: Failed to discard r= ange " + error_report("%s: Failed to discard range " "%s:%" PRIx64 " +%zx (%d)", - rb->idstr, start, length, ret); + __func__, rb->idstr, start, length, ret); goto err; } #else ret =3D -ENOSYS; - error_report("ram_block_discard_range: MADVISE not available" - "%s:%" PRIx64 " +%zx (%d)", - rb->idstr, start, length, ret); + error_report("%s: MADVISE not available %s:%" PRIx64 " +%zx (%= d)", + __func__, rb->idstr, start, length, ret); goto err; #endif } trace_ram_block_discard_range(rb->idstr, host_startaddr, length, need_madvise, need_fallocate, ret); } else { - error_report("ram_block_discard_range: Overrun block '%s' (%" PRIu= 64 - "/%zx/" RAM_ADDR_FMT")", - rb->idstr, start, length, rb->max_length); + error_report("%s: Overrun block '%s' (%" PRIu64 "/%zx/" RAM_ADDR_F= MT")", + __func__, rb->idstr, start, length, rb->max_length); } =20 err: --=20 2.34.1