From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970674163700.5901324701223; Thu, 10 May 2018 09:44:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A1B39820EA; Thu, 10 May 2018 16:44:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 039175D750; Thu, 10 May 2018 16:44:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id ACEAA4BB79; Thu, 10 May 2018 16:44:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiS03013002 for ; Thu, 10 May 2018 12:44:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id C62186403C; Thu, 10 May 2018 16:44:28 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B6146466E for ; Thu, 10 May 2018 16:44:28 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:13 +0200 Message-Id: <577a0588796908a04a33aa860913f4072497b38d.1525970507.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 01/12] virJSONValue: remove unused 'protect' property X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 10 May 2018 16:44:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 The last usage was removed by commit <167028e> Signed-off-by: J=C3=A1n Tomko --- src/util/virjson.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/util/virjson.c b/src/util/virjson.c index dfe00d9280..92a15b28a1 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -78,7 +78,6 @@ struct _virJSONArray { =20 struct _virJSONValue { int type; /* enum virJSONType */ - bool protect; /* prevents deletion when embedded in another object */ =20 union { virJSONObject object; @@ -395,7 +394,7 @@ void virJSONValueFree(virJSONValuePtr value) { size_t i; - if (!value || value->protect) + if (!value) return; =20 switch ((virJSONType) value->type) { --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970676192557.1378396182562; Thu, 10 May 2018 09:44:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63CC5C047B96; Thu, 10 May 2018 16:44:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 270DA2016BF2; Thu, 10 May 2018 16:44:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D5ED64CA94; Thu, 10 May 2018 16:44:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiT2h013007 for ; Thu, 10 May 2018 12:44:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 66D976403C; Thu, 10 May 2018 16:44:29 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C0F864660 for ; Thu, 10 May 2018 16:44:28 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:14 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 02/12] tests: replace references to yajl X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 10 May 2018 16:44:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Use "libvirt not compiled with JSON" instead of mentioning yajl specifically. Signed-off-by: J=C3=A1n Tomko --- tests/qemuagenttest.c | 2 +- tests/qemucapabilitiestest.c | 2 +- tests/qemucaps2xmltest.c | 2 +- tests/qemucommandutiltest.c | 2 +- tests/qemuhotplugtest.c | 2 +- tests/qemumigparamstest.c | 2 +- tests/qemumonitorjsontest.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index f214eb461f..b9d6153540 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -908,7 +908,7 @@ mymain(void) int ret =3D 0; =20 #if !WITH_YAJL - fputs("libvirt not compiled with yajl, skipping this test\n", stderr); + fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif =20 diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index 1b5970a4c5..bdfc97614f 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -140,7 +140,7 @@ mymain(void) testQemuData data; =20 #if !WITH_YAJL - fputs("libvirt not compiled with yajl, skipping this test\n", stderr); + fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif =20 diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c index f4838f7980..7948859d87 100644 --- a/tests/qemucaps2xmltest.c +++ b/tests/qemucaps2xmltest.c @@ -166,7 +166,7 @@ mymain(void) testQemuData data; =20 #if !WITH_YAJL - fputs("libvirt not compiled with yajl, skipping this test\n", stderr); + fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif =20 diff --git a/tests/qemucommandutiltest.c b/tests/qemucommandutiltest.c index eb155e7e16..1801182304 100644 --- a/tests/qemucommandutiltest.c +++ b/tests/qemucommandutiltest.c @@ -77,7 +77,7 @@ mymain(void) testQemuCommandBuildObjectFromJSONData data1; =20 #if !WITH_YAJL - fputs("libvirt not compiled with yajl, skipping this test\n", stderr); + fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif =20 diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 85e53653e1..7e63680f7f 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -589,7 +589,7 @@ mymain(void) struct testQemuHotplugCpuParams cpudata; =20 #if !WITH_YAJL - fputs("libvirt not compiled with yajl, skipping this test\n", stderr); + fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif =20 diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c index ba62aacc54..b117e5b6bb 100644 --- a/tests/qemumigparamstest.c +++ b/tests/qemumigparamstest.c @@ -204,7 +204,7 @@ mymain(void) int ret =3D 0; =20 #if !WITH_YAJL - fputs("libvirt not compiled with yajl, skipping this test\n", stderr); + fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif =20 diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 9a83c9a608..8ebf322cd1 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2865,7 +2865,7 @@ mymain(void) char *metaschema =3D NULL; =20 #if !WITH_YAJL - fputs("libvirt not compiled with yajl, skipping this test\n", stderr); + fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif =20 --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970685484276.84236162532784; Thu, 10 May 2018 09:44:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D035A3150099; Thu, 10 May 2018 16:44:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F2C330B8449; Thu, 10 May 2018 16:44:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5ED57180B5AA; Thu, 10 May 2018 16:44:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiUl9013014 for ; Thu, 10 May 2018 12:44:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 07CBB6403C; Thu, 10 May 2018 16:44:30 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0E856466B for ; Thu, 10 May 2018 16:44:29 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:15 +0200 Message-Id: <50521439016113fa3cc00e420f7a273a876e82d5.1525970507.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 03/12] build: add --with-jansson X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 10 May 2018 16:44:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Introduce the configure argument and check for Jansson >=3D 2.7 Signed-off-by: J=C3=A1n Tomko --- configure.ac | 3 +++ m4/virt-jansson.m4 | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 m4/virt-jansson.m4 diff --git a/configure.ac b/configure.ac index cc005ea9e8..c51e239b07 100644 --- a/configure.ac +++ b/configure.ac @@ -252,6 +252,7 @@ LIBVIRT_ARG_FUSE LIBVIRT_ARG_GLUSTER LIBVIRT_ARG_GNUTLS LIBVIRT_ARG_HAL +LIBVIRT_ARG_JANSSON LIBVIRT_ARG_LIBPCAP LIBVIRT_ARG_LIBSSH LIBVIRT_ARG_LIBXML @@ -292,6 +293,7 @@ LIBVIRT_CHECK_FUSE LIBVIRT_CHECK_GLUSTER LIBVIRT_CHECK_GNUTLS LIBVIRT_CHECK_HAL +LIBVIRT_CHECK_JANSSON LIBVIRT_CHECK_LIBNL LIBVIRT_CHECK_LIBPARTED LIBVIRT_CHECK_LIBPCAP @@ -957,6 +959,7 @@ LIBVIRT_RESULT_FUSE LIBVIRT_RESULT_GLUSTER LIBVIRT_RESULT_GNUTLS LIBVIRT_RESULT_HAL +LIBVIRT_RESULT_JANSSON LIBVIRT_RESULT_LIBNL LIBVIRT_RESULT_LIBPCAP LIBVIRT_RESULT_LIBSSH diff --git a/m4/virt-jansson.m4 b/m4/virt-jansson.m4 new file mode 100644 index 0000000000..1f1d0a66e6 --- /dev/null +++ b/m4/virt-jansson.m4 @@ -0,0 +1,29 @@ +dnl The jansson library +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License, or (at your option) any later version. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library. If not, see +dnl . +dnl + +AC_DEFUN([LIBVIRT_ARG_JANSSON],[ + LIBVIRT_ARG_WITH_FEATURE([JANSSON], [jansson], [check]) +]) + +AC_DEFUN([LIBVIRT_CHECK_JANSSON],[ + dnl Jansson http://www.digip.org/jansson/ + LIBVIRT_CHECK_PKG([JANSSON], [jansson], [2.7]) +]) + +AC_DEFUN([LIBVIRT_RESULT_JANSSON],[ + LIBVIRT_RESULT_LIB([JANSSON]) +]) --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970685021423.81502905494915; Thu, 10 May 2018 09:44:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8FA7C0467D7; Thu, 10 May 2018 16:44:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 733E184E0; Thu, 10 May 2018 16:44:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2B6EB4BB79; Thu, 10 May 2018 16:44:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiUvg013026 for ; Thu, 10 May 2018 12:44:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9CD2E6403C; Thu, 10 May 2018 16:44:30 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41FD164660 for ; Thu, 10 May 2018 16:44:30 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:16 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 04/12] build: undef WITH_JANSSON for SETUID_RPC_CLIENT X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 10 May 2018 16:44:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 There is no code using WITH_JANSSON yet, but once we add it, it should not be compiled for the setuid_rpc_client. Signed-off-by: J=C3=A1n Tomko --- config-post.h | 1 + 1 file changed, 1 insertion(+) diff --git a/config-post.h b/config-post.h index f7eba0d7ca..cb2fc2b4ee 100644 --- a/config-post.h +++ b/config-post.h @@ -37,6 +37,7 @@ # undef WITH_DTRACE_PROBES # undef WITH_GNUTLS # undef WITH_GNUTLS_GCRYPT +# undef WITH_JANSSON # undef WITH_LIBSSH # undef WITH_MACVTAP # undef WITH_NUMACTL --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970690149177.85351890410936; Thu, 10 May 2018 09:44:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F14181E00; Thu, 10 May 2018 16:44:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 522076017E; Thu, 10 May 2018 16:44:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 06030180B5B1; Thu, 10 May 2018 16:44:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiVCS013033 for ; Thu, 10 May 2018 12:44:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3D41D64660; Thu, 10 May 2018 16:44:31 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6B806466B for ; Thu, 10 May 2018 16:44:30 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:17 +0200 Message-Id: <185571355a670dd47ccd9537c0ce1b36fb6b23ab.1525970507.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 05/12] Switch from yajl to Jansson X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 10 May 2018 16:44:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Yajl has not seen much activity upstream recently. Switch to using Jansson >=3D 2.7. All the platforms we target on https://libvirt.org/platforms.html have a version >=3D 2.7 listed on the sites below: https://repology.org/metapackage/jansson/versions https://build.opensuse.org/package/show/devel:libraries:c_c++/libjansson Implement virJSONValue{From,To}String using Jansson, delete the yajl code (and the related virJSONParser structure) and report an error if someone explicitly specifies --with-yajl. Also adjust the test data to account for Jansson's different whitespace usage for empty arrays and tune up the specfile to keep 'make rpm' working when bisecting. Signed-off-by: J=C3=A1n Tomko --- src/util/virjson.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 223 insertions(+) diff --git a/src/util/virjson.c b/src/util/virjson.c index 92a15b28a1..cb38c35522 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -2011,6 +2011,229 @@ virJSONValueToString(virJSONValuePtr object, } =20 =20 +#elif WITH_JANSSON +# include + +static virJSONValuePtr +virJSONValueFromJansson(json_t *json) +{ + virJSONValuePtr ret =3D NULL; + const char *key; + json_t *cur; + size_t i; + + switch (json_typeof(json)) { + case JSON_OBJECT: + ret =3D virJSONValueNewObject(); + if (!ret) + goto error; + + json_object_foreach(json, key, cur) { + virJSONValuePtr val =3D virJSONValueFromJansson(cur); + if (!val) + goto error; + + if (virJSONValueObjectAppend(ret, key, val) < 0) { + virJSONValueFree(val); + goto error; + } + } + + break; + + case JSON_ARRAY: + ret =3D virJSONValueNewArray(); + if (!ret) + goto error; + + json_array_foreach(json, i, cur) { + virJSONValuePtr val =3D virJSONValueFromJansson(cur); + if (!val) + goto error; + + if (virJSONValueArrayAppend(ret, val) < 0) { + virJSONValueFree(val); + goto error; + } + } + break; + + case JSON_STRING: + ret =3D virJSONValueNewStringLen(json_string_value(json), + json_string_length(json)); + break; + + case JSON_INTEGER: + ret =3D virJSONValueNewNumberLong(json_integer_value(json)); + break; + + case JSON_REAL: + ret =3D virJSONValueNewNumberDouble(json_real_value(json)); + break; + + case JSON_TRUE: + case JSON_FALSE: + ret =3D virJSONValueNewBoolean(json_boolean_value(json)); + break; + + case JSON_NULL: + ret =3D virJSONValueNewNull(); + break; + } + + return ret; + + error: + virJSONValueFree(ret); + return NULL; +} + +virJSONValuePtr +virJSONValueFromString(const char *jsonstring) +{ + virJSONValuePtr ret =3D NULL; + json_t *json; + json_error_t error; + size_t flags =3D JSON_REJECT_DUPLICATES | + JSON_DECODE_ANY; + + if (!(json =3D json_loads(jsonstring, flags, &error))) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse JSON %d:%d: %s"), + error.line, error.column, error.text); + return NULL; + } + + ret =3D virJSONValueFromJansson(json); + json_decref(json); + return ret; +} + + +static json_t * +virJSONValueToJansson(virJSONValuePtr object) +{ + json_error_t error; + json_t *ret =3D NULL; + size_t i; + + switch (object->type) { + case VIR_JSON_TYPE_OBJECT: + ret =3D json_object(); + if (!ret) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to create JSON object: %s"), + error.text); + goto error; + } + for (i =3D 0; i < object->data.object.npairs; i++) { + virJSONObjectPairPtr cur =3D object->data.object.pairs + i; + json_t *val =3D virJSONValueToJansson(cur->value); + + if (!val) + goto error; + if (json_object_set_new(ret, cur->key, val) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to set JSON object: %s"), + error.text); + goto error; + } + } + break; + + case VIR_JSON_TYPE_ARRAY: + ret =3D json_array(); + if (!ret) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to create JSON array: %s"), + error.text); + goto error; + } + for (i =3D 0; i < object->data.array.nvalues; i++) { + virJSONValuePtr cur =3D object->data.array.values[i]; + json_t *val =3D virJSONValueToJansson(cur); + + if (!val) + goto error; + if (json_array_append_new(ret, val) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to append array value: %s"), + error.text); + goto error; + } + } + break; + + case VIR_JSON_TYPE_STRING: + ret =3D json_string(object->data.string); + break; + + case VIR_JSON_TYPE_NUMBER: { + long long ll_val; + double d_val; + if (virStrToLong_ll(object->data.number, NULL, 10, &ll_val) < 0) { + if (virStrToDouble(object->data.number, NULL, &d_val) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("JSON value is not a number")); + return NULL; + } + ret =3D json_real(d_val); + } else { + ret =3D json_integer(ll_val); + } + } + break; + + case VIR_JSON_TYPE_BOOLEAN: + ret =3D json_boolean(object->data.boolean); + break; + + case VIR_JSON_TYPE_NULL: + ret =3D json_null(); + break; + } + if (!ret) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("error creating JSON value: %s"), + error.text); + } + return ret; + + error: + json_decref(ret); + return NULL; +} + + +char * +virJSONValueToString(virJSONValuePtr object, + bool pretty) +{ + size_t flags =3D JSON_ENCODE_ANY; + json_t *json; + json_error_t error; + char *str =3D NULL; + + if (pretty) + flags |=3D JSON_INDENT(2); + else + flags |=3D JSON_COMPACT; + + json =3D virJSONValueToJansson(object); + if (!json) + return NULL; + + str =3D json_dumps(json, flags); + if (!str) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to format JSON %d:%d: %s"), + error.line, error.column, error.text); + } + json_decref(json); + return str; +} + + #else virJSONValuePtr virJSONValueFromString(const char *jsonstring ATTRIBUTE_UNUSED) --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970685772111.45722682733106; Thu, 10 May 2018 09:44:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CC1D4300484E; Thu, 10 May 2018 16:44:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A6DD30B8448; Thu, 10 May 2018 16:44:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5C1611801243; Thu, 10 May 2018 16:44:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiV4u013038 for ; Thu, 10 May 2018 12:44:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id D2FD66403C; Thu, 10 May 2018 16:44:31 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77A0A6466E for ; Thu, 10 May 2018 16:44:31 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:18 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 06/12] FIXUP: Adjust test data for Jansson X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 10 May 2018 16:44:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Jansson formats empty arrays differently. --- .../xml2json/file-backing_basic-aio_threads.json | 9 +++----- .../file-backing_basic-cache-directsync.json | 9 +++----- .../xml2json/file-backing_basic-cache-none.json | 9 +++----- .../xml2json/file-backing_basic-cache-unsafe.json | 9 +++----- .../file-backing_basic-cache-writeback.json | 9 +++----- .../file-backing_basic-cache-writethrough.json | 9 +++----- .../xml2json/file-backing_basic-detect.json | 9 +++----- .../xml2json/file-backing_basic-noopts.json | 9 +++----- .../xml2json/file-backing_basic-unmap-detect.json | 9 +++----- .../xml2json/file-backing_basic-unmap-ignore.json | 9 +++----- .../xml2json/file-backing_basic-unmap.json | 9 +++----- .../file-qcow2-backing-chain-encryption.json | 3 +-- .../xml2json/file-qcow2-backing-chain-noopts.json | 27 ++++++++----------= ---- .../file-qcow2-backing-chain-unterminated.json | 3 +-- .../network-qcow2-backing-chain-cache-unsafe.json | 3 +-- ...etwork-qcow2-backing-chain-encryption_auth.json | 3 +-- tests/qemumigparamsdata/empty.json | 4 +--- tests/qemumigparamsdata/unsupported.json | 4 +--- tests/virmacmaptestdata/empty.json | 4 +--- 19 files changed, 49 insertions(+), 101 deletions(-) diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_thread= s.json b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.js= on index dcaf905085..571f661f62 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json @@ -11,8 +11,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "driver": "qed", @@ -25,8 +24,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "driver": "vmdk", @@ -46,8 +44,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "driver": "raw", diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-dire= ctsync.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-dir= ectsync.json index 023caf013f..fe170125bd 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.= json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.= json @@ -18,8 +18,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "cache": { @@ -39,8 +38,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "cache": { @@ -68,8 +66,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "cache": { diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none= .json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json index 023caf013f..fe170125bd 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json @@ -18,8 +18,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "cache": { @@ -39,8 +38,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "cache": { @@ -68,8 +66,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "cache": { diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsa= fe.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.= json index 5f6b94a9d5..4b3e02c480 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json @@ -18,8 +18,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "cache": { @@ -39,8 +38,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "cache": { @@ -68,8 +66,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "cache": { diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= eback.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= eback.json index 9dc7d38850..c82491325e 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.j= son +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.j= son @@ -18,8 +18,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "cache": { @@ -39,8 +38,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "cache": { @@ -68,8 +66,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "cache": { diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= ethrough.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-w= ritethrough.json index 9dc7d38850..c82491325e 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethroug= h.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethroug= h.json @@ -18,8 +18,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "cache": { @@ -39,8 +38,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "cache": { @@ -68,8 +66,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "cache": { diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.jso= n b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json index c1e4c40757..e3e047b51a 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json @@ -11,8 +11,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "driver": "qed", @@ -24,8 +23,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "driver": "vmdk", @@ -45,8 +43,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "driver": "raw", diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.jso= n b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json index 3285a6ec67..cacf213b3d 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json @@ -10,8 +10,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "driver": "qcow", @@ -23,8 +22,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "driver": "vmdk", @@ -36,8 +34,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "driver": "raw", diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-dete= ct.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.= json index b00008dd54..eb04812de0 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json @@ -12,8 +12,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "discard": "unmap", @@ -26,8 +25,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "discard": "unmap", @@ -48,8 +46,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "discard": "unmap", diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-igno= re.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.= json index 5419deafc0..c60a2742a5 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json @@ -12,8 +12,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "discard": "ignore", @@ -26,8 +25,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "discard": "ignore", @@ -48,8 +46,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "discard": "ignore", diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json= b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json index 1efc462c06..87082b7d63 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json @@ -11,8 +11,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "discard": "unmap", @@ -25,8 +24,7 @@ "discard": "unmap" }, "backing": "node-c-f" -} -{ +}{ "node-name": "node-c-f", "read-only": true, "discard": "unmap", @@ -47,8 +45,7 @@ "discard": "unmap" }, "backing": "node-d-f" -} -{ +}{ "node-name": "node-d-f", "read-only": true, "discard": "unmap", diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encr= yption.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-enc= ryption.json index 94e2ecd1e2..19b8bc0cb5 100644 --- a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.= json +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.= json @@ -14,8 +14,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "driver": "qcow2", diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noop= ts.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.= json index 3e7c08f080..6a05e38a28 100644 --- a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json @@ -10,8 +10,7 @@ "discard": "unmap" }, "backing": "#block313" -} -{ +}{ "node-name": "#block313", "read-only": true, "driver": "qcow2", @@ -23,8 +22,7 @@ "discard": "unmap" }, "backing": "#block556" -} -{ +}{ "node-name": "#block556", "read-only": true, "driver": "qcow2", @@ -36,8 +34,7 @@ "discard": "unmap" }, "backing": "#block767" -} -{ +}{ "node-name": "#block767", "read-only": true, "driver": "qcow2", @@ -49,8 +46,7 @@ "discard": "unmap" }, "backing": "#block937" -} -{ +}{ "node-name": "#block937", "read-only": true, "driver": "qcow2", @@ -62,8 +58,7 @@ "discard": "unmap" }, "backing": "#block1157" -} -{ +}{ "node-name": "#block1157", "read-only": true, "driver": "qcow2", @@ -75,8 +70,7 @@ "discard": "unmap" }, "backing": "#block1392" -} -{ +}{ "node-name": "#block1392", "read-only": true, "driver": "qcow2", @@ -88,8 +82,7 @@ "discard": "unmap" }, "backing": "#block1523" -} -{ +}{ "node-name": "#block1523", "read-only": true, "driver": "qcow2", @@ -101,8 +94,7 @@ "discard": "unmap" }, "backing": "#block1742" -} -{ +}{ "node-name": "#block1742", "read-only": true, "driver": "qcow2", @@ -114,8 +106,7 @@ "discard": "unmap" }, "backing": "#block1909" -} -{ +}{ "node-name": "#block1909", "read-only": true, "driver": "qcow2", diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unte= rminated.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-u= nterminated.json index 8fcdc48bb0..edaac797ea 100644 --- a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminate= d.json +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminate= d.json @@ -10,8 +10,7 @@ "discard": "unmap" }, "backing": "#block313" -} -{ +}{ "node-name": "#block313", "read-only": true, "driver": "qcow2", diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-c= ache-unsafe.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-c= hain-cache-unsafe.json index 6161f3375d..2748d33eb2 100644 --- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-un= safe.json +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-un= safe.json @@ -30,8 +30,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "cache": { diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-e= ncryption_auth.json b/tests/qemublocktestdata/xml2json/network-qcow2-backin= g-chain-encryption_auth.json index 7e7a4e44f7..b55968ebb0 100644 --- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encrypti= on_auth.json +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encrypti= on_auth.json @@ -26,8 +26,7 @@ "discard": "unmap" }, "backing": "node-b-f" -} -{ +}{ "node-name": "node-b-f", "read-only": true, "driver": "qcow2", diff --git a/tests/qemumigparamsdata/empty.json b/tests/qemumigparamsdata/e= mpty.json index 0db3279e44..0967ef424b 100644 --- a/tests/qemumigparamsdata/empty.json +++ b/tests/qemumigparamsdata/empty.json @@ -1,3 +1 @@ -{ - -} +{} diff --git a/tests/qemumigparamsdata/unsupported.json b/tests/qemumigparams= data/unsupported.json index 0db3279e44..0967ef424b 100644 --- a/tests/qemumigparamsdata/unsupported.json +++ b/tests/qemumigparamsdata/unsupported.json @@ -1,3 +1 @@ -{ - -} +{} diff --git a/tests/virmacmaptestdata/empty.json b/tests/virmacmaptestdata/e= mpty.json index 41b42e677b..fe51488c70 100644 --- a/tests/virmacmaptestdata/empty.json +++ b/tests/virmacmaptestdata/empty.json @@ -1,3 +1 @@ -[ - -] +[] --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970694765754.3503880868806; Thu, 10 May 2018 09:44:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 70576820E5; Thu, 10 May 2018 16:44:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C3B820078A2; Thu, 10 May 2018 16:44:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E74171801218; Thu, 10 May 2018 16:44:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiWax013043 for ; Thu, 10 May 2018 12:44:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 74CBF6403C; Thu, 10 May 2018 16:44:32 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18EE764660 for ; Thu, 10 May 2018 16:44:31 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:19 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 07/12] FIXUP: Remove functions using yajl X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 10 May 2018 16:44:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- m4/virt-yajl.m4 | 27 +-- src/util/virjson.c | 530 +------------------------------------------------= ---- 2 files changed, 4 insertions(+), 553 deletions(-) diff --git a/m4/virt-yajl.m4 b/m4/virt-yajl.m4 index c4ea0102a3..8d4c43a6b2 100644 --- a/m4/virt-yajl.m4 +++ b/m4/virt-yajl.m4 @@ -23,31 +23,10 @@ AC_DEFUN([LIBVIRT_ARG_YAJL],[ =20 AC_DEFUN([LIBVIRT_CHECK_YAJL],[ dnl YAJL JSON library http://lloyd.github.com/yajl/ - if test "$with_qemu:$with_yajl" =3D yes:check; then - dnl Some versions of qemu require the use of yajl; try to detect them - dnl here, although we do not require qemu to exist in order to compile. - dnl This check mirrors src/qemu/qemu_capabilities.c - AC_PATH_PROGS([QEMU], [qemu-kvm qemu kvm qemu-system-x86_64], - [], [$PATH:/usr/bin:/usr/libexec]) - if test -x "$QEMU"; then - if $QEMU -help 2>/dev/null | grep -q libvirt; then - with_yajl=3Dyes - else - [qemu_version_sed=3D's/.*ersion \([0-9.,]*\).*/\1/'] - qemu_version=3D`$QEMU -version | sed "$qemu_version_sed"` - case $qemu_version in - [[1-9]].* | 0.15.* ) with_yajl=3Dyes ;; - 0.* | '' ) ;; - *) AC_MSG_ERROR([Unexpected qemu version string]) ;; - esac - fi - fi + if test "$with_yajl" =3D yes; then + AC_MSG_ERROR([Compilation with YAJL is no longer supported]) fi - - LIBVIRT_CHECK_LIB_ALT([YAJL], [yajl], - [yajl_parse_complete], [yajl/yajl_common.h], - [YAJL2], [yajl], - [yajl_tree_parse], [yajl/yajl_common.h]) + with_yajl=3Dno ]) =20 AC_DEFUN([LIBVIRT_RESULT_YAJL],[ diff --git a/src/util/virjson.c b/src/util/virjson.c index cb38c35522..eab498222e 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -30,22 +30,6 @@ #include "virstring.h" #include "virutil.h" =20 -#if WITH_YAJL -# include -# include - -# ifdef WITH_YAJL2 -# define yajl_size_t size_t -# define VIR_YAJL_STATUS_OK(status) ((status) =3D=3D yajl_status_ok) -# else -# define yajl_size_t unsigned int -# define yajl_complete_parse yajl_parse_complete -# define VIR_YAJL_STATUS_OK(status) \ - ((status) =3D=3D yajl_status_ok || (status) =3D=3D yajl_status_insuffi= cient_data) -# endif - -#endif - /* XXX fixme */ #define VIR_FROM_THIS VIR_FROM_NONE =20 @@ -89,23 +73,6 @@ struct _virJSONValue { }; =20 =20 -typedef struct _virJSONParserState virJSONParserState; -typedef virJSONParserState *virJSONParserStatePtr; -struct _virJSONParserState { - virJSONValuePtr value; - char *key; -}; - -typedef struct _virJSONParser virJSONParser; -typedef virJSONParser *virJSONParserPtr; -struct _virJSONParser { - virJSONValuePtr head; - virJSONParserStatePtr state; - size_t nstate; - int wrap; -}; - - virJSONType virJSONValueGetType(const virJSONValue *value) { @@ -1516,502 +1483,7 @@ virJSONValueCopy(const virJSONValue *in) } =20 =20 -#if WITH_YAJL -static int -virJSONParserInsertValue(virJSONParserPtr parser, - virJSONValuePtr value) -{ - if (!parser->head) { - parser->head =3D value; - } else { - virJSONParserStatePtr state; - if (!parser->nstate) { - VIR_DEBUG("got a value to insert without a container"); - return -1; - } - - state =3D &parser->state[parser->nstate-1]; - - switch (state->value->type) { - case VIR_JSON_TYPE_OBJECT: { - if (!state->key) { - VIR_DEBUG("missing key when inserting object value"); - return -1; - } - - if (virJSONValueObjectAppend(state->value, - state->key, - value) < 0) - return -1; - - VIR_FREE(state->key); - } break; - - case VIR_JSON_TYPE_ARRAY: { - if (state->key) { - VIR_DEBUG("unexpected key when inserting array value"); - return -1; - } - - if (virJSONValueArrayAppend(state->value, - value) < 0) - return -1; - } break; - - default: - VIR_DEBUG("unexpected value type, not a container"); - return -1; - } - } - - return 0; -} - - -static int -virJSONParserHandleNull(void *ctx) -{ - virJSONParserPtr parser =3D ctx; - virJSONValuePtr value =3D virJSONValueNewNull(); - - VIR_DEBUG("parser=3D%p", parser); - - if (!value) - return 0; - - if (virJSONParserInsertValue(parser, value) < 0) { - virJSONValueFree(value); - return 0; - } - - return 1; -} - - -static int -virJSONParserHandleBoolean(void *ctx, - int boolean_) -{ - virJSONParserPtr parser =3D ctx; - virJSONValuePtr value =3D virJSONValueNewBoolean(boolean_); - - VIR_DEBUG("parser=3D%p boolean=3D%d", parser, boolean_); - - if (!value) - return 0; - - if (virJSONParserInsertValue(parser, value) < 0) { - virJSONValueFree(value); - return 0; - } - - return 1; -} - - -static int -virJSONParserHandleNumber(void *ctx, - const char *s, - yajl_size_t l) -{ - virJSONParserPtr parser =3D ctx; - char *str; - virJSONValuePtr value; - - if (VIR_STRNDUP(str, s, l) < 0) - return -1; - value =3D virJSONValueNewNumber(str); - VIR_FREE(str); - - VIR_DEBUG("parser=3D%p str=3D%s", parser, str); - - if (!value) - return 0; - - if (virJSONParserInsertValue(parser, value) < 0) { - virJSONValueFree(value); - return 0; - } - - return 1; -} - - -static int -virJSONParserHandleString(void *ctx, - const unsigned char *stringVal, - yajl_size_t stringLen) -{ - virJSONParserPtr parser =3D ctx; - virJSONValuePtr value =3D virJSONValueNewStringLen((const char *)strin= gVal, - stringLen); - - VIR_DEBUG("parser=3D%p str=3D%p", parser, (const char *)stringVal); - - if (!value) - return 0; - - if (virJSONParserInsertValue(parser, value) < 0) { - virJSONValueFree(value); - return 0; - } - - return 1; -} - - -static int -virJSONParserHandleMapKey(void *ctx, - const unsigned char *stringVal, - yajl_size_t stringLen) -{ - virJSONParserPtr parser =3D ctx; - virJSONParserStatePtr state; - - VIR_DEBUG("parser=3D%p key=3D%p", parser, (const char *)stringVal); - - if (!parser->nstate) - return 0; - - state =3D &parser->state[parser->nstate-1]; - if (state->key) - return 0; - if (VIR_STRNDUP(state->key, (const char *)stringVal, stringLen) < 0) - return 0; - return 1; -} - - -static int -virJSONParserHandleStartMap(void *ctx) -{ - virJSONParserPtr parser =3D ctx; - virJSONValuePtr value =3D virJSONValueNewObject(); - - VIR_DEBUG("parser=3D%p", parser); - - if (!value) - return 0; - - if (virJSONParserInsertValue(parser, value) < 0) { - virJSONValueFree(value); - return 0; - } - - if (VIR_REALLOC_N(parser->state, - parser->nstate + 1) < 0) { - return 0; - } - - parser->state[parser->nstate].value =3D value; - parser->state[parser->nstate].key =3D NULL; - parser->nstate++; - - return 1; -} - - -static int -virJSONParserHandleEndMap(void *ctx) -{ - virJSONParserPtr parser =3D ctx; - virJSONParserStatePtr state; - - VIR_DEBUG("parser=3D%p", parser); - - if (!parser->nstate) - return 0; - - state =3D &(parser->state[parser->nstate-1]); - if (state->key) { - VIR_FREE(state->key); - return 0; - } - - VIR_DELETE_ELEMENT(parser->state, parser->nstate - 1, parser->nstate); - - return 1; -} - - -static int -virJSONParserHandleStartArray(void *ctx) -{ - virJSONParserPtr parser =3D ctx; - virJSONValuePtr value =3D virJSONValueNewArray(); - - VIR_DEBUG("parser=3D%p", parser); - - if (!value) - return 0; - - if (virJSONParserInsertValue(parser, value) < 0) { - virJSONValueFree(value); - return 0; - } - - if (VIR_REALLOC_N(parser->state, - parser->nstate + 1) < 0) - return 0; - - parser->state[parser->nstate].value =3D value; - parser->state[parser->nstate].key =3D NULL; - parser->nstate++; - - return 1; -} - - -static int -virJSONParserHandleEndArray(void *ctx) -{ - virJSONParserPtr parser =3D ctx; - virJSONParserStatePtr state; - - VIR_DEBUG("parser=3D%p", parser); - - if (!(parser->nstate - parser->wrap)) - return 0; - - state =3D &(parser->state[parser->nstate-1]); - if (state->key) { - VIR_FREE(state->key); - return 0; - } - - VIR_DELETE_ELEMENT(parser->state, parser->nstate - 1, parser->nstate); - - return 1; -} - - -static const yajl_callbacks parserCallbacks =3D { - virJSONParserHandleNull, - virJSONParserHandleBoolean, - NULL, - NULL, - virJSONParserHandleNumber, - virJSONParserHandleString, - virJSONParserHandleStartMap, - virJSONParserHandleMapKey, - virJSONParserHandleEndMap, - virJSONParserHandleStartArray, - virJSONParserHandleEndArray -}; - - -/* XXX add an incremental streaming parser - yajl trivially supports it */ -virJSONValuePtr -virJSONValueFromString(const char *jsonstring) -{ - yajl_handle hand; - virJSONParser parser =3D { NULL, NULL, 0, 0 }; - virJSONValuePtr ret =3D NULL; - int rc; - size_t len =3D strlen(jsonstring); -# ifndef WITH_YAJL2 - yajl_parser_config cfg =3D { 0, 1 }; /* Match yajl 2 default behavior = */ - virJSONValuePtr tmp; -# endif - - VIR_DEBUG("string=3D%s", jsonstring); - -# ifdef WITH_YAJL2 - hand =3D yajl_alloc(&parserCallbacks, NULL, &parser); -# else - hand =3D yajl_alloc(&parserCallbacks, &cfg, NULL, &parser); -# endif - if (!hand) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to create JSON parser")); - goto cleanup; - } - - /* Yajl 2 is nice enough to default to rejecting trailing garbage. - * Yajl 1.0.12 has yajl_get_bytes_consumed to make that detection - * simpler. But we're stuck with yajl 1.0.7 on RHEL 6, which - * happily quits parsing at the end of a valid JSON construct, - * with no visibility into how much more input remains. Wrapping - * things in an array forces yajl to confess the truth. */ -# ifdef WITH_YAJL2 - rc =3D yajl_parse(hand, (const unsigned char *)jsonstring, len); -# else - rc =3D yajl_parse(hand, (const unsigned char *)"[", 1); - parser.wrap =3D 1; - if (VIR_YAJL_STATUS_OK(rc)) - rc =3D yajl_parse(hand, (const unsigned char *)jsonstring, len); - parser.wrap =3D 0; - if (VIR_YAJL_STATUS_OK(rc)) - rc =3D yajl_parse(hand, (const unsigned char *)"]", 1); -# endif - if (!VIR_YAJL_STATUS_OK(rc) || - yajl_complete_parse(hand) !=3D yajl_status_ok) { - unsigned char *errstr =3D yajl_get_error(hand, 1, - (const unsigned char*)jsons= tring, - strlen(jsonstring)); - - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse json %s: %s"), - jsonstring, (const char*) errstr); - yajl_free_error(hand, errstr); - virJSONValueFree(parser.head); - goto cleanup; - } - - if (parser.nstate !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse json %s: unterminated string/map/ar= ray"), - jsonstring); - virJSONValueFree(parser.head); - } else { - ret =3D parser.head; -# ifndef WITH_YAJL2 - /* Undo the array wrapping above */ - tmp =3D ret; - ret =3D NULL; - if (virJSONValueArraySize(tmp) > 1) - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse json %s: too many items present= "), - jsonstring); - else - ret =3D virJSONValueArraySteal(tmp, 0); - virJSONValueFree(tmp); -# endif - } - - cleanup: - yajl_free(hand); - - if (parser.nstate) { - size_t i; - for (i =3D 0; i < parser.nstate; i++) - VIR_FREE(parser.state[i].key); - VIR_FREE(parser.state); - } - - VIR_DEBUG("result=3D%p", ret); - - return ret; -} - - -static int -virJSONValueToStringOne(virJSONValuePtr object, - yajl_gen g) -{ - size_t i; - - VIR_DEBUG("object=3D%p type=3D%d gen=3D%p", object, object->type, g); - - switch (object->type) { - case VIR_JSON_TYPE_OBJECT: - if (yajl_gen_map_open(g) !=3D yajl_gen_status_ok) - return -1; - for (i =3D 0; i < object->data.object.npairs; i++) { - if (yajl_gen_string(g, - (unsigned char *)object->data.object.pairs= [i].key, - strlen(object->data.object.pairs[i].key)) - !=3D yajl_gen_status_ok) - return -1; - if (virJSONValueToStringOne(object->data.object.pairs[i].value= , g) < 0) - return -1; - } - if (yajl_gen_map_close(g) !=3D yajl_gen_status_ok) - return -1; - break; - case VIR_JSON_TYPE_ARRAY: - if (yajl_gen_array_open(g) !=3D yajl_gen_status_ok) - return -1; - for (i =3D 0; i < object->data.array.nvalues; i++) { - if (virJSONValueToStringOne(object->data.array.values[i], g) <= 0) - return -1; - } - if (yajl_gen_array_close(g) !=3D yajl_gen_status_ok) - return -1; - break; - - case VIR_JSON_TYPE_STRING: - if (yajl_gen_string(g, (unsigned char *)object->data.string, - strlen(object->data.string)) !=3D yajl_gen_sta= tus_ok) - return -1; - break; - - case VIR_JSON_TYPE_NUMBER: - if (yajl_gen_number(g, object->data.number, - strlen(object->data.number)) !=3D yajl_gen_sta= tus_ok) - return -1; - break; - - case VIR_JSON_TYPE_BOOLEAN: - if (yajl_gen_bool(g, object->data.boolean) !=3D yajl_gen_status_ok) - return -1; - break; - - case VIR_JSON_TYPE_NULL: - if (yajl_gen_null(g) !=3D yajl_gen_status_ok) - return -1; - break; - - default: - return -1; - } - - return 0; -} - - -char * -virJSONValueToString(virJSONValuePtr object, - bool pretty) -{ - yajl_gen g; - const unsigned char *str; - char *ret =3D NULL; - yajl_size_t len; -# ifndef WITH_YAJL2 - yajl_gen_config conf =3D { pretty ? 1 : 0, pretty ? " " : " "}; -# endif - - VIR_DEBUG("object=3D%p", object); - -# ifdef WITH_YAJL2 - g =3D yajl_gen_alloc(NULL); - if (g) { - yajl_gen_config(g, yajl_gen_beautify, pretty ? 1 : 0); - yajl_gen_config(g, yajl_gen_indent_string, pretty ? " " : " "); - yajl_gen_config(g, yajl_gen_validate_utf8, 1); - } -# else - g =3D yajl_gen_alloc(&conf, NULL); -# endif - if (!g) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to create JSON formatter")); - goto cleanup; - } - - if (virJSONValueToStringOne(object, g) < 0) { - virReportOOMError(); - goto cleanup; - } - - if (yajl_gen_get_buf(g, &str, &len) !=3D yajl_gen_status_ok) { - virReportOOMError(); - goto cleanup; - } - - ignore_value(VIR_STRDUP(ret, (const char *)str)); - - cleanup: - yajl_gen_free(g); - - VIR_DEBUG("result=3D%s", NULLSTR(ret)); - - return ret; -} - - -#elif WITH_JANSSON +#if WITH_JANSSON # include =20 static virJSONValuePtr --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970690091375.3671752713035; Thu, 10 May 2018 09:44:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8EEB630CD9A3; Thu, 10 May 2018 16:44:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 587885E7DC; Thu, 10 May 2018 16:44:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 12E0CEEF4; Thu, 10 May 2018 16:44:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiXvK013048 for ; Thu, 10 May 2018 12:44:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 15C1964660; Thu, 10 May 2018 16:44:33 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEFE66466E for ; Thu, 10 May 2018 16:44:32 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:20 +0200 Message-Id: <8707fc010edea30b486c0258dd4a86b4be3ad0e0.1525970507.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 08/12] FIXUP: make nss depend on Jansson instead of yajl X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 10 May 2018 16:44:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- m4/virt-nss.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/virt-nss.m4 b/m4/virt-nss.m4 index 951a74e835..6dc0d663b9 100644 --- a/m4/virt-nss.m4 +++ b/m4/virt-nss.m4 @@ -27,9 +27,9 @@ AC_DEFUN([LIBVIRT_CHECK_NSS],[ bsd_nss=3Dno fail=3D0 if test "x$with_nss_plugin" !=3D "xno" ; then - if test "x$with_yajl" !=3D "xyes" ; then + if test "x$with_jansson" !=3D "xyes" ; then if test "x$with_nss_plugin" =3D "xyes" ; then - AC_MSG_ERROR([Can't build nss plugin without yajl]) + AC_MSG_ERROR([Can't build nss plugin without JSON]) else with_nss_plugin=3Dno fi --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970699302421.6000174140811; Thu, 10 May 2018 09:44:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0501730CD9A1; Thu, 10 May 2018 16:44:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B7AA320078A5; Thu, 10 May 2018 16:44:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 725173FA56; Thu, 10 May 2018 16:44:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiXJU013061 for ; Thu, 10 May 2018 12:44:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA29864660; Thu, 10 May 2018 16:44:33 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FD046403C for ; Thu, 10 May 2018 16:44:33 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:21 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 09/12] FIXUP: compile and link with Jansson instead of yajl X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 10 May 2018 16:44:58 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/Makefile.am | 8 ++++---- src/util/Makefile.inc.am | 4 ++-- tests/Makefile.am | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 0c380780c3..361cc98f0f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -550,7 +550,7 @@ libvirt_admin_la_CFLAGS =3D \ libvirt_admin_la_CFLAGS +=3D \ $(XDR_CFLAGS) \ $(CAPNG_CFLAGS) \ - $(YAJL_CFLAGS) \ + $(JANSSON_CFLAGS) \ $(SSH2_CFLAGS) \ $(SASL_CFLAGS) \ $(GNUTLS_CFLAGS) \ @@ -558,7 +558,7 @@ libvirt_admin_la_CFLAGS +=3D \ =20 libvirt_admin_la_LIBADD +=3D \ $(CAPNG_LIBS) \ - $(YAJL_LIBS) \ + $(JANSSON_LIBS) \ $(DEVMAPPER_LIBS) \ $(LIBXML_LIBS) \ $(SSH2_LIBS) \ @@ -1000,14 +1000,14 @@ libvirt_nss_la_SOURCES =3D \ libvirt_nss_la_CFLAGS =3D \ -DLIBVIRT_NSS \ $(AM_CFLAGS) \ - $(YAJL_CFLAGS) \ + $(JANSSON_CFLAGS) \ $(NULL) libvirt_nss_la_LDFLAGS =3D \ $(AM_LDFLAGS) \ $(NULL) =20 libvirt_nss_la_LIBADD =3D \ - $(YAJL_LIBS) \ + $(JANSSON_LIBS) \ $(NULL) endif WITH_NSS =20 diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am index ec8745da7e..b8f547d321 100644 --- a/src/util/Makefile.inc.am +++ b/src/util/Makefile.inc.am @@ -249,7 +249,7 @@ libvirt_util_la_SOURCES =3D \ $(NULL) libvirt_util_la_CFLAGS =3D \ $(CAPNG_CFLAGS) \ - $(YAJL_CFLAGS) \ + $(JANSSON_CFLAGS) \ $(LIBNL_CFLAGS) \ $(AM_CFLAGS) \ $(AUDIT_CFLAGS) \ @@ -262,7 +262,7 @@ libvirt_util_la_CFLAGS =3D \ $(NULL) libvirt_util_la_LIBADD =3D \ $(CAPNG_LIBS) \ - $(YAJL_LIBS) \ + $(JANSSON_LIBS) \ $(LIBNL_LIBS) \ $(THREAD_LIBS) \ $(AUDIT_LIBS) \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 621480dd0c..ddff0bbcea 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,7 +46,7 @@ AM_CFLAGS =3D \ $(SASL_CFLAGS) \ $(SELINUX_CFLAGS) \ $(APPARMOR_CFLAGS) \ - $(YAJL_CFLAGS) \ + $(JANSSON_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(XDR_CFLAGS) \ $(WARN_CFLAGS) --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152597069255763.15177253138211; Thu, 10 May 2018 09:44:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 08ADF7E43E; Thu, 10 May 2018 16:44:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2BCD30B8445; Thu, 10 May 2018 16:44:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 837D83FCFC; Thu, 10 May 2018 16:44:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiYFk013071 for ; Thu, 10 May 2018 12:44:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B71A6403C; Thu, 10 May 2018 16:44:34 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E48216466B for ; Thu, 10 May 2018 16:44:33 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:22 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 10/12] FIXUP: s/WITH_YAJL/WITH_JANSSON/ X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 10 May 2018 16:44:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/qemu/qemu_driver.c | 2 +- tests/Makefile.am | 10 +++++----- tests/cputest.c | 16 ++++++++-------- tests/libxlxml2domconfigtest.c | 4 ++-- tests/qemuagenttest.c | 2 +- tests/qemucapabilitiestest.c | 2 +- tests/qemucaps2xmltest.c | 2 +- tests/qemucommandutiltest.c | 2 +- tests/qemuhotplugtest.c | 2 +- tests/qemumigparamstest.c | 2 +- tests/qemumonitorjsontest.c | 2 +- tests/virmocklibxl.c | 4 ++-- tests/virnetdaemontest.c | 2 +- tests/virstoragetest.c | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c129321a5c..f25dbb8e64 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2112,7 +2112,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) */ if ((!useAgent) || (ret < 0 && (acpiRequested || !flags))) { -#if !WITH_YAJL +#if !WITH_JANSSON virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("ACPI reboot is not supported without the JSON mo= nitor")); goto endjob; diff --git a/tests/Makefile.am b/tests/Makefile.am index ddff0bbcea..4092f99713 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -331,9 +331,9 @@ if WITH_CIL test_programs +=3D objectlocking endif WITH_CIL =20 -if WITH_YAJL +if WITH_JANSSON test_programs +=3D virjsontest -endif WITH_YAJL +endif WITH_JANSSON =20 test_programs +=3D \ networkxml2xmltest \ @@ -1227,15 +1227,15 @@ virdeterministichashmock_la_LIBADD =3D $(MOCKLIBS_L= IBS) =20 test_libraries +=3D virdeterministichashmock.la =20 -if WITH_YAJL +if WITH_JANSSON virmacmaptest_SOURCES =3D \ virmacmaptest.c testutils.h testutils.c virmacmaptest_LDADD =3D $(LDADDS) =20 test_programs +=3D virmacmaptest -else ! WITH_YAJL +else ! WITH_JANSSON EXTRA_DIST +=3D virmacmaptest.c -endif ! WITH_YAJL +endif ! WITH_JANSSON =20 virnetdevtest_SOURCES =3D \ virnetdevtest.c testutils.h testutils.c diff --git a/tests/cputest.c b/tests/cputest.c index e86cd0b9bc..83c9cb0a35 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -40,7 +40,7 @@ #include "cpu/cpu_map.h" #include "virstring.h" =20 -#if WITH_QEMU && WITH_YAJL +#if WITH_QEMU && WITH_JANSSON # include "testutilsqemu.h" # include "qemumonitortestutils.h" # define __QEMU_CAPSPRIV_H_ALLOW__ @@ -67,7 +67,7 @@ struct data { int result; }; =20 -#if WITH_QEMU && WITH_YAJL +#if WITH_QEMU && WITH_JANSSON static virQEMUDriver driver; #endif =20 @@ -479,7 +479,7 @@ typedef enum { JSON_MODELS_REQUIRED, } cpuTestCPUIDJson; =20 -#if WITH_QEMU && WITH_YAJL +#if WITH_QEMU && WITH_JANSSON static virQEMUCapsPtr cpuTestMakeQEMUCaps(const struct data *data) { @@ -554,7 +554,7 @@ cpuTestGetCPUModels(const struct data *data, return 0; } =20 -#else /* if WITH_QEMU && WITH_YAJL */ +#else /* if WITH_QEMU && WITH_JANSSON */ =20 static int cpuTestGetCPUModels(const struct data *data, @@ -834,7 +834,7 @@ cpuTestUpdateLive(const void *arg) } =20 =20 -#if WITH_QEMU && WITH_YAJL +#if WITH_QEMU && WITH_JANSSON static int cpuTestJSONCPUID(const void *arg) { @@ -911,7 +911,7 @@ mymain(void) virDomainCapsCPUModelsPtr ppc_models =3D NULL; int ret =3D 0; =20 -#if WITH_QEMU && WITH_YAJL +#if WITH_QEMU && WITH_JANSSON if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; =20 @@ -1004,7 +1004,7 @@ mymain(void) host "/" cpu " (" #models ")", \ host, cpu, models, 0, result) =20 -#if WITH_QEMU && WITH_YAJL +#if WITH_QEMU && WITH_JANSSON # define DO_TEST_JSON(arch, host, json) \ do { \ if (json =3D=3D JSON_MODELS) { \ @@ -1205,7 +1205,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-X5460", JSON_NONE); =20 cleanup: -#if WITH_QEMU && WITH_YAJL +#if WITH_QEMU && WITH_JANSSON qemuTestDriverFree(&driver); #endif =20 diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 0d2a7385e5..5105874cdc 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -33,7 +33,7 @@ =20 #include "testutils.h" =20 -#if defined(WITH_LIBXL) && defined(WITH_YAJL) && defined(HAVE_LIBXL_DOMAIN= _CONFIG_FROM_JSON) +#if defined(WITH_LIBXL) && defined(WITH_JANSSON) && defined(HAVE_LIBXL_DOM= AIN_CONFIG_FROM_JSON) =20 # include "internal.h" # include "viralloc.h" @@ -225,4 +225,4 @@ int main(void) return EXIT_AM_SKIP; } =20 -#endif /* WITH_LIBXL && WITH_YAJL && HAVE_LIBXL_DOMAIN_CONFIG_FROM_JSON */ +#endif /* WITH_LIBXL && WITH_JANSSON && HAVE_LIBXL_DOMAIN_CONFIG_FROM_JSON= */ diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index b9d6153540..d8617bf63f 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -907,7 +907,7 @@ mymain(void) { int ret =3D 0; =20 -#if !WITH_YAJL +#if !WITH_JANSSON fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index bdfc97614f..8bf628322d 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -139,7 +139,7 @@ mymain(void) virQEMUDriver driver; testQemuData data; =20 -#if !WITH_YAJL +#if !WITH_JANSSON fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c index 7948859d87..f71fd5af5a 100644 --- a/tests/qemucaps2xmltest.c +++ b/tests/qemucaps2xmltest.c @@ -165,7 +165,7 @@ mymain(void) =20 testQemuData data; =20 -#if !WITH_YAJL +#if !WITH_JANSSON fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif diff --git a/tests/qemucommandutiltest.c b/tests/qemucommandutiltest.c index 1801182304..3412ee6585 100644 --- a/tests/qemucommandutiltest.c +++ b/tests/qemucommandutiltest.c @@ -76,7 +76,7 @@ mymain(void) int ret =3D 0; testQemuCommandBuildObjectFromJSONData data1; =20 -#if !WITH_YAJL +#if !WITH_JANSSON fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 7e63680f7f..dbaa02a067 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -588,7 +588,7 @@ mymain(void) struct qemuHotplugTestData data =3D {0}; struct testQemuHotplugCpuParams cpudata; =20 -#if !WITH_YAJL +#if !WITH_JANSSON fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c index b117e5b6bb..9ab8fd88b5 100644 --- a/tests/qemumigparamstest.c +++ b/tests/qemumigparamstest.c @@ -203,7 +203,7 @@ mymain(void) virQEMUDriver driver; int ret =3D 0; =20 -#if !WITH_YAJL +#if !WITH_JANSSON fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 8ebf322cd1..d688be496f 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2864,7 +2864,7 @@ mymain(void) struct testQAPISchemaData qapiData; char *metaschema =3D NULL; =20 -#if !WITH_YAJL +#if !WITH_JANSSON fputs("libvirt not compiled with JSON, skipping this test\n", stderr); return EXIT_AM_SKIP; #endif diff --git a/tests/virmocklibxl.c b/tests/virmocklibxl.c index 546c6d6a43..0a047c239f 100644 --- a/tests/virmocklibxl.c +++ b/tests/virmocklibxl.c @@ -22,7 +22,7 @@ =20 #include =20 -#if defined(WITH_LIBXL) && defined(WITH_YAJL) +#if defined(WITH_LIBXL) && defined(WITH_JANSSON) # include "virmock.h" # include # include @@ -136,4 +136,4 @@ VIR_MOCK_IMPL_RET_ARGS(stat, int, return real_stat(path, sb); } =20 -#endif /* WITH_LIBXL && WITH_YAJL */ +#endif /* WITH_LIBXL && WITH_JANSSON */ diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c index ef869b16e3..7167147b8b 100644 --- a/tests/virnetdaemontest.c +++ b/tests/virnetdaemontest.c @@ -26,7 +26,7 @@ =20 #define VIR_FROM_THIS VIR_FROM_RPC =20 -#if defined(HAVE_SOCKETPAIR) && defined(WITH_YAJL) +#if defined(HAVE_SOCKETPAIR) && defined(WITH_JANSSON) struct testClientPriv { int magic; }; diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 0e11602e84..3092134edd 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1364,7 +1364,7 @@ mymain(void) " \n" "\n"); =20 -#ifdef WITH_YAJL +#ifdef WITH_JANSSON TEST_BACKING_PARSE("json:", NULL); TEST_BACKING_PARSE("json:asdgsdfg", NULL); TEST_BACKING_PARSE("json:{}", NULL); @@ -1628,7 +1628,7 @@ mymain(void) "\n" " \n" "\n"); -#endif /* WITH_YAJL */ +#endif /* WITH_JANSSON */ =20 cleanup: /* Final cleanup */ --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970705134466.17300708498806; Thu, 10 May 2018 09:45:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F9EB820E9; Thu, 10 May 2018 16:45:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5AAAA1001903; Thu, 10 May 2018 16:45:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 020D84BB78; Thu, 10 May 2018 16:45:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiZJN013081 for ; Thu, 10 May 2018 12:44:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id E001B64660; Thu, 10 May 2018 16:44:34 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85C916466B for ; Thu, 10 May 2018 16:44:34 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:23 +0200 Message-Id: <83e4d297acc347be8fa3c0eab5d26b4e637a94d8.1525970507.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 11/12] FIXUP: libvirt.spec: use jansson instead of yajl X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 10 May 2018 16:45:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- libvirt.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 9ea5e6b32a..f653b98465 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -336,7 +336,7 @@ BuildRequires: systemd-devel >=3D 185 BuildRequires: libudev-devel >=3D 145 %endif BuildRequires: libpciaccess-devel >=3D 0.10.9 -BuildRequires: yajl-devel +BuildRequires: jansson-devel %if %{with_sanlock} BuildRequires: sanlock-devel >=3D 2.4 %endif @@ -1304,7 +1304,7 @@ rm -f po/stamp-po --without-apparmor \ --without-hal \ --with-udev \ - --with-yajl \ + --with-jansson \ %{?arg_sanlock} \ --with-libpcap \ --with-macvtap \ --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 20:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525970709790529.8584665974613; Thu, 10 May 2018 09:45:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B40A30B27BD; Thu, 10 May 2018 16:45:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2565560180; Thu, 10 May 2018 16:45:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BDEC3180B5B5; Thu, 10 May 2018 16:45:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AGiZXB013091 for ; Thu, 10 May 2018 12:44:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 811266403C; Thu, 10 May 2018 16:44:35 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 264C36466E for ; Thu, 10 May 2018 16:44:35 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 10 May 2018 18:44:24 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 12/12] build: require Jansson if QEMU driver is enabled X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 10 May 2018 16:45:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 If the QEMU driver was requested, require Jansson, since we need to use the JSON monitor to probe capabilities for all QEMU version supported by libvirt. Switch the default from 'yes' to 'check', and enable the QEMU driver by default if the Jansson library is present. Signed-off-by: J=C3=A1n Tomko --- m4/virt-driver-qemu.m4 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/m4/virt-driver-qemu.m4 b/m4/virt-driver-qemu.m4 index b9bafdab90..a0d34f1dca 100644 --- a/m4/virt-driver-qemu.m4 +++ b/m4/virt-driver-qemu.m4 @@ -18,7 +18,7 @@ dnl . dnl =20 AC_DEFUN([LIBVIRT_DRIVER_ARG_QEMU], [ - LIBVIRT_ARG_WITH_FEATURE([QEMU], [QEMU/KVM], [yes]) + LIBVIRT_ARG_WITH_FEATURE([QEMU], [QEMU/KVM], [check]) LIBVIRT_ARG_WITH([QEMU_USER], [username to run QEMU system instance as], ['platform dependent']) LIBVIRT_ARG_WITH([QEMU_GROUP], [groupname to run QEMU system instance as= ], @@ -26,6 +26,12 @@ AC_DEFUN([LIBVIRT_DRIVER_ARG_QEMU], [ ]) =20 AC_DEFUN([LIBVIRT_DRIVER_CHECK_QEMU], [ + if test "$with_qemu:$with_jansson" =3D "yes:no"; then + AC_MSG_ERROR([Jansson >=3D 2.7 is required to build QEMU driver]) + fi + if test "$with_qemu" =3D "check"; then + with_qemu=3D$with_jansson + fi if test "$with_qemu" =3D "yes" ; then AC_DEFINE_UNQUOTED([WITH_QEMU], 1, [whether QEMU driver is enabled]) fi --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list