# kproc-macros This is a design document where it is described a proposal to integrate a library in the Linux kernel where it is possible parser easly rust code to make easy the parsing of a procedural macros For now there is a support only for the following procedural macros - [ ] Derive macro, usually star with `#[derive(InitPin)]` - [ ] Function-like macro, can unlock [feature to simplify the module writing](https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/init.20and.20drop.20module.20with.20a.20procedural.20macro) - [ ] Attribute macro ## Implementation Draft implementation available at https://codeberg.org/vincenzopalazzo/kproc-macros ```rust fn parse(toks_stream) -> .. { let ast = parse_struct!(toks_stream); match ast { Struct(_, _, attr) => {} } let fun = parse_fn!(..); } ``` ### For Driver ```rust struct HelloModule; #[module_init] fn init(_name: &'static CStr, _module: &'static ThisModule) -> Result<HelloModule> { pr_info!("Hello world\n"); Ok(HelloModule) } } ```