mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Phillip Lougher <phillip@lougher.demon.co.uk>
To: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH/RFC] crypto: compress - Return produced bytes in crypto_{,de}compress_{update,final}() (was: Re: [PATCH/RFC] crypto: compress - Add comp_request.total_out
Date: Wed, 25 Mar 2009 10:12:38 +0000	[thread overview]
Message-ID: <49CA0396.20705@lougher.demon.co.uk> (raw)
In-Reply-To: <alpine.LRH.2.00.0903241729540.4446@vixen.sonytel.be>

Geert Uytterhoeven wrote:
> On Tue, 17 Mar 2009, Geert Uytterhoeven wrote:
>> On Wed, 11 Mar 2009, Geert Uytterhoeven wrote:
>>> On Sun, 8 Mar 2009, Phillip Lougher wrote:
>>>> Two API issues of concern (one major, one minor).  Both of these relate to the
>>>> way Squashfs drives the decompression code, where it repeatedly calls it
>>>> supplying additional input/output buffers, rather than using a "single-shot"
>>>> approach where it calls the decompression code once supplying all the
>>>> necessary input and output buffer space.
>>>>
>>>> 1. Minor issue -the lack of a stream.total_out field.  The current
>>>> zlib_inflate code collects the total number of bytes decompressed over the
>>>> multiple calls into the stream.total_out field.
>>>>
>>>>    There is clearly no such field available in the cryto API, leading to the
>>>> somewhat clumsy need to track it, i.e. it leads to the following additional
>>>> code.
>>> If people feel the need for a total_out field, I can add it to struct
>>> comp_request.
>>>
>>> BTW, what about total_in, which is also provided by plain zlib's z_stream?
>>> Do people see a need for a similar field?
>> The patch below (on top of the updated one to convert SquashFS to pcomp) adds
>> comp_request.total_out, so you don't have to calculate and accumulate the
>> decompressed output sizes in SquashFS.
>>
>> Notes:
>>   - This required the addition of a `struct comp_request *' parameter to
>>     crypto_{,de}compress_init()
>>   - Still, there's one of the 
>>
>> 	produced = req.avail_out;
>> 	...
>> 	produced -= req.avail_out;
>>
>>     left, as this is part of the logic to discover the end of decompression
>>     (no bytes produced, no error returned).
>>
>> Perhaps it's better to instead make crypto_{,de}compress_{update,final}()
>> return the (positive) number of output bytes (of the current step)?
>>
>> Currently it returns zero (no error) or a negative error value.
>> That would allow to get rid of both `produced = ... / produced -= ...'
>> constructs, but the user would have to accumulate the total output size again
>> (which is not such a big deal, IMHO).
> 
> Here's an alternative patch, which does exactly that.
> Phillip, what do you think?
> 

 From a quick look, it looks OK :-)  I'm not ignoring this, but I'm trying to get a release of
the 4.0 tools finished ASAP (now 2.6.29 is out).

Phillip

  reply	other threads:[~2009-03-25 10:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-25 13:43 [PATCH 0/6] Partial (de)compression Crypto API Geert Uytterhoeven
2009-02-25 13:43 ` [PATCH 1/6] netlink: Move netlink attribute parsing support to lib/ Geert Uytterhoeven
2009-02-25 13:43   ` [PATCH 2/6] crypto: compress - Add pcomp interface Geert Uytterhoeven
2009-02-25 13:43     ` [PATCH 3/6] crypto: testmgr - Add support for the " Geert Uytterhoeven
2009-02-25 13:43       ` [PATCH 4/6] crypto: new zlib crypto module, using pcomp Geert Uytterhoeven
2009-02-25 13:43         ` [PATCH 5/6] crypto: testmgr - add zlib test Geert Uytterhoeven
2009-02-25 13:43           ` [PATCH 6/6] squashfs: Make SquashFS 4 use the new pcomp crypto interface Geert Uytterhoeven
2009-03-07 10:46             ` Herbert Xu
2009-03-08  6:47               ` Phillip Lougher
2009-03-11 17:59                 ` Geert Uytterhoeven
2009-03-17 12:54                   ` [PATCH/RFC] crypto: compress - Add comp_request.total_out (was: Re: [PATCH 6/6] squashfs: Make SquashFS 4 use the new pcomp crypto interface) Geert Uytterhoeven
2009-03-24 16:33                     ` [PATCH/RFC] crypto: compress - Return produced bytes in crypto_{,de}compress_{update,final}() (was: Re: [PATCH/RFC] crypto: compress - Add comp_request.total_out (was: Re: [PATCH 6/6] squashfs: Make SquashFS 4 use the new pcomp crypto interface)) Geert Uytterhoeven
2009-03-25 10:12                       ` Phillip Lougher [this message]
2009-04-20  6:03                       ` Herbert Xu
2009-04-20  7:26                         ` Geert Uytterhoeven
2009-04-20 23:45                           ` [PATCH/RFC] crypto: compress - Return produced bytes in crypto_{,de}compress_{update,final}() (was: Re: [PATCH/RFC] crypto: compress - Add comp_request.total_out Phillip Lougher
2009-04-21  0:09                             ` Herbert Xu
2009-07-28 14:45                             ` [PATCH/RFC] crypto: compress - Return produced bytes in crypto_{, de}compress_{update, final}() " Geert Uytterhoeven
2009-05-05 14:14                           ` [PATCH/RFC] crypto: compress - Return produced bytes in crypto_{, de}compress_{update, final}() (was: Re: [PATCH/RFC] crypto: compress - Add comp_request.total_out (was: Re: [PATCH 6/6] squashfs: Make SquashFS 4 use the new pcomp crypto interface)) Geert Uytterhoeven
2009-05-11 15:35                             ` [PATCH] crypto: compress - Return produced bytes in crypto_{,de}compress_{update,final}() Geert Uytterhoeven
2009-05-18  7:16                               ` Geert Uytterhoeven
2009-05-18  7:22                                 ` Herbert Xu
2009-05-27  5:05                               ` Herbert Xu
2009-03-17 12:44             ` [PATCH 6/6] squashfs: Make SquashFS 4 use the new pcomp crypto interface Geert Uytterhoeven
2009-02-25 21:59   ` [PATCH 1/6] netlink: Move netlink attribute parsing support to lib/ David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49CA0396.20705@lougher.demon.co.uk \
    --to=phillip@lougher.demon.co.uk \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®