From: Ronald Rojas Subject: libxl to json return string Date: Thu, 12 Jan 2017 14:04:47 -0500 Message-ID: <20170112190446.GA5045@fedora.fios-router.home> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fUYQa+Pmc3FrFX/N" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cRkg9-0001bx-Cu for xen-devel@lists.xenproject.org; Thu, 12 Jan 2017 19:04:53 +0000 Received: by mail-qk0-f194.google.com with SMTP id 11so4029595qkl.0 for ; Thu, 12 Jan 2017 11:04:50 -0800 (PST) Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel@lists.xenproject.org Cc: dunlapg@umich.edu, ian.jackson@eu.citrix.com, george.dunlap@citrix.com List-Id: xen-devel@lists.xenproject.org --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I have an example attached below where I believe that libxl_physinfo_to_json() does not return all of the correct output. physinfo.c is the C program that outputs the json string. physc.out is the output that I recieved. physgo.out is the output I get using the golang bindings I'm creating for xenlight. The missing fields are : scrub_pages, outstanding_pages, sharing_freed_pages,sharing_used_frames, the last 4 indices of hw_cap, cap_hvm, and cap_hvm_directio I had a similar problem with libxl_dominfo_to_json() where some data fields were not added to the string. It was said on the IRC channel that default values are not converted to json, but is there a way to tell what is the default value for a data field? Thanks! Ronald Rojas --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="physc.out" { "threads_per_core": 1, "cores_per_socket": 4, "max_cpu_id": 3, "nr_cpus": 4, "cpu_khz": 3198157, "total_pages": 4179453, "free_pages": 32702, "nr_nodes": 1, "hw_cap": [ 3085695999, 2012935103, 739248128, 33 ] } --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="physgo.out" { "Threads_per_core": 1, "Cores_per_socket": 4, "Max_cpu_id": 3, "Nr_cpus": 4, "Cpu_khz": 3198157, "Total_pages": 4179453, "Free_pages": 32702, "Scrub_pages": 0, "Outstanding_pages": 0, "Sharing_freed_pages": 0, "Sharing_used_frames": 0, "Nr_nodes": 1, "Hw_cap": [ 3085695999, 2012935103, 739248128, 33, 1, 10155, 0, 256 ], "Cap_hvm": false, "Cap_hvm_directio": false } --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="physinfo.c" #include #include #include char * main(){ libxl_ctx *context; libxl_ctx_alloc(&context,LIBXL_VERSION, 0, NULL); libxl_physinfo info ; int err= libxl_get_physinfo(context,&info ); if(err != 0){ return NULL; } char * json= libxl_physinfo_to_json(context, &info); libxl_ctx_free(context); return json; } --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --fUYQa+Pmc3FrFX/N--