2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/init
Boqun Feng 0aa2b78ce5 rust: Introduce file_from_location()
Most of kernel debugging facilities take a nul-terminated string for
file names for a callsite (generated from __FILE__), however the Rust
courterpart, Location, would return a Rust string (not nul-terminated)
from method .file(). And such a string cannot be passed to C debugging
function directly.

There is ongoing work to support a Location::file_with_nul() [1], which
returns a nul-terminated string from a Location. Since it's still
working in progress, and it will take some time before the feature
finally gets stabilized and the kernel's minimal rustc version might
also take a while to bump to a version that at least has that feature,
introduce a file_from_location() function, which returns a warning
string if Location::file_with_nul() is not available.

This should work in most cases because as for now the known usage of
Location::file_with_nul() is only in debugging code (e.g. might_sleep())
and there might be other information reported by the debugging code that
could help locate the problematic function, so missing the file name is
fine at the moment.

Link: https://github.com/rust-lang/rust/issues/141727 [1]
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20250619151007.61767-2-boqun.feng@gmail.com
2025-06-24 15:53:46 -07:00
..
.gitignore kbuild: build init/built-in.a just once 2022-09-29 04:40:15 +09:00
.kunitconfig initramfs_test: kunit tests for initramfs unpacking 2025-03-08 12:13:04 +01:00
calibrate.c
do_mounts_initrd.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
do_mounts_rd.c init: add an init_unlink helper 2020-07-31 08:17:52 +02:00
do_mounts.c init: replace deprecated strncpy with strscpy_pad 2024-04-30 10:34:29 -07:00
do_mounts.h init: flush async file closing 2024-02-08 18:41:03 +01:00
init_task.c signal: Provide ignored_posix_timers list 2024-11-07 02:14:45 +01:00
initramfs_internal.h init: add initramfs_internal.h 2025-03-04 09:52:36 +01:00
initramfs_test.c initramfs_test: kunit tests for initramfs unpacking 2025-03-08 12:13:04 +01:00
initramfs.c initramfs: avoid static buffer for error message 2025-03-08 12:13:26 +01:00
Kconfig rust: Introduce file_from_location() 2025-06-24 15:53:46 -07:00
main.c - The 3 patch series "hung_task: extend blocking task stacktrace dump to 2025-05-31 19:12:53 -07:00
Makefile initramfs_test: kunit tests for initramfs unpacking 2025-03-08 12:13:04 +01:00
noinitramfs.c init: move usermodehelper_enable() to populate_rootfs() 2021-09-08 11:50:27 -07:00
version-timestamp.c init/version-timestamp.c: remove unneeded #include <linux/version.h> 2023-01-09 07:34:38 +09:00
version.c init/version.c: Replace strlcpy with strscpy 2023-09-22 09:50:56 -07:00