From patchwork Fri Feb 21 11:25:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 11396307 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F5B81892 for ; Fri, 21 Feb 2020 11:27:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 255C12073A for ; Fri, 21 Feb 2020 11:27:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LesQgUd7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 255C12073A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j56SX-0000i5-8T for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Feb 2020 06:27:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35587) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j56R3-0005ly-0Q for qemu-devel@nongnu.org; Fri, 21 Feb 2020 06:25:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j56R1-0001dA-BA for qemu-devel@nongnu.org; Fri, 21 Feb 2020 06:25:32 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:41263 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j56R1-0001bG-6j for qemu-devel@nongnu.org; Fri, 21 Feb 2020 06:25:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582284330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6Wp+feoApaRedcuxvS3R/XvLKR4dhX67cLkWnuwm0yk=; b=LesQgUd7CmwfKua+WDtQUrQ6k+PskNubBkvkA0RJfCv+Ew4nFBarVmzSZBiza17y8Flwvf mWDH0vJKn1XW46bVRO7P9NQtNfxDd9pVgidjM7DDqMqr2wVh8CX9MklY8kMgMPjr24ySlW rWUa9T8FloRkVLwz9uz7yt5MFsHVxEw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-403-8es5yceoPRerE33itSnxwQ-1; Fri, 21 Feb 2020 06:25:28 -0500 X-MC-Unique: 8es5yceoPRerE33itSnxwQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8BBA310CE7AE; Fri, 21 Feb 2020 11:25:27 +0000 (UTC) Received: from localhost (ovpn-117-223.ams2.redhat.com [10.36.117.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5974A5D9C5; Fri, 21 Feb 2020 11:25:24 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v4 0/4] luks: add qemu-img measure support Date: Fri, 21 Feb 2020 11:25:18 +0000 Message-Id: <20200221112522.1497712-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Stefan Hajnoczi , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" v4: * This revision is what German speakers call "das Tüpfelchen auf dem I". "The icing on the cake" is the English equivalent. Since I like cake and don't want it to be half-baked, and because I like my metaphors shaken, not stirred, I went ahead with the extra revision so I could write this message. * Use g_autoptr(QCryptoBlock) to make the code more concise [Max] * Use local_err consistently [Max] * Folded in Max's Reviewed-by tags v3: * Move payload offset calculation function to crypto/block.c [Max] * Zero/unallocated blocks always require disk space on encrypted files [Max] * Update qemu-iotests 178 output when changing qemu-img measure command-line options v2: * Fix uint64_t <-> size_t type mismatch in block_crypto_measure() so that 32-bit builds pass This patch series adds qemu-img measure support to the "luks" block driver. We just need to take into account the LUKS header when sizing the image. Stefan Hajnoczi (4): luks: extract qcrypto_block_calculate_payload_offset() luks: implement .bdrv_measure() qemu-img: allow qemu-img measure --object without a filename iotests: add 282 luks qemu-img measure test block/crypto.c | 62 +++++++++++++++++++++ block/qcow2.c | 74 +++++++------------------ crypto/block.c | 36 +++++++++++++ include/crypto/block.h | 22 ++++++++ qemu-img.c | 6 +-- tests/qemu-iotests/178 | 2 +- tests/qemu-iotests/178.out.qcow2 | 8 +-- tests/qemu-iotests/178.out.raw | 8 +-- tests/qemu-iotests/282 | 93 ++++++++++++++++++++++++++++++++ tests/qemu-iotests/282.out | 30 +++++++++++ tests/qemu-iotests/group | 1 + 11 files changed, 274 insertions(+), 68 deletions(-) create mode 100755 tests/qemu-iotests/282 create mode 100644 tests/qemu-iotests/282.out