[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/6] jsmn: Add convenience functions
From: |
Patrick Steinhardt |
Subject: |
Re: [PATCH 2/6] jsmn: Add convenience functions |
Date: |
Mon, 4 Nov 2019 12:00:53 +0100 |
On Mon, Nov 04, 2019 at 10:26:21AM +0000, Max Tottenham wrote:
> On 11/02, Patrick Steinhardt wrote:
> > The newly added jsmn library is a really bare-bones library that
> > focusses on simplicity. Because of that, it is lacking some functions
> > for convenience to abstract away some of its inner workings and to make
> > code easier to read. As such, we're now adding some functions that are
> > going to be used by the LUKS2 implementation later on.
> >
> > Signed-off-by: Patrick Steinhardt <address@hidden>
> > ---
> > include/grub/jsmn.h | 108 ++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 108 insertions(+)
> >
>
> Would it not make sense to keep the additions in a separate header from
> the vendored upstream library? That way it'll likely be easier to pull
> in any updates.
Yeah, I thought about that, too. I wasn't sure about where
"jsmn.h" and our own extension should live, though, which is why
I just bailed for now and waited on some feedback. I could
imagine two things:
- We create "include/grub/json.h" with an API that uses
GRUB's coding style. It would thus work as a wrapper around
the jsmn API and contain functions like "grub_json_parse",
"grub_json_get_object" and also a struct "grub_json_t" that
contains all things required to work with the parsed JSON
object. The implementation would be contained in
"gurb-core/lib/json.c" and use "grub-core/lib/jsmn.h",
which would be the unmodified upstream library. This would
allow us to swap out the JSON parser in the future more
easily without breaking any users and also make the API
feel less foreign.
- Or there is both a "include/grub/jsmn.h" and
"include/grub/json.h", where the former one is the
unmodified JSMN dependency and the latter one provides our
own extended functions.
I feel like the first one would be much cleaner, but I'd love
to hear what you think about this first.
Patrick
signature.asc
Description: PGP signature
- [PATCH 0/6] Support for LUKS2 disc encryption, Patrick Steinhardt, 2019/11/02
- [PATCH 3/6] bootstrap: Add gnulib's base64 module, Patrick Steinhardt, 2019/11/02
- [PATCH 2/6] jsmn: Add convenience functions, Patrick Steinhardt, 2019/11/02
- Re: [PATCH 2/6] jsmn: Add convenience functions, Max Tottenham, 2019/11/04
- Re: [PATCH 2/6] jsmn: Add convenience functions,
Patrick Steinhardt <=
- Re: [PATCH 2/6] jsmn: Add convenience functions, Daniel Kiper, 2019/11/04
- Re: [PATCH 2/6] jsmn: Add convenience functions, Patrick Steinhardt, 2019/11/04
- Re: [PATCH 2/6] jsmn: Add convenience functions, Daniel Kiper, 2019/11/06
- Re: [PATCH 2/6] jsmn: Add convenience functions, Patrick Steinhardt, 2019/11/06
- Re: [PATCH 2/6] jsmn: Add convenience functions, Daniel Kiper, 2019/11/13
[PATCH 1/6] jsmn: Add JSON parser, Patrick Steinhardt, 2019/11/02
[PATCH 4/6] afsplitter: Move into its own module, Patrick Steinhardt, 2019/11/02
[PATCH 5/6] luks: Move configuration of ciphers into cryptodisk, Patrick Steinhardt, 2019/11/02
[PATCH 6/6] disk: Implement support for LUKS2, Patrick Steinhardt, 2019/11/02
[PATCH v2 0/6] Support for LUKS2 disk encryption, Patrick Steinhardt, 2019/11/05