On 9/6/19 1:55 PM, Maxim Levitsky wrote: >>> +/* >>> + * qcow2_co_encrypt() >>> + * >>> + * Encrypts a sector size aligned contiguous area >>> + * >>> + * @host_cluster_offset - on disk offset of the cluster in which >>> + * the buffer resides >>> + * >>> + * @guest_offset - guest (virtual) offset of the buffer >>> + * @buf - buffer with the data to encrypt >>> + * @len - length of the buffer >>> + * >>> + * Note that the area is not cluster aligned and might cross a cluster >>> + * boundary >> >> Umm, how is it possible for a sector to cross a cluster boundary? All >> clusters are sector-aligned, and encryption only works on aligned >> sectors. Oh, I see - if @len is a multiple larger than sector size, >> then we have multiple sectors, and then indeed we may cross clusters. >> But then the docs about being 'a sector size aligned contiguous area' is >> not quite right. > > Why? the written area is always both aligned on _sector_ boundary > and multiple of the sector size. At least that what I see from > the existing asserts.
I'm thinking it should read something like: Encrypts one or more contiguous aligned sectors to make it obvious that because there can be multiple sectors, there may indeed be a cluster boundary mid-length. My complaint was that the original text made it sound like there was exactly one sector (at which point @len is redundant, unless sectors are variably-sized) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature