On Fri, 2019-09-06 at 14:00 -0500, Eric Blake wrote: > 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) > I agree with you completely, I will change that.
Best regards, Maxim Levitsky