Re: [PATCH v4 03/13] rust: implement `IdArray`, `IdTable` and `RawDeviceId`

From: Fabien Parent
Date: Fri Dec 06 2024 - 20:14:24 EST


Hi Danilo,

> +/// Create device table alias for modpost.
> +#[macro_export]
> +macro_rules! module_device_table {
> + ($table_type: literal, $module_table_name:ident, $table_name:ident) => {
> + #[rustfmt::skip]
> + #[export_name =
> + concat!("__mod_", $table_type,
> + "__", module_path!(),
> + "_", line!(),
> + "_", stringify!($table_name),
> + "_device_table")

This doesn't work on top of v6.13-rc1. The alias symbol name has been
renamed by commit 054a9cd395a7 (modpost: rename alias
symbol for MODULE_DEVICE_TABLE())

I applied the following change to make it work again:
- concat!("__mod_", $table_type,
+ concat!("__mod_device_table__", $table_type,
"__", module_path!(),
"_", line!(),
- "_", stringify!($table_name),
- "_device_table")
+ "_", stringify!($table_name))


> + ]
> + static $module_table_name: [core::mem::MaybeUninit<u8>; $table_name.raw_ids().size()] =
> + unsafe { core::mem::transmute_copy($table_name.raw_ids()) };
> + };
> +}