Re: [PATCH v2 5/5] tools/bootconfig: Define memblock_free_ptr() to fix build error

From: Masami Hiramatsu
Date: Tue Sep 14 2021 - 23:00:40 EST


On Tue, 14 Sep 2021 18:57:34 -0700
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Tue, Sep 14, 2021 at 6:47 PM Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:
> >
> > Hmm, OK. Let me copy lib/bootconfig.c itself into tools/bootconfig
> > as a user-space code.
>
> Well, or we need to have some really good way to mark these shared files.
>
> Normally I don't think we share any *.c files with tooling, and
> tooling copies over the *.h files it needs. Is this the only one?

What I need to share is lib/bootconfig.c and include/linux/bootconfig.h.
Those provides bootconfig APIs and parser.

But since bootconfig.c uses some kernel APIs, I made wrapper
header files. If I can add #ifdefs to split the parser and APIs
from those part (as you can see 90% of code doesn't need kernel
APIs), I think I don't need any wrappers to include the file
(instead of copying bootconfig.c).

> So yes, copying the *.c file in this case would match what we do for
> the header files, but particularly if there are others, maybe we could
> have something like the "uapi" directory that allows people to
> explicialy share files with the tools.

OK.

> But it would need to be very explicit in the pathname, so that people
> would have that big warning sign of "hey, now you're editing a file
> that is shared with tooling".
>
> That has worked at least _somewhat_ with include/uapi/ and arch/*/include/uapi/.

Hmm, what about lib/uapi/bootconfig.c ?

Thank you,

>
> Linus


--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>