From nobody Fri May 3 15:45:27 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558611549; cv=none; d=zoho.com; s=zohoarc; b=MMbRo+zxRoPVjditWSGS3WlXxByJogWFDFHqRxoV1DjYBx+ufQQ+rHPHkbCmKXmZSlOItP04WbL/4YdTJYNtOMd0M5HsuSkxRH/QPGJKmNcksGqdd2qaFNCMegULnYGzx4l4uRV3Zxa4Q9jQ4oRkH/x/pDWGXl7WGBQiwnBWCRU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558611549; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=QJg0CMaFjuEcUmwYl0CAICN1co+2U+8LX1zrdtdeM6w=; b=atLY5W80ma1wD92uZD0+CIB8vqoIWQbXk3YlVrfePb8pMwMx8YFw2aIELs7yFubHx8/sPebJcVj1sJzfKxVo5ceohCamBVpi0sySM1VMZ9Yy7MgWUim5xeONVECl8b2071902Mz2ZoSgwku7O+g3NRAQ//u4C65QRvE71g+jIXc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558611549585191.74177093901312; Thu, 23 May 2019 04:39:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CD018830E; Thu, 23 May 2019 11:38:47 +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 B333679582; Thu, 23 May 2019 11:38:22 +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 AC1E91806B13; Thu, 23 May 2019 11:38:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4NBbpoB021367 for ; Thu, 23 May 2019 07:37:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id B86B5795A0; Thu, 23 May 2019 11:37:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 807EE79583; Thu, 23 May 2019 11:37:47 +0000 (UTC) Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78D12A3B5D; Thu, 23 May 2019 11:37:36 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id l25so8741603eda.9; Thu, 23 May 2019 04:37:36 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id n11sm8055683edn.77.2019.05.23.04.37.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 04:37:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Fcga90YecPApVeYx88Iad3u3vvEQ2cMbsYD4Rj4jgTg=; b=IMYMt6e1mWpFgcmb5Lmh+/hvX8u2Jopf8q4ev5YeoJ9JcZg7EuwpdOpJCpwD8yQ1m2 KVb5SwQqvzAadSQIQl1k29my9i764VY0fkhCyE+odWFqqxOqUGhxoMB0oprbOoa0Bt3X fnRQFtGzaRkNfHlBT+wTwehyT9psVg+XXJh+mKiOhx7e7Mj6YPv1VJtK22Cg71vcOJ7Y cuk5hSSsFlL+ryz1xTRyTMYgg73zjBE88z5m+h7PXefpqXdHyiZm1ByrJdvFCtK9AeTz B0Wz7cJ+aNMaPGHJD0MN/HOJhI6/15eLK42aU4Kgrf5DB89RcdgZ8NAQKp/wxp40euL7 Sj6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Fcga90YecPApVeYx88Iad3u3vvEQ2cMbsYD4Rj4jgTg=; b=FYh+mffjsv865l/pQkTY9EWrqmORnCBSUntjg+Qtapb3zQyOgZLKV6DhEOGn+Qe1jY kdBHtaHEnNHfaL6xtFJQfAF+hz5v4+mjSeaok61AfV4gIbCGo9wswAI/pX8d1vuDb/Kp oJ8+150Wpp47hcNWN5OfOyI8ORwAf9B7GWXMwUSzQqpQ9HrAXVDVRQDvvjNu6CY8Zsmy 6yVdfchDxm76EHIzDjj0SXg/PZHinc2nnWYExpnTwmV7bZtCoAUx88Xw98/8YEafYUYO 2/XO5f5ptwkISJCFdmFrISoMBvaRJr96fBCd1WVRcBAVAoNbkZ64XabQmftlak/xBXyh YYfw== X-Gm-Message-State: APjAAAVeCUz3GzFptKvlh1pkDfnpx4hgQQ9VXJObQ0Wb/ORuNo45DagA xGaRD6Fz1vGe/ZFmMY3RD+Lud+VoMfM= X-Google-Smtp-Source: APXvYqwG1Aop+YrkmJ7aLBf6oqAlu2YB7PSmjuQ2MwdTfe+js/qRtGuBsGhoDVeCIzRmVeC34bZGXA== X-Received: by 2002:a17:906:14db:: with SMTP id y27mr4451031ejc.132.1558611454518; Thu, 23 May 2019 04:37:34 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Thu, 23 May 2019 13:37:01 +0200 Message-Id: <20190523113701.22459-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 23 May 2019 11:37:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 23 May 2019 11:37:36 +0000 (UTC) for IP:'209.85.208.68' DOMAIN:'mail-ed1-f68.google.com' HELO:'mail-ed1-f68.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.109 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.208.68 mail-ed1-f68.google.com 209.85.208.68 mail-ed1-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] test_driver: implement virDomainMemoryPeek 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-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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 23 May 2019 11:38:57 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Begins by writing a @start byte in the first position of @buffer and then for every next byte it stores the value of its previous one incremented by one. Behaves the same for both supported flags. Signed-off-by: Ilias Stamatis Reviewed-by: J=C3=A1n Tomko --- Initially I thought about checking whether start+size exceeds the available physical or virtual memory. However I noticed that even when I pass -1 as @start the qemu driver doesn't complain and it fills the buffer with data. So I left it as is, without performing any additional checks. src/test/test_driver.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index a4c17ef0df..04fdf7a4b8 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -6000,6 +6000,42 @@ testDomainManagedSaveRemove(virDomainPtr dom, unsign= ed int flags) return 0; } +static int +testDomainMemoryPeek(virDomainPtr dom, + unsigned long long start, + size_t size, + void *buffer, + unsigned int flags) +{ + int ret =3D -1; + size_t i; + unsigned char b =3D start; + virDomainObjPtr vm =3D NULL; + + virCheckFlags(VIR_MEMORY_VIRTUAL | VIR_MEMORY_PHYSICAL, -1); + + if (flags !=3D VIR_MEMORY_VIRTUAL && flags !=3D VIR_MEMORY_PHYSICAL) { + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("flags parameter must be VIR_MEMORY_VIRTUAL= or VIR_MEMORY_PHYSICAL")); + goto cleanup; + } + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + for (i =3D 0; i < size; i++) + ((unsigned char *) buffer)[i] =3D b++; + + ret =3D 0; + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + /* * Snapshot APIs @@ -6897,6 +6933,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainManagedSave =3D testDomainManagedSave, /* 1.1.4 */ .domainHasManagedSaveImage =3D testDomainHasManagedSaveImage, /* 1.1.4= */ .domainManagedSaveRemove =3D testDomainManagedSaveRemove, /* 1.1.4 */ + .domainMemoryPeek =3D testDomainMemoryPeek, /* 5.4.0 */ .domainSnapshotNum =3D testDomainSnapshotNum, /* 1.1.4 */ .domainSnapshotListNames =3D testDomainSnapshotListNames, /* 1.1.4 */ -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list