From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org
Cc: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-rust@nongnu.org, Bernhard Beschow <shentey@gmail.com>
Subject: [PATCH v3 0/4] Initial logging support for Rust
Date: Sun, 15 Jun 2025 13:20:33 +0200 [thread overview]
Message-ID: <20250615112037.11992-1-shentey@gmail.com> (raw)
This series introduces a log_mask_ln! macro which is inspired by the C version
and is just a thin wrapper around qemu_log(). It caters to Rust expectations by
accepting an enum for logging categories and working like the format! macro. The
macro then gets used in the pl011 device which either had its logging commented
out or relied on eprintln!() which can't be silenced by users.
Testing done:
* Run `make clippy`
* Purposefully trigger warnings with varying number of arguments
v3:
* Add macro to prelude (Manos)
* Have log_mask_ln! rather than log_mask! macro (Manos, Paolo)
* rustdoc improvements (Paolo)
* Fix logged function names (Manos)
* Add missing logging to pl011 to match C version (Paolo)
* Add patch to make clippy happier (which still complains about "PrimeCell" in
rustdoc comment)
v2:
* Drop the qemu_ prefix from the macro name (Paolo)
* Use an enum for the logging categories in PascalCase as suggested by Paolo
Bernhard Beschow (4):
rust/qemu-api: Add initial logging support based on C API
rust/hw/char/pl011/src/device: Implement logging
rust/hw/char/pl011/src/device: Add missing logging to match C version
rust/qemu-api: Fix clippy lint `missing_const_for_fn`
docs/devel/rust.rst | 1 +
rust/wrapper.h | 2 +
rust/hw/char/pl011/src/device.rs | 18 ++++++--
rust/qemu-api/meson.build | 1 +
rust/qemu-api/src/cell.rs | 2 +-
rust/qemu-api/src/lib.rs | 1 +
rust/qemu-api/src/log.rs | 78 ++++++++++++++++++++++++++++++++
rust/qemu-api/src/prelude.rs | 2 +
rust/qemu-api/src/qom.rs | 2 +-
9 files changed, 101 insertions(+), 6 deletions(-)
create mode 100644 rust/qemu-api/src/log.rs
--
2.49.0
next reply other threads:[~2025-06-15 11:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-15 11:20 Bernhard Beschow [this message]
2025-06-15 11:20 ` [PATCH v3 1/4] rust/qemu-api: Add initial logging support based on C API Bernhard Beschow
2025-06-15 11:20 ` [PATCH v3 2/4] rust/hw/char/pl011/src/device: Implement logging Bernhard Beschow
2025-06-15 11:20 ` [PATCH v3 3/4] rust/hw/char/pl011/src/device: Add missing logging to match C version Bernhard Beschow
2025-06-15 11:20 ` [PATCH v3 4/4] rust/qemu-api: Fix clippy lint `missing_const_for_fn` Bernhard Beschow
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=20250615112037.11992-1-shentey@gmail.com \
--to=shentey@gmail.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
/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).