From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] ubifs: BUG: Blocks commpressed with zlib
Date: Fri, 24 Apr 2009 17:05:02 +0200 [thread overview]
Message-ID: <200904241705.02689.sr@denx.de> (raw)
In-Reply-To: <1240583766-9040-2-git-send-email-ricardo.ribalda@uam.es>
On Friday 24 April 2009, Ricardo Ribalda Delgado wrote:
> Blocks compressed with zlib dont have the full gzip header.
>
> This patch adds a new function to properly handle blocks compressed
> with zlib.
>
> Without this patch, block compressed with zlib cannot be readed!
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
Looks better. Below some mostly nitpicking comments.
> ---
> v2: remove unused parts..
> fs/ubifs/ubifs.c | 36 +++++++++++++++++++++++++++++++++++-
> fs/ubifs/ubifs.h | 2 --
> 2 files changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
> index 3c8b5da..44bf651 100644
> --- a/fs/ubifs/ubifs.c
> +++ b/fs/ubifs/ubifs.c
> @@ -24,6 +24,7 @@
> */
>
> #include "ubifs.h"
> +#include <u-boot/zlib.h>
>
> #if !defined(CONFIG_SYS_64BIT_VSPRINTF)
> #warning Please define CONFIG_SYS_64BIT_VSPRINTF for correct output!
> @@ -33,6 +34,10 @@ DECLARE_GLOBAL_DATA_PTR;
>
> /* compress.c */
>
> +int ubi_gunzip(void *dst, int dstlen, unsigned char *src, unsigned long
> *lenp);
> +void *zalloc(void *, unsigned, unsigned);
> +void zfree(void *, void *, unsigned);
Please move those prototypes to the header instead (ubifs.h).
> +
> /*
> * We need a wrapper for gunzip() because the parameters are
> * incompatible with the lzo decompressor.
> @@ -41,7 +46,7 @@ static int gzip_decompress(const unsigned char *in,
> size_t in_len, unsigned char *out, size_t *out_len)
> {
> unsigned long len = in_len;
> - return gunzip(out, *out_len, (unsigned char *)in, &len);
> + return ubi_gunzip(out, *out_len, (unsigned char *)in, &len);
> }
>
> /* Fake description object for the "none" compressor */
> @@ -686,3 +691,32 @@ out:
> ubi_close_volume(c->ubi);
> return err;
> }
> +
> +int ubi_gunzip(void *dst, int dstlen, unsigned char *src, unsigned long
> *lenp) +{
> + z_stream s;
> + int r, flags;
> +
> + s.zalloc = zalloc;
> + s.zfree = zfree;
> +#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
> + s.outcb = (cb_func)WATCHDOG_RESET;
> +#else
> + s.outcb = Z_NULL;
> +#endif /* CONFIG_HW_WATCHDOG */
> +
> + r = inflateInit2(&s, -MAX_WBITS);
> + if (r != Z_OK) {
> + printf ("Error: inflateInit2() returned %d\n", r);
> + return (-1);
return is not a function. So just use:
return -1;
> + }
> + s.next_in = src;
> + s.avail_in = *lenp;
> + s.next_out = dst;
> + s.avail_out = dstlen;
> + r = inflate(&s, Z_FINISH);
> + *lenp = s.next_out - (unsigned char *) dst;
> + inflateEnd(&s);
> +
> + return (0);
Again, please "return 0;" here.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
next prev parent reply other threads:[~2009-04-24 15:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-24 14:36 [U-Boot] [PATCH 1/2] ubifs: BUG realpath string must be ended with ZERO Ricardo Ribalda Delgado
2009-04-24 14:36 ` [U-Boot] [PATCH 2/2] ubifs: BUG: Blocks commpressed with zlib Ricardo Ribalda Delgado
2009-04-24 15:05 ` Stefan Roese [this message]
2009-04-27 6:59 ` Mike Frysinger
2009-04-27 7:06 ` Ricardo Ribalda Delgado
2009-04-27 7:29 ` Mike Frysinger
2009-04-27 7:36 ` Stefan Roese
2009-04-27 7:48 ` Ricardo Ribalda Delgado
2009-04-27 7:54 ` Mike Frysinger
2009-04-27 6:58 ` [U-Boot] [PATCH 1/2] ubifs: BUG realpath string must be ended with ZERO Mike Frysinger
-- strict thread matches above, loose matches on Subject: below --
2009-04-24 15:23 [U-Boot] [PATCH 2/2] ubifs: BUG: Blocks commpressed with zlib Ricardo Ribalda Delgado
2009-04-27 9:19 [U-Boot] [PATCH 1/2] lib_generic: gunzip: New function zunzip Ricardo Ribalda Delgado
2009-04-27 9:19 ` [U-Boot] [PATCH 2/2] ubifs: BUG: Blocks commpressed with zlib Ricardo Ribalda Delgado
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=200904241705.02689.sr@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.de \
/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