qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/4] bulk: Replace TARGET_FMT_plx -> HWADDR_PRIx


From: Richard Henderson
Subject: Re: [PATCH v2 3/4] bulk: Replace TARGET_FMT_plx -> HWADDR_PRIx
Date: Wed, 11 Jan 2023 09:50:25 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 1/11/23 00:39, Philippe Mathieu-Daudé wrote:
The 'hwaddr' type is defined in "exec/hwaddr.h" as:

     hwaddr is the type of a physical address
    (its size can be different from 'target_ulong').

All definitions use the 'HWADDR_' prefix, except TARGET_FMT_plx:

  $ fgrep define include/exec/hwaddr.h
  #define HWADDR_H
  #define HWADDR_BITS 64
  #define HWADDR_MAX UINT64_MAX
  #define TARGET_FMT_plx "%016" PRIx64
          ^^^^^^
  #define HWADDR_PRId PRId64
  #define HWADDR_PRIi PRIi64
  #define HWADDR_PRIo PRIo64
  #define HWADDR_PRIu PRIu64
  #define HWADDR_PRIx PRIx64
  #define HWADDR_PRIX PRIX64

Since hwaddr's size can be*different*  from target_ulong, it is
very confusing to read one of its format using the 'TARGET_FMT_'
prefix, normally used for the target_long / target_ulong types:

$ fgrep TARGET_FMT_ include/exec/cpu-defs.h
  #define TARGET_FMT_lx "%08x"
  #define TARGET_FMT_ld "%d"
  #define TARGET_FMT_lu "%u"
  #define TARGET_FMT_lx "%016" PRIx64
  #define TARGET_FMT_ld "%" PRId64
  #define TARGET_FMT_lu "%" PRIu64

Apparently this format was missed during commit a8170e5e97
("Rename target_phys_addr_t to hwaddr"), so complete it by
doing a bulk-replacement to '"%016" HWADDR_PRIx' using:

  $ sed -i -E \
        -e 's/" ?TARGET_FMT_plx ?"/%016" HWADDR_PRIx "/g' \
        -e 's/" ?TARGET_FMT_plx/%016" HWADDR_PRIx/g' \
        -e 's/TARGET_FMT_plx ?"/"%016" HWADDR_PRIx "/g' \
        $(git grep -l TARGET_FMT_plx)

and removing the definition from "exec/hwaddr.h".

Suggested-by: BALATON Zoltan<balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
---

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]