Re: [RFC PATCH 2/2] kbuild: rust: provide an option to inline C helpers into Rust

From: Gary Guo
Date: Wed May 29 2024 - 16:46:10 EST


On Wed, 29 May 2024 21:28:15 +0100
Gary Guo <gary@xxxxxxxxxxx> wrote:

> Makefile | 4 +++-
> lib/Kconfig.debug | 10 ++++++++++
> rust/Makefile | 34 ++++++++++++++++++++++++++++++----
> rust/exports.c | 3 +++
> rust/helpers.c | 41 +++++++++++++++++++++--------------------
> scripts/Makefile.build | 5 ++++-
> 6 files changed, 71 insertions(+), 26 deletions(-)
>
> diff --git a/rust/helpers.c b/rust/helpers.c
> index 895f4b696962..3abf96f14148 100644
> --- a/rust/helpers.c
> +++ b/rust/helpers.c
> @@ -32,18 +32,19 @@
> #include <linux/spinlock.h>
> #include <linux/wait.h>
> #include <linux/workqueue.h>
> +#include "helpers.h"

I made a mistake during rebase and forgot to include rust/helpers.h in
this patch. The content is

```
#ifndef RUST_HELPERS_H
#define RUST_HELPERS_H

#include <linux/compiler_types.h>

#ifdef __BINDGEN__
#define __rust_helper
#else
#define __rust_helper inline
#endif

#endif
```

I'll include this in patch v2 but would like to get a general feedback
before sending another version.