[BusyBox] Re: [patch] Making micro-bunzip play nice with tar...

Rob Landley rob at landley.net
Thu Oct 16 06:44:01 UTC 2003


On Wednesday 15 October 2003 23:47, Glenn McGrath wrote:
> On Wed, 15 Oct 2003 23:07:21 -0500
>
> Rob Landley <rob at landley.net> wrote:
> > Glenn: is this what you wanted for tar?
>
> Almost, i really want the interface
>
> extern ssize_t read_bz2(int fd, void *buf, size_t count)
>
> Then i can point to it with a function pointer inside the common
> unarchiving code.

Well, I got really close with version 3, but you need a wrapper. :)

I suppose I should put in code so we don't have to worry about it overflowing 
IOBUF_SIZE in the output buffer.  (What's the longest count you're ever going 
to feed it?)

I COULD also have it write directly into buf, and only use outbuf for file 
decompression.  Hmmm...

> include/unarchive.h
> typedef struct archive_handle_s {
> 	...
> 	ssize_t (*read)(int fd, void *buf, size_t count);
> }
>
> The arguments are that way so its compatable with libc's
> ssize_t read(int fd, void *buf, size_t count);
> and
> ssize_t read_gz(int fd, void *buf, size_t count)
> from libunarchive/unzip.c's
>
> Being able to read uncompressed, gzip compressed or bzip compressed data
> interchangably is very convenient.
>
> You seem to have all the bits there, i just need a litle wrapper around
> your functions.
>
> Im working on something else at the moment, but i can have a go at
> hooking this up in the next couple of days if you want to move on.

I'm happy to maintain my code if people need changes made to it.  I'll 
probably post this on my website...  Actually, I might as well do that now... 
:)

http://www.landley.net/code

But hopefully I've cleaned up the bunzip code enough that people don't 
actually NEED me here anymore.  (If not, shout out now.)

I'm still tweaking a bit.  Yeah I want to move on before too much longer, and 
I _really_ don't want to make the code much bigger than it is.  (I think a 
working bunzip in under 7k is cool, and would rather like to keep it that 
way. :)  But I'm pondering that one last cleanup to allow writes to 
arbitrary-sized buffers without the bounce off outbuf limiting it to 
IOBUF_SIZE.  Might get to it tonight...

I must admit that the compression side is calling me, though...

> Glenn

Rob



More information about the busybox mailing list