]> git.proxmox.com Git - mirror_qemu.git/commit - block/qcow2-cluster.c
qcow2: Convert qcow2_get_cluster_offset() into qcow2_get_host_offset()
authorAlberto Garcia <berto@igalia.com>
Fri, 10 Jul 2020 16:12:44 +0000 (18:12 +0200)
committerMax Reitz <mreitz@redhat.com>
Tue, 25 Aug 2020 06:33:20 +0000 (08:33 +0200)
commit388e581615d11126bc6d37223d50cbf8e127bde1
tree154f606f9c42fc6f71f0d182c861b232ea48bb82
parent9c4269d54b8bcc1939641009a2ea9b24d887fd58
qcow2: Convert qcow2_get_cluster_offset() into qcow2_get_host_offset()

qcow2_get_cluster_offset() takes an (unaligned) guest offset and
returns the (aligned) offset of the corresponding cluster in the qcow2
image.

In practice none of the callers need to know where the cluster starts
so this patch makes the function calculate and return the final host
offset directly. The function is also renamed accordingly.

There is a pre-existing exception with compressed clusters: in this
case the function returns the complete cluster descriptor (containing
the offset and size of the compressed data). This does not change with
this patch but it is now documented.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <ffae6cdc5ca8950e8280ac0f696dcc376cb07095.1594396418.git.berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2-cluster.c
block/qcow2.c
block/qcow2.h