Skip to content

rust: configfs: add procedural macro for declaring configfs attributes#978

Open
blktests-ci[bot] wants to merge 1 commit into
for-next_basefrom
series/1113837=>for-next
Open

rust: configfs: add procedural macro for declaring configfs attributes#978
blktests-ci[bot] wants to merge 1 commit into
for-next_basefrom
series/1113837=>for-next

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jun 19, 2026

Copy link
Copy Markdown

Pull request for series with
subject: rust: configfs: add procedural macro for declaring configfs attributes
version: 4
url: https://patchwork.kernel.org/project/linux-block/list/?series=1113837

@blktests-ci

blktests-ci Bot commented Jun 19, 2026

Copy link
Copy Markdown
Author

Upstream branch: 5c7804e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1113837
version: 4

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/linux-block/list/?series=1113837
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am --3way
  stdout: 'Applying: rust: configfs: add procedural macro for declaring configfs attributes
Using index info to reconstruct a base tree...
M	MAINTAINERS
M	rust/macros/lib.rs
Falling back to patching base and 3-way merge...
Auto-merging rust/macros/lib.rs
CONFLICT (content): Merge conflict in rust/macros/lib.rs
Auto-merging MAINTAINERS
Patch failed at 0001 rust: configfs: add procedural macro for declaring configfs attributes
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".'
  stderr: 'error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch'

conflict:

diff --cc rust/macros/lib.rs
index 4a48fabbc268,ebb41e80ecc7..000000000000
--- a/rust/macros/lib.rs
+++ b/rust/macros/lib.rs
@@@ -15,9 -15,10 +15,11 @@@
  #![cfg_attr(not(CONFIG_RUSTC_HAS_SPAN_FILE), feature(proc_macro_span))]
  
  mod concat_idents;
+ #[cfg(CONFIG_CONFIGFS_FS)]
+ mod configfs_attrs;
  mod export;
  mod fmt;
 +mod for_lt;
  mod helpers;
  mod kunit;
  mod module;
@@@ -491,14 -492,87 +493,100 @@@ pub fn kunit_tests(attr: TokenStream, i
          .into()
  }
  
++<<<<<<< HEAD
 +/// Obtain a type that implements [`ForLt`] for the given higher-ranked type.
 +///
 +/// Please refer to the documentation of the [`ForLt`] trait.
 +///
 +/// [`ForLt`]: trait.ForLt.html
 +#[proc_macro]
 +// The macro shares the name with the trait.
 +#[allow(non_snake_case)]
 +pub fn ForLt(input: TokenStream) -> TokenStream {
 +    for_lt::for_lt(parse_macro_input!(input)).into()
++=======
+ /// Define a list of configfs attributes statically.
+ ///
+ /// # Examples
+ ///
+ /// ```ignore
+ /// let item_type = configfs_attrs! {
+ ///     container: configfs::Subsystem<Configuration>,
+ ///     data: Configuration,
+ ///     child: Child,
+ ///     attributes: [
+ ///         message: 0,
+ ///         bar: 1,
+ ///     ],
+ /// };
+ /// ```
+ ///
+ /// Expands the following output:
+ ///
+ /// ```ignore
+ /// let item_type = {
+ ///         static DATA_ATTR_LIST: kernel::configfs::AttributeList<
+ ///             3usize,
+ ///             Configuration,
+ ///         > = unsafe { kernel::configfs::AttributeList::new() };
+ ///         static MESSAGE_ATTR_0: kernel::configfs::Attribute<
+ ///             0u64,
+ ///             Configuration,
+ ///             Configuration,
+ ///         > = unsafe {
+ ///             kernel::configfs::Attribute::new({
+ ///                 const S: &str = "message\u{0}";
+ ///                 const C: &kernel::str::CStr = match kernel::str::CStr::from_bytes_with_nul(
+ ///                     S.as_bytes(),
+ ///                 ) {
+ ///                     Ok(v) => v,
+ ///                     Err(_) => {
+ ///                         ::core::panicking::panic_fmt(
+ ///                             format_args!("string contains interior NUL"),
+ ///                         );
+ ///                     }
+ ///                 };
+ ///                 C
+ ///             })
+ ///         };
+ ///         unsafe { DATA_ATTR_LIST.add::<0usize, 0u64, _>(&MESSAGE_ATTR_0) }
+ ///         static BAR_ATTR_1: kernel::configfs::Attribute<
+ ///             1u64,
+ ///             Configuration,
+ ///             Configuration,
+ ///         > = unsafe {
+ ///             kernel::configfs::Attribute::new({
+ ///                 const S: &str = "bar\u{0}";
+ ///                 const C: &kernel::str::CStr = match kernel::str::CStr::from_bytes_with_nul(
+ ///                     S.as_bytes(),
+ ///                 ) {
+ ///                     Ok(v) => v,
+ ///                     Err(_) => {
+ ///                         ::core::panicking::panic_fmt(
+ ///                             format_args!("string contains interior NUL"),
+ ///                         );
+ ///                     }
+ ///                 };
+ ///                 C
+ ///             })
+ ///         };
+ ///         unsafe { DATA_ATTR_LIST.add::<1usize, 1u64, _>(&BAR_ATTR_1) }
+ ///         {
+ ///             static DATA_TPE: kernel::configfs::ItemType<
+ ///                 Subsystem<Configuration>,
+ ///                 Configuration,
+ ///             > = kernel::configfs::ItemType::<
+ ///                 Subsystem<Configuration>,
+ ///                 Configuration,
+ ///             >::new_with_child_ctor::<3usize, Child>(&THIS_MODULE, &DATA_ATTR_LIST);
+ ///             &DATA_TPE
+ ///         }
+ ///     };
+ /// ```
+ #[cfg(CONFIG_CONFIGFS_FS)]
+ #[proc_macro]
+ pub fn configfs_attrs(input: TokenStream) -> TokenStream {
+     configfs_attrs::configfs_attrs(parse_macro_input!(input as configfs_attrs::ConfigfsAttrs))
+         .into()
++>>>>>>> rust: configfs: add procedural macro for declaring configfs attributes
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants