From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE06EC3A589 for ; Tue, 20 Aug 2019 13:00:59 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8932A22D6D for ; Tue, 20 Aug 2019 13:00:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mgzoJMRe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8932A22D6D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=invisiblethingslab.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i03kh-0001nf-11; Tue, 20 Aug 2019 13:00:43 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i03kg-0001na-7E for xen-devel@lists.xen.org; Tue, 20 Aug 2019 13:00:42 +0000 X-Inumbo-ID: 838da884-c34a-11e9-b90c-bc764e2007e4 Received: from out1-smtp.messagingengine.com (unknown [66.111.4.25]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 838da884-c34a-11e9-b90c-bc764e2007e4; Tue, 20 Aug 2019 13:00:41 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 3819E220AF; Tue, 20 Aug 2019 09:00:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 20 Aug 2019 09:00:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=gHVoe2 ynsaEysBEieFdg9JnORGx8WpC95683FUXM8kA=; b=mgzoJMRe9c0/nB57NolWGC 9aefT7p2gE2UONbwxOjSzDy0Y3DV1vkedqK8gXIrEokVPVT2gzXfRToNirKMF4Wh VToDosbpqCppudihQhtVR5uYfj5b5ACSXncxkMcJQfdytBOpuiaROX2VVHUTvSU+ at6v8xm+0hyZxKyYD8NQqzvR/vfQq6YCZ2LAx43YplefyLuRD5ZCfrhErcrJbp// OhEa59HCZ8SLmLudULC95kOT14ZaIvReWnP9T9xC9LK9i+LGw9Nzf4LZyRol6kU6 JNHumoagl7ZlyyB6SZVQivYT++wdo+LwoH7eScmfykFPBhut9pwjInb7fJoeD//Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeguddgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdef feenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslh gvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from mail-itl (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id C78848005B; Tue, 20 Aug 2019 09:00:39 -0400 (EDT) Date: Tue, 20 Aug 2019 15:00:37 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Pawel Wieczorkiewicz Message-ID: <20190820130037.GF1457@mail-itl> References: <20190815094400.126289-1-wipawel@amazon.de> <20190820125108.104102-1-wipawel@amazon.de> MIME-Version: 1.0 In-Reply-To: <20190820125108.104102-1-wipawel@amazon.de> Subject: Re: [Xen-devel] [livepatch: independ. modules v3 3/3] python: Add XC binding for Xen build ID X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Ian Jackson , xen-devel@lists.xen.org, mpohlack@amazon.de, amazein@amazon.de, xen-devel@lists.xenproject.org Content-Type: multipart/mixed; boundary="===============3303476028460382227==" Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" --===============3303476028460382227== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QXO0/MSS4VvK6f+D" Content-Disposition: inline --QXO0/MSS4VvK6f+D Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [livepatch: independ. modules v3 3/3] python: Add XC binding for Xen build ID On Tue, Aug 20, 2019 at 12:51:08PM +0000, Pawel Wieczorkiewicz wrote: > Extend the list of xc() object methods with additional one to display > Xen's buildid. The implementation follows the libxl implementation > (e.g. max buildid size assumption being XC_PAGE_SIZE minus > sizeof(buildid->len)). >=20 > Signed-off-by: Pawel Wieczorkiewicz > Reviewed-by: Martin Mazein > Reviewed-by: Andra-Irina Paraschiv > Reviewed-by: Norbert Manthey Acked-by: Marek Marczykowski-G=C3=B3recki > --- > v3: > * Instead of allocating XC_PAGE_SIZE plus size of the len field, > allocate one XC_PAGE_SIZE for the whole buildid struct. > * Modify commit message to reflect the above change. > v2: > * No code change > * Adding maintainers > --- > tools/python/xen/lowlevel/xc/xc.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) >=20 > diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowleve= l/xc/xc.c > index 522cbe3b9c..7ed4a253de 100644 > --- a/tools/python/xen/lowlevel/xc/xc.c > +++ b/tools/python/xen/lowlevel/xc/xc.c > @@ -1211,6 +1211,26 @@ out: > return ret_obj ? ret_obj : pyxc_error_to_exception(self->xc_handle); > } > =20 > +static PyObject *pyxc_xenbuildid(XcObject *self) > +{ > + xen_build_id_t *buildid; > + int i, r; > + char *str; > + > + buildid =3D alloca(XC_PAGE_SIZE); > + buildid->len =3D XC_PAGE_SIZE - sizeof(*buildid); > + > + r =3D xc_version(self->xc_handle, XENVER_build_id, buildid); > + if ( r <=3D 0 ) > + return pyxc_error_to_exception(self->xc_handle); > + > + str =3D alloca((r * 2) + 1); > + for ( i =3D 0; i < r; i++ ) > + snprintf(&str[i * 2], 3, "%02hhx", buildid->buf[i]); > + > + return Py_BuildValue("s", str); > +} > + > static PyObject *pyxc_xeninfo(XcObject *self) > { > xen_extraversion_t xen_extra; > @@ -2294,6 +2314,13 @@ static PyMethodDef pyxc_methods[] =3D { > "Returns [dict]: information about Xen" > " [None]: on failure.\n" }, > =20 > + { "buildid", > + (PyCFunction)pyxc_xenbuildid, > + METH_NOARGS, "\n" > + "Get Xen buildid\n" > + "Returns [str]: Xen buildid" > + " [None]: on failure.\n" }, > + > { "shadow_control",=20 > (PyCFunction)pyxc_shadow_control,=20 > METH_VARARGS | METH_KEYWORDS, "\n" --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? --QXO0/MSS4VvK6f+D Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAl1b7vUACgkQ24/THMrX 1yxW5Qf+IDjGbvF7uuK64oSQUJMBk1kpkxPbvnPGMeZhGRCj+rX5JntWA4JcAzY5 7TDoJeoszsKHwcLUDQc9YotVX3Jo6ESRVfxr0+dN4bEqxlvbqF3yLcuetK17Ahs8 j3E2843ZYP7dJ5XJCMsabP0ORnIPuG96HPEd+mLGq3mJ63wrj9iOc/PV41rCYjIF xOQnMWHJRCVXfpnKaMXKwyDxXlh7PNphJm+gp9EgyPSLZaNxL7q/CC3pV+y6gsHB hvreqQXAmSeJ7lZqOaEUyvPwLiNgMHy9V5M+uGAl6yhxkDywvcQnKCMnVHwgVvBP 6BGg2yrQSbiM7OQvkZ1whGLF1LnMPw== =6OYn -----END PGP SIGNATURE----- --QXO0/MSS4VvK6f+D-- --===============3303476028460382227== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcKaHR0cHM6Ly9saXN0 cy54ZW5wcm9qZWN0Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL3hlbi1kZXZlbA== --===============3303476028460382227==--