On Fri, Aug 22, 2025 at 3:28 PM Paolo Bonzini <pbonz...@redhat.com> wrote:
>
> Putting "unsigned" in anything but the first position is weird.  As such,
> tracetool's Rust type conversion will not support it.  Remove it from
> the whole of QEMU's source code, not just trace-events.
>

Hm weird C quirk indeed.

Why can't tracetool support this? Can't we just add the permutations
in the C_TO_RUST_TYPE_MAP dict in "[PATCH 06/14] tracetool: Add Rust
format support"?

+    "unsigned long long": "std::ffi::c_ulonglong",
+    "long unsigned long": "std::ffi::c_ulonglong",
+    "long long unsigned": "std::ffi::c_ulonglong",



> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
> ---
>  crypto/pbkdf-gcrypt.c        | 2 +-
>  crypto/pbkdf-gnutls.c        | 2 +-
>  crypto/pbkdf-nettle.c        | 2 +-
>  hw/display/exynos4210_fimd.c | 2 +-
>  hw/misc/imx7_src.c           | 4 ++--
>  hw/net/can/can_sja1000.c     | 4 ++--
>  hw/xen/trace-events          | 4 ++--
>  7 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/crypto/pbkdf-gcrypt.c b/crypto/pbkdf-gcrypt.c
> index e89b8b1c768..f93996f674c 100644
> --- a/crypto/pbkdf-gcrypt.c
> +++ b/crypto/pbkdf-gcrypt.c
> @@ -66,7 +66,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgo hash,
>      if (iterations > ULONG_MAX) {
>          error_setg_errno(errp, ERANGE,
>                           "PBKDF iterations %llu must be less than %lu",
> -                         (long long unsigned)iterations, ULONG_MAX);
> +                         (unsigned long long)iterations, ULONG_MAX);
>          return -1;
>      }
>
> diff --git a/crypto/pbkdf-gnutls.c b/crypto/pbkdf-gnutls.c
> index f34423f918b..46a3a869994 100644
> --- a/crypto/pbkdf-gnutls.c
> +++ b/crypto/pbkdf-gnutls.c
> @@ -62,7 +62,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgo hash,
>      if (iterations > ULONG_MAX) {
>          error_setg_errno(errp, ERANGE,
>                           "PBKDF iterations %llu must be less than %lu",
> -                         (long long unsigned)iterations, ULONG_MAX);
> +                         (unsigned long long)iterations, ULONG_MAX);
>          return -1;
>      }
>
> diff --git a/crypto/pbkdf-nettle.c b/crypto/pbkdf-nettle.c
> index 3ef9c1b52c4..3c8bbaf9f17 100644
> --- a/crypto/pbkdf-nettle.c
> +++ b/crypto/pbkdf-nettle.c
> @@ -66,7 +66,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgo hash,
>      if (iterations > UINT_MAX) {
>          error_setg_errno(errp, ERANGE,
>                           "PBKDF iterations %llu must be less than %u",
> -                         (long long unsigned)iterations, UINT_MAX);
> +                         (unsigned long long)iterations, ULONG_MAX);
>          return -1;
>      }
>
> diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c
> index c61e0280a7c..5632aa1388c 100644
> --- a/hw/display/exynos4210_fimd.c
> +++ b/hw/display/exynos4210_fimd.c
> @@ -1380,7 +1380,7 @@ static void exynos4210_fimd_write(void *opaque, hwaddr 
> offset,
>      uint32_t old_value;
>
>      DPRINT_L2("write offset 0x%08x, value=%llu(0x%08llx)\n", offset,
> -            (long long unsigned int)val, (long long unsigned int)val);
> +            (unsigned long long)val, (unsigned long long)val);
>
>      switch (offset) {
>      case FIMD_VIDCON0:
> diff --git a/hw/misc/imx7_src.c b/hw/misc/imx7_src.c
> index df0b0a69057..817c95bf65b 100644
> --- a/hw/misc/imx7_src.c
> +++ b/hw/misc/imx7_src.c
> @@ -169,7 +169,7 @@ static void imx7_src_write(void *opaque, hwaddr offset, 
> uint64_t value,
>  {
>      IMX7SRCState *s = (IMX7SRCState *)opaque;
>      uint32_t index = offset >> 2;
> -    long unsigned int change_mask;
> +    uint32_t change_mask;
>      uint32_t current_value = value;
>
>      if (index >= SRC_MAX) {
> @@ -180,7 +180,7 @@ static void imx7_src_write(void *opaque, hwaddr offset, 
> uint64_t value,
>
>      trace_imx7_src_write(imx7_src_reg_name(SRC_A7RCR0), s->regs[SRC_A7RCR0]);
>
> -    change_mask = s->regs[index] ^ (uint32_t)current_value;
> +    change_mask = s->regs[index] ^ current_value;
>
>      switch (index) {
>      case SRC_A7RCR0:
> diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
> index 5b6ba9df6c4..545c520c3b4 100644
> --- a/hw/net/can/can_sja1000.c
> +++ b/hw/net/can/can_sja1000.c
> @@ -750,8 +750,8 @@ uint64_t can_sja_mem_read(CanSJA1000State *s, hwaddr 
> addr, unsigned size)
>              break;
>          }
>      }
> -    DPRINTF("read addr 0x%02x, %d bytes, content 0x%02lx\n",
> -            (int)addr, size, (long unsigned int)temp);
> +    DPRINTF("read addr 0x%02x, %d bytes, content 0x%02x\n",
> +            (int)addr, size, (unsigned)temp);
>
>      return temp;
>  }
> diff --git a/hw/xen/trace-events b/hw/xen/trace-events
> index b67942d07b4..3b71ee641ff 100644
> --- a/hw/xen/trace-events
> +++ b/hw/xen/trace-events
> @@ -57,8 +57,8 @@ cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t 
> reg, uint32_t size, uin
>  cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t 
> size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x"
>  cpu_get_ioreq_from_shared_memory_req_not_ready(int state, int data_is_ptr, 
> uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O request not 
> ready: 0x%x, ptr: 0x%x, port: 0x%"PRIx64", data: 0x%"PRIx64", count: %u, 
> size: %u"
>  xen_main_loop_prepare_init_cpu(int id, void *cpu) "cpu_by_vcpu_id[%d]=%p"
> -xen_map_ioreq_server_shared_page(long unsigned int ioreq_pfn) "shared page 
> at pfn 0x%lx"
> -xen_map_ioreq_server_buffered_io_page(long unsigned int ioreq_pfn) "buffered 
> io page at pfn 0x%lx"
> +xen_map_ioreq_server_shared_page(unsigned long int ioreq_pfn) "shared page 
> at pfn 0x%lx"
> +xen_map_ioreq_server_buffered_io_page(unsigned long int ioreq_pfn) "buffered 
> io page at pfn 0x%lx"
>  xen_map_ioreq_server_buffered_io_evtchn(int bufioreq_evtchn) "buffered io 
> evtchn is 0x%x"
>  destroy_hvm_domain_cannot_acquire_handle(void) "Cannot acquire xenctrl 
> handle"
>  destroy_hvm_domain_failed_action(const char *action, int sts, char *errno_s) 
> "xc_domain_shutdown failed to issue %s, sts %d, %s"
> --
> 2.50.1
>
>

-- 
Manos Pitsidianakis
Emulation and Virtualization Engineer at Linaro Ltd

Reply via email to