From 7e02bc2027ce4cb0ed26050077c0c33620c99926 Mon Sep 17 00:00:00 2001 From: Sourav Moitra Date: Thu, 12 Dec 2024 16:54:58 +0530 Subject: [PATCH] More changes Signed-off-by: Sourav Moitra --- lua/lua_crun.c | 4 ++-- python/crun_python.c | 4 ++-- src/crun.c | 2 +- src/libcrun/container.c | 6 ++---- src/libcrun/criu.c | 4 ++-- src/libcrun/error.c | 2 -- src/libcrun/linux.c | 2 -- src/libcrun/status.c | 2 -- tests/alpine-build/Dockerfile | 2 +- tests/centos8-build/Dockerfile | 2 +- tests/centos9-build/Dockerfile | 2 +- tests/containerd/Dockerfile | 2 +- tests/cri-o/Dockerfile | 2 +- tests/fuzzing/Dockerfile | 2 +- tests/oci-validation/Dockerfile | 2 +- tests/podman/Dockerfile | 2 +- tests/wasmedge-build/Dockerfile | 4 ++-- 17 files changed, 19 insertions(+), 27 deletions(-) diff --git a/lua/lua_crun.c b/lua/lua_crun.c index 4fee03d11e..c0a6e20274 100644 --- a/lua/lua_crun.c +++ b/lua/lua_crun.c @@ -659,7 +659,7 @@ luacrun_ctx_update_container (lua_State *S) luaL_checkstack (S, 2, NULL); json_error_t *error; - json_t *parsed_json = yajl_tree_parse (content, 0, error); + json_t *parsed_json = json_loads (content, 0, error); if (parsed_json == NULL) { lua_pushboolean (S, false); @@ -671,7 +671,7 @@ luacrun_ctx_update_container (lua_State *S) runtime_spec_schema_config_schema_process *rt_spec_process; parser_error p_err = NULL; rt_spec_process = make_runtime_spec_schema_config_schema_process (parsed_json, &parser_ctx, &p_err); - yajl_tree_free (parsed_json); + json_decref (parsed_json); if (rt_spec_process == NULL) { lua_pushboolean (S, false); diff --git a/python/crun_python.c b/python/crun_python.c index 49635bd29b..8f84cbff6d 100644 --- a/python/crun_python.c +++ b/python/crun_python.c @@ -380,7 +380,7 @@ container_update (PyObject *self arg_unused, PyObject *args) libcrun_context_t *ctx; char *id = NULL; char *content = NULL; - json_T *tree = NULL; + json_t *tree = NULL; int ret; parser_error parser_err = NULL; struct parser_context parser_ctx = { 0, stderr }; @@ -398,7 +398,7 @@ container_update (PyObject *self arg_unused, PyObject *args) return set_error (&err); process = make_runtime_spec_schema_config_schema_process (tree, &parser_ctx, &parser_err); - yajl_tree_free (tree); + json_decref (tree); if (process == NULL) { cleanup_free char *msg = NULL; diff --git a/src/crun.c b/src/crun.c index f356a95c44..5cb5ab1ae7 100644 --- a/src/crun.c +++ b/src/crun.c @@ -264,7 +264,7 @@ print_version (FILE *stream, struct argp_state *state arg_unused) libcrun_handler_manager_print_feature_tags (libcrun_get_handler_manager (), stream); - fprintf (stream, "+YAJL\n"); + fprintf (stream, "+ json_t\n"); } static error_t diff --git a/src/libcrun/container.c b/src/libcrun/container.c index 4e7edd00a1..a445cb3234 100644 --- a/src/libcrun/container.c +++ b/src/libcrun/container.c @@ -61,8 +61,6 @@ # include #endif -#define YAJL_STR(x) ((const unsigned char *) (x)) - enum { SYNC_SOCKET_SYNC_MESSAGE, @@ -776,7 +774,7 @@ do_hooks (runtime_spec_schema_config_schema *def, pid_t pid, const char *id, boo } static int -get_yajl_result (json_t *root, char **out, size_t *out_len) +get_json_result (json_t *root, char **out, size_t *out_len) { char *buf = NULL; size_t buf_len = 0; @@ -904,7 +902,7 @@ get_seccomp_receiver_fd_payload (libcrun_container_t *container, const char *sta goto exit; /* End state. */ - r = get_yajl_result (root, seccomp_fd_payload, seccomp_fd_payload_len); + r = get_json_result (root, seccomp_fd_payload, seccomp_fd_payload_len); exit: json_decref(root); diff --git a/src/libcrun/criu.c b/src/libcrun/criu.c index cd0c0e07cc..35bcafd2ca 100644 --- a/src/libcrun/criu.c +++ b/src/libcrun/criu.c @@ -802,11 +802,11 @@ libcrun_container_restore_linux_criu (libcrun_container_status_t *status, libcru * recording the destination of FD 0, 1 and 2. */ json_array_foreach(tree ,index, value) { - if (value && YAJL_IS_STRING (value)) + if (value && json_is_string (value)) { char *str = json_string_Value (value); if (has_prefix (str, "pipe:")) - libcriu_wrapper->criu_add_inherit_fd (i, str); + libcriu_wrapper->criu_add_inherit_fd (index, str); } } } diff --git a/src/libcrun/error.c b/src/libcrun/error.c index 10fb20f240..19d45d1451 100644 --- a/src/libcrun/error.c +++ b/src/libcrun/error.c @@ -31,8 +31,6 @@ # include #endif -#define YAJL_STR(x) ((const unsigned char *) (x)) - enum { LOG_FORMAT_TEXT = 0, diff --git a/src/libcrun/linux.c b/src/libcrun/linux.c index 77264eed71..2778972a97 100644 --- a/src/libcrun/linux.c +++ b/src/libcrun/linux.c @@ -68,8 +68,6 @@ #include "mount_flags.h" -#define YAJL_STR(x) ((const unsigned char *) (x)) - #ifndef RLIMIT_RTTIME # define RLIMIT_RTTIME 15 #endif diff --git a/src/libcrun/status.c b/src/libcrun/status.c index 5edc5d5307..bd4b8d6c13 100644 --- a/src/libcrun/status.c +++ b/src/libcrun/status.c @@ -29,8 +29,6 @@ #include #include -#define YAJL_STR(x) ((const unsigned char *) (x)) - struct pid_stat { char state; diff --git a/tests/alpine-build/Dockerfile b/tests/alpine-build/Dockerfile index 12302e9c43..0f8c55aa49 100644 --- a/tests/alpine-build/Dockerfile +++ b/tests/alpine-build/Dockerfile @@ -1,7 +1,7 @@ FROM alpine RUN apk add gcc automake autoconf libtool gettext pkgconf git make musl-dev \ - python3 libcap-dev libseccomp-dev yajl-dev argp-standalone go-md2man + python3 libcap-dev libseccomp-dev jansson-dev argp-standalone go-md2man COPY run-tests.sh /usr/local/bin diff --git a/tests/centos8-build/Dockerfile b/tests/centos8-build/Dockerfile index b446dd452a..ba279c8cbd 100644 --- a/tests/centos8-build/Dockerfile +++ b/tests/centos8-build/Dockerfile @@ -2,7 +2,7 @@ FROM quay.io/centos/centos:stream8 RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \ yum --enablerepo='powertools' install -y make automake autoconf gettext \ - criu-devel libtool gcc libcap-devel systemd-devel yajl-devel \ + criu-devel libtool gcc libcap-devel systemd-devel jansson-devel \ libseccomp-devel python36 libtool git COPY run-tests.sh /usr/local/bin diff --git a/tests/centos9-build/Dockerfile b/tests/centos9-build/Dockerfile index e052d03a97..34d04b700f 100644 --- a/tests/centos9-build/Dockerfile +++ b/tests/centos9-build/Dockerfile @@ -1,7 +1,7 @@ FROM quay.io/centos/centos:stream9 RUN yum --enablerepo='appstream' --enablerepo='baseos' --enablerepo='crb' install -y make \ - automake autoconf gettext criu-devel libtool gcc libcap-devel systemd-devel yajl-devel \ + automake autoconf gettext criu-devel libtool gcc libcap-devel systemd-devel jansson-devel \ libseccomp-devel python3 libtool git protobuf-c protobuf-c-devel COPY run-tests.sh /usr/local/bin diff --git a/tests/containerd/Dockerfile b/tests/containerd/Dockerfile index d73637f10e..3d90e96c26 100644 --- a/tests/containerd/Dockerfile +++ b/tests/containerd/Dockerfile @@ -9,7 +9,7 @@ RUN apt-get update \ protobuf-c-compiler libcap-dev libaio-dev \ curl libprotobuf-c-dev libprotobuf-dev socat libseccomp-dev \ pigz lsof make git gcc build-essential pkgconf libtool \ - libsystemd-dev libcap-dev libyajl-dev \ + libsystemd-dev libcap-dev libjansson-dev \ go-md2man libtool autoconf python3 automake sudo \ && update-alternatives --install /usr/bin/go go /usr/lib/go-1.22/bin/go 0 \ && mkdir -p /root/go/src/github.com/containerd \ diff --git a/tests/cri-o/Dockerfile b/tests/cri-o/Dockerfile index 4aa7d3c680..25ef6bbffe 100644 --- a/tests/cri-o/Dockerfile +++ b/tests/cri-o/Dockerfile @@ -4,7 +4,7 @@ ENV GOPATH=/root/go ENV PATH=/usr/bin:/usr/sbin:/root/go/bin:/usr/local/bin::/usr/local/sbin RUN yum install -y python git gcc automake autoconf libcap-devel \ - systemd-devel yajl-devel libseccomp-devel go-md2man conntrack-tools which \ + systemd-devel jansson-devel libseccomp-devel go-md2man conntrack-tools which \ glibc-static python3-libmount libtool make podman xz nmap-ncat jq bats \ iproute openssl iputils socat criu-libs irqbalance && \ dnf install -y 'dnf-command(builddep)' && dnf builddep -y podman && \ diff --git a/tests/fuzzing/Dockerfile b/tests/fuzzing/Dockerfile index 86b28cef6e..1217a87241 100644 --- a/tests/fuzzing/Dockerfile +++ b/tests/fuzzing/Dockerfile @@ -1,7 +1,7 @@ FROM fedora:latest RUN yum install -y golang python git automake autoconf libcap-devel \ - systemd-devel yajl-devel libseccomp-devel go-md2man \ + systemd-devel jansson-devel libseccomp-devel go-md2man \ glibc-static python3-libmount libtool make honggfuzz git RUN git clone https://github.com/giuseppe/containers-fuzzing-corpus /testcases diff --git a/tests/oci-validation/Dockerfile b/tests/oci-validation/Dockerfile index ef14e90ba1..86800760cd 100644 --- a/tests/oci-validation/Dockerfile +++ b/tests/oci-validation/Dockerfile @@ -4,7 +4,7 @@ ENV GOPATH=/root/go ENV PATH=/usr/bin:/usr/sbin:/root/go/bin:/usr/local/bin::/usr/local/sbin RUN yum install -y golang python git gcc automake autoconf libcap-devel \ - systemd-devel yajl-devel libseccomp-devel libselinux-devel \ + systemd-devel jansson-devel libseccomp-devel libselinux-devel \ glibc-static python3-libmount libtool make go-md2man perl-Test2-Harness COPY run-tests.sh /usr/local/bin diff --git a/tests/podman/Dockerfile b/tests/podman/Dockerfile index 154ec5eefc..1962430f17 100644 --- a/tests/podman/Dockerfile +++ b/tests/podman/Dockerfile @@ -4,7 +4,7 @@ ENV GOPATH=/root/go ENV PATH=/usr/bin:/usr/sbin:/root/go/bin:/usr/local/bin::/usr/local/sbin RUN dnf install -y golang python git gcc automake autoconf libcap-devel \ - systemd-devel yajl-devel libseccomp-devel go-md2man \ + systemd-devel jansson-devel libseccomp-devel go-md2man \ glibc-static python3-libmount libtool make podman xz nmap-ncat procps-ng slirp4netns \ device-mapper-devel containernetworking-plugins 'dnf-command(builddep)' && \ dnf builddep -y podman && \ diff --git a/tests/wasmedge-build/Dockerfile b/tests/wasmedge-build/Dockerfile index e953269bb0..9f414e24e9 100644 --- a/tests/wasmedge-build/Dockerfile +++ b/tests/wasmedge-build/Dockerfile @@ -3,8 +3,8 @@ ARG WASM_EDGE_VERSION="0.14.0" # Install the deps for building crun RUN dnf update -y && dnf install -y make python git gcc automake autoconf libcap-devel \ - systemd-devel yajl-devel libseccomp-devel pkg-config diffutils \ - systemd-devel yajl-devel libseccomp-devel pkg-config \ + systemd-devel jansson-devel libseccomp-devel pkg-config diffutils \ + systemd-devel libseccomp-devel pkg-config \ go-md2man glibc-static python3-libmount libtool buildah podman which # Install WasmEdge