Skip to contentSkip to conversation

Fix broken `srctree/` links and warn about them

PATCH Applied Miguel Ojeda 5 participants 8 messages Jul 30, 2025 – Sep 7, 2025

Subsystems (5)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

cover Fix broken `srctree/` links and warn about them

This fixes a handful of broken links and introduces a warning to prevent them from happening in the future.

Relatedly, we could also perhaps check the other side of the links, but perhaps there are cases we want to customize. Alternatively, we could also in the future introduce custom syntax for these that avoids repetition or a fancier preprocessing step.

Miguel Ojeda (3):
rust: block: fix srctree/ links
rust: drm: fix srctree/ links
rust: warn if srctree/ links do not exist

 rust/Makefile                    | 6 ++++++
 rust/kernel/block/mq/gen_disk.rs | 2 +-
 rust/kernel/drm/device.rs        | 2 +-
 rust/kernel/drm/driver.rs        | 2 +-
 rust/kernel/drm/file.rs          | 2 +-
 rust/kernel/drm/gem/mod.rs       | 2 +-
 rust/kernel/drm/ioctl.rs         | 2 +-
 7 files changed, 12 insertions(+), 6 deletions(-)

--
2.50.1

author maintainer
#1 lore raw

PATCH 1/3 rust: block: fix `srctree/` links

This srctree/ link pointed to a file with an underscore, but the header used a dash instead.

Thus fix it.

This cleans a future warning that will check our srctree/ links.

Fixes 3253aba3408a ("rust: block: introduce `kernel::block::mq` module")
---
 rust/kernel/block/mq/gen_disk.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/block/mq/gen_disk.rs +1 -1
index cd54cd64ea88..e1af0fa302a3 100644
@@ -3,7 +3,7 @@
 //! Generic disk abstraction.
 //!
 //! C header: [`include/linux/blkdev.h`](srctree/include/linux/blkdev.h)
-//! C header: [`include/linux/blk_mq.h`](srctree/include/linux/blk_mq.h)
+//! C header: [`include/linux/blk-mq.h`](srctree/include/linux/blk-mq.h)
 
 use crate::block::mq::{raw_writer::RawWriter, Operations, TagSet};
 use crate::{bindings, error::from_err_ptr, error::Result, sync::Arc};
Signature · 1 line
2.50.1
author maintainer
#2 lore raw

PATCH 2/3 rust: drm: fix `srctree/` links

In reply to Miguel Ojeda

These srctree/ links pointed inside linux/, but they are directly under drm/.

Thus fix them.

This cleans a future warning that will check our srctree/ links.

Fixes a98a73be9ee9 ("rust: drm: file: Add File abstraction")
Fixes c284d3e42338 ("rust: drm: gem: Add GEM object abstraction")
Fixes 07c9016085f9 ("rust: drm: add driver abstractions")
Fixes 1e4b8896c0f3 ("rust: drm: add device abstraction")
Fixes 9a69570682b1 ("rust: drm: ioctl: Add DRM ioctl abstraction")
---
 rust/kernel/drm/device.rs  | 2 +-
 rust/kernel/drm/driver.rs  | 2 +-
 rust/kernel/drm/file.rs    | 2 +-
 rust/kernel/drm/gem/mod.rs | 2 +-
 rust/kernel/drm/ioctl.rs   | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
rust/kernel/drm/device.rs +1 -1
index e598c4274f29..306aaa783bbc 100644
@@ -2,7 +2,7 @@
 
 //! DRM device.
 //!
-//! C header: [`include/linux/drm/drm_device.h`](srctree/include/linux/drm/drm_device.h)
+//! C header: [`include/drm/drm_device.h`](srctree/include/drm/drm_device.h)
 
 use crate::{
     bindings, device, drm,
rust/kernel/drm/driver.rs +1 -1
index acb638086131..6381cf57fb42 100644
@@ -2,7 +2,7 @@
 
 //! DRM driver core.
 //!
-//! C header: [`include/linux/drm/drm_drv.h`](srctree/include/linux/drm/drm_drv.h)
+//! C header: [`include/drm/drm_drv.h`](srctree/include/drm/drm_drv.h)
 
 use crate::{
     bindings, device,
rust/kernel/drm/file.rs +1 -1
index b9527705e551..f736cade7eb4 100644
@@ -2,7 +2,7 @@
 
 //! DRM File objects.
 //!
-//! C header: [`include/linux/drm/drm_file.h`](srctree/include/linux/drm/drm_file.h)
+//! C header: [`include/drm/drm_file.h`](srctree/include/drm/drm_file.h)
 
 use crate::{bindings, drm, error::Result, prelude::*, types::Opaque};
 use core::marker::PhantomData;
rust/kernel/drm/gem/mod.rs +1 -1
index 6f914ae0a5aa..95fb562cc968 100644
@@ -2,7 +2,7 @@
 
 //! DRM GEM API
 //!
-//! C header: [`include/linux/drm/drm_gem.h`](srctree/include/linux/drm/drm_gem.h)
+//! C header: [`include/drm/drm_gem.h`](srctree/include/drm/drm_gem.h)
 
 use crate::{
     alloc::flags::*,
rust/kernel/drm/ioctl.rs +1 -1
index 445639404fb7..a19bc8eca029 100644
@@ -2,7 +2,7 @@
 
 //! DRM IOCTL definitions.
 //!
-//! C header: [`include/linux/drm/drm_ioctl.h`](srctree/include/linux/drm/drm_ioctl.h)
+//! C header: [`include/drm/drm_ioctl.h`](srctree/include/drm/drm_ioctl.h)
 
 use crate::ioctl;
 
Signature · 1 line
2.50.1
maintainer Acked-by on v1 2/3
#3 lore raw

Re: [PATCH 2/3] rust: drm: fix `srctree/` links

Quoted 5 lines · Miguel Ojeda

These srctree/ links pointed inside linux/, but they are directly under drm/.

Thus fix them.

Quoted 8 lines

This cleans a future warning that will check our srctree/ links.

Fixes a98a73be9ee9 ("rust: drm: file: Add File abstraction")
Fixes c284d3e42338 ("rust: drm: gem: Add GEM object abstraction")
Fixes 07c9016085f9 ("rust: drm: add driver abstractions")
Fixes 1e4b8896c0f3 ("rust: drm: add device abstraction")
Fixes 9a69570682b1 ("rust: drm: ioctl: Add DRM ioctl abstraction")

Good catch!

author maintainer
#4 lore raw

PATCH 3/3 rust: warn if `srctree/` links do not exist

In reply to Miguel Ojeda

srctree/ links may point to nonexistent files, e.g. due to renames that missed to update the files or simply because of typos.

Since they can be easily checked for validity, do so and print a warning in the file does not exist.

This found the following cases already in-tree:

warning: srctree/ link to include/linux/blk_mq.h does not exist
warning: srctree/ link to include/linux/drm/drm_gem.h does not exist
warning: srctree/ link to include/linux/drm/drm_drv.h does not exist
warning: srctree/ link to include/linux/drm/drm_ioctl.h does not exist
warning: srctree/ link to include/linux/drm/drm_file.h does not exist
warning: srctree/ link to include/linux/drm/drm_device.h does not exist

---
 rust/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)
rust/Makefile +6 -0
index 4e675d210dd8..a27503028216 100644
@@ -93,6 +93,12 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
 # and then retouch the generated files.
 rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
     rustdoc-kernel rustdoc-pin_init
+	$(Q)grep -Ehro '<a href="srctree/([^"]+)"' $(rustdoc_output) | \
+		cut -d'"' -f2 | cut -d/ -f2- | while read f; do \
+			if [ ! -e "$(srctree)/$$f" ]; then \
+				echo "warning: srctree/ link to $$f does not exist"; \
+			fi \
+		done
 	$(Q)cp $(srctree)/Documentation/images/logo.svg $(rustdoc_output)/static.files/
 	$(Q)cp $(srctree)/Documentation/images/COPYING-logo $(rustdoc_output)/static.files/
 	$(Q)find $(rustdoc_output) -name '*.html' -type f -print0 | xargs -0 sed -Ei \
Signature · 1 line
2.50.1
reviewer Reviewed-by on v1 3/3
#5 lore raw

Re: [PATCH 3/3] rust: warn if `srctree/` links do not exist

Quoted 40 lines · On Wed, 30 Jul 2025 15:07:16 +0200 Miguel Ojeda <[email protected]> wrote:

srctree/ links may point to nonexistent files, e.g. due to renames that missed to update the files or simply because of typos.

Since they can be easily checked for validity, do so and print a warning in the file does not exist.

This found the following cases already in-tree:

warning: srctree/ link to include/linux/blk_mq.h does not exist
warning: srctree/ link to include/linux/drm/drm_gem.h does not
exist warning: srctree/ link to include/linux/drm/drm_drv.h does not exist warning: srctree/ link to include/linux/drm/drm_ioctl.h does not exist warning: srctree/ link to include/linux/drm/drm_file.h does not exist warning: srctree/ link to include/linux/drm/drm_device.h does not exist

Link:
https://lore.kernel.org/rust-for-linux/CANiq72=xCYA7z7_rxpzzKkkhJs6m7L_xEaLMuArVn3ZAcyeHdA@mail.gmail.com/

 rust/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)
rust/Makefile +0 -0
index 4e675d210dd8..a27503028216 100644
@@ -93,6 +93,12 @@ quiet_cmd_rustdoc = RUSTDOC $(if

$(rustdoc_host),H, ) $< # and then retouch the generated files.
rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
rustdoc-kernel rustdoc-pin_init

rust/Makefile +1 -0
+	$(Q)grep -Ehro '<a href="srctree/([^"]+)"' $(rustdoc_output)

| \

rust/Makefile +3 -0
+		cut -d'"' -f2 | cut -d/ -f2- | while read f; do \
+			if [ ! -e "$(srctree)/$$f" ]; then \
+				echo "warning: srctree/ link to $$f

does not exist"; \

rust/Makefile +2 -0
+			fi \
+		done
 	$(Q)cp $(srctree)/Documentation/images/logo.svg
Quoted 4 lines

$(rustdoc_output)/static.files/ $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(rustdoc_output)/static.files/ $(Q)find $(rustdoc_output) -name '*.html' -type f -print0 | xargs -0 sed -Ei \

That's awesome! This would help a lot. :)

--

Regards,
Onur

reviewer Reviewed-by on the v1 series
#6 lore raw
In reply to Miguel Ojeda

Hi Miguel, this is indeed nice!

Quoted 24 lines · Miguel Ojeda

This fixes a handful of broken links and introduces a warning to prevent them from happening in the future.

Relatedly, we could also perhaps check the other side of the links, but perhaps there are cases we want to customize. Alternatively, we could also in the future introduce custom syntax for these that avoids repetition or a fancier preprocessing step.

Miguel Ojeda (3):
rust: block: fix srctree/ links
rust: drm: fix srctree/ links
rust: warn if srctree/ links do not exist

rust/Makefile                    | 6 ++++++
rust/kernel/block/mq/gen_disk.rs | 2 +-
rust/kernel/drm/device.rs        | 2 +-
rust/kernel/drm/driver.rs        | 2 +-
rust/kernel/drm/file.rs          | 2 +-
rust/kernel/drm/gem/mod.rs       | 2 +-
rust/kernel/drm/ioctl.rs         | 2 +-
7 files changed, 12 insertions(+), 6 deletions(-)
Quoted 2 lines

—
2.50.1

Patch 3 alone indeed produces the following warnings:

warning: srctree/ link to include/linux/blk_mq.h does not exist
warning: srctree/ link to include/linux/drm/drm_device.h does not exist
warning: srctree/ link to include/linux/drm/drm_ioctl.h does not exist
warning: srctree/ link to include/linux/drm/drm_file.h does not exist
warning: srctree/ link to include/linux/drm/drm_drv.h does not exist
warning: srctree/ link to include/linux/drm/drm_gem.h does not exist

So you can add my Tested-by for that one.

Cheers,
— Daniel

Applied
#7 lore raw
In reply to Miguel Ojeda
Quoted 3 lines · Miguel Ojeda

This fixes a handful of broken links and introduces a warning to prevent them from happening in the future.

Applied to rust-next -- thanks everyone!

I added Cc: [email protected] on the fixes.

Andreas/Boqun: if you don't want the block fix, please shout!

Cheers,
Miguel