<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/rust/kernel/print.rs, branch update-toolchain</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/rust/kernel/print.rs?h=update-toolchain</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/rust/kernel/print.rs?h=update-toolchain'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2024-05-05T17:22:25Z</updated>
<entry>
<title>rust: kernel: remove redundant imports</title>
<updated>2024-05-05T17:22:25Z</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2024-04-01T21:23:02Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=00280272a0e5d98055e4d47db38a9b4b5517520e'/>
<id>urn:sha1:00280272a0e5d98055e4d47db38a9b4b5517520e</id>
<content type='text'>
Rust's `unused_imports` lint covers both unused and redundant imports.
In the upcoming 1.78.0, the lint detects more cases of redundant imports
[1], e.g.:

    error: the item `bindings` is imported redundantly
      --&gt; rust/kernel/print.rs:38:9
       |
    38 |     use crate::bindings;
       |         ^^^^^^^^^^^^^^^ the item `bindings` is already defined by prelude

Most cases are `use crate::bindings`, plus a few other items like `Box`.
Thus clean them up.

Note that, in the `bindings` case, the message "defined by prelude"
above means the extern prelude, i.e. the `--extern` flags we pass.

Link: https://github.com/rust-lang/rust/pull/117772 [1]
Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Link: https://lore.kernel.org/r/20240401212303.537355-3-ojeda@kernel.org
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: support `srctree`-relative links</title>
<updated>2023-12-21T19:54:17Z</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2023-12-15T23:54:28Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=bc2e7d5c298a86f2aa759cabe46f66f862fca3b3'/>
<id>urn:sha1:bc2e7d5c298a86f2aa759cabe46f66f862fca3b3</id>
<content type='text'>
Some of our links use relative paths in order to point to files in the
source tree, e.g.:

    //! C header: [`include/linux/printk.h`](../../../../include/linux/printk.h)
    /// [`struct mutex`]: ../../../../include/linux/mutex.h

These are problematic because they are hard to maintain and do not support
`O=` builds.

Instead, provide support for `srctree`-relative links, e.g.:

    //! C header: [`include/linux/printk.h`](srctree/include/linux/printk.h)
    /// [`struct mutex`]: srctree/include/linux/mutex.h

The links are fixed after `rustdoc` generation to be based on the absolute
path to the source tree.

Essentially, this is the automatic version of Tomonori's fix [1],
suggested by Gary [2].

Suggested-by: Gary Guo &lt;gary@garyguo.net&gt;
Reported-by: FUJITA Tomonori &lt;fujita.tomonori@gmail.com&gt;
Closes: https://lore.kernel.org/r/20231026.204058.2167744626131849993.fujita.tomonori@gmail.com [1]
Fixes: 48fadf440075 ("docs: Move rustdoc output, cross-reference it")
Link: https://lore.kernel.org/rust-for-linux/20231026154525.6d14b495@eugeo/ [2]
Reviewed-by: Martin Rodriguez Reboredo &lt;yakoyoku@gmail.com&gt;
Reviewed-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
Link: https://lore.kernel.org/r/20231215235428.243211-1-ojeda@kernel.org
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: print: use explicit link in documentation</title>
<updated>2023-10-15T19:25:08Z</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2023-10-05T21:05:54Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=a53d8cdd5a0aec75ae32badc2d8995c59ea6e3f0'/>
<id>urn:sha1:a53d8cdd5a0aec75ae32badc2d8995c59ea6e3f0</id>
<content type='text'>
The future `rustdoc` in the Rust 1.73.0 upgrade requires an explicit
link for `pr_info!`:

    error: unresolved link to `pr_info`
       --&gt; rust/kernel/print.rs:395:63
        |
    395 | /// Use only when continuing a previous `pr_*!` macro (e.g. [`pr_info!`]).
        |                                                               ^^^^^^^^ no item named `pr_info` in scope
        |
        = note: `macro_rules` named `pr_info` exists in this crate, but it is not in scope at this link's location
        = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`

Thus do so to avoid a broken link while upgrading.

Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Reviewed-by: Vincenzo Palazzo &lt;vincenzopalazzodev@gmail.com&gt;
Reviewed-by: Finn Behrens &lt;me@kloenk.dev&gt;
Reviewed-by: Martin Rodriguez Reboredo &lt;yakoyoku@gmail.com&gt;
Link: https://lore.kernel.org/r/20231005210556.466856-3-ojeda@kernel.org
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: kernel: Mark rust_fmt_argument as extern "C"</title>
<updated>2023-04-06T21:11:04Z</updated>
<author>
<name>David Gow</name>
<email>davidgow@google.com</email>
</author>
<published>2023-02-14T22:47:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=c682e4c37d2b8ba3bde1125cbbea4ee88824b4e2'/>
<id>urn:sha1:c682e4c37d2b8ba3bde1125cbbea4ee88824b4e2</id>
<content type='text'>
The rust_fmt_argument function is called from printk() to handle the %pA
format specifier.

Since it's called from C, we should mark it extern "C" to make sure it's
ABI compatible.

Cc: stable@vger.kernel.org
Fixes: 247b365dc8dc ("rust: add `kernel` crate")
Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Reviewed-by: Vincenzo Palazzo &lt;vincenzopalazzodev@gmail.com&gt;
[Applied `rustfmt`]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: print: avoid evaluating arguments in `pr_*` macros in `unsafe` blocks</title>
<updated>2023-01-15T23:54:35Z</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2022-12-13T18:03:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=6618d69aa129a8fc613e64775d5019524c6f231b'/>
<id>urn:sha1:6618d69aa129a8fc613e64775d5019524c6f231b</id>
<content type='text'>
At the moment it is possible to perform unsafe operations in
the arguments of `pr_*` macros since they are evaluated inside
an `unsafe` block:

    let x = &amp;10u32 as *const u32;
    pr_info!("{}", *x);

In other words, this is a soundness issue.

Fix it so that it requires an explicit `unsafe` block.

Reported-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Reported-by: Domen Puncer Kugler &lt;domen.puncerkugler@nccgroup.com&gt;
Link: https://github.com/Rust-for-Linux/linux/issues/479
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Reviewed-by: Vincenzo Palazzo &lt;vincenzopalazzodev@gmail.com&gt;
</content>
</entry>
<entry>
<title>rust: print: add `pr_cont!` macro</title>
<updated>2022-12-01T19:12:44Z</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2022-11-10T16:41:15Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=fc6c7cac83f05f455be1f35160a618e9df103838'/>
<id>urn:sha1:fc6c7cac83f05f455be1f35160a618e9df103838</id>
<content type='text'>
This level is a bit different from the rest since it does not
pass the module name to the `_printk()` call.

Thus add a new parameter to the general `print_macro!` to
handle it differently.

Co-developed-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Signed-off-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Co-developed-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Reviewed-by: Sergio González Collado &lt;sergio.collado@gmail.com&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: print: add more `pr_*!` levels</title>
<updated>2022-12-01T19:12:14Z</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2022-11-10T16:41:14Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=4c7f949906ae2ceb31d71fb235975f1bfa1adb21'/>
<id>urn:sha1:4c7f949906ae2ceb31d71fb235975f1bfa1adb21</id>
<content type='text'>
Currently, only `pr_info!` (for the minimal sample) and
`pr_emerg!` (for the panic handler) are there.

Add the other levels as new macros, i.e. `pr_alert!`, `pr_crit!`,
`pr_err!`, `pr_warn!`, `pr_notice!` and `pr_debug!`.

Co-developed-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Signed-off-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Co-developed-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Reviewed-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Reviewed-by: Sergio Gonzalez Collado &lt;sergio.collado@gmail.com&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: add `kernel` crate</title>
<updated>2022-09-28T06:58:24Z</updated>
<author>
<name>Wedson Almeida Filho</name>
<email>wedsonaf@google.com</email>
</author>
<published>2022-02-11T19:25:34Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=247b365dc8dc442412c88fe02346cd2bddac7bd6'/>
<id>urn:sha1:247b365dc8dc442412c88fe02346cd2bddac7bd6</id>
<content type='text'>
The `kernel` crate currently includes all the abstractions that wrap
kernel features written in C.

These abstractions call the C side of the kernel via the generated
bindings with the `bindgen` tool. Modules developed in Rust should
never call the bindings themselves.

In the future, as the abstractions grow in number, we may need
to split this crate into several, possibly following a similar
subdivision in subsystems as the kernel itself and/or moving
the code to the actual subsystems.

Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Co-developed-by: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Signed-off-by: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Co-developed-by: Geoffrey Thomas &lt;geofft@ldpreload.com&gt;
Signed-off-by: Geoffrey Thomas &lt;geofft@ldpreload.com&gt;
Co-developed-by: Finn Behrens &lt;me@kloenk.de&gt;
Signed-off-by: Finn Behrens &lt;me@kloenk.de&gt;
Co-developed-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Signed-off-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Co-developed-by: Sven Van Asbroeck &lt;thesven73@gmail.com&gt;
Signed-off-by: Sven Van Asbroeck &lt;thesven73@gmail.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Co-developed-by: Boris-Chengbiao Zhou &lt;bobo1239@web.de&gt;
Signed-off-by: Boris-Chengbiao Zhou &lt;bobo1239@web.de&gt;
Co-developed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Co-developed-by: Fox Chen &lt;foxhlchen@gmail.com&gt;
Signed-off-by: Fox Chen &lt;foxhlchen@gmail.com&gt;
Co-developed-by: Viktor Garske &lt;viktor@v-gar.de&gt;
Signed-off-by: Viktor Garske &lt;viktor@v-gar.de&gt;
Co-developed-by: Dariusz Sosnowski &lt;dsosnowski@dsosnowski.pl&gt;
Signed-off-by: Dariusz Sosnowski &lt;dsosnowski@dsosnowski.pl&gt;
Co-developed-by: Léo Lanteri Thauvin &lt;leseulartichaut@gmail.com&gt;
Signed-off-by: Léo Lanteri Thauvin &lt;leseulartichaut@gmail.com&gt;
Co-developed-by: Niklas Mohrin &lt;dev@niklasmohrin.de&gt;
Signed-off-by: Niklas Mohrin &lt;dev@niklasmohrin.de&gt;
Co-developed-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Signed-off-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Co-developed-by: Morgan Bartlett &lt;mjmouse9999@gmail.com&gt;
Signed-off-by: Morgan Bartlett &lt;mjmouse9999@gmail.com&gt;
Co-developed-by: Maciej Falkowski &lt;m.falkowski@samsung.com&gt;
Signed-off-by: Maciej Falkowski &lt;m.falkowski@samsung.com&gt;
Co-developed-by: Nándor István Krácser &lt;bonifaido@gmail.com&gt;
Signed-off-by: Nándor István Krácser &lt;bonifaido@gmail.com&gt;
Co-developed-by: David Gow &lt;davidgow@google.com&gt;
Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Co-developed-by: John Baublitz &lt;john.m.baublitz@gmail.com&gt;
Signed-off-by: John Baublitz &lt;john.m.baublitz@gmail.com&gt;
Co-developed-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Signed-off-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@google.com&gt;
Co-developed-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
</feed>
