From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YG8q3-0003jv-N8 for qemu-devel@nongnu.org; Tue, 27 Jan 2015 11:18:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YG8pz-00044i-AM for qemu-devel@nongnu.org; Tue, 27 Jan 2015 11:18:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YG8pz-00044e-3P for qemu-devel@nongnu.org; Tue, 27 Jan 2015 11:17:59 -0500 Message-ID: <54C7BA34.3010804@redhat.com> Date: Tue, 27 Jan 2015 09:17:56 -0700 From: Eric Blake MIME-Version: 1.0 References: <1422356197-5285-1-git-send-email-vsementsov@parallels.com> <1422356197-5285-2-git-send-email-vsementsov@parallels.com> In-Reply-To: <1422356197-5285-2-git-send-email-vsementsov@parallels.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DpJi3Q5bOluInqP31dM5wetgENbDIJFOD" Subject: Re: [Qemu-devel] [PATCH RFC v2 1/8] qmp: print dirty bitmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org Cc: kwolf@redhat.com, den@openvz.org, jsnow@redhat.com, stefanha@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DpJi3Q5bOluInqP31dM5wetgENbDIJFOD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/27/2015 03:56 AM, Vladimir Sementsov-Ogievskiy wrote: > Adds qmp and hmp commands to print dirty bitmap. This is needed only fo= r > testing. >=20 > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block.c | 33 +++++++++++++++++++++++++++++++++ > blockdev.c | 13 +++++++++++++ > hmp-commands.hx | 15 +++++++++++++++ > hmp.c | 8 ++++++++ > hmp.h | 1 + > include/block/block.h | 2 ++ > qapi-schema.json | 3 ++- > qapi/block-core.json | 3 +++ > qmp-commands.hx | 5 +++++ > 9 files changed, 82 insertions(+), 1 deletion(-) >=20 > +void bdrv_print_dirty_bitmap(BdrvDirtyBitmap *bitmap) > +{ > + unsigned long a =3D 0, b =3D 0; > + > + printf("bitmap '%s'\n", bitmap->name ? bitmap->name : "no name"); > + printf("enabled: %s\n", bitmap->enabled ? "true" : "false"); > + printf("size: %" PRId64 "\n", bitmap->size); > + printf("granularity: %" PRId64 "\n", bitmap->granularity); > + printf("dirty regions begin:\n"); > + > +void qmp_block_dirty_bitmap_print(const char *node_ref, const char *na= me, > + Error **errp) > +{ > + BdrvDirtyBitmap *bitmap; > + > + bitmap =3D block_dirty_bitmap_lookup(node_ref, name, NULL, errp); > + if (!bitmap) { > + return; > + } > + > + bdrv_print_dirty_bitmap(bitmap); Won't work. You cannot assume that stdout is usable when invoked from QMP. The only sane thing to do is to bundle up the structured data into JSON, pass that back over the QMP connection, and let the client decide how to print it. I'm opposed to adding this command as-is. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --DpJi3Q5bOluInqP31dM5wetgENbDIJFOD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJUx7o1AAoJEKeha0olJ0NqCfEIAIZnlASdJc64iFaqTbEHFxkJ ITR64SPyJldMHBoqEhX9TlPOfTRpoIjYlmU8zVB0ecfZzTMLGrnqxQfXjhzmBd/h LLhk7YmQvtLxWWJbL0s1njmn+94HQmt0ufZzwH1x4ef3Ey5cTFdtJdPNetGUlQVM SKJAAj7DqIN/VgAvuI90R7dVszz5EOQi6xflMyBiqFRe5jslmGsHjN+29QDNgF0Z pqYV8l8/oYKWT9l1rFJm6paJh/KSfwaF3FOeUMidgPlRNdMJLmtMf9SMqOSY76Ku U9DmtH46IfPxhb59YposL1A5e3jzfmc+6QFbtJskv5wC3cMrdiKuv3umqgXdEzU= =1qg9 -----END PGP SIGNATURE----- --DpJi3Q5bOluInqP31dM5wetgENbDIJFOD--