qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Xiaoyao Li" <xiaoyao.li@intel.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 05/17] physmem: replace function name with __func__ in ram_block_discard_range()
Date: Tue, 20 Feb 2024 09:05:46 +0100	[thread overview]
Message-ID: <20240220080558.365903-6-pbonzini@redhat.com> (raw)
In-Reply-To: <20240220080558.365903-1-pbonzini@redhat.com>

From: Xiaoyao Li <xiaoyao.li@intel.com>

Use __func__ to avoid hard-coded function name.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240125023328.2520888-1-xiaoyao.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 system/physmem.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/system/physmem.c b/system/physmem.c
index 5e66d9ae361..5e054650b88 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -3495,16 +3495,15 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length)
     uint8_t *host_startaddr = rb->host + start;
 
     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;
     }
 
     if ((start + length) <= 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;
         }
 
@@ -3528,8 +3527,8 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, 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 not"
+                             " supported", __func__);
                 goto err;
 
             }
@@ -3544,27 +3543,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__);
             }
 
             ret = fallocate(rb->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                             start, length);
             if (ret) {
                 ret = -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 = -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
         }
@@ -3582,25 +3580,23 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length)
             }
             if (ret) {
                 ret = -errno;
-                error_report("ram_block_discard_range: Failed to discard range "
+                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 = -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' (%" PRIu64
-                     "/%zx/" RAM_ADDR_FMT")",
-                     rb->idstr, start, length, rb->max_length);
+        error_report("%s: Overrun block '%s' (%" PRIu64 "/%zx/" RAM_ADDR_FMT")",
+                     __func__, rb->idstr, start, length, rb->max_length);
     }
 
 err:
-- 
2.43.0



  parent reply	other threads:[~2024-02-20  8:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20  8:05 [PULL 00/17] Build, x86 patches for 2024-02-16 Paolo Bonzini
2024-02-20  8:05 ` [PULL 01/17] i386/cpu: Clear FEAT_XSAVE_XSS_LO/HI leafs when CPUID_EXT_XSAVE is not available Paolo Bonzini
2024-02-20  8:05 ` [PULL 02/17] i386/cpu: Mask with XCR0/XSS mask for FEAT_XSAVE_XCR0_HI and FEAT_XSAVE_XSS_HI leafs Paolo Bonzini
2024-02-20  8:05 ` [PULL 03/17] target/i386: Add support of KVM_FEATURE_ASYNC_PF_VMEXIT for guest Paolo Bonzini
2024-02-20  8:05 ` [PULL 04/17] i386/pc: Drop pc_machine_kvm_type() Paolo Bonzini
2024-02-20  8:05 ` Paolo Bonzini [this message]
2024-02-20  8:05 ` [PULL 06/17] i386/cpuid: Decrease cpuid_i when skipping CPUID leaf 1F Paolo Bonzini
2024-02-20  8:05 ` [PULL 07/17] i386/cpuid: Remove subleaf constraint on " Paolo Bonzini
2024-02-20  8:05 ` [PULL 08/17] i386/cpuid: Move leaf 7 to correct group Paolo Bonzini
2024-02-20  8:05 ` [PULL 09/17] mips: remove unnecessary "select PTIMER" Paolo Bonzini
2024-02-20  8:05 ` [PULL 10/17] isa-superio: validate floppy.count value Paolo Bonzini
2024-02-20  8:05 ` [PULL 11/17] smc37c669: remove useless is_enabled functions Paolo Bonzini
2024-02-20  8:05 ` [PULL 12/17] configure: do not create legacy symlinks Paolo Bonzini
2024-02-20  8:05 ` [PULL 13/17] configure: put all symlink creation together Paolo Bonzini
2024-02-20  8:05 ` [PULL 14/17] i386: xen: fix compilation --without-default-devices Paolo Bonzini
2024-02-20  8:05 ` [PULL 15/17] target/i386: Generate an illegal opcode exception on cmp instructions with lock prefix Paolo Bonzini
2024-02-20  8:05 ` [PULL 16/17] usb: inline device creation functions Paolo Bonzini
2024-02-20  8:05 ` [PULL 17/17] ci: Fix again build-previous-qemu Paolo Bonzini
2024-02-20 15:26 ` [PULL 00/17] Build, x86 patches for 2024-02-16 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=20240220080558.365903-6-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=david@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=xiaoyao.li@intel.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).