summaryrefslogtreecommitdiff
path: root/rust/helpers/xarray.c
diff options
context:
space:
mode:
authorBoqun Feng <boqun.feng@gmail.com>2025-06-15 15:14:00 -0700
committerBoqun Feng <boqun.feng@gmail.com>2025-06-24 15:53:46 -0700
commit0aa2b78ce5a9eac8f3332192ea77755d63a831cd (patch)
treedf506edc55b3eb6c2f43564b58f301b23c6f43c1 /rust/helpers/xarray.c
parent0a41f5af19391ce55cae1f0d7a562e8694bf1fd5 (diff)
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
Diffstat (limited to 'rust/helpers/xarray.c')
0 files changed, 0 insertions, 0 deletions