[XEN PATCH v2 0/8] Allow to build libxl and other tools with json-c instead of yajl

Anthony PERARD posted 8 patches 5 days, 8 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20250929120756.46075-1-anthony@xenproject.org
CHANGELOG.md                              |   2 +
README                                    |   2 +-
config/Tools.mk.in                        |   1 +
tools/config.h.in                         |   3 +
tools/configure                           | 136 +++++-
tools/configure.ac                        |  10 +-
tools/include/libxl_json.h                |  27 ++
tools/libs/light/Makefile                 |   6 +-
tools/libs/light/gentypes.py              | 160 +++++-
tools/libs/light/idl.py                   |   7 +-
tools/libs/light/libxl_cpuid.c            | 119 +++++
tools/libs/light/libxl_internal.h         |  23 +-
tools/libs/light/libxl_json.c             | 562 +++++++++++++++++++++-
tools/libs/light/libxl_qmp.c              |  53 ++
tools/libs/light/libxl_types.idl          |   7 +-
tools/libs/light/libxl_types_internal.idl |   3 +-
tools/libs/stat/Makefile                  |   2 +-
tools/libs/stat/xenstat_qmp.c             | 126 ++++-
tools/xl/Makefile                         |   2 +-
tools/xl/xl_info.c                        | 102 +++-
20 files changed, 1312 insertions(+), 41 deletions(-)
[XEN PATCH v2 0/8] Allow to build libxl and other tools with json-c instead of yajl
Posted by Anthony PERARD 5 days, 8 hours ago
From: Anthony PERARD <anthony.perard@vates.tech>

Patch series available in this git branch:
https://xenbits.xenproject.org/git-http/people/aperard/xen-unstable.git br.libxl-libjsonc-v2

changes in v2:
- introduce $(XEN_JSON_LIBS) to have either -lyajl or -ljson-c or both (for a
  short while).
- few more changes detail in each patches.

Hi,

The library YAJL has been unmaintained for several years, without an obvious
fork to pick.

On the other and the library json-c is been maintained and use by several other
project, it's probably already installed on your machine. So this patch series
intend to allow to build the Xen toolstack again json-c, and forgo yajl.

Just in case, YAJL is can still be used.

There's bit of libxl API that exposes YAJL, mainly so it can be used by `xl` to
call libxl_domain_config_gen_json(). It was exposed via the "libxl_json.h"
headers. This functions and others won't be available when libxl is build
against json-c.

Cheers,

Anthony PERARD (8):
  tools/configure: Introduce deps on json-c lib for libxl
  libxl: Convert libxl__json_parse() to use json-c
  libxl: convert libxl__json_object_to_yajl_gen to
    libxl__json_object_to_libjsonc_object
  libxl: libxl__object_to_json() to json-c
  libxl: convert libxl__json_object_to_json() to json_object
  tools/libxenstat: Use json-c when available
  configure: Use json-c by default, fallback to yajl
  Update CHANGELOG and README with dependency on json-c

 CHANGELOG.md                              |   2 +
 README                                    |   2 +-
 config/Tools.mk.in                        |   1 +
 tools/config.h.in                         |   3 +
 tools/configure                           | 136 +++++-
 tools/configure.ac                        |  10 +-
 tools/include/libxl_json.h                |  27 ++
 tools/libs/light/Makefile                 |   6 +-
 tools/libs/light/gentypes.py              | 160 +++++-
 tools/libs/light/idl.py                   |   7 +-
 tools/libs/light/libxl_cpuid.c            | 119 +++++
 tools/libs/light/libxl_internal.h         |  23 +-
 tools/libs/light/libxl_json.c             | 562 +++++++++++++++++++++-
 tools/libs/light/libxl_qmp.c              |  53 ++
 tools/libs/light/libxl_types.idl          |   7 +-
 tools/libs/light/libxl_types_internal.idl |   3 +-
 tools/libs/stat/Makefile                  |   2 +-
 tools/libs/stat/xenstat_qmp.c             | 126 ++++-
 tools/xl/Makefile                         |   2 +-
 tools/xl/xl_info.c                        | 102 +++-
 20 files changed, 1312 insertions(+), 41 deletions(-)

-- 
Anthony PERARD
Re: [XEN PATCH v2 0/8] Allow to build libxl and other tools with json-c instead of yajl
Posted by Oleksii Kurochko 5 days, 4 hours ago
On 9/29/25 2:07 PM, Anthony PERARD wrote:
> From: Anthony PERARD<anthony.perard@vates.tech>
>
> Patch series available in this git branch:
> https://xenbits.xenproject.org/git-http/people/aperard/xen-unstable.git br.libxl-libjsonc-v2
>
> changes in v2:
> - introduce $(XEN_JSON_LIBS) to have either -lyajl or -ljson-c or both (for a
>    short while).
> - few more changes detail in each patches.
>
> Hi,
>
> The library YAJL has been unmaintained for several years, without an obvious
> fork to pick.
>
> On the other and the library json-c is been maintained and use by several other
> project, it's probably already installed on your machine. So this patch series
> intend to allow to build the Xen toolstack again json-c, and forgo yajl.

Do we have any plans to drop fallback to yajl in the next release? Or because of
this ...

>
> Just in case, YAJL is can still be used.
>
> There's bit of libxl API that exposes YAJL, mainly so it can be used by `xl` to
> call libxl_domain_config_gen_json(). It was exposed via the "libxl_json.h"
> headers. This functions and others won't be available when libxl is build
> against json-c.

... that some API trying to use API exposed by YAJL we just can't drop support
of yajl?

~ Oleksii


>
> Cheers,
>
> Anthony PERARD (8):
>    tools/configure: Introduce deps on json-c lib for libxl
>    libxl: Convert libxl__json_parse() to use json-c
>    libxl: convert libxl__json_object_to_yajl_gen to
>      libxl__json_object_to_libjsonc_object
>    libxl: libxl__object_to_json() to json-c
>    libxl: convert libxl__json_object_to_json() to json_object
>    tools/libxenstat: Use json-c when available
>    configure: Use json-c by default, fallback to yajl
>    Update CHANGELOG and README with dependency on json-c
>
>   CHANGELOG.md                              |   2 +
>   README                                    |   2 +-
>   config/Tools.mk.in                        |   1 +
>   tools/config.h.in                         |   3 +
>   tools/configure                           | 136 +++++-
>   tools/configure.ac                        |  10 +-
>   tools/include/libxl_json.h                |  27 ++
>   tools/libs/light/Makefile                 |   6 +-
>   tools/libs/light/gentypes.py              | 160 +++++-
>   tools/libs/light/idl.py                   |   7 +-
>   tools/libs/light/libxl_cpuid.c            | 119 +++++
>   tools/libs/light/libxl_internal.h         |  23 +-
>   tools/libs/light/libxl_json.c             | 562 +++++++++++++++++++++-
>   tools/libs/light/libxl_qmp.c              |  53 ++
>   tools/libs/light/libxl_types.idl          |   7 +-
>   tools/libs/light/libxl_types_internal.idl |   3 +-
>   tools/libs/stat/Makefile                  |   2 +-
>   tools/libs/stat/xenstat_qmp.c             | 126 ++++-
>   tools/xl/Makefile                         |   2 +-
>   tools/xl/xl_info.c                        | 102 +++-
>   20 files changed, 1312 insertions(+), 41 deletions(-)
>
Re: [XEN PATCH v2 0/8] Allow to build libxl and other tools with json-c instead of yajl
Posted by Anthony PERARD 2 days, 5 hours ago
On Mon, Sep 29, 2025 at 05:35:01PM +0200, Oleksii Kurochko wrote:
> 
> On 9/29/25 2:07 PM, Anthony PERARD wrote:
> > The library YAJL has been unmaintained for several years, without an obvious
> > fork to pick.
> > 
> > On the other and the library json-c is been maintained and use by several other
> > project, it's probably already installed on your machine. So this patch series
> > intend to allow to build the Xen toolstack again json-c, and forgo yajl.
> 
> Do we have any plans to drop fallback to yajl in the next release? Or because of
> this ...

Do we need a plan? We still have to support ancient version of several
dependencies, and json-c is a fairly recent project. In any case, usage
of yajl is quite contained, so I don't think it's a problem to let it
rot, and remove it when it get broken for long enough, but that's
unlikely to happen.

> > 
> > Just in case, YAJL is can still be used.
> > 
> > There's bit of libxl API that exposes YAJL, mainly so it can be used by `xl` to
> > call libxl_domain_config_gen_json(). It was exposed via the "libxl_json.h"
> > headers. This functions and others won't be available when libxl is build
> > against json-c.
> 
> ... that some API trying to use API exposed by YAJL we just can't drop support
> of yajl?

Well, I'm hopping those API are only used by `xl` and nothing else. And
to be fair, I've seen few project dropping support for YAJL and use
json-c instead (libvirt, to name one), so they can't use those API.

Cheers,

-- 
Anthony PERARD