lib_generic: gunzip: New function zunzip
PATCH 1/2 lib_generic: gunzip: New function zunzip
Separate gunzip in
gunzip: Find the end of the header and call zunzip.
zunzip: Inflate gunzip block without header.
--- lib_generic/gunzip.c | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-)
lib_generic/gunzip.c +20 -7
@@ -39,6 +39,8 @@int gunzip (void *,int ,unsigned char *,unsigned long *);void *zalloc (void *,unsigned ,unsigned );void zfree (void *,void *,unsigned ); +int zunzip (void *dst,int dstlen,unsigned char *src,unsigned long *lenp, +int stoponerr,int offset);void *zalloc (void *x,unsigned items,unsigned size) {
@@ -59,8 +61,7 @@ void zfree(void *x, void *addr, unsigned nb)int gunzip (void *dst,int dstlen,unsigned char *src,unsigned long *lenp) { -z_stream s; -int r, i, flags; +int i, flags;/* skip header */ i =10 ;
@@ -84,6 +85,18 @@ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)return (-1 ); } +return zunzip (dst, dstlen, src, lenp,1 , i); +} + +/* +* Uncompress blocks compressed with zlib without headers +*/ +int zunzip (void *dst,int dstlen,unsigned char *src,unsigned long *lenp, +int stoponerr,int offset) +{ +z_stream s; +int r; + s.zalloc = zalloc; s.zfree = zfree;#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG )
@@ -95,14 +108,14 @@ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp) r =inflateInit2 (&s, -MAX_WBITS );if (r !=Z_OK ) {printf ("Error: inflateInit2() returned %d\n" , r); -return (-1 ); +return -1 ; } - s.next_in = src + i; - s.avail_in = *lenp - i; + s.next_in = src + offset; + s.avail_in = *lenp - offset; s.next_out = dst; s.avail_out = dstlen; r =inflate (&s,Z_FINISH ); -if (r !=Z_STREAM_END ) { +if ((r !=Z_STREAM_END ) && (stoponerr==1 )) {printf ("Error: inflate() returned %d\n" , r);inflateEnd (&s);return (-1 );
@@ -110,5 +123,5 @@ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp) *lenp = s.next_out - (unsigned char *) dst;inflateEnd (&s); -return (0 ); +return 0 ; }
Signature · 1 line
1.6.2.4
PATCH 2/2 ubifs: BUG: Blocks commpressed with zlib
Blocks compressed with zlib dont have the full gzip header.
Without this patch, block compressed with zlib cannot be readed!
---
v3: Create generic function zunzip
v2: remove unused parts.
fs/ubifs/ubifs.c | 7 +++++-- fs/ubifs/ubifs.h | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-)
fs/ubifs/ubifs.c +5 -2
@@ -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,15 +34,17 @@ DECLARE_GLOBAL_DATA_PTR;/* compress.c */ +int zunzip (void *dst,int dstlen,unsigned char *src,unsigned long *lenp, +int stoponerr,int offset);/* -* We need a wrapper for gunzip() because the parameters are +* We need a wrapper for zunzip() because the parameters are * incompatible with the lzo decompressor. */ 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 zunzip (out, *out_len, (unsigned char *)in, &len,0 ,0 ); }/* Fake description object for the "none" compressor */
fs/ubifs/ubifs.h +0 -2
@@ -2172,6 +2172,4 @@ int ubifs_decompress(const void *buf, int len, void *out, int *out_len,/* todo: Move these to a common U-Boot header */ int lzo1x_decompress_safe (const unsigned char *in,size_t in_len,unsigned char *out,size_t *out_len); -int gunzip (void *dst,int dstlen,unsigned char *src,unsigned long *lenp); -#endif /* !__UBIFS_H__ */
Signature · 1 line
1.6.2.4
PATCH 1/2 lib_generic: gunzip: New function zunzip
In reply to Ricardo Ribalda DelgadoDear Ricardo Ribalda Delgado,
Quoted 4 lines · In message <[email protected]> you wrote:
Separate gunzip in
gunzip: Find the end of the header and call zunzip.
zunzip: Inflate gunzip block without header.
What is the needed for? Maybe you should provide a use case so we can see why this change makes sense.
Quoted 53 lines
Signed-off-by Ricardo Ribalda Delgado <[email protected]>--- lib_generic/gunzip.c | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-)lib_generic/gunzip.c +16
-3@@ -39,6 +39,8 @@int gunzip (void *,int ,unsigned char *,unsigned long *);void *zalloc (void *,unsigned ,unsigned );void zfree (void *,void *,unsigned ); +int zunzip (void *dst,int dstlen,unsigned char *src,unsigned long *lenp, +int stoponerr,int offset);void *zalloc (void *x,unsigned items,unsigned size) {@@ -59,8 +61,7 @@ void zfree(void *x, void *addr, unsigned nb)int gunzip (void *dst,int dstlen,unsigned char *src,unsigned long *lenp) { -z_stream s; -int r, i, flags; +int i, flags;/* skip header */ i =10 ;@@ -84,6 +85,18 @@ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)return (-1 ); } +return zunzip (dst, dstlen, src, lenp,1 , i); +} + +/* +* Uncompress blocks compressed with zlib without headers +*/ +int zunzip (void *dst,int dstlen,unsigned char *src,unsigned long *lenp, +int stoponerr,int offset) +{ +z_stream s; +int r; + s.zalloc = zalloc; s.zfree = zfree;#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG )@@ -95,14 +108,14 @@ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp) r =inflateInit2 (&s, -MAX_WBITS );if (r !=Z_OK ) {printf ("Error: inflateInit2() returned %d\n" , r); -return (-1 ); +return -1 ;
lib_generic/gunzip.c int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp) · line 118
Quoted 10 lines
lib_generic/gunzip.c +3
-3} - s.next_in = src + i; - s.avail_in = *lenp - i; + s.next_in = src + offset; + s.avail_in = *lenp - offset; s.next_out = dst; s.avail_out = dstlen; r =inflate (&s,Z_FINISH ); -if (r !=Z_STREAM_END ) { +if ((r !=Z_STREAM_END ) && (stoponerr==1 )) {
Seems this is an unrelated change. Maybe this should be split out into a separate patch?
Please comment what it means.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de To the systems programmer, users and applications serve only to provide a test load.
PATCH 1/2 lib_generic: gunzip: New function zunzip
Hello Wolfgang
UBI fs blocks can be compresed in lzo, zlib or no-compression. The current implementation of u-boot supported all the compressions but there was a bug in the implementation of zlib.
UBIFS's Zlib blocks do not have header but they were compressed using gunzip, a function used to decompress gunzip files/sectors with a header.
This patch creates a functions that is able of decompress such a blocks.
Quoted 15 lines
Please comment what it means.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de To the systems programmer, ?users ?and ?applications ?serve ?only ?to provide a test load.
Signature · 2 lines
Ricardo Ribalda http://www.eps.uam.es/~rribalda/
PATCH 1/2 lib_generic: gunzip: New function zunzip
Dear Ricardo Ribalda Delgado,
Quoted 8 lines · In message <[email protected]> you…
UBI fs blocks can be compresed in lzo, zlib or no-compression. The current implementation of u-boot supported all the compressions but there was a bug in the implementation of zlib.
UBIFS's Zlib blocks do not have header but they were compressed using gunzip, a function used to decompress gunzip files/sectors with a header.
This patch creates a functions that is able of decompress such a blocks.
Then please write this in the commit message of the patch.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Niklaus Wirth has lamented that, whereas Europeans pronounce his name correctly (Ni-klows Virt), Americans invariably mangle it into (Nick- les Worth). Which is to say that Europeans call him by name, but Americans call him by value.
PATCH 1/2 lib_generic: gunzip: New function zunzip
Hello
Quoted 1 line
Then please write this in the commit message of the patch.
It is already written in the ubifs patch (#2) Shall I also add this to this patch (#1), that only touches the gunzip file?
Regards
Quoted 14 lines
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Niklaus Wirth has lamented that, whereas Europeans pronounce his name correctly (Ni-klows Virt), Americans invariably mangle it into (Nick- les Worth). Which is to say that Europeans ?call ?him ?by ?name, ?but Americans call him by value.
Signature · 2 lines
Ricardo Ribalda http://www.eps.uam.es/~rribalda/
PATCH 1/2 lib_generic: gunzip: New function zunzip
Dear Ricardo Ribalda Delgado,
Quoted 6 lines · In message <[email protected]> you…
Quoted 3 lines
Then please write this in the commit message of the patch.
It is already written in the ubifs patch (#2) Shall I also add this to this patch (#1), that only touches the gunzip file?
How should anybody know why the gunzip file gets changed if there is no explanation given at all in the commit message?
How should he know that some other patch might be related when all he has is the commit logs?
Please add an explanation to the patch that says what the patch is changing, and why.
Please re-read http://www.denx.de/wiki/U-Boot/Patches
It says:
In the message body, include a description of your changes.
* For bug fixes: a description of the bug and how your patch fixes this bug. Please try to include a way of demonstrating that the patch actually fixes something.
* For new features: a description of the feature and your implementation.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de How many QA engineers does it take to screw in a lightbulb? 3: 1 to screw it in and 2 to say "I told you so" when it doesn't work.
PATCH 1/2 lib_generic: gunzip: New function zunzip
In reply to Ricardo Ribalda DelgadoDear Ricardo,
Quoted 8 lines · In message <[email protected]> you…
UBI fs blocks can be compresed in lzo, zlib or no-compression. The current implementation of u-boot supported all the compressions but there was a bug in the implementation of zlib.
UBIFS's Zlib blocks do not have header but they were compressed using gunzip, a function used to decompress gunzip files/sectors with a header.
This patch creates a functions that is able of decompress such a blocks.
BTW: what is patch 2/2 of this series? According to the References:
header it's "[PATCH 2/2] ubifs: BUG: Blocks commpressed with zlib".
But then, what is the second patch for the "[PATCH 1/2] ubifs: BUG realpath string must be ended with NULL" posting?
In other words, we have 2 x [PATCH 1/2] but only one [PATCH 2/2] - or am I missing something?
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de What kind of love is that? Not to be loved; never to have shown love. -- Commissioner Nancy Hedford, "Metamorphosis", stardate 3219.8
PATCH 1/2 lib_generic: gunzip: New function zunzip
Sorry for the mess.
There were 2 patch
1/2 ->: BUG realpath string must be ended with NULL" posting?
2/2 ->ubifs: BUG: Blocks commpressed with zlib"
Since 1/2 has been applied. And 2/2 needed to be separated in two patches
1/2 -> lib_generic: gunzip: New function zunzip
2/2 -> ubifs: BUG: Blocks commpressed with zlib
1/2 Creates a new zunzip function and 2/2 calls it.
Quoted 34 lines · Wolfgang Denk
Dear Ricardo,
Quoted 8 lines · In message <[email protected]> you…
UBI fs blocks can be compresed in lzo, zlib or no-compression. The current implementation of u-boot supported all the compressions but there was a bug in the implementation of zlib.
UBIFS's Zlib blocks do not have header but they were compressed using gunzip, a function used to decompress gunzip files/sectors with a header.
This patch creates a functions that is able of decompress such a blocks.BTW: what is patch 2/2 of this series? According to the References:
header it's "[PATCH 2/2] ubifs: BUG: Blocks commpressed with zlib".But then, what is the second patch for the "[PATCH 1/2] ubifs: BUG realpath string must be ended with NULL" posting?
In other words, we have 2 x [PATCH 1/2] but only one [PATCH 2/2] - or am I missing something?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de What kind of love is that? ?Not to be loved; never to have shown love. ? ? ? ?-- Commissioner Nancy Hedford, "Metamorphosis",
? ? ? ? ? stardate 3219.8
Signature · 2 lines
Ricardo Ribalda http://www.eps.uam.es/~rribalda/
PATCH 1/2 lib_generic: gunzip: New function zunzip
Dear Ricardo Ribalda Delgado,
Quoted 10 lines · In message <[email protected]> you…
Sorry for the mess.
There were 2 patch
1/2 ->: BUG realpath string must be ended with NULL" posting?
2/2 ->ubifs: BUG: Blocks commpressed with zlib"
Since 1/2 has been applied. And 2/2 needed to be separated in two patches
The "realpath string must be ended with NULL" has been applied? This is news to me.
I don't have it in my trees.
Please explain what you mean?
Quoted 2 lines
1/2 ->
lib_generic: gunzip: New function zunzip
2/2 -> ubifs: BUG: Blocks commpressed with zlib
In such a situation it would have been much better if you has reposted a new patch series consisting of 3 parts (1/3, 2/3 and 3/3).
Quoted 5 lines · Wolfgang Denk
Quoted 3 lines
Dear Ricardo,
In message <[email protected]> =
you wrote:
...
PLEASE STOP TOP POSTING and FULL QUOTING.
PLEASE STOP TOP POSTING and FULL QUOTING.
PLEASE STOP TOP POSTING and FULL QUOTING.
PLEASE STOP TOP POSTING and FULL QUOTING.
PLEASE STOP TOP POSTING and FULL QUOTING.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de A father doesn't destroy his children. -- Lt. Carolyn Palamas, "Who Mourns for Adonais?", stardate 3468.1.
PATCH 1/2 lib_generic: gunzip: New function zunzip
Hi Wolfgang
Quoted 3 lines
In such a situation it would have been much better if you has reposted a new patch series consisting of 3 parts (1/3, 2/3 and 3/3).
Just sent a new patch series consisting 3 parts.
Sorry for the top posting...
Signature · 2 lines
Ricardo Ribalda http://www.eps.uam.es/~rribalda/
PATCH 1/2 lib_generic: gunzip: New function zunzip
In reply to Ricardo Ribalda DelgadoQuoted 7 lines · Ricardo Ribalda Delgado
There were 2 patch
1/2 ->: BUG realpath string must be ended with NULL" posting?
2/2 ->ubifs: BUG: Blocks commpressed with zlib"
Since 1/2 has been applied. And 2/2 needed to be separated in two patches
Just to clarify: Patch 1/2 hasn't been applied yet. I "only" acked it. Wolfgang needs to apply it when he finds time.
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
=====================================================================